Skip to content

Commit

Permalink
GH-1510 Use boot contract to activate protocol features instead of ol…
Browse files Browse the repository at this point in the history
…d bios contract. Use current bios contract for setting producers.
  • Loading branch information
heifner committed Dec 18, 2023
1 parent 021b0c3 commit c494c5c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 27 deletions.
41 changes: 16 additions & 25 deletions tests/TestHarness/Cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -993,20 +993,6 @@ def parseClusterKeys(totalNodes):
return producerKeys

def activateInstantFinality(self, launcher):
# 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))
# assumes eosio already in wallet
eosioAccount=Account("eosio")
trans = self.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": {{'
Expand Down Expand Up @@ -1077,15 +1063,8 @@ def bootstrap(self, launcher, biosNode, totalNodes, prodCount, totalProducers,
Utils.Print("ERROR: Failed to import %s account keys into ignition wallet." % (eosioName))
return None

if activateIF:
self.activateInstantFinality(launcher)

contract="eosio.bios"
contractDir= str(self.libTestingContractsPath / contract)
if PFSetupPolicy.hasPreactivateFeature(pfSetupPolicy):
contractDir=str(self.libTestingContractsPath / "old_versions" / "v1.7.0-develop-preactivate_feature" / contract)
else:
contractDir=str(self.libTestingContractsPath / "old_versions" / "v1.6.0-rc3" / contract)
contract="eosio.boot"
contractDir= str(self.unittestsContractsPath / contract)
wasmFile="%s.wasm" % (contract)
abiFile="%s.abi" % (contract)
Utils.Print("Publish %s contract" % (contract))
Expand All @@ -1096,9 +1075,21 @@ def bootstrap(self, launcher, biosNode, totalNodes, prodCount, totalProducers,

if pfSetupPolicy == PFSetupPolicy.FULL:
biosNode.preactivateAllBuiltinProtocolFeature()

Node.validateTransaction(trans)

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

if activateIF:
self.activateInstantFinality(launcher)

Utils.Print("Creating accounts: %s " % ", ".join(producerKeys.keys()))
producerKeys.pop(eosioName)
accounts=[]
Expand Down Expand Up @@ -1145,7 +1136,7 @@ def bootstrap(self, launcher, biosNode, totalNodes, prodCount, totalProducers,
if counts[keys["node"]] >= prodCount:
Utils.Print(f'Count for this node exceeded: {counts[keys["node"]]}')
continue
prodStanzas.append({ 'producer_name': keys['name'], 'block_signing_key': keys['public'] })
prodStanzas.append({ 'producer_name': keys['name'], 'authority': ["block_signing_authority_v0", { 'threshold': 1, 'keys': [{ 'key': keys['public'], 'weight': 1 }]}]})
prodNames.append(keys["name"])
counts[keys["node"]] += 1
setProdsStr += json.dumps(prodStanzas)
Expand Down
2 changes: 1 addition & 1 deletion tests/nodeos_chainbase_allocation_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
nonProdNode.createAccount(newProducerAcc, cluster.eosioAccount, waitForTransBlock=True)

setProdsStr = '{"schedule": ['
setProdsStr += '{"producer_name":' + newProducerAcc.name + ',"block_signing_key":' + newProducerAcc.activePublicKey + '}'
setProdsStr += '{"producer_name":' + newProducerAcc.name + ',"authority": ["block_signing_authority_v0", {"threshold":1, "keys":[{"key":' + newProducerAcc.activePublicKey + ', "weight":1}]}]}'
setProdsStr += ']}'
cmd="push action -j eosio setprods '{}' -p eosio".format(setProdsStr)
trans = producerNode.processCleosCmd(cmd, cmd, silentErrors=False)
Expand Down
2 changes: 1 addition & 1 deletion tests/nodeos_producer_watermark_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def setProds(sharedProdKey):
key = cluster.defProducerAccounts[name].activePublicKey
if name == "shrproducera":
key = sharedProdKey
setProdsStr += ' { "producer_name": "%s", "block_signing_key": "%s" }' % (name, key)
setProdsStr += '{"producer_name":' + name + ',"authority": ["block_signing_authority_v0", {"threshold":1, "keys":[{"key":' + key + ', "weight":1}]}]}'

setProdsStr += ' ] }'
Utils.Print("setprods: %s" % (setProdsStr))
Expand Down

0 comments on commit c494c5c

Please sign in to comment.