From 8bcbe9c1927797534209cb4f7df40a56524acaf3 Mon Sep 17 00:00:00 2001 From: Igor Crevar Date: Fri, 1 Mar 2024 10:02:09 +0100 Subject: [PATCH] gas higher --- .../contractsapi/test-contracts/TestValidatorSetPrecompile.json | 2 +- .../contractsapi/test-contracts/TestValidatorSetPrecompile.sol | 2 +- state/runtime/precompiled/validator_set_precompile.go | 2 +- state/runtime/precompiled/validator_set_precompile_test.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/consensus/polybft/contractsapi/test-contracts/TestValidatorSetPrecompile.json b/consensus/polybft/contractsapi/test-contracts/TestValidatorSetPrecompile.json index 58eabe1f22..94fb9c4c27 100644 --- a/consensus/polybft/contractsapi/test-contracts/TestValidatorSetPrecompile.json +++ b/consensus/polybft/contractsapi/test-contracts/TestValidatorSetPrecompile.json @@ -60,7 +60,7 @@ "type":"function" } ], - "bytecode": "0x608060405234801561000f575f80fd5b506106508061001d5f395ff3fe608060405234801561000f575f80fd5b5060043610610034575f3560e01c8063371303c014610038578063815b4d1b14610042575b5f80fd5b610040610060565b005b61004a610251565b6040516100579190610320565b60405180910390f35b5f8061204073ffffffffffffffffffffffffffffffffffffffff16620249f0336040516020016100909190610378565b6040516020818303038152906040526040516100ac91906103fd565b5f604051808303818686fa925050503d805f81146100e5576040519150601f19603f3d011682016040523d82523d5f602084013e6100ea565b606091505b509150915081801561010c57508080602001905181019061010b9190610441565b5b61014b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610142906104c6565b60405180910390fd5b5f803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff1661024d57600133908060018154018082558091505060019003905f5260205f20015f9091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060015f803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff0219169083151502179055505b5050565b5f805f61204073ffffffffffffffffffffffffffffffffffffffff16620249f0600160405160200161028391906105fa565b60405160208183030381529060405260405161029f91906103fd565b5f604051808303818686fa925050503d805f81146102d8576040519150601f19603f3d011682016040523d82523d5f602084013e6102dd565b606091505b50915091508180156102ff5750808060200190518101906102fe9190610441565b5b9250505090565b5f8115159050919050565b61031a81610306565b82525050565b5f6020820190506103335f830184610311565b92915050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f61036282610339565b9050919050565b61037281610358565b82525050565b5f60208201905061038b5f830184610369565b92915050565b5f81519050919050565b5f81905092915050565b5f5b838110156103c25780820151818401526020810190506103a7565b5f8484015250505050565b5f6103d782610391565b6103e1818561039b565b93506103f18185602086016103a5565b80840191505092915050565b5f61040882846103cd565b915081905092915050565b5f80fd5b61042081610306565b811461042a575f80fd5b50565b5f8151905061043b81610417565b92915050565b5f6020828403121561045657610455610413565b5b5f6104638482850161042d565b91505092915050565b5f82825260208201905092915050565b7f76616c696461746f7200000000000000000000000000000000000000000000005f82015250565b5f6104b060098361046c565b91506104bb8261047c565b602082019050919050565b5f6020820190508181035f8301526104dd816104a4565b9050919050565b5f81549050919050565b5f82825260208201905092915050565b5f819050815f5260205f209050919050565b61051981610358565b82525050565b5f61052a8383610510565b60208301905092915050565b5f815f1c9050919050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f61057261056d83610536565b610541565b9050919050565b5f6105848254610560565b9050919050565b5f600182019050919050565b5f6105a1826104e4565b6105ab81856104ee565b93506105b6836104fe565b805f5b838110156105ed576105ca82610579565b6105d4888261051f565b97506105df8361058b565b9250506001810190506105b9565b5085935050505092915050565b5f6020820190508181035f8301526106128184610597565b90509291505056fea26469706673582212207ce9734a4cb70866c45912245079c5f01a9c3f3b2cae0888b8afbbec2c224b6c64736f6c63430008180033", + "bytecode": "0x608060405234801561000f575f80fd5b506106508061001d5f395ff3fe608060405234801561000f575f80fd5b5060043610610034575f3560e01c8063371303c014610038578063815b4d1b14610042575b5f80fd5b610040610060565b005b61004a610251565b6040516100579190610320565b60405180910390f35b5f8061204073ffffffffffffffffffffffffffffffffffffffff166203a980336040516020016100909190610378565b6040516020818303038152906040526040516100ac91906103fd565b5f604051808303818686fa925050503d805f81146100e5576040519150601f19603f3d011682016040523d82523d5f602084013e6100ea565b606091505b509150915081801561010c57508080602001905181019061010b9190610441565b5b61014b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610142906104c6565b60405180910390fd5b5f803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff1661024d57600133908060018154018082558091505060019003905f5260205f20015f9091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060015f803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff0219169083151502179055505b5050565b5f805f61204073ffffffffffffffffffffffffffffffffffffffff166203a980600160405160200161028391906105fa565b60405160208183030381529060405260405161029f91906103fd565b5f604051808303818686fa925050503d805f81146102d8576040519150601f19603f3d011682016040523d82523d5f602084013e6102dd565b606091505b50915091508180156102ff5750808060200190518101906102fe9190610441565b5b9250505090565b5f8115159050919050565b61031a81610306565b82525050565b5f6020820190506103335f830184610311565b92915050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f61036282610339565b9050919050565b61037281610358565b82525050565b5f60208201905061038b5f830184610369565b92915050565b5f81519050919050565b5f81905092915050565b5f5b838110156103c25780820151818401526020810190506103a7565b5f8484015250505050565b5f6103d782610391565b6103e1818561039b565b93506103f18185602086016103a5565b80840191505092915050565b5f61040882846103cd565b915081905092915050565b5f80fd5b61042081610306565b811461042a575f80fd5b50565b5f8151905061043b81610417565b92915050565b5f6020828403121561045657610455610413565b5b5f6104638482850161042d565b91505092915050565b5f82825260208201905092915050565b7f76616c696461746f7200000000000000000000000000000000000000000000005f82015250565b5f6104b060098361046c565b91506104bb8261047c565b602082019050919050565b5f6020820190508181035f8301526104dd816104a4565b9050919050565b5f81549050919050565b5f82825260208201905092915050565b5f819050815f5260205f209050919050565b61051981610358565b82525050565b5f61052a8383610510565b60208301905092915050565b5f815f1c9050919050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f61057261056d83610536565b610541565b9050919050565b5f6105848254610560565b9050919050565b5f600182019050919050565b5f6105a1826104e4565b6105ab81856104ee565b93506105b6836104fe565b805f5b838110156105ed576105ca82610579565b6105d4888261051f565b97506105df8361058b565b9250506001810190506105b9565b5085935050505092915050565b5f6020820190508181035f8301526106128184610597565b90509291505056fea26469706673582212206efd0d43fe03760dad6d6d6027319396055df00430d6654ecf53622a2dc85a4764736f6c63430008180033", "linkReferences": {}, "deployedLinkReferences": {} } \ No newline at end of file diff --git a/consensus/polybft/contractsapi/test-contracts/TestValidatorSetPrecompile.sol b/consensus/polybft/contractsapi/test-contracts/TestValidatorSetPrecompile.sol index c44fc1a05a..a90c320ff2 100644 --- a/consensus/polybft/contractsapi/test-contracts/TestValidatorSetPrecompile.sol +++ b/consensus/polybft/contractsapi/test-contracts/TestValidatorSetPrecompile.sol @@ -5,7 +5,7 @@ pragma solidity ^0.8.0; contract TestValidatorSetPrecompile { address constant VALIDATOR_SET_PRECOMPILE = 0x0000000000000000000000000000000000002040; - uint256 constant VALIDATOR_SET_PRECOMPILE_GAS = 150000; + uint256 constant VALIDATOR_SET_PRECOMPILE_GAS = 240000; mapping(address => bool) voteMap; address[] votes; diff --git a/state/runtime/precompiled/validator_set_precompile.go b/state/runtime/precompiled/validator_set_precompile.go index c8c47a8a6d..6ab9fdd98a 100644 --- a/state/runtime/precompiled/validator_set_precompile.go +++ b/state/runtime/precompiled/validator_set_precompile.go @@ -35,7 +35,7 @@ type validatorSetPrecompile struct { // gas returns the gas required to execute the pre-compiled contract func (c *validatorSetPrecompile) gas(input []byte, _ *chain.ForksInTime) uint64 { - return 150000 + return 240000 } // Run runs the precompiled contract with the given input. diff --git a/state/runtime/precompiled/validator_set_precompile_test.go b/state/runtime/precompiled/validator_set_precompile_test.go index 15ea510c06..32c81be933 100644 --- a/state/runtime/precompiled/validator_set_precompile_test.go +++ b/state/runtime/precompiled/validator_set_precompile_test.go @@ -15,7 +15,7 @@ import ( ) func Test_ValidatorSetPrecompile_gas(t *testing.T) { - assert.Equal(t, uint64(150000), (&validatorSetPrecompile{}).gas(nil, nil)) + assert.Equal(t, uint64(240000), (&validatorSetPrecompile{}).gas(nil, nil)) } func Test_ValidatorSetPrecompile_run_BackendNotSet(t *testing.T) {