15
15
deploy_contract ,
16
16
edit_ini_sections ,
17
17
get_consensus_params ,
18
+ get_send_enable ,
18
19
send_transaction ,
19
20
wait_for_block ,
20
21
wait_for_new_blocks ,
@@ -86,13 +87,13 @@ def test_cosmovisor_upgrade(custom_cronos: Cronos, tmp_path_factory):
86
87
{"denom" : "basetcro" , "enabled" : False },
87
88
{"denom" : "stake" , "enabled" : True },
88
89
]
89
- p = cli . query_bank_send ( )
90
+ p = get_send_enable ( port )
90
91
assert sorted (p , key = lambda x : x ["denom" ]) == send_enable
91
92
92
- # export genesis from cronos v1.1.0-rc1
93
+ # export genesis from cronos v0.8.x
93
94
custom_cronos .supervisorctl ("stop" , "all" )
94
95
migrate = tmp_path_factory .mktemp ("migrate" )
95
- file_path0 = Path (migrate / "v1.1.0-rc1 .json" )
96
+ file_path0 = Path (migrate / "v0.8 .json" )
96
97
with open (file_path0 , "w" ) as fp :
97
98
json .dump (json .loads (cli .export ()), fp )
98
99
fp .flush ()
@@ -115,7 +116,7 @@ def test_cosmovisor_upgrade(custom_cronos: Cronos, tmp_path_factory):
115
116
)
116
117
print ("old values" , old_height , old_balance , old_base_fee )
117
118
118
- plan_name = "v1.1.0-testnet "
119
+ plan_name = "v1.1.0"
119
120
rsp = cli .gov_propose_legacy (
120
121
"community" ,
121
122
"software-upgrade" ,
@@ -178,16 +179,30 @@ def test_cosmovisor_upgrade(custom_cronos: Cronos, tmp_path_factory):
178
179
179
180
rsp = cli .query_params ("icaauth" )
180
181
assert rsp ["params" ]["min_timeout_duration" ] == "3600s" , rsp
181
- max_callback_gas = cli .query_params ()["max_callback_gas" ]
182
- assert max_callback_gas == "50000" , max_callback_gas
182
+ assert cli .query_params ()["max_callback_gas" ] == "50000" , rsp
183
+
184
+ # migrate to sdk v0.47
185
+ custom_cronos .supervisorctl ("stop" , "all" )
186
+ sdk_version = "v0.47"
187
+ file_path1 = Path (migrate / f"{ sdk_version } .json" )
188
+ with open (file_path1 , "w" ) as fp :
189
+ json .dump (cli .migrate_sdk_genesis (sdk_version , str (file_path0 )), fp )
190
+ fp .flush ()
191
+ # migrate to cronos v1.0.x
192
+ cronos_version = "v1.0"
193
+ file_path2 = Path (migrate / f"{ cronos_version } .json" )
194
+ with open (file_path2 , "w" ) as fp :
195
+ json .dump (cli .migrate_cronos_genesis (cronos_version , str (file_path1 )), fp )
196
+ fp .flush ()
197
+ print (cli .validate_genesis (str (file_path2 )))
183
198
184
199
# update the genesis time = current time + 5 secs
185
200
newtime = datetime .utcnow () + timedelta (seconds = 5 )
186
201
newtime = newtime .replace (tzinfo = None ).isoformat ("T" ) + "Z"
187
202
config = custom_cronos .config
188
203
config ["genesis-time" ] = newtime
189
204
for i , _ in enumerate (config ["validators" ]):
190
- genesis = json .load (open (file_path0 ))
205
+ genesis = json .load (open (file_path2 ))
191
206
genesis ["genesis_time" ] = config .get ("genesis-time" )
192
207
file = custom_cronos .cosmos_cli (i ).data_dir / "config/genesis.json"
193
208
file .write_text (json .dumps (genesis ))
0 commit comments