Skip to content

Commit

Permalink
GH-1510 bios contract has to be set so setfinalizer is available
Browse files Browse the repository at this point in the history
  • Loading branch information
heifner committed Dec 18, 2023
1 parent 0fd01b4 commit fc1dc69
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion tests/TestHarness/Cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -1156,6 +1156,19 @@ def createSystemAccount(accountName):

# enable instant finality
if activateIF:
# publish bios contract with setfinalizer
contract = "eosio.bios"
contractDir = str(self.libTestingContractsPath / contract)
wasmFile = "%s.wasm" % (contract)
abiFile = "%s.abi" % (contract)
Utils.Print("Publish %s contract" % (contract))
trans = biosNode.publishContract(eosioAccount, contractDir, wasmFile, abiFile, waitForTransBlock=True)
if trans is None:
Utils.Print("ERROR: Failed to publish contract %s." % (contract))
return None
Node.validateTransaction(trans)

# call setfinalizer
numFins = len(launcher.network.nodes.values())
setFinStr = f'{{"finalizer_policy": {{'
setFinStr += f' "threshold": {int(numFins * 2 / 3 + 1)}, '
Expand All @@ -1167,7 +1180,7 @@ def createSystemAccount(accountName):
if len(n.producers) == 0:
continue
setFinStr += f' {{"description": "finalizer #{finNum}", '
setFinStr += f' "fweight":1, '
setFinStr += f' "weight":1, '
setFinStr += f' "public_key": "{n.keys[0].blspubkey}", '
setFinStr += f' "pop": "{n.keys[0].blspop}"'
setFinStr += f' }}'
Expand Down

0 comments on commit fc1dc69

Please sign in to comment.