From dfe484d6a28307de3de52a42ffcde9cc4b2a4129 Mon Sep 17 00:00:00 2001 From: zhiqiangxu <652732310@qq.com> Date: Fri, 5 Jan 2024 23:49:19 +0800 Subject: [PATCH 1/7] should use Lock when mutating the flag --- core/blockstm/mvhashmap.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/blockstm/mvhashmap.go b/core/blockstm/mvhashmap.go index 59085138cf..51fcce63f1 100644 --- a/core/blockstm/mvhashmap.go +++ b/core/blockstm/mvhashmap.go @@ -166,13 +166,13 @@ func (mv *MVHashMap) MarkEstimate(k Key, txIdx int) { panic(fmt.Errorf("path must already exist")) }) - cells.rw.RLock() + cells.rw.Lock() if ci, ok := cells.tm.Get(txIdx); !ok { panic(fmt.Sprintf("should not happen - cell should be present for path. TxIdx: %v, path, %x, cells keys: %v", txIdx, k, cells.tm.Keys())) } else { ci.(*WriteCell).flag = FlagEstimate } - cells.rw.RUnlock() + cells.rw.Unlock() } func (mv *MVHashMap) Delete(k Key, txIdx int) { From aa00c8f96cc2a57eaf474bbc78b35ee3ba3a8450 Mon Sep 17 00:00:00 2001 From: zhiqiangxu <652732310@qq.com> Date: Sat, 6 Jan 2024 21:25:09 +0800 Subject: [PATCH 2/7] same problem in MVHashMap.Write --- core/blockstm/mvhashmap.go | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/core/blockstm/mvhashmap.go b/core/blockstm/mvhashmap.go index 51fcce63f1..38b075b0d8 100644 --- a/core/blockstm/mvhashmap.go +++ b/core/blockstm/mvhashmap.go @@ -121,34 +121,23 @@ func (mv *MVHashMap) Write(k Key, v Version, data interface{}) { return }) - cells.rw.RLock() - ci, ok := cells.tm.Get(v.TxnIndex) - cells.rw.RUnlock() - - if ok { + cells.rw.Lock() + if ci, ok := cells.tm.Get(v.TxnIndex); !ok { + cells.tm.Put(v.TxnIndex, &WriteCell{ + flag: FlagDone, + incarnation: v.Incarnation, + data: data, + }) + } else { if ci.(*WriteCell).incarnation > v.Incarnation { panic(fmt.Errorf("existing transaction value does not have lower incarnation: %v, %v", k, v.TxnIndex)) } - ci.(*WriteCell).flag = FlagDone ci.(*WriteCell).incarnation = v.Incarnation ci.(*WriteCell).data = data - } else { - cells.rw.Lock() - if ci, ok = cells.tm.Get(v.TxnIndex); !ok { - cells.tm.Put(v.TxnIndex, &WriteCell{ - flag: FlagDone, - incarnation: v.Incarnation, - data: data, - }) - } else { - ci.(*WriteCell).flag = FlagDone - ci.(*WriteCell).incarnation = v.Incarnation - ci.(*WriteCell).data = data - } - cells.rw.Unlock() } + cells.rw.Unlock() } func (mv *MVHashMap) ReadStorage(k Key, fallBack func() any) any { From d0c7045cceea4ebac80dc562a888bd466a05c02d Mon Sep 17 00:00:00 2001 From: zhiqiangxu <652732310@qq.com> Date: Sat, 6 Jan 2024 21:33:58 +0800 Subject: [PATCH 3/7] hole the rlock while reading WriteCell --- core/blockstm/mvhashmap.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/blockstm/mvhashmap.go b/core/blockstm/mvhashmap.go index 38b075b0d8..003de91e70 100644 --- a/core/blockstm/mvhashmap.go +++ b/core/blockstm/mvhashmap.go @@ -222,8 +222,8 @@ func (mv *MVHashMap) Read(k Key, txIdx int) (res MVReadResult) { } cells.rw.RLock() + fk, fv := cells.tm.Floor(txIdx - 1) - cells.rw.RUnlock() if fk != nil && fv != nil { c := fv.(*WriteCell) @@ -242,6 +242,8 @@ func (mv *MVHashMap) Read(k Key, txIdx int) (res MVReadResult) { } } + cells.rw.RUnlock() + return } From a622722ff2ff96eb0617932faf9741ede2b27aea Mon Sep 17 00:00:00 2001 From: Anshal Shukla Date: Thu, 18 Jan 2024 11:52:02 +0530 Subject: [PATCH 4/7] remove: kgz precompile from cancun --- core/vm/contracts.go | 1 - 1 file changed, 1 deletion(-) diff --git a/core/vm/contracts.go b/core/vm/contracts.go index 9e907f97b2..382c1ab405 100644 --- a/core/vm/contracts.go +++ b/core/vm/contracts.go @@ -105,7 +105,6 @@ var PrecompiledContractsCancun = map[common.Address]PrecompiledContract{ common.BytesToAddress([]byte{7}): &bn256ScalarMulIstanbul{}, common.BytesToAddress([]byte{8}): &bn256PairingIstanbul{}, common.BytesToAddress([]byte{9}): &blake2F{}, - common.BytesToAddress([]byte{0x0a}): &kzgPointEvaluation{}, common.BytesToAddress([]byte{0x01, 0x00}): &p256Verify{}, } From 0660fac39b5d5a31cd4da54e48b4ca8eda4d7cb4 Mon Sep 17 00:00:00 2001 From: Manav Darji Date: Thu, 18 Jan 2024 13:11:50 +0530 Subject: [PATCH 5/7] integration-tests: update ipc path on ci tests (#1127) * integration-tests: update ipc path on ci tests * added devnetBorFlags in matic-cli-config.yml --------- Co-authored-by: Pratik Patil --- .github/matic-cli-config.yml | 1 + integration-tests/bor_health.sh | 4 ++-- integration-tests/smoke_test.sh | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/matic-cli-config.yml b/.github/matic-cli-config.yml index 8c31e17dc6..e3200ec8b8 100644 --- a/.github/matic-cli-config.yml +++ b/.github/matic-cli-config.yml @@ -23,3 +23,4 @@ borDockerBuildContext: "../../bor" heimdallDockerBuildContext: "https://github.com/maticnetwork/heimdall.git#develop" sprintSizeBlockNumber: - '0' +devnetBorFlags: config,config,config diff --git a/integration-tests/bor_health.sh b/integration-tests/bor_health.sh index 3288739f85..63aba9aab1 100644 --- a/integration-tests/bor_health.sh +++ b/integration-tests/bor_health.sh @@ -3,8 +3,8 @@ set -e while true do - peers=$(docker exec bor0 bash -c "bor attach /root/.bor/data/bor.ipc -exec 'admin.peers'") - block=$(docker exec bor0 bash -c "bor attach /root/.bor/data/bor.ipc -exec 'eth.blockNumber'") + peers=$(docker exec bor0 bash -c "bor attach /root/var/lib/bor/data/bor.ipc -exec 'admin.peers'") + block=$(docker exec bor0 bash -c "bor attach /root/var/lib/bor/data/bor.ipc -exec 'eth.blockNumber'") if [[ -n "$peers" ]] && [[ -n "$block" ]]; then break diff --git a/integration-tests/smoke_test.sh b/integration-tests/smoke_test.sh index 62ca370ee7..9275093b16 100644 --- a/integration-tests/smoke_test.sh +++ b/integration-tests/smoke_test.sh @@ -1,7 +1,7 @@ #!/bin/bash set -e -balanceInit=$(docker exec bor0 bash -c "bor attach /root/.bor/data/bor.ipc -exec 'Math.round(web3.fromWei(eth.getBalance(eth.accounts[0])))'") +balanceInit=$(docker exec bor0 bash -c "bor attach /root/var/lib/bor/data/bor.ipc -exec 'Math.round(web3.fromWei(eth.getBalance(eth.accounts[0])))'") stateSyncFound="false" checkpointFound="false" @@ -11,7 +11,7 @@ start_time=$SECONDS while true do - balance=$(docker exec bor0 bash -c "bor attach /root/.bor/data/bor.ipc -exec 'Math.round(web3.fromWei(eth.getBalance(eth.accounts[0])))'") + balance=$(docker exec bor0 bash -c "bor attach /root/var/lib/bor/data/bor.ipc -exec 'Math.round(web3.fromWei(eth.getBalance(eth.accounts[0])))'") if ! [[ "$balance" =~ ^[0-9]+$ ]]; then echo "Something is wrong! Can't find the balance of first account in bor network." From 2a35bf8340820e6d0e87d3f4aabfb35bbf6b4c72 Mon Sep 17 00:00:00 2001 From: SHIVAM SHARMA Date: Fri, 19 Jan 2024 02:01:36 +0530 Subject: [PATCH 6/7] add : amoy flags and genesis (#1131) * add : amoy flags and genesis * minor fix * add : amoy.json in internal/cli/server * disable : peer check in mining for Amoy * add : amoy genesis hash * add amoy testnet deployment entries * update : amoy genesis * fix typos * add : post london forks + burn contract * add : amoy genesis hash * bump : version meta to amoy (#1092) * add : amoy bootnodes * chg : maxpeers of amoy val to 3 from 1 * bump : version to v1.1.0-amoy-2 * add : amoychain worker restriction on peercount --------- Co-authored-by: sreevalsanmr --- .github/ISSUE_TEMPLATE/bug.md | 2 +- .github/pull_request_template.md | 2 +- .github/workflows/packager.yml | 416 ++++++++++++++++++ README.md | 4 +- builder/files/config.toml | 2 +- cmd/devp2p/nodesetcmd.go | 2 + cmd/faucet/faucet.go | 7 +- cmd/geth/config.go | 28 ++ cmd/geth/consolecmd.go | 2 +- cmd/geth/main.go | 5 + cmd/utils/flags.go | 4 + core/allocs/amoy.json | 17 + core/genesis.go | 16 + docs/cli/example_config.toml | 10 +- docs/cli/server.md | 4 +- internal/cli/server/chains/allocs/amoy.json | 17 + internal/cli/server/chains/amoy.go | 70 +++ internal/cli/server/chains/chain.go | 1 + internal/cli/server/flags.go | 2 +- miner/worker.go | 2 +- .../testnet-amoy/archive/config.toml | 175 ++++++++ .../sentry/sentry/bor/config.toml | 175 ++++++++ .../sentry/validator/bor/config.toml | 176 ++++++++ .../without-sentry/bor/config.toml | 177 ++++++++ params/bootnodes.go | 9 + params/config.go | 48 ++ scripts/getconfig.go | 3 + 27 files changed, 1359 insertions(+), 17 deletions(-) create mode 100644 core/allocs/amoy.json create mode 100644 internal/cli/server/chains/allocs/amoy.json create mode 100644 internal/cli/server/chains/amoy.go create mode 100644 packaging/templates/testnet-amoy/archive/config.toml create mode 100644 packaging/templates/testnet-amoy/sentry/sentry/bor/config.toml create mode 100644 packaging/templates/testnet-amoy/sentry/validator/bor/config.toml create mode 100644 packaging/templates/testnet-amoy/without-sentry/bor/config.toml diff --git a/.github/ISSUE_TEMPLATE/bug.md b/.github/ISSUE_TEMPLATE/bug.md index 9ecc722ca4..72bca49dd6 100644 --- a/.github/ISSUE_TEMPLATE/bug.md +++ b/.github/ISSUE_TEMPLATE/bug.md @@ -20,7 +20,7 @@ Heimdall client version: [e.g. v0.2.10]