From 60fb90904e230a85a47a44dab511a021de87c6e0 Mon Sep 17 00:00:00 2001 From: stana-ethernal Date: Wed, 30 Aug 2023 17:24:21 +0200 Subject: [PATCH] cr fix --- command/genesis/params.go | 5 +++++ consensus/polybft/polybft.go | 7 ++----- e2e-polybft/framework/test-cluster.go | 7 ++++--- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/command/genesis/params.go b/command/genesis/params.go index a705dda18d..d95ff6040d 100644 --- a/command/genesis/params.go +++ b/command/genesis/params.go @@ -17,6 +17,7 @@ import ( "github.com/0xPolygon/polygon-edge/consensus/ibft/fork" "github.com/0xPolygon/polygon-edge/consensus/ibft/signer" "github.com/0xPolygon/polygon-edge/consensus/polybft/common" + "github.com/0xPolygon/polygon-edge/contracts" "github.com/0xPolygon/polygon-edge/contracts/staking" stakingHelper "github.com/0xPolygon/polygon-edge/helper/staking" "github.com/0xPolygon/polygon-edge/server" @@ -572,6 +573,10 @@ func (p *genesisParams) validateProxyContractsAdmin() error { return errors.New("proxy contracts admin address must not be zero address") } + if proxyContractsAdminAddr == contracts.SystemCaller { + return errors.New("proxy contracts admin address must not be system caller address") + } + return nil } diff --git a/consensus/polybft/polybft.go b/consensus/polybft/polybft.go index ce170f8af5..100479aab9 100644 --- a/consensus/polybft/polybft.go +++ b/consensus/polybft/polybft.go @@ -152,11 +152,8 @@ func GenesisPostHookFactory(config *chain.Chain, engineName string) func(txn *st proxyAddr := contracts.GetProxyImplementationMapping() - var burnContractAddress types.Address - - var isBurnContractSet bool - - if burnContractAddress, isBurnContractSet = getBurnContractAddress(config, polyBFTConfig); isBurnContractSet { + burnContractAddress, isBurnContractSet := getBurnContractAddress(config, polyBFTConfig) + if isBurnContractSet { proxyAddr[contracts.DefaultBurnContract] = burnContractAddress } diff --git a/e2e-polybft/framework/test-cluster.go b/e2e-polybft/framework/test-cluster.go index a6694555ab..7189fdfd96 100644 --- a/e2e-polybft/framework/test-cluster.go +++ b/e2e-polybft/framework/test-cluster.go @@ -52,8 +52,9 @@ const ( ) var ( - startTime int64 - testRewardWalletAddr = types.StringToAddress("0xFFFFFFFF") + startTime int64 + testRewardWalletAddr = types.StringToAddress("0xFFFFFFFF") + ProxyContractAdminAddr = "0x5aaeb6053f3e94c9b9a09f33669435e7ef1beaed" ) func init() { @@ -612,7 +613,7 @@ func NewTestCluster(t *testing.T, validatorsCount int, opts ...ClusterOption) *T proxyAdminAddr := cluster.Config.ProxyContractsAdmin if proxyAdminAddr == "" { - proxyAdminAddr = "0x5aaeb6053f3e94c9b9a09f33669435e7ef1beaed" + proxyAdminAddr = ProxyContractAdminAddr } args = append(args, "--proxy-contracts-admin", proxyAdminAddr)