diff --git a/builder/files/genesis-testnet-v4.json b/builder/files/genesis-testnet-v4.json index afad138492..f3881b0166 100644 --- a/builder/files/genesis-testnet-v4.json +++ b/builder/files/genesis-testnet-v4.json @@ -14,6 +14,7 @@ "berlinBlock": 13996000, "londonBlock": 22640000, "shanghaiBlock": 41874000, + "cancunBlock": 45648608, "bor": { "jaipurBlock": 22770000, "delhiBlock": 29638656, diff --git a/cmd/bootnode/main.go b/cmd/bootnode/main.go index 491a35fb6d..4f744e102b 100644 --- a/cmd/bootnode/main.go +++ b/cmd/bootnode/main.go @@ -15,7 +15,8 @@ // along with go-ethereum. If not, see . // bootnode runs a bootstrap node for the Ethereum Discovery Protocol. -package main +// Keep package as bootnode during upstram merge. +package bootnode import ( "crypto/ecdsa" @@ -34,6 +35,7 @@ import ( "github.com/ethereum/go-ethereum/p2p/netutil" ) +// nolint func main() { var ( listenAddr = flag.String("addr", ":30301", "listen address") @@ -213,3 +215,12 @@ func doPortMapping(natm nat.Interface, ln *enode.LocalNode, addr *net.UDPAddr) * return extaddr } + +// Implemented separate functions so that there are minimal conflicts during upstream merge +func PrintNotice(nodeKey *ecdsa.PublicKey, addr net.UDPAddr) { + printNotice(nodeKey, addr) +} + +func DoPortMapping(natm nat.Interface, ln *enode.LocalNode, addr *net.UDPAddr) *net.UDPAddr { + return doPortMapping(natm, ln, addr) +} diff --git a/core/types/transaction_marshalling.go b/core/types/transaction_marshalling.go index 1378cb4014..e5d71a85d6 100644 --- a/core/types/transaction_marshalling.go +++ b/core/types/transaction_marshalling.go @@ -373,20 +373,20 @@ func (tx *Transaction) UnmarshalJSON(input []byte) error { itx.BlobHashes = dec.BlobVersionedHashes // signature R - var ok bool + var overflow bool if dec.R == nil { return errors.New("missing required field 'r' in transaction") } - itx.R, ok = uint256.FromBig((*big.Int)(dec.R)) - if !ok { + itx.R, overflow = uint256.FromBig((*big.Int)(dec.R)) + if overflow { return errors.New("'r' value overflows uint256") } // signature S if dec.S == nil { return errors.New("missing required field 's' in transaction") } - itx.S, ok = uint256.FromBig((*big.Int)(dec.S)) - if !ok { + itx.S, overflow = uint256.FromBig((*big.Int)(dec.S)) + if overflow { return errors.New("'s' value overflows uint256") } // signature V @@ -394,8 +394,8 @@ func (tx *Transaction) UnmarshalJSON(input []byte) error { if err != nil { return err } - itx.V, ok = uint256.FromBig(vbig) - if !ok { + itx.V, overflow = uint256.FromBig(vbig) + if overflow { return errors.New("'v' value overflows uint256") } if itx.V.Sign() != 0 || itx.R.Sign() != 0 || itx.S.Sign() != 0 { diff --git a/eth/bor_checkpoint_verifier.go b/eth/bor_checkpoint_verifier.go index f8ac341e74..a0bdfeac8e 100644 --- a/eth/bor_checkpoint_verifier.go +++ b/eth/bor_checkpoint_verifier.go @@ -37,6 +37,8 @@ var ( rewindLengthMeter = metrics.NewRegisteredMeter("chain/autorewind/length", nil) ) +const maxRewindLen uint64 = 126 + type borVerifier struct { verify func(ctx context.Context, eth *Ethereum, handler *ethHandler, start uint64, end uint64, hash string, isCheckpoint bool) (string, error) } @@ -117,8 +119,8 @@ func borVerify(ctx context.Context, eth *Ethereum, handler *ethHandler, start ui } } - if head-rewindTo > 255 { - rewindTo = head - 255 + if head-rewindTo > maxRewindLen { + rewindTo = head - maxRewindLen } if isCheckpoint { diff --git a/internal/cli/bootnode.go b/internal/cli/bootnode.go index 756956daa9..979d69ec23 100644 --- a/internal/cli/bootnode.go +++ b/internal/cli/bootnode.go @@ -13,6 +13,7 @@ import ( "syscall" "time" + "github.com/ethereum/go-ethereum/cmd/bootnode" "github.com/ethereum/go-ethereum/cmd/utils" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/internal/cli/flagset" @@ -213,33 +214,25 @@ func (b *BootnodeCommand) Run(args []string) int { } conn, err := net.ListenUDP("udp", addr) - if err != nil { b.UI.Error(fmt.Sprintf("failed to listen udp addr '%s': %v", b.listenAddr, err)) return 1 } + defer conn.Close() - realaddr := conn.LocalAddr().(*net.UDPAddr) - if natm != nil { - if !realaddr.IP.IsLoopback() { - go nat.Map(natm, nil, "udp", realaddr.Port, realaddr.Port, "ethereum discovery") - } + db, _ := enode.OpenDB("") + ln := enode.NewLocalNode(db, nodeKey) - if ext, err := natm.ExternalIP(); err == nil { - // nolint: govet - realaddr = &net.UDPAddr{IP: ext, Port: realaddr.Port} + listenerAddr := conn.LocalAddr().(*net.UDPAddr) + if natm != nil { + natAddr := bootnode.DoPortMapping(natm, ln, listenerAddr) + if natAddr != nil { + listenerAddr = natAddr } } - n := enode.NewV4(&nodeKey.PublicKey, addr.IP, addr.Port, addr.Port) - b.UI.Info(n.String()) - - if b.dryRun { - return 0 - } + bootnode.PrintNotice(&nodeKey.PublicKey, *listenerAddr) - db, _ := enode.OpenDB("") - ln := enode.NewLocalNode(db, nodeKey) cfg := discover.Config{ PrivateKey: nodeKey, Log: log.Root(), diff --git a/internal/cli/server/chains/mumbai.go b/internal/cli/server/chains/mumbai.go index 7fe25554c5..56fe8a1d47 100644 --- a/internal/cli/server/chains/mumbai.go +++ b/internal/cli/server/chains/mumbai.go @@ -28,6 +28,7 @@ var mumbaiTestnet = &Chain{ BerlinBlock: big.NewInt(13996000), LondonBlock: big.NewInt(22640000), ShanghaiBlock: big.NewInt(41874000), + CancunBlock: big.NewInt(45648608), Bor: ¶ms.BorConfig{ JaipurBlock: big.NewInt(22770000), DelhiBlock: big.NewInt(29638656), diff --git a/internal/cli/server/chains/test_files/chain_legacy_test.json b/internal/cli/server/chains/test_files/chain_legacy_test.json index c3e9b3c7bf..cc81db1608 100644 --- a/internal/cli/server/chains/test_files/chain_legacy_test.json +++ b/internal/cli/server/chains/test_files/chain_legacy_test.json @@ -15,6 +15,7 @@ "berlinBlock": 13996000, "londonBlock": 13996000, "shanghaiBlock": 41874000, + "cancunBlock": 45648608, "bor": { "period": { "0": 2, diff --git a/internal/cli/server/chains/test_files/chain_test.json b/internal/cli/server/chains/test_files/chain_test.json index 8555833321..3f826d285f 100644 --- a/internal/cli/server/chains/test_files/chain_test.json +++ b/internal/cli/server/chains/test_files/chain_test.json @@ -17,6 +17,7 @@ "berlinBlock":13996000, "londonBlock":13996000, "shanghaiBlock": 41874000, + "cancunBlock": 45648608, "bor":{ "period":{ "0":2, diff --git a/miner/worker.go b/miner/worker.go index 3573eccfee..0e1dd83691 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -920,7 +920,7 @@ func (w *worker) commitTransactions(env *environment, txs *transactionsByPriceAn EnableMVHashMap := w.chainConfig.IsCancun(env.header.Number) // create and add empty mvHashMap in statedb - if EnableMVHashMap { + if EnableMVHashMap && w.IsRunning() { deps = map[int]map[int]bool{} chDeps = make(chan blockstm.TxDep) @@ -956,7 +956,7 @@ func (w *worker) commitTransactions(env *environment, txs *transactionsByPriceAn mainloop: for { if interruptCtx != nil { - if EnableMVHashMap { + if EnableMVHashMap && w.IsRunning() { env.state.AddEmptyMVHashMap() } @@ -1055,7 +1055,7 @@ mainloop: coalescedLogs = append(coalescedLogs, logs...) env.tcount++ - if EnableMVHashMap { + if EnableMVHashMap && w.IsRunning() { env.depsMVFullWriteList = append(env.depsMVFullWriteList, env.state.MVFullWriteList()) env.mvReadMapList = append(env.mvReadMapList, env.state.MVReadMap()) @@ -1085,7 +1085,7 @@ mainloop: txs.Pop() } - if EnableMVHashMap { + if EnableMVHashMap && w.IsRunning() { env.state.ClearReadMap() env.state.ClearWriteMap() } diff --git a/packaging/templates/package_scripts/control b/packaging/templates/package_scripts/control index 94eeea3661..45ac1ebc99 100644 --- a/packaging/templates/package_scripts/control +++ b/packaging/templates/package_scripts/control @@ -1,5 +1,5 @@ Source: bor -Version: 1.2.3 +Version: 1.2.5 Section: develop Priority: standard Maintainer: Polygon diff --git a/packaging/templates/package_scripts/control.arm64 b/packaging/templates/package_scripts/control.arm64 index 809d705aa6..3ff615a535 100644 --- a/packaging/templates/package_scripts/control.arm64 +++ b/packaging/templates/package_scripts/control.arm64 @@ -1,5 +1,5 @@ Source: bor -Version: 1.2.3 +Version: 1.2.5 Section: develop Priority: standard Maintainer: Polygon diff --git a/packaging/templates/package_scripts/control.profile.amd64 b/packaging/templates/package_scripts/control.profile.amd64 index 22470ccd49..397fc9b3fd 100644 --- a/packaging/templates/package_scripts/control.profile.amd64 +++ b/packaging/templates/package_scripts/control.profile.amd64 @@ -1,5 +1,5 @@ Source: bor-profile -Version: 1.2.3 +Version: 1.2.5 Section: develop Priority: standard Maintainer: Polygon diff --git a/packaging/templates/package_scripts/control.profile.arm64 b/packaging/templates/package_scripts/control.profile.arm64 index 4a52b2e063..54dbc080ca 100644 --- a/packaging/templates/package_scripts/control.profile.arm64 +++ b/packaging/templates/package_scripts/control.profile.arm64 @@ -1,5 +1,5 @@ Source: bor-profile -Version: 1.2.3 +Version: 1.2.5 Section: develop Priority: standard Maintainer: Polygon diff --git a/packaging/templates/package_scripts/control.validator b/packaging/templates/package_scripts/control.validator index 00b517c3b0..dd9d25dd1c 100644 --- a/packaging/templates/package_scripts/control.validator +++ b/packaging/templates/package_scripts/control.validator @@ -1,5 +1,5 @@ Source: bor-profile -Version: 1.2.3 +Version: 1.2.5 Section: develop Priority: standard Maintainer: Polygon diff --git a/packaging/templates/package_scripts/control.validator.arm64 b/packaging/templates/package_scripts/control.validator.arm64 index 725a4ec394..be34db34f6 100644 --- a/packaging/templates/package_scripts/control.validator.arm64 +++ b/packaging/templates/package_scripts/control.validator.arm64 @@ -1,5 +1,5 @@ Source: bor-profile -Version: 1.2.3 +Version: 1.2.5 Section: develop Priority: standard Maintainer: Polygon diff --git a/params/config.go b/params/config.go index e724a02747..a82800206b 100644 --- a/params/config.go +++ b/params/config.go @@ -196,6 +196,7 @@ var ( BerlinBlock: big.NewInt(13996000), LondonBlock: big.NewInt(22640000), ShanghaiBlock: big.NewInt(41874000), + CancunBlock: big.NewInt(45648608), Bor: &BorConfig{ JaipurBlock: big.NewInt(22770000), DelhiBlock: big.NewInt(29638656), diff --git a/params/version.go b/params/version.go index b44ab8079c..50271daa76 100644 --- a/params/version.go +++ b/params/version.go @@ -23,7 +23,7 @@ import ( const ( VersionMajor = 1 // Major version component of the current release VersionMinor = 2 // Minor version component of the current release - VersionPatch = 3 // Patch version component of the current release + VersionPatch = 5 // Patch version component of the current release VersionMeta = "" // Version metadata to append to the version string )