@@ -758,7 +758,7 @@ def makeReservedEvmAddress(account):
758758 # Verify header.nonce == 1 (evmversion=1)
759759 evm_block = w3 .eth .get_block ('latest' )
760760 Utils .Print ("before fork, the latest evm block is:" + str (evm_block ))
761- assert (evm_block ["nonce" ].hex () == "0000000000000001" )
761+ assert (evm_block ["nonce" ].hex () == "0000000000000001" or evm_block [ "nonce" ]. hex () == "0x0000000000000001" )
762762 assert ("consensusParameter" in evm_block )
763763 assert (evm_block ["consensusParameter" ]["gasFeeParameters" ]["gasCodedeposit" ] == 477 )
764764 assert (evm_block ["consensusParameter" ]["gasFeeParameters" ]["gasNewaccount" ] == 165519 )
@@ -942,7 +942,7 @@ def makeReservedEvmAddress(account):
942942 # verify eos-evm-node get the new gas parameter from the minor fork
943943 evm_block = w3 .eth .get_block ('latest' )
944944 Utils .Print ("in minor fork, the latest evm block is:" + str (evm_block ))
945- assert (evm_block ["nonce" ].hex () == "0000000000000001" )
945+ assert (evm_block ["nonce" ].hex () == "0000000000000001" or evm_block [ "nonce" ]. hex () == "0x0000000000000001" )
946946 assert ("consensusParameter" in evm_block )
947947
948948 assert (evm_block ["consensusParameter" ]["gasFeeParameters" ]["gasCodedeposit" ] == 573 )
@@ -992,6 +992,10 @@ def makeReservedEvmAddress(account):
992992 # if node1.verifyAlive():
993993 # Utils.errorExit("Expected the node 1 to have shutdown.")
994994
995+ blockNum0 = prodNodes [0 ].getBlockNum ()
996+ blockNum1 = prodNodes [1 ].getBlockNum ()
997+ WaitUntilBlockNum = max (blockNum0 , blockNum1 ) + 20
998+ Print ("Before relaunching the bridge node: prod[0] head_block_num %d, prod[1] head_block_num %d" % (blockNum0 , blockNum1 ))
995999 Print ("Relaunching the non-producing bridge node to connect the node 0 (defproducera, defproducerb)" )
9961000 if not nonProdNode .relaunch (chainArg = " --hard-replay " ):
9971001 errorExit ("Failure - (non-production) node %d should have restarted" % (nonProdNode .nodeNum ))
@@ -1001,7 +1005,7 @@ def makeReservedEvmAddress(account):
10011005 # if not node1.relaunch(chainArg=" --enable-stale-production "):
10021006 # errorExit("Failure - (non-production) node 1 should have restarted")
10031007
1004- Print ("Waiting to allow forks to resolve" )
1008+ Print ("Waiting to allow forks to resolve from block %d" % ( killBlockNum ) )
10051009 time .sleep (3 )
10061010
10071011 for prodNode in prodNodes :
@@ -1024,9 +1028,10 @@ def makeReservedEvmAddress(account):
10241028 if match :
10251029 if checkHead :
10261030 forkResolved = True
1027- Print ("Great! fork resolved!!!" )
1031+ Print ("Great! fork resolved!!! killBlockNum %d, current head_number %d, producer %s" % ( killBlockNum , checkMatchBlock , blockProducer0 ) )
10281032 break
10291033 else :
1034+ Print ("Block %d has producer %s in both nodes, continue to check head" % (checkMatchBlock , blockProducer0 ))
10301035 checkHead = True
10311036 continue
10321037 Print ("Fork has not resolved yet, wait a little more. Block %s has producer %s for node_00 and %s for node_01. Original divergence was at block %s. Wait time remaining: %d" % (checkMatchBlock , blockProducer0 , blockProducer1 , killBlockNum , remainingChecks ))
@@ -1036,6 +1041,18 @@ def makeReservedEvmAddress(account):
10361041 assert forkResolved , "fork was not resolved in a reasonable time. node_00 lib {} head {}, node_01 lib {} head {}" .format (\
10371042 prodNodes [0 ].getIrreversibleBlockNum (), prodNodes [0 ].getHeadBlockNum (), \
10381043 prodNodes [1 ].getIrreversibleBlockNum (), prodNodes [1 ].getHeadBlockNum ())
1044+
1045+ # wait until the current chain is longer than any minor fork happened in the past
1046+ # ensure the EVM oracle to switch to longer fork
1047+ remainingChecks = 60
1048+ blockNum0 = prodNodes [0 ].getBlockNum ()
1049+ WaitUntilBlockNum = max (WaitUntilBlockNum , killBlockNum + 30 )
1050+ while (blockNum0 <= WaitUntilBlockNum ):
1051+ Print ("Wait for prodnode0's block_num proceed until %d, now %d" % (WaitUntilBlockNum , blockNum0 ))
1052+ time .sleep (1 )
1053+ remainingChecks -= 1
1054+ assert remainingChecks >= 0 , "prodnode0 does not producer block at %d after resolving the fork" % (blockNum0 )
1055+ blockNum0 = prodNodes [0 ].getBlockNum ()
10391056
10401057 row4 = prodNode .getTableRow (evmAcc .name , evmAcc .name , "account" , 4 )
10411058 Utils .Print ("\t account row4 in node0: " , row4 )
@@ -1046,7 +1063,7 @@ def makeReservedEvmAddress(account):
10461063
10471064 evm_block = w3 .eth .get_block ('latest' )
10481065 Utils .Print ("after fork resolved, the latest evm block is:" + str (evm_block ))
1049- assert (evm_block ["nonce" ].hex () == "0000000000000001" )
1066+ assert (evm_block ["nonce" ].hex () == "0000000000000001" or evm_block [ "nonce" ]. hex () == "0x0000000000000001" )
10501067 assert ("consensusParameter" in evm_block )
10511068
10521069 assert (evm_block ["consensusParameter" ]["gasFeeParameters" ]["gasCodedeposit" ] == 477 )
0 commit comments