Skip to content

Commit

Permalink
GH-2286 Add an irreversible node to test
Browse files Browse the repository at this point in the history
  • Loading branch information
heifner committed Mar 22, 2024
1 parent 51feb05 commit 78bbc62
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions tests/transition_to_if.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
topo=args.s
debug=args.v
prod_count = 1 # per node prod count
total_nodes=pnodes
total_nodes=pnodes+1
dumpErrorDetails=args.dump_error_details

Utils.Debug=debug
Expand All @@ -41,8 +41,9 @@
numTrxGenerators=2
Print("Stand up cluster")
# For now do not load system contract as it does not support setfinalizer
specificExtraNodeosArgs = { 4: "--read-mode irreversible"}
if cluster.launch(pnodes=pnodes, totalNodes=total_nodes, prodCount=prod_count, maximumP2pPerHost=total_nodes+numTrxGenerators, topo=topo, delay=delay, loadSystemContract=False,
activateIF=False) is False:
activateIF=False, specificExtraNodeosArgs=specificExtraNodeosArgs) is False:
errorExit("Failed to stand up eos cluster.")

assert cluster.biosNode.getInfo(exitOnError=True)["head_block_producer"] != "eosio", "launch should have waited for production to change"
Expand All @@ -63,7 +64,9 @@
assert cluster.biosNode.waitForLibToAdvance(), "Lib should advance after instant finality activated"
assert cluster.biosNode.waitForProducer("defproducera"), "Did not see defproducera"
assert cluster.biosNode.waitForHeadToAdvance(blocksToAdvance=13) # into next producer
assert cluster.biosNode.waitForLibToAdvance(), "Lib stopped advancing"
assert cluster.biosNode.waitForLibToAdvance(), "Lib stopped advancing on biosNode"
assert cluster.getNode(1).waitForLibToAdvance(), "Lib stopped advancing on Node 1"
assert cluster.getNode(4).waitForLibToAdvance(), "Lib stopped advancing on Node 4, irreversible node"

info = cluster.biosNode.getInfo(exitOnError=True)
assert (info["head_block_num"] - info["last_irreversible_block_num"]) < 9, "Instant finality enabled LIB diff should be small"
Expand All @@ -76,8 +79,9 @@
# should take effect in first block of defproducerg slot (so defproducerh)
assert cluster.setProds(["defproducerb", "defproducerh", "defproducerm", "defproducerr"]), "setprods failed"
setProdsBlockNum = cluster.biosNode.getBlockNum()
cluster.biosNode.waitForBlock(setProdsBlockNum+12+12+1)
assert cluster.biosNode.waitForBlock(setProdsBlockNum+12+12+1), "Block of new producers not reached"
assert cluster.biosNode.getInfo(exitOnError=True)["head_block_producer"] == "defproducerh", "setprods should have taken effect"
assert cluster.getNode(4).waitForBlock(setProdsBlockNum + 12 + 12 + 1), "Block of new producers not reached on irreversible node"

testSuccessful=True
finally:
Expand Down

0 comments on commit 78bbc62

Please sign in to comment.