From 2075bdea83e442df789510239acecf79307b41c0 Mon Sep 17 00:00:00 2001 From: Zhenyang Shi Date: Tue, 18 Feb 2025 21:12:50 +1000 Subject: [PATCH 1/3] Update geth to v1.15.2 --- go.mod | 2 +- go.sum | 4 ++-- processor/helper.go | 2 +- processor/processor.go | 2 +- rpc/call.go | 2 +- rpc/estimate.go | 4 ++-- rpc/eth_handlers.go | 2 +- rpc/gasprice.go | 4 ++-- rpc/helper.go | 6 +++--- rpc/trace.go | 2 +- rpc/trace_handlers.go | 2 +- rpc/trace_test.go | 2 +- tests/chain_test.go | 2 +- validator/validator.go | 4 ++-- worldstate/mutablestate_impl.go | 2 +- 15 files changed, 21 insertions(+), 21 deletions(-) diff --git a/go.mod b/go.mod index e60ecc8..2713114 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.22.6 require ( github.com/dgraph-io/badger/v2 v2.2007.3 - github.com/ethereum/go-ethereum v1.15.1 + github.com/ethereum/go-ethereum v1.15.2 github.com/hashicorp/golang-lru/v2 v2.0.7 github.com/holiman/uint256 v1.3.2 github.com/ipfs/go-datastore v0.6.0 diff --git a/go.sum b/go.sum index 04c2808..9100e26 100644 --- a/go.sum +++ b/go.sum @@ -73,8 +73,8 @@ github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4 github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/ethereum/c-kzg-4844 v1.0.0 h1:0X1LBXxaEtYD9xsyj9B9ctQEZIpnvVDeoBx8aHEwTNA= github.com/ethereum/c-kzg-4844 v1.0.0/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0= -github.com/ethereum/go-ethereum v1.15.1 h1:ZR5hh6NXem4hNnhMIrdPFMTGHo6USTwWn47hbs6gRj4= -github.com/ethereum/go-ethereum v1.15.1/go.mod h1:wGQINJKEVUunCeoaA9C9qKMQ9GEOsEIunzzqTUO2F6Y= +github.com/ethereum/go-ethereum v1.15.2 h1:CcU13w1IXOo6FvS60JGCTVcAJ5Ik6RkWoVIvziiHdTU= +github.com/ethereum/go-ethereum v1.15.2/go.mod h1:wGQINJKEVUunCeoaA9C9qKMQ9GEOsEIunzzqTUO2F6Y= github.com/ethereum/go-verkle v0.2.2 h1:I2W0WjnrFUIzzVPwm8ykY+7pL2d4VhlsePn4j7cnFk8= github.com/ethereum/go-verkle v0.2.2/go.mod h1:M3b90YRnzqKyyzBEWJGqj8Qff4IDeXnzFw0P9bFw3uk= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= diff --git a/processor/helper.go b/processor/helper.go index d6d9200..824de32 100644 --- a/processor/helper.go +++ b/processor/helper.go @@ -137,7 +137,7 @@ func ApplyTransaction(msg *core.Message, gp *core.GasPool, worldState worldstate // Set the receipt logs and create the bloom filter. receipt.Logs = worldState.GetLogs(tx.Hash(), blockNumber.Uint64(), blockHash) - receipt.Bloom = types.CreateBloom(types.Receipts{receipt}) + receipt.Bloom = types.CreateBloom(receipt) receipt.BlockHash = blockHash receipt.BlockNumber = blockNumber receipt.TransactionIndex = uint(worldState.TxIndex()) diff --git a/processor/processor.go b/processor/processor.go index 3abc4ce..c9a98f9 100644 --- a/processor/processor.go +++ b/processor/processor.go @@ -32,7 +32,7 @@ var log = logging.Logger("processor") // Note: // This is adapted from: -// go-ethereum@v1.15.0/core/state_processor.go +// go-ethereum@v1.15.2/core/state_processor.go // Adapted code have been commented below. // When merge from upstream, perform check from Process() function below. diff --git a/rpc/call.go b/rpc/call.go index bbbfd1c..aa12f56 100644 --- a/rpc/call.go +++ b/rpc/call.go @@ -28,7 +28,7 @@ import ( // Note: // This is adapted from: -// go-ethereum@v1.15.0/internal/ethapi/api.go +// go-ethereum@v1.15.2/internal/ethapi/api.go func DoCall(ctx context.Context, be backend.Backend, args TransactionArgs, blockNrOrHash rpc.BlockNumberOrHash, overrides *StateOverride, blockOverrides *BlockOverrides, timeout time.Duration, globalGasCap uint64) (*core.ExecutionResult, error) { defer func(start time.Time) { log.Debug("Executing EVM call finished", "runtime", time.Since(start)) }(time.Now()) diff --git a/rpc/estimate.go b/rpc/estimate.go index 3913d82..dd06f49 100644 --- a/rpc/estimate.go +++ b/rpc/estimate.go @@ -31,8 +31,8 @@ import ( // Note: // This is adapted from: -// go-ethereum@v1.15.0/internal/ethapi/api.go -// go-ethereum@v1.15.0/gasestimator/gasestimator.go +// go-ethereum@v1.15.2/internal/ethapi/api.go +// go-ethereum@v1.15.2/gasestimator/gasestimator.go const estimateGasErrorRatio = 0.015 diff --git a/rpc/eth_handlers.go b/rpc/eth_handlers.go index e8d9af0..3c39ee4 100644 --- a/rpc/eth_handlers.go +++ b/rpc/eth_handlers.go @@ -28,7 +28,7 @@ import ( // Note: // This is adapted from: -// go-ethereum@v1.15.0/internal/ethapi/api.go +// go-ethereum@v1.15.2/internal/ethapi/api.go // ethAPIHandler is used to handle eth API. type ethAPIHandler struct { diff --git a/rpc/gasprice.go b/rpc/gasprice.go index 1314409..d20e2c5 100644 --- a/rpc/gasprice.go +++ b/rpc/gasprice.go @@ -27,8 +27,8 @@ import ( // Note: // This is adapted from: -// go-ethereum@v1.15.0/internal/ethapi/api.go -// go-ethereum@v1.15.0/eth/gasprice/gasprice.go +// go-ethereum@v1.15.2/internal/ethapi/api.go +// go-ethereum@v1.15.2/eth/gasprice/gasprice.go type feeHistoryResult struct { OldestBlock *hexutil.Big `json:"oldestBlock"` diff --git a/rpc/helper.go b/rpc/helper.go index 5a8c0f3..ab05b21 100644 --- a/rpc/helper.go +++ b/rpc/helper.go @@ -36,9 +36,9 @@ import ( // Note: // This is adapted from: -// go-ethereum@v1.15.0/internal/ethapi/api.go -// go-ethereum@v1.15.0/internal/ethapi/transaction_args.go -// go-ethereum@v1.15.0/internal/ethapi/errors.go +// go-ethereum@v1.15.2/internal/ethapi/api.go +// go-ethereum@v1.15.2/internal/ethapi/transaction_args.go +// go-ethereum@v1.15.2/internal/ethapi/errors.go // TransactionArgs represents the arguments to construct a new transaction // or a message call. diff --git a/rpc/trace.go b/rpc/trace.go index c945ea3..08f29a9 100644 --- a/rpc/trace.go +++ b/rpc/trace.go @@ -32,7 +32,7 @@ import ( // Note: // This is adapted from: -// go-ethereum@v1.15.0/eth/tracers/api.go +// go-ethereum@v1.15.2/eth/tracers/api.go const ( // defaultTraceTimeout is the amount of time a single transaction can execute diff --git a/rpc/trace_handlers.go b/rpc/trace_handlers.go index d72a1a8..f40211b 100644 --- a/rpc/trace_handlers.go +++ b/rpc/trace_handlers.go @@ -26,7 +26,7 @@ import ( // Note: // This is adapted from: -// go-ethereum@v1.15.0/eth/tracers/api.go +// go-ethereum@v1.15.2/eth/tracers/api.go // traceAPIHandler is used to handle trace API. type traceAPIHandler struct { diff --git a/rpc/trace_test.go b/rpc/trace_test.go index 31814ff..368f3ca 100644 --- a/rpc/trace_test.go +++ b/rpc/trace_test.go @@ -47,7 +47,7 @@ import ( // Note: // This is adapted from: -// go-ethereum@v1.15.0/eth/tracers/api_test.go +// go-ethereum@v1.15.2/eth/tracers/api_test.go const ( testDS = "./test-ds" diff --git a/tests/chain_test.go b/tests/chain_test.go index 2d3a4ee..db8cee5 100644 --- a/tests/chain_test.go +++ b/tests/chain_test.go @@ -40,7 +40,7 @@ import ( // Note: // This is adapted from: -// go-ethereum@v1.15.0/core/blockchain_test.go +// go-ethereum@v1.15.2/core/blockchain_test.go // Logger var log = logging.Logger("tests") diff --git a/validator/validator.go b/validator/validator.go index 41a8218..884da2f 100644 --- a/validator/validator.go +++ b/validator/validator.go @@ -20,7 +20,7 @@ import ( // Note: // This is adapted from: -// go-ethereum@v1.15.0/core/block_validator.go +// go-ethereum@v1.15.2/core/block_validator.go // Adapted code have been commented below. // Validate validates the given block against the receipts and gas used. @@ -31,7 +31,7 @@ func Validate(chainConfig *params.ChainConfig, block *types.Block, receipts type } // Validate the received block's bloom with the one derived from the generated receipts. // For valid blocks this should always validate to true. - rbloom := types.CreateBloom(receipts) + rbloom := types.MergeBloom(receipts) if rbloom != header.Bloom { return fmt.Errorf("invalid bloom (remote: %x local: %x)", header.Bloom, rbloom) } diff --git a/worldstate/mutablestate_impl.go b/worldstate/mutablestate_impl.go index 865fd83..ac867a9 100644 --- a/worldstate/mutablestate_impl.go +++ b/worldstate/mutablestate_impl.go @@ -265,7 +265,7 @@ func (s *mutableStateImpl) Prepare(rules params.Rules, sender, coinbase common.A // log.Debugf("precompiles: %v", precompiles) // log.Debugf("txAccesses: %v", txAccesses) - // Adapted from go-ethereum@v1.15.0/core/state/statedb.go + // Adapted from go-ethereum@v1.15.2/core/state/statedb.go if rules.IsEIP2929 && rules.IsEIP4762 { log.Panicf("eip2929 and eip4762 are both activated") } From edb59240c74afe13afc574bbd7fcc0ddb16ba18f Mon Sep 17 00:00:00 2001 From: Zhenyang Shi Date: Tue, 18 Feb 2025 21:17:47 +1000 Subject: [PATCH 2/3] Fix panic --- sync/sync.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sync/sync.go b/sync/sync.go index 55f3954..150c70f 100644 --- a/sync/sync.go +++ b/sync/sync.go @@ -35,10 +35,10 @@ func ForwardSync(ctx context.Context, b backend.Backend, blkSrc BlockSource, tar // Use a separate go routine to pull blocks blkChan := make(chan *types.Block, 100) errChan := make(chan error, 1) - defer close(errChan) go func(start uint64, target uint64) { defer close(blkChan) + defer close(errChan) for i := start; i <= target; i++ { select { case <-ctx.Done(): From 7f3e35e087e5761d942e9661156387249ce17289 Mon Sep 17 00:00:00 2001 From: Zhenyang Shi Date: Tue, 18 Feb 2025 21:19:32 +1000 Subject: [PATCH 3/3] Revert "Fix panic" This reverts commit edb59240c74afe13afc574bbd7fcc0ddb16ba18f. --- sync/sync.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sync/sync.go b/sync/sync.go index 150c70f..55f3954 100644 --- a/sync/sync.go +++ b/sync/sync.go @@ -35,10 +35,10 @@ func ForwardSync(ctx context.Context, b backend.Backend, blkSrc BlockSource, tar // Use a separate go routine to pull blocks blkChan := make(chan *types.Block, 100) errChan := make(chan error, 1) + defer close(errChan) go func(start uint64, target uint64) { defer close(blkChan) - defer close(errChan) for i := start; i <= target; i++ { select { case <-ctx.Done():