@@ -39,39 +39,6 @@ def get_path_to_pythdir_pair(account_addr):
39
39
return os .path .join (pyth_dir , "account_" + str (account_addr ) + ".json" )
40
40
41
41
42
-
43
- def resize_account (price_account_address ):
44
- """
45
- given a string with the pubkey of a price account it calls the resize instruction of the Oracle on it
46
- """
47
- #constants from oracle.h
48
- PROGRAM_VERSION = 2 #TODO: update this
49
- COMMAND_UPD_ACCOUNT = 14
50
- SYSTEM_PROGRAM = "11111111111111111111111111111111"
51
-
52
- #update version of price accounts to make sure they resize
53
- layout = Struct ("version" / Int32ul , "command" / Int32sl )
54
- data = layout .build (dict (version = PROGRAM_VERSION , command = COMMAND_UPD_ACCOUNT ))
55
- funding_key = PublicKey (solana_keygen [0 ])
56
- price_key = PublicKey (price_account_address )
57
- system_key = PublicKey (SYSTEM_PROGRAM )
58
- resize_instruction = TransactionInstruction (
59
- data = data ,
60
- keys = [
61
- AccountMeta (pubkey = funding_key , is_signer = True , is_writable = True ),
62
- AccountMeta (pubkey = price_key , is_signer = True , is_writable = True ),
63
- AccountMeta (pubkey = system_key , is_signer = False , is_writable = False ),
64
- ],
65
- program_id = PublicKey (solana_program_deploy ),
66
- )
67
- txn = Transaction ().add (resize_instruction )
68
- txn .fee_payer = funding_key
69
- funding_key_pair = get_key_pair (solana_keygen [1 ])
70
- path_to_price = get_path_to_pythdir_pair (price_key )
71
- price_key_pair = get_key_pair (path_to_price )
72
- solana_client = Client ("http://localhost:8899" )
73
- solana_client .send_transaction (txn , funding_key_pair , price_key_pair )
74
-
75
42
def get_account_size (acc_address ):
76
43
"""
77
44
given a string with the pubkey of an account, return its size
@@ -116,15 +83,12 @@ def get_account_size(acc_address):
116
83
assert after ['publisher_accounts' ][0 ]['conf' ] == 7
117
84
assert after ['publisher_accounts' ][0 ]['status' ] == 'trading'
118
85
119
- resize_account (pyth_init_price ['LTC' ])
120
86
time .sleep (20 )
121
87
#defined in oracle.h
122
88
new_account_size = 6176
123
89
assert get_account_size (pyth_init_price ['LTC' ]) == new_account_size
124
90
125
91
126
-
127
- #try adding a new price to the resized accounts
128
92
cmd = [
129
93
'pyth' , 'upd_price_val' ,
130
94
pyth_init_price ['LTC' ],
0 commit comments