From b05a3fed3806f98bfdb08df653573d78b4593341 Mon Sep 17 00:00:00 2001 From: Marko Atanasievski Date: Fri, 15 Sep 2023 12:55:16 +0200 Subject: [PATCH 1/4] feat: optional custom block time --- docker/local-topos/polygon-edge.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docker/local-topos/polygon-edge.sh b/docker/local-topos/polygon-edge.sh index 61a2f7e9cb..d26b887d8f 100755 --- a/docker/local-topos/polygon-edge.sh +++ b/docker/local-topos/polygon-edge.sh @@ -7,6 +7,7 @@ CONTRACTS_PATH=/contracts GENESIS_PATH=/data/genesis.json CHAIN_ID="${CHAIN_ID:-100}" # 100 is Edge's default value NUMBER_OF_NODES="${NUMBER_OF_NODES:-4}" # Number of subnet nodes in the consensus +BLOCK_TIME="${BLOCK_TIME:-2s}" # Block time in seconds BOOTNODE_DOMAIN_NAME="${BOOTNODE_DOMAIN_NAME:-node-1}" CHAIN_CUSTOM_OPTIONS=$(tr "\n" " " << EOL --block-gas-limit 10000000 @@ -46,6 +47,7 @@ case "$1" in cd /data && /polygon-edge/polygon-edge genesis $CHAIN_CUSTOM_OPTIONS \ --dir genesis.json \ --consensus ibft \ + --block-time $BLOCK_TIME \ --ibft-validators-prefix-path data- \ --max-validator-count=$NUMBER_OF_NODES \ --bootnode /dns4/"$BOOTNODE_DOMAIN_NAME"/tcp/1478/p2p/$BOOTNODE_ID \ @@ -75,6 +77,7 @@ case "$1" in "$POLYGON_EDGE_BIN" genesis $CHAIN_CUSTOM_OPTIONS \ --dir "$GENESIS_PATH" \ --consensus polybft \ + --block-time $BLOCK_TIME \ --manifest /data/manifest.json \ --max-validator-count=$NUMBER_OF_NODES \ --bootnode /dns4/"$BOOTNODE_DOMAIN_NAME"/tcp/1478/p2p/$BOOTNODE_ID @@ -102,6 +105,7 @@ case "$1" in echo "Generating genesis script..." "$POLYGON_EDGE_BIN" genesis --dir genesis.json \ --consensus ibft \ + --block-time $BLOCK_TIME \ --ibft-validators-prefix-path data- \ --max-validator-count=1 \ --premine=0x4AAb25B4fAd0Beaac466050f3A7142A502f4Cf0a:1000000000000000000000 \ From 18feda8a26b36dda1bdd2d25dd959ac1a5b8a9cc Mon Sep 17 00:00:00 2001 From: Marko Atanasievski Date: Fri, 15 Sep 2023 13:37:53 +0200 Subject: [PATCH 2/4] fix: lint --- consensus/ibft/signer/helper_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/consensus/ibft/signer/helper_test.go b/consensus/ibft/signer/helper_test.go index c5a24331b4..4386f63ee7 100644 --- a/consensus/ibft/signer/helper_test.go +++ b/consensus/ibft/signer/helper_test.go @@ -73,7 +73,7 @@ func Test_wrapCommitHash(t *testing.T) { assert.Equal(t, expectedOutput, output) } -// nolint +//nolint func Test_getOrCreateECDSAKey(t *testing.T) { t.Parallel() @@ -184,7 +184,7 @@ func Test_getOrCreateECDSAKey(t *testing.T) { } } -// nolint +//nolint func Test_getOrCreateBLSKey(t *testing.T) { t.Parallel() From bc1743acbc06f709a89f92bac1d48b3913ec1b03 Mon Sep 17 00:00:00 2001 From: Marko Atanasievski Date: Fri, 15 Sep 2023 13:41:21 +0200 Subject: [PATCH 3/4] fix: printout --- docker/local-topos/polygon-edge.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/local-topos/polygon-edge.sh b/docker/local-topos/polygon-edge.sh index d26b887d8f..bfef3f6294 100755 --- a/docker/local-topos/polygon-edge.sh +++ b/docker/local-topos/polygon-edge.sh @@ -111,7 +111,7 @@ case "$1" in --premine=0x4AAb25B4fAd0Beaac466050f3A7142A502f4Cf0a:1000000000000000000000 \ --bootnode /ip4/127.0.0.1/tcp/10001/p2p/$NODE_ID - echo "Executing polygon-edge standalone node..." + echo "Executing polygon-edge standalone node with block time " $BLOCK_TIME exec "$POLYGON_EDGE_BIN" server --data-dir ./data-1 --chain genesis.json ;; From fc5ca83d222373b4dbb8e60ea86f23fb5e1881a3 Mon Sep 17 00:00:00 2001 From: Marko Atanasievski Date: Fri, 15 Sep 2023 13:50:22 +0200 Subject: [PATCH 4/4] fix: remove comments --- server/server.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/server/server.go b/server/server.go index f6872a4555..54fa0e168c 100644 --- a/server/server.go +++ b/server/server.go @@ -705,7 +705,6 @@ func (j *jsonRPCHub) GetAccount(root types.Hash, addr types.Address) (*jsonrpc.A return account, nil } -// TODO: use eth_getProof once it is available in Polygon Edge func (j *jsonRPCHub) GetAccountProof(root types.Hash, addr types.Address) ([][]byte, error) { proof, err := getAccountProofImpl(j.state, root, addr) if err != nil { @@ -736,7 +735,6 @@ func (j *jsonRPCHub) GetStorage(stateRoot types.Hash, addr types.Address, slot t return res.Bytes(), nil } -// TODO: use eth_getProof once it is available in Polygon Edge func (j *jsonRPCHub) GetStorageProof(stateRoot types.Hash, addr types.Address, slot types.Hash) ([][]byte, error) { account, err := getAccountImpl(j.state, stateRoot, addr) if err != nil {