From b5a88dafae52c7126b185aed841a418943fc5cb9 Mon Sep 17 00:00:00 2001 From: Martin HS Date: Thu, 26 Sep 2024 08:12:12 +0200 Subject: [PATCH 01/18] p2p/discover: fix flaky tests writing to test.log after completion (#30506) This PR fixes two tests, which had a tendency to sometimes write to the `*testing.T` `log` facility after the test function had completed, which is not allowed. This PR fixes it by using waitgroups to ensure that the handler/logwriter terminates before the test exits. closes #30505 --- p2p/discover/v4_lookup_test.go | 26 ++++++++++++++++++++++---- p2p/enode/nodedb.go | 6 +++++- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/p2p/discover/v4_lookup_test.go b/p2p/discover/v4_lookup_test.go index 70bd7056fb..29a9dd6645 100644 --- a/p2p/discover/v4_lookup_test.go +++ b/p2p/discover/v4_lookup_test.go @@ -21,6 +21,7 @@ import ( "fmt" "net/netip" "slices" + "sync" "testing" "github.com/ethereum/go-ethereum/crypto" @@ -67,7 +68,11 @@ func TestUDPv4_Lookup(t *testing.T) { func TestUDPv4_LookupIterator(t *testing.T) { t.Parallel() test := newUDPTest(t) - defer test.close() + var wg sync.WaitGroup + defer func() { + test.close() + wg.Wait() + }() // Seed table with initial nodes. bootnodes := make([]*enode.Node, len(lookupTestnet.dists[256])) @@ -75,7 +80,11 @@ func TestUDPv4_LookupIterator(t *testing.T) { bootnodes[i] = lookupTestnet.node(256, i) } fillTable(test.table, bootnodes, true) - go serveTestnet(test, lookupTestnet) + wg.Add(1) + go func() { + serveTestnet(test, lookupTestnet) + wg.Done() + }() // Create the iterator and collect the nodes it yields. iter := test.udp.RandomNodes() @@ -102,7 +111,11 @@ func TestUDPv4_LookupIterator(t *testing.T) { func TestUDPv4_LookupIteratorClose(t *testing.T) { t.Parallel() test := newUDPTest(t) - defer test.close() + var wg sync.WaitGroup + defer func() { + test.close() + wg.Wait() + }() // Seed table with initial nodes. bootnodes := make([]*enode.Node, len(lookupTestnet.dists[256])) @@ -110,7 +123,12 @@ func TestUDPv4_LookupIteratorClose(t *testing.T) { bootnodes[i] = lookupTestnet.node(256, i) } fillTable(test.table, bootnodes, true) - go serveTestnet(test, lookupTestnet) + + wg.Add(1) + go func() { + serveTestnet(test, lookupTestnet) + wg.Done() + }() it := test.udp.RandomNodes() if ok := it.Next(); !ok || it.Node() == nil { diff --git a/p2p/enode/nodedb.go b/p2p/enode/nodedb.go index 1f31c98d22..51e554e68a 100644 --- a/p2p/enode/nodedb.go +++ b/p2p/enode/nodedb.go @@ -496,6 +496,10 @@ func nextNode(it iterator.Iterator) *Node { // Close flushes and closes the database files. func (db *DB) Close() { - close(db.quit) + select { + case <-db.quit: // already closed + default: + close(db.quit) + } db.lvl.Close() } From 93675d1da702618310db3232da41b09b8a5853da Mon Sep 17 00:00:00 2001 From: Martin HS Date: Thu, 26 Sep 2024 09:28:40 +0200 Subject: [PATCH 02/18] deps: update supranational/blst (#30504) This update should only affect the fuzzers, as far as I know. But it seems like it might also fix some arm/macos compilation issue in https://github.com/ethereum/go-ethereum/issues/30494 Closes #30494 (I think) --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index a8f5d11a89..e9692cf8b3 100644 --- a/go.mod +++ b/go.mod @@ -61,7 +61,7 @@ require ( github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible github.com/status-im/keycard-go v0.2.0 github.com/stretchr/testify v1.9.0 - github.com/supranational/blst v0.3.11 + github.com/supranational/blst v0.3.13 github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 github.com/tyler-smith/go-bip39 v1.1.0 github.com/urfave/cli/v2 v2.25.7 diff --git a/go.sum b/go.sum index ab9bff9960..21a5e5bcd8 100644 --- a/go.sum +++ b/go.sum @@ -495,8 +495,8 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/supranational/blst v0.3.11 h1:LyU6FolezeWAhvQk0k6O/d49jqgO52MSDDfYgbeoEm4= -github.com/supranational/blst v0.3.11/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= +github.com/supranational/blst v0.3.13 h1:AYeSxdOMacwu7FBmpfloBz5pbFXDmJL33RuwnKtmTjk= +github.com/supranational/blst v0.3.13/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= From bb9897f11be1054bdbb8fc3b10fed38be8f33000 Mon Sep 17 00:00:00 2001 From: jwasinger Date: Thu, 26 Sep 2024 16:08:36 +0700 Subject: [PATCH 03/18] core/txpool, eth/catalyst: ensure gas tip retains current value upon rollback (#30495) Here we move the method that drops all transactions by temporarily increasing the fee into the TxPool itself. It's better to have it there because we can set it back to the configured value afterwards. This resolves a TODO in the simulated backend. --- core/txpool/blobpool/blobpool.go | 105 +++++++++++++++------------ core/txpool/legacypool/legacypool.go | 23 ++++-- core/txpool/subpool.go | 3 + core/txpool/txpool.go | 7 ++ eth/catalyst/simulated_beacon.go | 9 +-- 5 files changed, 86 insertions(+), 61 deletions(-) diff --git a/core/txpool/blobpool/blobpool.go b/core/txpool/blobpool/blobpool.go index 685c017cbd..864b92257b 100644 --- a/core/txpool/blobpool/blobpool.go +++ b/core/txpool/blobpool/blobpool.go @@ -1013,6 +1013,56 @@ func (p *BlobPool) reinject(addr common.Address, txhash common.Hash) error { return nil } +func (p *BlobPool) flushTransactionsBelowTip(tip *uint256.Int) { + for addr, txs := range p.index { + for i, tx := range txs { + if tx.execTipCap.Cmp(tip) < 0 { + // Drop the offending transaction + var ( + ids = []uint64{tx.id} + nonces = []uint64{tx.nonce} + ) + p.spent[addr] = new(uint256.Int).Sub(p.spent[addr], txs[i].costCap) + p.stored -= uint64(tx.size) + delete(p.lookup, tx.hash) + txs[i] = nil + + // Drop everything afterwards, no gaps allowed + for j, tx := range txs[i+1:] { + ids = append(ids, tx.id) + nonces = append(nonces, tx.nonce) + + p.spent[addr] = new(uint256.Int).Sub(p.spent[addr], tx.costCap) + p.stored -= uint64(tx.size) + delete(p.lookup, tx.hash) + txs[i+1+j] = nil + } + // Clear out the dropped transactions from the index + if i > 0 { + p.index[addr] = txs[:i] + heap.Fix(p.evict, p.evict.index[addr]) + } else { + delete(p.index, addr) + delete(p.spent, addr) + + heap.Remove(p.evict, p.evict.index[addr]) + p.reserve(addr, false) + } + // Clear out the transactions from the data store + log.Warn("Dropping underpriced blob transaction", "from", addr, "rejected", tx.nonce, "tip", tx.execTipCap, "want", tip, "drop", nonces, "ids", ids) + dropUnderpricedMeter.Mark(int64(len(ids))) + + for _, id := range ids { + if err := p.store.Delete(id); err != nil { + log.Error("Failed to delete dropped transaction", "id", id, "err", err) + } + } + break + } + } + } +} + // SetGasTip implements txpool.SubPool, allowing the blob pool's gas requirements // to be kept in sync with the main transaction pool's gas requirements. func (p *BlobPool) SetGasTip(tip *big.Int) { @@ -1025,59 +1075,20 @@ func (p *BlobPool) SetGasTip(tip *big.Int) { // If the min miner fee increased, remove transactions below the new threshold if old == nil || p.gasTip.Cmp(old) > 0 { - for addr, txs := range p.index { - for i, tx := range txs { - if tx.execTipCap.Cmp(p.gasTip) < 0 { - // Drop the offending transaction - var ( - ids = []uint64{tx.id} - nonces = []uint64{tx.nonce} - ) - p.spent[addr] = new(uint256.Int).Sub(p.spent[addr], txs[i].costCap) - p.stored -= uint64(tx.size) - delete(p.lookup, tx.hash) - txs[i] = nil - - // Drop everything afterwards, no gaps allowed - for j, tx := range txs[i+1:] { - ids = append(ids, tx.id) - nonces = append(nonces, tx.nonce) - - p.spent[addr] = new(uint256.Int).Sub(p.spent[addr], tx.costCap) - p.stored -= uint64(tx.size) - delete(p.lookup, tx.hash) - txs[i+1+j] = nil - } - // Clear out the dropped transactions from the index - if i > 0 { - p.index[addr] = txs[:i] - heap.Fix(p.evict, p.evict.index[addr]) - } else { - delete(p.index, addr) - delete(p.spent, addr) - - heap.Remove(p.evict, p.evict.index[addr]) - p.reserve(addr, false) - } - // Clear out the transactions from the data store - log.Warn("Dropping underpriced blob transaction", "from", addr, "rejected", tx.nonce, "tip", tx.execTipCap, "want", tip, "drop", nonces, "ids", ids) - dropUnderpricedMeter.Mark(int64(len(ids))) - - for _, id := range ids { - if err := p.store.Delete(id); err != nil { - log.Error("Failed to delete dropped transaction", "id", id, "err", err) - } - } - break - } - } - } + p.flushTransactionsBelowTip(p.gasTip) } log.Debug("Blobpool tip threshold updated", "tip", tip) pooltipGauge.Update(tip.Int64()) p.updateStorageMetrics() } +func (p *BlobPool) FlushAllTransactions() { + maxUint256 := uint256.MustFromBig(new(big.Int).Sub(new(big.Int).Lsh(common.Big1, 256), common.Big1)) + p.lock.Lock() + defer p.lock.Unlock() + p.flushTransactionsBelowTip(maxUint256) +} + // validateTx checks whether a transaction is valid according to the consensus // rules and adheres to some heuristic limits of the local node (price and size). func (p *BlobPool) validateTx(tx *types.Transaction) error { diff --git a/core/txpool/legacypool/legacypool.go b/core/txpool/legacypool/legacypool.go index 5506ecc31f..1ac8086522 100644 --- a/core/txpool/legacypool/legacypool.go +++ b/core/txpool/legacypool/legacypool.go @@ -429,6 +429,15 @@ func (pool *LegacyPool) SubscribeTransactions(ch chan<- core.NewTxsEvent, reorgs return pool.txFeed.Subscribe(ch) } +func (pool *LegacyPool) flushTransactionsBelowTip(tip *big.Int) { + // pool.priced is sorted by GasFeeCap, so we have to iterate through pool.all instead + drop := pool.all.RemotesBelowTip(tip) + for _, tx := range drop { + pool.removeTx(tx.Hash(), false, true) + } + pool.priced.Removed(len(drop)) +} + // SetGasTip updates the minimum gas tip required by the transaction pool for a // new transaction, and drops all transactions below this threshold. func (pool *LegacyPool) SetGasTip(tip *big.Int) { @@ -442,16 +451,18 @@ func (pool *LegacyPool) SetGasTip(tip *big.Int) { pool.gasTip.Store(newTip) // If the min miner fee increased, remove transactions below the new threshold if newTip.Cmp(old) > 0 { - // pool.priced is sorted by GasFeeCap, so we have to iterate through pool.all instead - drop := pool.all.RemotesBelowTip(tip) - for _, tx := range drop { - pool.removeTx(tx.Hash(), false, true) - } - pool.priced.Removed(len(drop)) + pool.flushTransactionsBelowTip(tip) } log.Info("Legacy pool tip threshold updated", "tip", newTip) } +func (pool *LegacyPool) FlushAllTransactions() { + maxUint256 := new(big.Int).Sub(new(big.Int).Lsh(common.Big1, 256), common.Big1) + pool.mu.Lock() + defer pool.mu.Unlock() + pool.flushTransactionsBelowTip(maxUint256) +} + // Nonce returns the next nonce of an account, with all transactions executable // by the pool already applied on top. func (pool *LegacyPool) Nonce(addr common.Address) uint64 { diff --git a/core/txpool/subpool.go b/core/txpool/subpool.go index 9881ed1b8f..e361eabd4e 100644 --- a/core/txpool/subpool.go +++ b/core/txpool/subpool.go @@ -116,6 +116,9 @@ type SubPool interface { // transaction, and drops all transactions below this threshold. SetGasTip(tip *big.Int) + // FlushAllTransactions drops all transactions in the pool. + FlushAllTransactions() + // Has returns an indicator whether subpool has a transaction cached with the // given hash. Has(hash common.Hash) bool diff --git a/core/txpool/txpool.go b/core/txpool/txpool.go index be7435247d..f18eb4c6a0 100644 --- a/core/txpool/txpool.go +++ b/core/txpool/txpool.go @@ -104,6 +104,13 @@ func New(gasTip uint64, chain BlockChain, subpools []SubPool) (*TxPool, error) { return pool, nil } +// FlushAllTransactions removes all transactions from all subpools +func (p *TxPool) FlushAllTransactions() { + for _, subpool := range p.subpools { + subpool.FlushAllTransactions() + } +} + // reserver is a method to create an address reservation callback to exclusively // assign/deassign addresses to/from subpools. This can ensure that at any point // in time, only a single subpool is able to manage an account, avoiding cross diff --git a/eth/catalyst/simulated_beacon.go b/eth/catalyst/simulated_beacon.go index dbf561ca41..247d906d05 100644 --- a/eth/catalyst/simulated_beacon.go +++ b/eth/catalyst/simulated_beacon.go @@ -21,7 +21,6 @@ import ( "crypto/sha256" "errors" "fmt" - "math/big" "sync" "time" @@ -34,7 +33,6 @@ import ( "github.com/ethereum/go-ethereum/event" "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/node" - "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/rpc" ) @@ -286,12 +284,7 @@ func (c *SimulatedBeacon) Commit() common.Hash { // Rollback un-sends previously added transactions. func (c *SimulatedBeacon) Rollback() { - // Flush all transactions from the transaction pools - maxUint256 := new(big.Int).Sub(new(big.Int).Lsh(common.Big1, 256), common.Big1) - c.eth.TxPool().SetGasTip(maxUint256) - // Set the gas tip back to accept new transactions - // TODO (Marius van der Wijden): set gas tip to parameter passed by config - c.eth.TxPool().SetGasTip(big.NewInt(params.GWei)) + c.eth.TxPool().FlushAllTransactions() } // Fork sets the head to the provided hash. From 9274f28210f6743e06fc0692748cd257125ff11e Mon Sep 17 00:00:00 2001 From: Martin Holst Swende Date: Fri, 27 Sep 2024 08:24:23 +0200 Subject: [PATCH 04/18] core/txpool/blobpool: revert part of #30437, return all reinject-addresses --- core/txpool/blobpool/blobpool.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/core/txpool/blobpool/blobpool.go b/core/txpool/blobpool/blobpool.go index 864b92257b..1789367be1 100644 --- a/core/txpool/blobpool/blobpool.go +++ b/core/txpool/blobpool/blobpool.go @@ -949,9 +949,7 @@ func (p *BlobPool) reorg(oldHead, newHead *types.Header) (map[common.Address][]* lost = append(lost, tx) } } - if len(lost) > 0 { - reinject[addr] = lost - } + reinject[addr] = lost // Update the set that was already reincluded to track the blocks in limbo for _, tx := range types.TxDifference(included[addr], discarded[addr]) { From abbd3d9d21aeac7229f72ffff600d40fa5519cc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Fri, 27 Sep 2024 11:55:42 +0300 Subject: [PATCH 05/18] core/txpool/blobpool: add test to check internal shuffling --- core/txpool/blobpool/blobpool_test.go | 108 ++++++++++++++++++-------- 1 file changed, 76 insertions(+), 32 deletions(-) diff --git a/core/txpool/blobpool/blobpool_test.go b/core/txpool/blobpool/blobpool_test.go index feccb17922..9bbc763e77 100644 --- a/core/txpool/blobpool/blobpool_test.go +++ b/core/txpool/blobpool/blobpool_test.go @@ -27,7 +27,6 @@ import ( "path/filepath" "sync" "testing" - "time" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/consensus/misc/eip1559" @@ -53,25 +52,14 @@ var ( emptyBlobVHash = kzg4844.CalcBlobHashV1(sha256.New(), &emptyBlobCommit) ) -// Chain configuration with Cancun enabled. -// -// TODO(karalabe): replace with params.MainnetChainConfig after Cancun. -var testChainConfig *params.ChainConfig - -func init() { - testChainConfig = new(params.ChainConfig) - *testChainConfig = *params.MainnetChainConfig - - testChainConfig.CancunTime = new(uint64) - *testChainConfig.CancunTime = uint64(time.Now().Unix()) -} - // testBlockChain is a mock of the live chain for testing the pool. type testBlockChain struct { config *params.ChainConfig basefee *uint256.Int blobfee *uint256.Int statedb *state.StateDB + + blocks map[uint64]*types.Block } func (bc *testBlockChain) Config() *params.ChainConfig { @@ -79,7 +67,7 @@ func (bc *testBlockChain) Config() *params.ChainConfig { } func (bc *testBlockChain) CurrentBlock() *types.Header { - // Yolo, life is too short to invert mist.CalcBaseFee and misc.CalcBlobFee, + // Yolo, life is too short to invert misc.CalcBaseFee and misc.CalcBlobFee, // just binary search it them. // The base fee at 5714 ETH translates into the 21000 base gas higher than @@ -142,7 +130,14 @@ func (bc *testBlockChain) CurrentFinalBlock() *types.Header { } func (bc *testBlockChain) GetBlock(hash common.Hash, number uint64) *types.Block { - return nil + // This is very yolo for the tests. If the number is the origin block we use + // to init the pool, return an empty block with the correct starting header. + // + // If it is something else, return some baked in mock data. + if number == bc.config.LondonBlock.Uint64()+1 { + return types.NewBlockWithHeader(bc.CurrentBlock()) + } + return bc.blocks[number] } func (bc *testBlockChain) StateAt(common.Hash) (*state.StateDB, error) { @@ -181,14 +176,14 @@ func makeAddressReserver() txpool.AddressReserver { // the blob pool. func makeTx(nonce uint64, gasTipCap uint64, gasFeeCap uint64, blobFeeCap uint64, key *ecdsa.PrivateKey) *types.Transaction { blobtx := makeUnsignedTx(nonce, gasTipCap, gasFeeCap, blobFeeCap) - return types.MustSignNewTx(key, types.LatestSigner(testChainConfig), blobtx) + return types.MustSignNewTx(key, types.LatestSigner(params.MainnetChainConfig), blobtx) } // makeUnsignedTx is a utility method to construct a random blob transaction // without signing it. func makeUnsignedTx(nonce uint64, gasTipCap uint64, gasFeeCap uint64, blobFeeCap uint64) *types.BlobTx { return &types.BlobTx{ - ChainID: uint256.MustFromBig(testChainConfig.ChainID), + ChainID: uint256.MustFromBig(params.MainnetChainConfig.ChainID), Nonce: nonce, GasTipCap: uint256.NewInt(gasTipCap), GasFeeCap: uint256.NewInt(gasFeeCap), @@ -229,13 +224,17 @@ func verifyPoolInternals(t *testing.T, pool *BlobPool) { for hash := range seen { t.Errorf("indexed transaction hash #%x missing from lookup table", hash) } - // Verify that transactions are sorted per account and contain no nonce gaps + // Verify that transactions are sorted per account and contain no nonce gaps, + // and that the first nonce is the next expected one based on the state. for addr, txs := range pool.index { for i := 1; i < len(txs); i++ { if txs[i].nonce != txs[i-1].nonce+1 { t.Errorf("addr %v, tx %d nonce mismatch: have %d, want %d", addr, i, txs[i].nonce, txs[i-1].nonce+1) } } + if txs[0].nonce != pool.state.GetNonce(addr) { + t.Errorf("addr %v, first tx nonce mismatch: have %d, want %d", addr, txs[0].nonce, pool.state.GetNonce(addr)) + } } // Verify that calculated evacuation thresholds are correct for addr, txs := range pool.index { @@ -331,7 +330,7 @@ func TestOpenDrops(t *testing.T) { // Insert a transaction with a bad signature to verify that stale junk after // potential hard-forks can get evicted (case 2) tx := types.NewTx(&types.BlobTx{ - ChainID: uint256.MustFromBig(testChainConfig.ChainID), + ChainID: uint256.MustFromBig(params.MainnetChainConfig.ChainID), GasTipCap: new(uint256.Int), GasFeeCap: new(uint256.Int), Gas: 0, @@ -560,7 +559,7 @@ func TestOpenDrops(t *testing.T) { statedb.Commit(0, true) chain := &testBlockChain{ - config: testChainConfig, + config: params.MainnetChainConfig, basefee: uint256.NewInt(params.InitialBaseFee), blobfee: uint256.NewInt(params.BlobTxMinBlobGasprice), statedb: statedb, @@ -679,7 +678,7 @@ func TestOpenIndex(t *testing.T) { statedb.Commit(0, true) chain := &testBlockChain{ - config: testChainConfig, + config: params.MainnetChainConfig, basefee: uint256.NewInt(params.InitialBaseFee), blobfee: uint256.NewInt(params.BlobTxMinBlobGasprice), statedb: statedb, @@ -781,7 +780,7 @@ func TestOpenHeap(t *testing.T) { statedb.Commit(0, true) chain := &testBlockChain{ - config: testChainConfig, + config: params.MainnetChainConfig, basefee: uint256.NewInt(1050), blobfee: uint256.NewInt(105), statedb: statedb, @@ -861,7 +860,7 @@ func TestOpenCap(t *testing.T) { statedb.Commit(0, true) chain := &testBlockChain{ - config: testChainConfig, + config: params.MainnetChainConfig, basefee: uint256.NewInt(1050), blobfee: uint256.NewInt(105), statedb: statedb, @@ -908,13 +907,12 @@ func TestOpenCap(t *testing.T) { func TestAdd(t *testing.T) { log.SetDefault(log.NewLogger(log.NewTerminalHandlerWithLevel(os.Stderr, log.LevelTrace, true))) - // seed is a helper tumpe to seed an initial state db and pool + // seed is a helper tuple to seed an initial state db and pool type seed struct { balance uint64 nonce uint64 txs []*types.BlobTx } - // addtx is a helper sender/tx tuple to represent a new tx addition type addtx struct { from string @@ -925,6 +923,7 @@ func TestAdd(t *testing.T) { tests := []struct { seeds map[string]seed adds []addtx + block []addtx }{ // Transactions from new accounts should be accepted if their initial // nonce matches the expected one from the statedb. Higher or lower must @@ -1250,6 +1249,25 @@ func TestAdd(t *testing.T) { }, }, }, + // Tests issue #30518 where a refactor broke internal state invariants, + // causing included transactions not to be properly accounted and thus + // account states going our of sync with the chain. + { + seeds: map[string]seed{ + "alice": { + balance: 1000000, + txs: []*types.BlobTx{ + makeUnsignedTx(0, 1, 1, 1), + }, + }, + }, + block: []addtx{ + { + from: "alice", + tx: makeUnsignedTx(0, 1, 1, 1), + }, + }, + }, } for i, tt := range tests { // Create a temporary folder for the persistent backend @@ -1276,7 +1294,7 @@ func TestAdd(t *testing.T) { // Sign the seed transactions and store them in the data store for _, tx := range seed.txs { - signed := types.MustSignNewTx(keys[acc], types.LatestSigner(testChainConfig), tx) + signed := types.MustSignNewTx(keys[acc], types.LatestSigner(params.MainnetChainConfig), tx) blob, _ := rlp.EncodeToBytes(signed) store.Put(blob) } @@ -1286,7 +1304,7 @@ func TestAdd(t *testing.T) { // Create a blob pool out of the pre-seeded dats chain := &testBlockChain{ - config: testChainConfig, + config: params.MainnetChainConfig, basefee: uint256.NewInt(1050), blobfee: uint256.NewInt(105), statedb: statedb, @@ -1299,14 +1317,40 @@ func TestAdd(t *testing.T) { // Add each transaction one by one, verifying the pool internals in between for j, add := range tt.adds { - signed, _ := types.SignNewTx(keys[add.from], types.LatestSigner(testChainConfig), add.tx) + signed, _ := types.SignNewTx(keys[add.from], types.LatestSigner(params.MainnetChainConfig), add.tx) if err := pool.add(signed); !errors.Is(err, add.err) { t.Errorf("test %d, tx %d: adding transaction error mismatch: have %v, want %v", i, j, err, add.err) } verifyPoolInternals(t, pool) } - // Verify the pool internals and close down the test verifyPoolInternals(t, pool) + + // If the test contains a chain head event, run that and gain verify the internals + if tt.block != nil { + // Fake a header for the new set of transactions + header := &types.Header{ + Number: big.NewInt(int64(chain.CurrentBlock().Number.Uint64() + 1)), + BaseFee: chain.CurrentBlock().BaseFee, // invalid, but nothing checks it, yolo + } + // Inject the fake block into the chain + txs := make([]*types.Transaction, len(tt.block)) + for j, inc := range tt.block { + txs[j] = types.MustSignNewTx(keys[inc.from], types.LatestSigner(params.MainnetChainConfig), inc.tx) + } + chain.blocks = map[uint64]*types.Block{ + header.Number.Uint64(): types.NewBlockWithHeader(header).WithBody(types.Body{ + Transactions: txs, + }), + } + // Apply the nonce updates to the state db + for _, tx := range txs { + sender, _ := types.Sender(types.LatestSigner(params.MainnetChainConfig), tx) + chain.statedb.SetNonce(sender, tx.Nonce()+1) + } + pool.Reset(chain.CurrentBlock(), header) + verifyPoolInternals(t, pool) + } + // Close down the test pool.Close() } } @@ -1325,10 +1369,10 @@ func benchmarkPoolPending(b *testing.B, datacap uint64) { var ( basefee = uint64(1050) blobfee = uint64(105) - signer = types.LatestSigner(testChainConfig) + signer = types.LatestSigner(params.MainnetChainConfig) statedb, _ = state.New(types.EmptyRootHash, state.NewDatabaseForTesting()) chain = &testBlockChain{ - config: testChainConfig, + config: params.MainnetChainConfig, basefee: uint256.NewInt(basefee), blobfee: uint256.NewInt(blobfee), statedb: statedb, From 1df75dbe3611d92b585148b7abc1a33bfba17557 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Fri, 27 Sep 2024 13:56:25 +0300 Subject: [PATCH 06/18] Revert "core/txpool, eth/catalyst: ensure gas tip retains current value upon rollback" (#30521) Reverts ethereum/go-ethereum#30495 You are free to create a proper Clear method if that's the best way. But one that does a proper cleanup, not some hacky call to set gas which screws up logs, metrics and everything along the way. Also doesn't work for legacy pool local transactions. The current code had a hack in the simulated code, now we have a hack in live txpooling code. No, that's not acceptable. I want the live code to be proper, meaningful API, meaningful comments, meaningful implementation. --- core/txpool/blobpool/blobpool.go | 105 ++++++++++++--------------- core/txpool/legacypool/legacypool.go | 23 ++---- core/txpool/subpool.go | 3 - core/txpool/txpool.go | 7 -- eth/catalyst/simulated_beacon.go | 9 ++- 5 files changed, 61 insertions(+), 86 deletions(-) diff --git a/core/txpool/blobpool/blobpool.go b/core/txpool/blobpool/blobpool.go index 1789367be1..745fc08fec 100644 --- a/core/txpool/blobpool/blobpool.go +++ b/core/txpool/blobpool/blobpool.go @@ -1011,56 +1011,6 @@ func (p *BlobPool) reinject(addr common.Address, txhash common.Hash) error { return nil } -func (p *BlobPool) flushTransactionsBelowTip(tip *uint256.Int) { - for addr, txs := range p.index { - for i, tx := range txs { - if tx.execTipCap.Cmp(tip) < 0 { - // Drop the offending transaction - var ( - ids = []uint64{tx.id} - nonces = []uint64{tx.nonce} - ) - p.spent[addr] = new(uint256.Int).Sub(p.spent[addr], txs[i].costCap) - p.stored -= uint64(tx.size) - delete(p.lookup, tx.hash) - txs[i] = nil - - // Drop everything afterwards, no gaps allowed - for j, tx := range txs[i+1:] { - ids = append(ids, tx.id) - nonces = append(nonces, tx.nonce) - - p.spent[addr] = new(uint256.Int).Sub(p.spent[addr], tx.costCap) - p.stored -= uint64(tx.size) - delete(p.lookup, tx.hash) - txs[i+1+j] = nil - } - // Clear out the dropped transactions from the index - if i > 0 { - p.index[addr] = txs[:i] - heap.Fix(p.evict, p.evict.index[addr]) - } else { - delete(p.index, addr) - delete(p.spent, addr) - - heap.Remove(p.evict, p.evict.index[addr]) - p.reserve(addr, false) - } - // Clear out the transactions from the data store - log.Warn("Dropping underpriced blob transaction", "from", addr, "rejected", tx.nonce, "tip", tx.execTipCap, "want", tip, "drop", nonces, "ids", ids) - dropUnderpricedMeter.Mark(int64(len(ids))) - - for _, id := range ids { - if err := p.store.Delete(id); err != nil { - log.Error("Failed to delete dropped transaction", "id", id, "err", err) - } - } - break - } - } - } -} - // SetGasTip implements txpool.SubPool, allowing the blob pool's gas requirements // to be kept in sync with the main transaction pool's gas requirements. func (p *BlobPool) SetGasTip(tip *big.Int) { @@ -1073,20 +1023,59 @@ func (p *BlobPool) SetGasTip(tip *big.Int) { // If the min miner fee increased, remove transactions below the new threshold if old == nil || p.gasTip.Cmp(old) > 0 { - p.flushTransactionsBelowTip(p.gasTip) + for addr, txs := range p.index { + for i, tx := range txs { + if tx.execTipCap.Cmp(p.gasTip) < 0 { + // Drop the offending transaction + var ( + ids = []uint64{tx.id} + nonces = []uint64{tx.nonce} + ) + p.spent[addr] = new(uint256.Int).Sub(p.spent[addr], txs[i].costCap) + p.stored -= uint64(tx.size) + delete(p.lookup, tx.hash) + txs[i] = nil + + // Drop everything afterwards, no gaps allowed + for j, tx := range txs[i+1:] { + ids = append(ids, tx.id) + nonces = append(nonces, tx.nonce) + + p.spent[addr] = new(uint256.Int).Sub(p.spent[addr], tx.costCap) + p.stored -= uint64(tx.size) + delete(p.lookup, tx.hash) + txs[i+1+j] = nil + } + // Clear out the dropped transactions from the index + if i > 0 { + p.index[addr] = txs[:i] + heap.Fix(p.evict, p.evict.index[addr]) + } else { + delete(p.index, addr) + delete(p.spent, addr) + + heap.Remove(p.evict, p.evict.index[addr]) + p.reserve(addr, false) + } + // Clear out the transactions from the data store + log.Warn("Dropping underpriced blob transaction", "from", addr, "rejected", tx.nonce, "tip", tx.execTipCap, "want", tip, "drop", nonces, "ids", ids) + dropUnderpricedMeter.Mark(int64(len(ids))) + + for _, id := range ids { + if err := p.store.Delete(id); err != nil { + log.Error("Failed to delete dropped transaction", "id", id, "err", err) + } + } + break + } + } + } } log.Debug("Blobpool tip threshold updated", "tip", tip) pooltipGauge.Update(tip.Int64()) p.updateStorageMetrics() } -func (p *BlobPool) FlushAllTransactions() { - maxUint256 := uint256.MustFromBig(new(big.Int).Sub(new(big.Int).Lsh(common.Big1, 256), common.Big1)) - p.lock.Lock() - defer p.lock.Unlock() - p.flushTransactionsBelowTip(maxUint256) -} - // validateTx checks whether a transaction is valid according to the consensus // rules and adheres to some heuristic limits of the local node (price and size). func (p *BlobPool) validateTx(tx *types.Transaction) error { diff --git a/core/txpool/legacypool/legacypool.go b/core/txpool/legacypool/legacypool.go index 1ac8086522..5506ecc31f 100644 --- a/core/txpool/legacypool/legacypool.go +++ b/core/txpool/legacypool/legacypool.go @@ -429,15 +429,6 @@ func (pool *LegacyPool) SubscribeTransactions(ch chan<- core.NewTxsEvent, reorgs return pool.txFeed.Subscribe(ch) } -func (pool *LegacyPool) flushTransactionsBelowTip(tip *big.Int) { - // pool.priced is sorted by GasFeeCap, so we have to iterate through pool.all instead - drop := pool.all.RemotesBelowTip(tip) - for _, tx := range drop { - pool.removeTx(tx.Hash(), false, true) - } - pool.priced.Removed(len(drop)) -} - // SetGasTip updates the minimum gas tip required by the transaction pool for a // new transaction, and drops all transactions below this threshold. func (pool *LegacyPool) SetGasTip(tip *big.Int) { @@ -451,18 +442,16 @@ func (pool *LegacyPool) SetGasTip(tip *big.Int) { pool.gasTip.Store(newTip) // If the min miner fee increased, remove transactions below the new threshold if newTip.Cmp(old) > 0 { - pool.flushTransactionsBelowTip(tip) + // pool.priced is sorted by GasFeeCap, so we have to iterate through pool.all instead + drop := pool.all.RemotesBelowTip(tip) + for _, tx := range drop { + pool.removeTx(tx.Hash(), false, true) + } + pool.priced.Removed(len(drop)) } log.Info("Legacy pool tip threshold updated", "tip", newTip) } -func (pool *LegacyPool) FlushAllTransactions() { - maxUint256 := new(big.Int).Sub(new(big.Int).Lsh(common.Big1, 256), common.Big1) - pool.mu.Lock() - defer pool.mu.Unlock() - pool.flushTransactionsBelowTip(maxUint256) -} - // Nonce returns the next nonce of an account, with all transactions executable // by the pool already applied on top. func (pool *LegacyPool) Nonce(addr common.Address) uint64 { diff --git a/core/txpool/subpool.go b/core/txpool/subpool.go index e361eabd4e..9881ed1b8f 100644 --- a/core/txpool/subpool.go +++ b/core/txpool/subpool.go @@ -116,9 +116,6 @@ type SubPool interface { // transaction, and drops all transactions below this threshold. SetGasTip(tip *big.Int) - // FlushAllTransactions drops all transactions in the pool. - FlushAllTransactions() - // Has returns an indicator whether subpool has a transaction cached with the // given hash. Has(hash common.Hash) bool diff --git a/core/txpool/txpool.go b/core/txpool/txpool.go index f18eb4c6a0..be7435247d 100644 --- a/core/txpool/txpool.go +++ b/core/txpool/txpool.go @@ -104,13 +104,6 @@ func New(gasTip uint64, chain BlockChain, subpools []SubPool) (*TxPool, error) { return pool, nil } -// FlushAllTransactions removes all transactions from all subpools -func (p *TxPool) FlushAllTransactions() { - for _, subpool := range p.subpools { - subpool.FlushAllTransactions() - } -} - // reserver is a method to create an address reservation callback to exclusively // assign/deassign addresses to/from subpools. This can ensure that at any point // in time, only a single subpool is able to manage an account, avoiding cross diff --git a/eth/catalyst/simulated_beacon.go b/eth/catalyst/simulated_beacon.go index 247d906d05..dbf561ca41 100644 --- a/eth/catalyst/simulated_beacon.go +++ b/eth/catalyst/simulated_beacon.go @@ -21,6 +21,7 @@ import ( "crypto/sha256" "errors" "fmt" + "math/big" "sync" "time" @@ -33,6 +34,7 @@ import ( "github.com/ethereum/go-ethereum/event" "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/node" + "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/rpc" ) @@ -284,7 +286,12 @@ func (c *SimulatedBeacon) Commit() common.Hash { // Rollback un-sends previously added transactions. func (c *SimulatedBeacon) Rollback() { - c.eth.TxPool().FlushAllTransactions() + // Flush all transactions from the transaction pools + maxUint256 := new(big.Int).Sub(new(big.Int).Lsh(common.Big1, 256), common.Big1) + c.eth.TxPool().SetGasTip(maxUint256) + // Set the gas tip back to accept new transactions + // TODO (Marius van der Wijden): set gas tip to parameter passed by config + c.eth.TxPool().SetGasTip(big.NewInt(params.GWei)) } // Fork sets the head to the provided hash. From 269551876e86fb9428501b68a4e79c72d73e1502 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Fri, 27 Sep 2024 14:09:42 +0300 Subject: [PATCH 07/18] params: release Geth v1.14.10 --- params/version.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/params/version.go b/params/version.go index 22eabc08f9..f3414c2182 100644 --- a/params/version.go +++ b/params/version.go @@ -21,10 +21,10 @@ import ( ) const ( - VersionMajor = 1 // Major version component of the current release - VersionMinor = 14 // Minor version component of the current release - VersionPatch = 10 // Patch version component of the current release - VersionMeta = "unstable" // Version metadata to append to the version string + VersionMajor = 1 // Major version component of the current release + VersionMinor = 14 // Minor version component of the current release + VersionPatch = 10 // Patch version component of the current release + VersionMeta = "stable" // Version metadata to append to the version string ) // Version holds the textual version string. From 283be238172c8ae3a05f97e2f3c159f5c2319e07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Fri, 27 Sep 2024 14:13:45 +0300 Subject: [PATCH 08/18] params: begin v1.14.11 release cycle --- params/version.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/params/version.go b/params/version.go index f3414c2182..1fe2d3459d 100644 --- a/params/version.go +++ b/params/version.go @@ -21,10 +21,10 @@ import ( ) const ( - VersionMajor = 1 // Major version component of the current release - VersionMinor = 14 // Minor version component of the current release - VersionPatch = 10 // Patch version component of the current release - VersionMeta = "stable" // Version metadata to append to the version string + VersionMajor = 1 // Major version component of the current release + VersionMinor = 14 // Minor version component of the current release + VersionPatch = 11 // Patch version component of the current release + VersionMeta = "unstable" // Version metadata to append to the version string ) // Version holds the textual version string. From 6b61b54dc7f69cd091dcf3094ce19f26477f55a2 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Mon, 30 Sep 2024 10:56:14 +0200 Subject: [PATCH 09/18] p2p/discover: add config option for disabling FINDNODE liveness check (#30512) This is for fixing Prysm integration tests. --- p2p/discover/common.go | 7 ++++--- p2p/discover/table.go | 6 +++--- p2p/discover/v4_udp.go | 3 ++- p2p/discover/v5_udp.go | 3 ++- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/p2p/discover/common.go b/p2p/discover/common.go index 0716f7472f..cabc5c7962 100644 --- a/p2p/discover/common.go +++ b/p2p/discover/common.go @@ -53,9 +53,10 @@ type Config struct { Unhandled chan<- ReadPacket // unhandled packets are sent on this channel // Node table configuration: - Bootnodes []*enode.Node // list of bootstrap nodes - PingInterval time.Duration // speed of node liveness check - RefreshInterval time.Duration // used in bucket refresh + Bootnodes []*enode.Node // list of bootstrap nodes + PingInterval time.Duration // speed of node liveness check + RefreshInterval time.Duration // used in bucket refresh + NoFindnodeLivenessCheck bool // turns off validation of table nodes in FINDNODE handler // The options below are useful in very specific cases, like in unit tests. V5ProtocolID *[6]byte diff --git a/p2p/discover/table.go b/p2p/discover/table.go index 8045f1389e..cbe2972541 100644 --- a/p2p/discover/table.go +++ b/p2p/discover/table.go @@ -268,9 +268,9 @@ func (tab *Table) findnodeByID(target enode.ID, nresults int, preferLive bool) * return nodes } -// appendLiveNodes adds nodes at the given distance to the result slice. +// appendBucketNodes adds nodes at the given distance to the result slice. // This is used by the FINDNODE/v5 handler. -func (tab *Table) appendLiveNodes(dist uint, result []*enode.Node) []*enode.Node { +func (tab *Table) appendBucketNodes(dist uint, result []*enode.Node, checkLive bool) []*enode.Node { if dist > 256 { return result } @@ -280,7 +280,7 @@ func (tab *Table) appendLiveNodes(dist uint, result []*enode.Node) []*enode.Node tab.mutex.Lock() for _, n := range tab.bucketAtDistance(int(dist)).entries { - if n.isValidatedLive { + if !checkLive || n.isValidatedLive { result = append(result, n.Node) } } diff --git a/p2p/discover/v4_udp.go b/p2p/discover/v4_udp.go index cc2a3fb924..29ae5f2c08 100644 --- a/p2p/discover/v4_udp.go +++ b/p2p/discover/v4_udp.go @@ -746,7 +746,8 @@ func (t *UDPv4) handleFindnode(h *packetHandlerV4, from netip.AddrPort, fromID e // Determine closest nodes. target := enode.ID(crypto.Keccak256Hash(req.Target[:])) - closest := t.tab.findnodeByID(target, bucketSize, true).entries + preferLive := !t.tab.cfg.NoFindnodeLivenessCheck + closest := t.tab.findnodeByID(target, bucketSize, preferLive).entries // Send neighbors in chunks with at most maxNeighbors per packet // to stay below the packet size limit. diff --git a/p2p/discover/v5_udp.go b/p2p/discover/v5_udp.go index 81d94812aa..4453d10695 100644 --- a/p2p/discover/v5_udp.go +++ b/p2p/discover/v5_udp.go @@ -862,7 +862,8 @@ func (t *UDPv5) collectTableNodes(rip netip.Addr, distances []uint, limit int) [ } processed[dist] = struct{}{} - for _, n := range t.tab.appendLiveNodes(dist, bn[:0]) { + checkLive := !t.tab.cfg.NoFindnodeLivenessCheck + for _, n := range t.tab.appendBucketNodes(dist, bn[:0], checkLive) { // Apply some pre-checks to avoid sending invalid nodes. // Note liveness is checked by appendLiveNodes. if netutil.CheckRelayAddr(rip, n.IPAddr()) != nil { From 0a21cb4d21a254cc87c7ecc50462f8c2735a302f Mon Sep 17 00:00:00 2001 From: minh-bq <97180373+minh-bq@users.noreply.github.com> Date: Mon, 30 Sep 2024 16:06:10 +0700 Subject: [PATCH 10/18] core/txpool/blobpool: use types.Sender instead of signer.Sender (#30473) Use types.Sender(signer, tx) to utilize the transaction's sender cache and avoid repeated address recover. --- core/txpool/blobpool/blobpool.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/core/txpool/blobpool/blobpool.go b/core/txpool/blobpool/blobpool.go index 745fc08fec..82df09a4bf 100644 --- a/core/txpool/blobpool/blobpool.go +++ b/core/txpool/blobpool/blobpool.go @@ -478,7 +478,7 @@ func (p *BlobPool) parseTransaction(id uint64, size uint32, blob []byte) error { log.Error("Rejecting duplicate blob pool entry", "id", id, "hash", tx.Hash()) return errors.New("duplicate blob entry") } - sender, err := p.signer.Sender(tx) + sender, err := types.Sender(p.signer, tx) if err != nil { // This path is impossible unless the signature validity changes across // restarts. For that ever improbable case, recover gracefully by ignoring @@ -892,7 +892,7 @@ func (p *BlobPool) reorg(oldHead, newHead *types.Header) (map[common.Address][]* // and accumulate the transactors and transactions for rem.NumberU64() > add.NumberU64() { for _, tx := range rem.Transactions() { - from, _ := p.signer.Sender(tx) + from, _ := types.Sender(p.signer, tx) discarded[from] = append(discarded[from], tx) transactors[from] = struct{}{} @@ -904,7 +904,7 @@ func (p *BlobPool) reorg(oldHead, newHead *types.Header) (map[common.Address][]* } for add.NumberU64() > rem.NumberU64() { for _, tx := range add.Transactions() { - from, _ := p.signer.Sender(tx) + from, _ := types.Sender(p.signer, tx) included[from] = append(included[from], tx) inclusions[tx.Hash()] = add.NumberU64() @@ -917,7 +917,7 @@ func (p *BlobPool) reorg(oldHead, newHead *types.Header) (map[common.Address][]* } for rem.Hash() != add.Hash() { for _, tx := range rem.Transactions() { - from, _ := p.signer.Sender(tx) + from, _ := types.Sender(p.signer, tx) discarded[from] = append(discarded[from], tx) transactors[from] = struct{}{} @@ -927,7 +927,7 @@ func (p *BlobPool) reorg(oldHead, newHead *types.Header) (map[common.Address][]* return nil, nil } for _, tx := range add.Transactions() { - from, _ := p.signer.Sender(tx) + from, _ := types.Sender(p.signer, tx) included[from] = append(included[from], tx) inclusions[tx.Hash()] = add.NumberU64() @@ -1127,7 +1127,7 @@ func (p *BlobPool) validateTx(tx *types.Transaction) error { // If the transaction replaces an existing one, ensure that price bumps are // adhered to. var ( - from, _ = p.signer.Sender(tx) // already validated above + from, _ = types.Sender(p.signer, tx) // already validated above next = p.state.GetNonce(from) ) if uint64(len(p.index[from])) > tx.Nonce()-next { From cfe25c7a3b634efba5a5bd69d697f88c3b1d5b2f Mon Sep 17 00:00:00 2001 From: Martin HS Date: Mon, 30 Sep 2024 14:39:53 +0200 Subject: [PATCH 11/18] build: use buildx to build multi-platform docker images (#30530) --- .travis.yml | 22 +------ Dockerfile | 2 +- Dockerfile.alltools | 9 ++- build/ci.go | 151 +++++++------------------------------------- 4 files changed, 34 insertions(+), 150 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3c639d40f9..31c944641f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,8 +9,7 @@ jobs: - azure-osx include: - # These builders create the Docker sub-images for multi-arch push and each - # will attempt to push the multi-arch image if they are the last builder + # This builder create and push the Docker images for all architectures - stage: build if: type = push os: linux @@ -26,24 +25,7 @@ jobs: before_install: - export DOCKER_CLI_EXPERIMENTAL=enabled script: - - go run build/ci.go docker -image -manifest amd64,arm64 -upload ethereum/client-go - - - stage: build - if: type = push - os: linux - arch: arm64 - dist: focal - go: 1.23.x - env: - - docker - services: - - docker - git: - submodules: false # avoid cloning ethereum/tests - before_install: - - export DOCKER_CLI_EXPERIMENTAL=enabled - script: - - go run build/ci.go docker -image -manifest amd64,arm64 -upload ethereum/client-go + - go run build/ci.go dockerx -platform "linux/amd64,linux/arm64" -upload ethereum/client-go # This builder does the Linux Azure uploads - stage: build diff --git a/Dockerfile b/Dockerfile index 56c31bad26..ff89e92f25 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ ARG VERSION="" ARG BUILDNUM="" # Build Geth in a stock Go builder container -FROM golang:1.23-alpine as builder +FROM golang:1.23-alpine AS builder RUN apk add --no-cache gcc musl-dev linux-headers git diff --git a/Dockerfile.alltools b/Dockerfile.alltools index c7871364ad..44d5065af0 100644 --- a/Dockerfile.alltools +++ b/Dockerfile.alltools @@ -4,7 +4,7 @@ ARG VERSION="" ARG BUILDNUM="" # Build Geth in a stock Go builder container -FROM golang:1.23-alpine as builder +FROM golang:1.23-alpine AS builder RUN apk add --no-cache gcc musl-dev linux-headers git @@ -14,6 +14,13 @@ COPY go.sum /go-ethereum/ RUN cd /go-ethereum && go mod download ADD . /go-ethereum + +# This is not strictly necessary, but it matches the "Dockerfile" steps, thus +# makes it so that under certain circumstances, the docker layer can be cached, +# and the builder can jump to the next (build all) command, with the go cache fully loaded. +# +RUN cd /go-ethereum && go run build/ci.go install -static ./cmd/geth + RUN cd /go-ethereum && go run build/ci.go install -static # Pull all binaries into a second stage deploy alpine container diff --git a/build/ci.go b/build/ci.go index 2932d2c9ce..0d3cdd019d 100644 --- a/build/ci.go +++ b/build/ci.go @@ -50,7 +50,6 @@ import ( "path" "path/filepath" "runtime" - "strconv" "strings" "time" @@ -159,8 +158,8 @@ func main() { doLint(os.Args[2:]) case "archive": doArchive(os.Args[2:]) - case "docker": - doDocker(os.Args[2:]) + case "dockerx": + doDockerBuildx(os.Args[2:]) case "debsrc": doDebianSource(os.Args[2:]) case "nsis": @@ -723,10 +722,9 @@ func maybeSkipArchive(env build.Environment) { } // Builds the docker images and optionally uploads them to Docker Hub. -func doDocker(cmdline []string) { +func doDockerBuildx(cmdline []string) { var ( - image = flag.Bool("image", false, `Whether to build and push an arch specific docker image`) - manifest = flag.String("manifest", "", `Push a multi-arch docker image for the specified architectures (usually "amd64,arm64")`) + platform = flag.String("platform", "", `Push a multi-arch docker image for the specified architectures (usually "linux/amd64,linux/arm64")`) upload = flag.String("upload", "", `Where to upload the docker image (usually "ethereum/client-go")`) ) flag.CommandLine.Parse(cmdline) @@ -761,129 +759,26 @@ func doDocker(cmdline []string) { case strings.HasPrefix(env.Tag, "v1."): tags = []string{"stable", fmt.Sprintf("release-1.%d", params.VersionMinor), "v" + params.Version} } - // If architecture specific image builds are requested, build and push them - if *image { - build.MustRunCommand("docker", "build", "--build-arg", "COMMIT="+env.Commit, "--build-arg", "VERSION="+params.VersionWithMeta, "--build-arg", "BUILDNUM="+env.Buildnum, "--tag", fmt.Sprintf("%s:TAG", *upload), ".") - build.MustRunCommand("docker", "build", "--build-arg", "COMMIT="+env.Commit, "--build-arg", "VERSION="+params.VersionWithMeta, "--build-arg", "BUILDNUM="+env.Buildnum, "--tag", fmt.Sprintf("%s:alltools-TAG", *upload), "-f", "Dockerfile.alltools", ".") + // Need to create a mult-arch builder + build.MustRunCommand("docker", "buildx", "create", "--use", "--name", "multi-arch-builder", "--platform", *platform) - // Tag and upload the images to Docker Hub - for _, tag := range tags { - gethImage := fmt.Sprintf("%s:%s-%s", *upload, tag, runtime.GOARCH) - toolImage := fmt.Sprintf("%s:alltools-%s-%s", *upload, tag, runtime.GOARCH) - - // If the image already exists (non version tag), check the build - // number to prevent overwriting a newer commit if concurrent builds - // are running. This is still a tiny bit racey if two published are - // done at the same time, but that's extremely unlikely even on the - // master branch. - for _, img := range []string{gethImage, toolImage} { - if exec.Command("docker", "pull", img).Run() != nil { - continue // Generally the only failure is a missing image, which is good - } - buildnum, err := exec.Command("docker", "inspect", "--format", "{{index .Config.Labels \"buildnum\"}}", img).CombinedOutput() - if err != nil { - log.Fatalf("Failed to inspect container: %v\nOutput: %s", err, string(buildnum)) - } - buildnum = bytes.TrimSpace(buildnum) - - if len(buildnum) > 0 && len(env.Buildnum) > 0 { - oldnum, err := strconv.Atoi(string(buildnum)) - if err != nil { - log.Fatalf("Failed to parse old image build number: %v", err) - } - newnum, err := strconv.Atoi(env.Buildnum) - if err != nil { - log.Fatalf("Failed to parse current build number: %v", err) - } - if oldnum > newnum { - log.Fatalf("Current build number %d not newer than existing %d", newnum, oldnum) - } else { - log.Printf("Updating %s from build %d to %d", img, oldnum, newnum) - } - } - } - build.MustRunCommand("docker", "image", "tag", fmt.Sprintf("%s:TAG", *upload), gethImage) - build.MustRunCommand("docker", "image", "tag", fmt.Sprintf("%s:alltools-TAG", *upload), toolImage) - build.MustRunCommand("docker", "push", gethImage) - build.MustRunCommand("docker", "push", toolImage) - } - } - // If multi-arch image manifest push is requested, assemble it - if len(*manifest) != 0 { - // Since different architectures are pushed by different builders, wait - // until all required images are updated. - var mismatch bool - for i := 0; i < 2; i++ { // 2 attempts, second is race check - mismatch = false // hope there's no mismatch now - - for _, tag := range tags { - for _, arch := range strings.Split(*manifest, ",") { - gethImage := fmt.Sprintf("%s:%s-%s", *upload, tag, arch) - toolImage := fmt.Sprintf("%s:alltools-%s-%s", *upload, tag, arch) - - for _, img := range []string{gethImage, toolImage} { - if out, err := exec.Command("docker", "pull", img).CombinedOutput(); err != nil { - log.Printf("Required image %s unavailable: %v\nOutput: %s", img, err, out) - mismatch = true - break - } - buildnum, err := exec.Command("docker", "inspect", "--format", "{{index .Config.Labels \"buildnum\"}}", img).CombinedOutput() - if err != nil { - log.Fatalf("Failed to inspect container: %v\nOutput: %s", err, string(buildnum)) - } - buildnum = bytes.TrimSpace(buildnum) - - if string(buildnum) != env.Buildnum { - log.Printf("Build number mismatch on %s: want %s, have %s", img, env.Buildnum, buildnum) - mismatch = true - break - } - } - if mismatch { - break - } - } - if mismatch { - break - } - } - if mismatch { - // Build numbers mismatching, retry in a short time to - // avoid concurrent fails in both publisher images. If - // however the retry failed too, it means the concurrent - // builder is still crunching, let that do the publish. - if i == 0 { - time.Sleep(30 * time.Second) - } - continue - } - break - } - if mismatch { - log.Println("Relinquishing publish to other builder") - return - } - // Assemble and push the Geth manifest image - for _, tag := range tags { - gethImage := fmt.Sprintf("%s:%s", *upload, tag) - - var gethSubImages []string - for _, arch := range strings.Split(*manifest, ",") { - gethSubImages = append(gethSubImages, gethImage+"-"+arch) - } - build.MustRunCommand("docker", append([]string{"manifest", "create", gethImage}, gethSubImages...)...) - build.MustRunCommand("docker", "manifest", "push", gethImage) - } - // Assemble and push the alltools manifest image - for _, tag := range tags { - toolImage := fmt.Sprintf("%s:alltools-%s", *upload, tag) - - var toolSubImages []string - for _, arch := range strings.Split(*manifest, ",") { - toolSubImages = append(toolSubImages, toolImage+"-"+arch) - } - build.MustRunCommand("docker", append([]string{"manifest", "create", toolImage}, toolSubImages...)...) - build.MustRunCommand("docker", "manifest", "push", toolImage) + for _, spec := range []struct { + file string + base string + }{ + {file: "Dockerfile", base: fmt.Sprintf("%s:", *upload)}, + {file: "Dockerfile.alltools", base: fmt.Sprintf("%s:alltools-", *upload)}, + } { + for _, tag := range tags { // latest, stable etc + gethImage := fmt.Sprintf("%s%s", spec.base, tag) + build.MustRunCommand("docker", "buildx", "build", + "--build-arg", "COMMIT="+env.Commit, + "--build-arg", "VERSION="+params.VersionWithMeta, + "--build-arg", "BUILDNUM="+env.Buildnum, + "--tag", gethImage, + "--platform", *platform, + "--push", + "--file", spec.file, ".") } } } From e67d5f8c441d5c85cfa69317db8d85794645af14 Mon Sep 17 00:00:00 2001 From: Martin HS Date: Mon, 30 Sep 2024 14:46:39 +0200 Subject: [PATCH 12/18] eth/catalyst: use setcanonical instead of sethead in simulated fork (#30465) Fixes https://github.com/ethereum/go-ethereum/issues/30448 --- eth/catalyst/simulated_beacon.go | 3 ++- ethclient/simulated/backend_test.go | 10 +++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/eth/catalyst/simulated_beacon.go b/eth/catalyst/simulated_beacon.go index dbf561ca41..1f3d4f635c 100644 --- a/eth/catalyst/simulated_beacon.go +++ b/eth/catalyst/simulated_beacon.go @@ -306,7 +306,8 @@ func (c *SimulatedBeacon) Fork(parentHash common.Hash) error { if parent == nil { return errors.New("parent not found") } - return c.eth.BlockChain().SetHead(parent.NumberU64()) + _, err := c.eth.BlockChain().SetCanonical(parent) + return err } // AdjustTime creates a new block with an adjusted timestamp. diff --git a/ethclient/simulated/backend_test.go b/ethclient/simulated/backend_test.go index 308f5c44c9..37f4dbbf7b 100644 --- a/ethclient/simulated/backend_test.go +++ b/ethclient/simulated/backend_test.go @@ -194,8 +194,8 @@ func TestFork(t *testing.T) { // 2. Send a transaction. // 3. Check that the TX is included in block 1. // 4. Fork by using the parent block as ancestor. -// 5. Mine a block, Re-send the transaction and mine another one. -// 6. Check that the TX is now included in block 2. +// 5. Mine a block. We expect the out-forked tx to have trickled to the pool, and into the new block. +// 6. Check that the TX is now included in (the new) block 1. func TestForkResendTx(t *testing.T) { t.Parallel() testAddr := crypto.PubkeyToAddress(testKey.PublicKey) @@ -231,12 +231,8 @@ func TestForkResendTx(t *testing.T) { // 5. sim.Commit() - if err := client.SendTransaction(ctx, tx); err != nil { - t.Fatalf("sending transaction: %v", err) - } - sim.Commit() receipt, _ = client.TransactionReceipt(ctx, tx.Hash()) - if h := receipt.BlockNumber.Uint64(); h != 2 { + if h := receipt.BlockNumber.Uint64(); h != 1 { t.Errorf("TX included in wrong block: %d", h) } } From db6ae7fa1249b29ad44fd52db751fef572ae43ae Mon Sep 17 00:00:00 2001 From: Ng Wei Han <47109095+weiihann@users.noreply.github.com> Date: Tue, 1 Oct 2024 00:32:39 +0800 Subject: [PATCH 13/18] cmd/geth: remove deprecated lightchaindata db (#30527) This PR removes the dependencies on `lightchaindata` db as the light protocol has been deprecated and removed from the codebase. --- cmd/geth/chaincmd.go | 64 ++++++++++++++++++++------------------------ cmd/utils/flags.go | 2 -- 2 files changed, 29 insertions(+), 37 deletions(-) diff --git a/cmd/geth/chaincmd.go b/cmd/geth/chaincmd.go index 018bca4a0f..d85e4a83c8 100644 --- a/cmd/geth/chaincmd.go +++ b/cmd/geth/chaincmd.go @@ -221,22 +221,23 @@ func initGenesis(ctx *cli.Context) error { v := ctx.Uint64(utils.OverrideVerkle.Name) overrides.OverrideVerkle = &v } - for _, name := range []string{"chaindata", "lightchaindata"} { - chaindb, err := stack.OpenDatabaseWithFreezer(name, 0, 0, ctx.String(utils.AncientFlag.Name), "", false) - if err != nil { - utils.Fatalf("Failed to open database: %v", err) - } - defer chaindb.Close() - triedb := utils.MakeTrieDatabase(ctx, chaindb, ctx.Bool(utils.CachePreimagesFlag.Name), false, genesis.IsVerkle()) - defer triedb.Close() - - _, hash, err := core.SetupGenesisBlockWithOverride(chaindb, triedb, genesis, &overrides) - if err != nil { - utils.Fatalf("Failed to write genesis block: %v", err) - } - log.Info("Successfully wrote genesis state", "database", name, "hash", hash) + chaindb, err := stack.OpenDatabaseWithFreezer("chaindata", 0, 0, ctx.String(utils.AncientFlag.Name), "", false) + if err != nil { + utils.Fatalf("Failed to open database: %v", err) } + defer chaindb.Close() + + triedb := utils.MakeTrieDatabase(ctx, chaindb, ctx.Bool(utils.CachePreimagesFlag.Name), false, genesis.IsVerkle()) + defer triedb.Close() + + _, hash, err := core.SetupGenesisBlockWithOverride(chaindb, triedb, genesis, &overrides) + if err != nil { + utils.Fatalf("Failed to write genesis block: %v", err) + } + + log.Info("Successfully wrote genesis state", "database", "chaindata", "hash", hash) + return nil } @@ -258,29 +259,22 @@ func dumpGenesis(ctx *cli.Context) error { // dump whatever already exists in the datadir stack, _ := makeConfigNode(ctx) - for _, name := range []string{"chaindata", "lightchaindata"} { - db, err := stack.OpenDatabase(name, 0, 0, "", true) - if err != nil { - if !os.IsNotExist(err) { - return err - } - continue - } - genesis, err := core.ReadGenesis(db) - if err != nil { - utils.Fatalf("failed to read genesis: %s", err) - } - db.Close() - if err := json.NewEncoder(os.Stdout).Encode(*genesis); err != nil { - utils.Fatalf("could not encode stored genesis: %s", err) - } - return nil + db, err := stack.OpenDatabase("chaindata", 0, 0, "", true) + if err != nil { + return err } - if ctx.IsSet(utils.DataDirFlag.Name) { - utils.Fatalf("no existing datadir at %s", stack.Config().DataDir) + defer db.Close() + + genesis, err = core.ReadGenesis(db) + if err != nil { + utils.Fatalf("failed to read genesis: %s", err) } - utils.Fatalf("no network preset provided, and no genesis exists in the default datadir") + + if err := json.NewEncoder(os.Stdout).Encode(*genesis); err != nil { + utils.Fatalf("could not encode stored genesis: %s", err) + } + return nil } @@ -557,7 +551,7 @@ func parseDumpConfig(ctx *cli.Context, db ethdb.Database) (*state.DumpConfig, co default: return nil, common.Hash{}, fmt.Errorf("invalid start argument: %x. 20 or 32 hex-encoded bytes required", startArg) } - var conf = &state.DumpConfig{ + conf := &state.DumpConfig{ SkipCode: ctx.Bool(utils.ExcludeCodeFlag.Name), SkipStorage: ctx.Bool(utils.ExcludeStorageFlag.Name), OnlyWithAddresses: !ctx.Bool(utils.IncludeIncompletesFlag.Name), diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index da2814855a..a8f7a812bb 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -2061,8 +2061,6 @@ func MakeChainDatabase(ctx *cli.Context, stack *node.Node, readonly bool) ethdb. break } chainDb = remotedb.New(client) - case ctx.String(SyncModeFlag.Name) == "light": - chainDb, err = stack.OpenDatabase("lightchaindata", cache, handles, "", readonly) default: chainDb, err = stack.OpenDatabaseWithFreezer("chaindata", cache, handles, ctx.String(AncientFlag.Name), "", readonly) } From 40fd887df6812033f96941181549693d2cd5444d Mon Sep 17 00:00:00 2001 From: Sina M <1591639+s1na@users.noreply.github.com> Date: Tue, 1 Oct 2024 11:36:56 +0200 Subject: [PATCH 14/18] internal/ethapi: remove td field from block (#30386) implement https://github.com/ethereum/execution-apis/pull/570 --- cmd/utils/flags.go | 4 +-- .../testdata/call_tracer/blob_tx.json | 1 - .../testdata/call_tracer/create.json | 3 +- .../testdata/call_tracer/deep_calls.json | 3 +- .../testdata/call_tracer/delegatecall.json | 3 +- .../inner_create_oog_outer_throw.json | 3 +- .../testdata/call_tracer/inner_instafail.json | 1 - .../call_tracer/inner_revert_reason.json | 1 - .../call_tracer/inner_throw_outer_revert.json | 3 +- .../tracetest/testdata/call_tracer/oog.json | 3 +- .../testdata/call_tracer/revert.json | 3 +- .../testdata/call_tracer/revert_reason.json | 3 +- .../testdata/call_tracer/selfdestruct.json | 3 +- .../testdata/call_tracer/simple.json | 3 +- .../testdata/call_tracer/simple_onlytop.json | 3 +- .../tracetest/testdata/call_tracer/throw.json | 3 +- .../testdata/call_tracer_flat/big_slow.json | 1 - .../callcode_precompiled_fail_hide.json | 1 - .../callcode_precompiled_oog.json | 1 - .../callcode_precompiled_throw.json | 1 - .../testdata/call_tracer_flat/create.json | 3 +- .../testdata/call_tracer_flat/deep_calls.json | 3 +- .../call_tracer_flat/delegatecall.json | 3 +- .../delegatecall_parent_value.json | 1 - .../testdata/call_tracer_flat/gas.json | 1 - .../call_tracer_flat/include_precompiled.json | 1 - .../inner_create_oog_outer_throw.json | 3 +- .../call_tracer_flat/inner_instafail.json | 1 - .../inner_precompiled_wrong_gas.json | 1 - .../inner_throw_outer_revert.json | 3 +- .../call_tracer_flat/nested_create.json | 1 - .../nested_create2_action_gas.json | 1 - .../nested_create_action_gas.json | 1 - .../nested_create_inerror.json | 1 - .../nested_pointer_issue.json | 1 - .../testdata/call_tracer_flat/oog.json | 3 +- .../option_convert_parity_errors.json | 3 +- .../call_tracer_flat/result_output.json | 1 - .../testdata/call_tracer_flat/revert.json | 3 +- .../call_tracer_flat/revert_reason.json | 3 +- .../call_tracer_flat/selfdestruct.json | 1 - .../testdata/call_tracer_flat/simple.json | 3 +- .../call_tracer_flat/simple_onlytop.json | 3 +- .../skip_no_balance_error.json | 1 - .../staticcall_precompiled.json | 1 - .../testdata/call_tracer_flat/suicide.json | 1 - .../testdata/call_tracer_flat/throw.json | 3 +- .../testdata/call_tracer_legacy/create.json | 3 +- .../call_tracer_legacy/deep_calls.json | 3 +- .../call_tracer_legacy/delegatecall.json | 3 +- .../inner_create_oog_outer_throw.json | 3 +- .../call_tracer_legacy/inner_instafail.json | 1 - .../inner_throw_outer_revert.json | 3 +- .../testdata/call_tracer_legacy/oog.json | 3 +- .../testdata/call_tracer_legacy/revert.json | 3 +- .../call_tracer_legacy/revert_reason.json | 3 +- .../call_tracer_legacy/selfdestruct.json | 3 +- .../testdata/call_tracer_legacy/simple.json | 3 +- .../testdata/call_tracer_legacy/throw.json | 3 +- .../call_tracer_withLog/calldata.json | 1 - .../call_tracer_withLog/delegatecall.json | 1 - .../frontier_create_outofstorage.json | 1 - .../call_tracer_withLog/multi_contracts.json | 1 - .../call_tracer_withLog/multilogs.json | 1 - .../testdata/call_tracer_withLog/notopic.json | 1 - .../testdata/call_tracer_withLog/simple.json | 1 - .../call_tracer_withLog/tx_failed.json | 1 - .../tx_partial_failed.json | 1 - .../call_tracer_withLog/with_onlyTopCall.json | 1 - .../testdata/prestate_tracer/blob_tx.json | 1 - .../prestate_tracer/create_create.json | 1 - .../create_existing_contract.json | 1 - .../prestate_tracer/create_post_eip158.json | 1 - .../testdata/prestate_tracer/simple.json | 3 +- .../prestate_tracer_legacy/simple.json | 3 +- .../create.json | 1 - .../create_post_eip158.json | 1 - .../create_suicide.json | 1 - .../inner_create.json | 1 - .../simple.json | 3 +- .../suicide.json | 1 - graphql/graphql.go | 12 ------- graphql/graphql_test.go | 4 +-- graphql/schema.go | 3 -- internal/ethapi/api.go | 34 +++++-------------- internal/ethapi/backend.go | 1 - internal/ethapi/simulate.go | 3 -- .../testdata/eth_getBlockByHash-hash-1.json | 1 - .../eth_getBlockByHash-hash-genesis.json | 1 - ...h_getBlockByHash-hash-latest-1-fullTx.json | 1 - .../eth_getBlockByHash-hash-latest.json | 1 - .../eth_getBlockByNumber-number-0.json | 1 - .../eth_getBlockByNumber-number-1.json | 1 - .../eth_getBlockByNumber-number-latest-1.json | 1 - .../eth_getBlockByNumber-tag-latest.json | 1 - ...h_getBlockByNumber-tag-pending-fullTx.json | 1 - .../eth_getBlockByNumber-tag-pending.json | 1 - .../testdata/eth_getHeaderByHash-hash-0.json | 1 - .../testdata/eth_getHeaderByHash-hash-1.json | 1 - .../eth_getHeaderByHash-hash-latest-1.json | 1 - .../eth_getHeaderByHash-hash-latest.json | 1 - .../eth_getHeaderByNumber-number-0.json | 1 - .../eth_getHeaderByNumber-number-1.json | 1 - ...eth_getHeaderByNumber-number-latest-1.json | 1 - .../eth_getHeaderByNumber-tag-latest.json | 1 - .../eth_getHeaderByNumber-tag-pending.json | 1 - internal/jsre/deps/web3.js | 1 - 107 files changed, 50 insertions(+), 187 deletions(-) diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index a8f7a812bb..6db88ff661 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -1925,7 +1925,7 @@ func SetDNSDiscoveryDefaults(cfg *ethconfig.Config, genesis common.Hash) { // RegisterEthService adds an Ethereum client to the stack. // The second return value is the full node instance. -func RegisterEthService(stack *node.Node, cfg *ethconfig.Config) (ethapi.Backend, *eth.Ethereum) { +func RegisterEthService(stack *node.Node, cfg *ethconfig.Config) (*eth.EthAPIBackend, *eth.Ethereum) { backend, err := eth.New(stack, cfg) if err != nil { Fatalf("Failed to register the Ethereum service: %v", err) @@ -1935,7 +1935,7 @@ func RegisterEthService(stack *node.Node, cfg *ethconfig.Config) (ethapi.Backend } // RegisterEthStatsService configures the Ethereum Stats daemon and adds it to the node. -func RegisterEthStatsService(stack *node.Node, backend ethapi.Backend, url string) { +func RegisterEthStatsService(stack *node.Node, backend *eth.EthAPIBackend, url string) { if err := ethstats.New(stack, backend, backend.Engine(), url); err != nil { Fatalf("Failed to register the Ethereum Stats service: %v", err) } diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer/blob_tx.json b/eth/tracers/internal/tracetest/testdata/call_tracer/blob_tx.json index 549acb1fe6..b974151c1b 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer/blob_tx.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer/blob_tx.json @@ -14,7 +14,6 @@ "parentBeaconBlockRoot": "0x0000000000000000000000000000000000000000000000000000000000000000", "stateRoot": "0x577f42ab21ccfd946511c57869ace0bdf7c217c36f02b7cd3459df0ed1cffc1a", "timestamp": "1709626771", - "totalDifficulty": "1", "withdrawals": [], "withdrawalsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "alloc": { diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer/create.json b/eth/tracers/internal/tracetest/testdata/call_tracer/create.json index df0b2872b4..621a6a97a4 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer/create.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer/create.json @@ -41,8 +41,7 @@ "nonce": "0x93363bbd2c95f410", "number": "2294701", "stateRoot": "0x6b6737d5bde8058990483e915866bd1578014baeff57bd5e4ed228a2bfad635c", - "timestamp": "1513676127", - "totalDifficulty": "7160808139332585" + "timestamp": "1513676127" }, "input": "0xf907ef098504e3b29200830897be8080b9079c606060405260405160208061077c83398101604052808051906020019091905050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415151561007d57600080fd5b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001600460006101000a81548160ff02191690831515021790555050610653806101296000396000f300606060405260043610610083576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305e4382a146100855780631c02708d146100ae5780632e1a7d4d146100c35780635114cb52146100e6578063a37dda2c146100fe578063ae200e7914610153578063b5769f70146101a8575b005b341561009057600080fd5b6100986101d1565b6040518082815260200191505060405180910390f35b34156100b957600080fd5b6100c16101d7565b005b34156100ce57600080fd5b6100e460048080359060200190919050506102eb565b005b6100fc6004808035906020019091905050610513565b005b341561010957600080fd5b6101116105d6565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561015e57600080fd5b6101666105fc565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156101b357600080fd5b6101bb610621565b6040518082815260200191505060405180910390f35b60025481565b60011515600460009054906101000a900460ff1615151415156101f957600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806102a15750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b15156102ac57600080fd5b6000600460006101000a81548160ff0219169083151502179055506003543073ffffffffffffffffffffffffffffffffffffffff163103600281905550565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806103935750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b151561039e57600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561048357600060025411801561040757506002548111155b151561041257600080fd5b80600254036002819055506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050151561047e57600080fd5b610510565b600060035411801561049757506003548111155b15156104a257600080fd5b8060035403600381905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050151561050f57600080fd5b5b50565b60011515600460009054906101000a900460ff16151514151561053557600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614801561059657506003548160035401115b80156105bd575080600354013073ffffffffffffffffffffffffffffffffffffffff163110155b15156105c857600080fd5b806003540160038190555050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600354815600a165627a7a72305820c3b849e8440987ce43eae3097b77672a69234d516351368b03fe5b7de03807910029000000000000000000000000c65e620a3a55451316168d57e268f5702ef56a1129a01060f46676a5dff6f407f0f51eb6f37f5c8c54e238c70221e18e65fc29d3ea65a0557b01c50ff4ffaac8ed6e5d31237a4ecbac843ab1bfe8bb0165a0060df7c54f", "result": { diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer/deep_calls.json b/eth/tracers/internal/tracetest/testdata/call_tracer/deep_calls.json index 975616064a..0b38caec2c 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer/deep_calls.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer/deep_calls.json @@ -104,8 +104,7 @@ "nonce": "0x38dee147326a8d40", "number": "25000", "stateRoot": "0xc5d6bbcd46236fcdcc80b332ffaaa5476b980b01608f9708408cfef01b58bd5b", - "timestamp": "1479891517", - "totalDifficulty": "1895410389427" + "timestamp": "1479891517" }, "input": "0xf88b8206628504a817c8008303d09094c212e03b9e060e36facad5fd8f4435412ca22e6b80a451a34eb80000000000000000000000000000000000000000000000280faf689c35ac00002aa0a7ee5b7877811bf671d121b40569462e722657044808dc1d6c4f1e4233ec145ba0417e7543d52b65738d9df419cbe40a708424f4d54b0fc145c0a64545a2bb1065", "result": { diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer/delegatecall.json b/eth/tracers/internal/tracetest/testdata/call_tracer/delegatecall.json index 6a2cda7dc9..4dd96e2f79 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer/delegatecall.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer/delegatecall.json @@ -57,8 +57,7 @@ "nonce": "0x684129f283aaef18", "number": "11494", "stateRoot": "0x7057f31fe3dab1d620771adad35224aae43eb70e94861208bc84c557ff5b9d10", - "timestamp": "1479735912", - "totalDifficulty": "90744064339" + "timestamp": "1479735912" }, "input": "0xf889448504a817c800832dc6c094269296dddce321a6bcbaa2f0181127593d732cba80a47065cb480000000000000000000000001523e55a1ca4efbae03355775ae89f8d7699ad9e29a080ed81e4c5e9971a730efab4885566e2c868cd80bd4166d0ed8c287fdf181650a069d7c49215e3d4416ad239cd09dbb71b9f04c16b33b385d14f40b618a7a65115", "result": { diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer/inner_create_oog_outer_throw.json b/eth/tracers/internal/tracetest/testdata/call_tracer/inner_create_oog_outer_throw.json index bb16a4a430..8b3b1e3d93 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer/inner_create_oog_outer_throw.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer/inner_create_oog_outer_throw.json @@ -49,8 +49,7 @@ "nonce": "0x28c446f1cb9748c1", "number": "2290743", "stateRoot": "0x4898aceede76739daef76448a367d10015a2c022c9e7909b99a10fbf6fb16708", - "timestamp": "1513616414", - "totalDifficulty": "7146523769022564" + "timestamp": "1513616414" }, "input": "0xf8aa0e8509502f9000830493e0941d3ddf7caf024f253487e18bc4a15b1a360c170a80b8443b91f506000000000000000000000000a14bdd7e5666d784dcce98ad24d383a6b1cd4182000000000000000000000000e4a13bc304682a903e9472f469c33801dd18d9e829a0524564944fa419f5c189b5074044f89210c6d6b2d77ee8f7f12a927d59b636dfa0015b28986807a424b18b186ee6642d76739df36cad802d20e8c00e79a61d7281", "result": { diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer/inner_instafail.json b/eth/tracers/internal/tracetest/testdata/call_tracer/inner_instafail.json index ed3688a942..e69df9d1f9 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer/inner_instafail.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer/inner_instafail.json @@ -10,7 +10,6 @@ "number": "24973", "stateRoot": "0x532a5c3f75453a696428db078e32ae283c85cb97e4d8560dbdf022adac6df369", "timestamp": "1479891145", - "totalDifficulty": "1892250259406", "alloc": { "0x6c06b16512b332e6cd8293a2974872674716ce18": { "balance": "0x0", diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer/inner_revert_reason.json b/eth/tracers/internal/tracetest/testdata/call_tracer/inner_revert_reason.json index 0108c93ae0..09ff53d104 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer/inner_revert_reason.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer/inner_revert_reason.json @@ -11,7 +11,6 @@ "number": "0", "stateRoot": "0xa775801d572e9b79585eb131d18d79f8a0f71895455ab9a5b656911428e11708", "timestamp": "0", - "totalDifficulty": "1", "alloc": { "0x3623191d4ccfbbdf09e8ebf6382a1f8257417bc1": { "balance": "0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7" diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer/inner_throw_outer_revert.json b/eth/tracers/internal/tracetest/testdata/call_tracer/inner_throw_outer_revert.json index a023ed6d9b..17442f15b9 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer/inner_throw_outer_revert.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer/inner_throw_outer_revert.json @@ -52,8 +52,7 @@ "nonce": "0x810f923ff4b450a1", "number": "2295103", "stateRoot": "0xff403612573d76dfdaf4fea2429b77dbe9764021ae0e38dc8ac79a3cf551179e", - "timestamp": "1513681246", - "totalDifficulty": "7162347056825919" + "timestamp": "1513681246" }, "input": "0xf86d808504e3b292008307dfa69433056b5dcac09a9b4becad0e1dcf92c19bd0af76880e92596fd62900008029a0e5f27bb66431f7081bb7f1f242003056d7f3f35414c352cd3d1848b52716dac2a07d0be78980edb0bd2a0678fc53aa90ea9558ce346b0d947967216918ac74ccea", "result": { diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer/oog.json b/eth/tracers/internal/tracetest/testdata/call_tracer/oog.json index 333bdd038c..e28958a69e 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer/oog.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer/oog.json @@ -43,8 +43,7 @@ "nonce": "0xd1bdb150f6fd170e", "number": "2294630", "stateRoot": "0x1ab1a534e84cc787cda1db21e0d5920ab06017948075b759166cfea7274657a1", - "timestamp": "1513675347", - "totalDifficulty": "7160543502214733" + "timestamp": "1513675347" }, "input": "0xf8ab820109855d21dba00082ca1d9443064693d3d38ad6a7cb579e0d6d9718c8aa6b6280b844a9059cbb000000000000000000000000e77b1ac803616503510bed0086e3a7be2627a69900000000000000000000000000000000000000000000000000000009502f90001ba0ce3ad83f5530136467b7c2bb225f406bd170f4ad59c254e5103c34eeabb5bd69a0455154527224a42ab405cacf0fe92918a75641ce4152f8db292019a5527aa956", "result": { diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer/revert.json b/eth/tracers/internal/tracetest/testdata/call_tracer/revert.json index 3207a298a9..f69bb72e0a 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer/revert.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer/revert.json @@ -41,8 +41,7 @@ "nonce": "0xbc5d43adc2c30c7d", "number": "2294500", "stateRoot": "0xca645b335888352ef9d8b1ef083e9019648180b259026572e3139717270de97d", - "timestamp": "1513673552", - "totalDifficulty": "7160066586979149" + "timestamp": "1513673552" }, "input": "0xf9018b0a8505d21dba00832dc6c094abbcd5b340c80b5f1c0545c04c987b87310296ae80b9012473b40a5c000000000000000000000000400de2e016bda6577407dfc379faba9899bc73ef0000000000000000000000002cc31912b2b0f3075a87b3640923d45a26cef3ee000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000064d79d8e6c7265636f76657279416464726573730000000000000000000000000000000000000000000000000000000000383e3ec32dc0f66d8fe60dbdc2f6815bdf73a988383e3ec32dc0f66d8fe60dbdc2f6815bdf73a988000000000000000000000000000000000000000000000000000000000000000000000000000000001ba0fd659d76a4edbd2a823e324c93f78ad6803b30ff4a9c8bce71ba82798975c70ca06571eecc0b765688ec6c78942c5ee8b585e00988c0141b518287e9be919bc48a", "result": { diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer/revert_reason.json b/eth/tracers/internal/tracetest/testdata/call_tracer/revert_reason.json index f02e5c6863..add992f5aa 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer/revert_reason.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer/revert_reason.json @@ -46,8 +46,7 @@ "nonce": "0x4eb12e19c16d43da", "number": "2289805", "stateRoot": "0xc7f10f352bff82fac3c2999d3085093d12652e19c7fd32591de49dc5d91b4f1f", - "timestamp": "1513601261", - "totalDifficulty": "7143276353481064" + "timestamp": "1513601261" }, "input": "0xf888068449504f80832dc6c094f58833cf0c791881b494eb79d461e08a1f043f5280a45c19a95c000000000000000000000000f7579c3d8a669c89d5ed246a22eb6db8f6fedbf12da0264664db3e71fae1dbdaf2f53954be149ad3b7ba8a5054b4d89c70febfacc8b1a0212e8398757963f419681839ae8c5a54b411e252473c82d93dda68405ca63294", "result": { diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer/selfdestruct.json b/eth/tracers/internal/tracetest/testdata/call_tracer/selfdestruct.json index 620df1d614..73960ea607 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer/selfdestruct.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer/selfdestruct.json @@ -47,8 +47,7 @@ "nonce": "0x4eb12e19c16d43da", "number": "2289805", "stateRoot": "0xc7f10f352bff82fac3c2999d3085093d12652e19c7fd32591de49dc5d91b4f1f", - "timestamp": "1513601261", - "totalDifficulty": "7143276353481064" + "timestamp": "1513601261" }, "input": "0xf88b8271908506fc23ac0083015f90943b873a919aa0512d5a0f09e6dcceaa4a6727fafe80a463e4bff40000000000000000000000000024f658a46fbb89d8ac105e98d7ac7cbbaf27c52aa0bdce0b59e8761854e857fe64015f06dd08a4fbb7624f6094893a79a72e6ad6bea01d9dde033cff7bb235a3163f348a6d7ab8d6b52bc0963a95b91612e40ca766a4", "result": { diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer/simple.json b/eth/tracers/internal/tracetest/testdata/call_tracer/simple.json index 6c7d01de1f..b923b903bf 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer/simple.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer/simple.json @@ -52,8 +52,7 @@ "nonce": "0x4eb12e19c16d43da", "number": "2289805", "stateRoot": "0xc7f10f352bff82fac3c2999d3085093d12652e19c7fd32591de49dc5d91b4f1f", - "timestamp": "1513601261", - "totalDifficulty": "7143276353481064" + "timestamp": "1513601261" }, "input": "0xf88b8271908506fc23ac0083015f90943b873a919aa0512d5a0f09e6dcceaa4a6727fafe80a463e4bff40000000000000000000000000024f658a46fbb89d8ac105e98d7ac7cbbaf27c52aa0bdce0b59e8761854e857fe64015f06dd08a4fbb7624f6094893a79a72e6ad6bea01d9dde033cff7bb235a3163f348a6d7ab8d6b52bc0963a95b91612e40ca766a4", "result": { diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer/simple_onlytop.json b/eth/tracers/internal/tracetest/testdata/call_tracer/simple_onlytop.json index affb4ab033..d1aa2a58b4 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer/simple_onlytop.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer/simple_onlytop.json @@ -52,8 +52,7 @@ "nonce": "0x4eb12e19c16d43da", "number": "2289805", "stateRoot": "0xc7f10f352bff82fac3c2999d3085093d12652e19c7fd32591de49dc5d91b4f1f", - "timestamp": "1513601261", - "totalDifficulty": "7143276353481064" + "timestamp": "1513601261" }, "input": "0xf88b8271908506fc23ac0083015f90943b873a919aa0512d5a0f09e6dcceaa4a6727fafe80a463e4bff40000000000000000000000000024f658a46fbb89d8ac105e98d7ac7cbbaf27c52aa0bdce0b59e8761854e857fe64015f06dd08a4fbb7624f6094893a79a72e6ad6bea01d9dde033cff7bb235a3163f348a6d7ab8d6b52bc0963a95b91612e40ca766a4", "tracerConfig": { diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer/throw.json b/eth/tracers/internal/tracetest/testdata/call_tracer/throw.json index 499b449a6e..d439d2b284 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer/throw.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer/throw.json @@ -45,8 +45,7 @@ "nonce": "0x70849d5838dee2e9", "number": "25008", "stateRoot": "0x1e01d2161794768c5b917069e73d86e8dca80cd7f3168c0597de420ab93a3b7b", - "timestamp": "1479891641", - "totalDifficulty": "1896347038589" + "timestamp": "1479891641" }, "input": "0xf88b8206668504a817c8008303d09094c212e03b9e060e36facad5fd8f4435412ca22e6b80a451a34eb8000000000000000000000000000000000000000000000027fad02094277c000029a0692a3b4e7b2842f8dd7832e712c21e09f451f416c8976d5b8d02e8c0c2b4bea9a07645e90fc421b63dd755767fd93d3c03b4ec0c4d8fafa059558d08cf11d59750", "result": { diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/big_slow.json b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/big_slow.json index 617f52a14e..26495dfbce 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/big_slow.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/big_slow.json @@ -10,7 +10,6 @@ "number": "1719576", "stateRoot": "0xab5eec2177a92d633e282936af66c46e24cfa8f2fdc2b8155f33885f483d06f3", "timestamp": "1466150166", - "totalDifficulty": "28295412423546970038", "alloc": { "0xf8bda96b67036ee48107f2a0695ea673479dda56": { "balance": "0x1529e844f9ecdeec", diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/callcode_precompiled_fail_hide.json b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/callcode_precompiled_fail_hide.json index a2386ea9c7..72a4db6901 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/callcode_precompiled_fail_hide.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/callcode_precompiled_fail_hide.json @@ -10,7 +10,6 @@ "number": "1555278", "stateRoot": "0x5f56d8323ee384b0c8d1de49d63e150e17283eea813483698362bc0ec9e0242a", "timestamp": "1590795319", - "totalDifficulty": "2242614315030", "alloc": { "0x0000000000000000000000000000000000000004": { "balance": "0x0", diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/callcode_precompiled_oog.json b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/callcode_precompiled_oog.json index fb29e49660..0c4d29dd5b 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/callcode_precompiled_oog.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/callcode_precompiled_oog.json @@ -10,7 +10,6 @@ "number": "1555277", "stateRoot": "0x6290d79215a2eebc25d5e456b35876c6d78ffc1ea47bdd70e375ebb3cf325620", "timestamp": "1590795308", - "totalDifficulty": "2242609643446", "alloc": { "0x0000000000000000000000000000000000000001": { "balance": "0x0", diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/callcode_precompiled_throw.json b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/callcode_precompiled_throw.json index 5e27261554..5538a708ea 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/callcode_precompiled_throw.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/callcode_precompiled_throw.json @@ -10,7 +10,6 @@ "number": "1555274", "stateRoot": "0x795751f3f96a5de1fd3944ddd78cbfe4ef10491e1086be47609869a30929d0e5", "timestamp": "1590795228", - "totalDifficulty": "2242595605834", "alloc": { "0x0000000000000000000000000000000000000009": { "balance": "0x0", diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/create.json b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/create.json index 11bc4eae02..83d20fb078 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/create.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/create.json @@ -41,8 +41,7 @@ "nonce": "0x93363bbd2c95f410", "number": "2294701", "stateRoot": "0x6b6737d5bde8058990483e915866bd1578014baeff57bd5e4ed228a2bfad635c", - "timestamp": "1513676127", - "totalDifficulty": "7160808139332585" + "timestamp": "1513676127" }, "input": "0xf907ef098504e3b29200830897be8080b9079c606060405260405160208061077c83398101604052808051906020019091905050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415151561007d57600080fd5b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001600460006101000a81548160ff02191690831515021790555050610653806101296000396000f300606060405260043610610083576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305e4382a146100855780631c02708d146100ae5780632e1a7d4d146100c35780635114cb52146100e6578063a37dda2c146100fe578063ae200e7914610153578063b5769f70146101a8575b005b341561009057600080fd5b6100986101d1565b6040518082815260200191505060405180910390f35b34156100b957600080fd5b6100c16101d7565b005b34156100ce57600080fd5b6100e460048080359060200190919050506102eb565b005b6100fc6004808035906020019091905050610513565b005b341561010957600080fd5b6101116105d6565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561015e57600080fd5b6101666105fc565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156101b357600080fd5b6101bb610621565b6040518082815260200191505060405180910390f35b60025481565b60011515600460009054906101000a900460ff1615151415156101f957600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806102a15750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b15156102ac57600080fd5b6000600460006101000a81548160ff0219169083151502179055506003543073ffffffffffffffffffffffffffffffffffffffff163103600281905550565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806103935750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b151561039e57600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561048357600060025411801561040757506002548111155b151561041257600080fd5b80600254036002819055506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050151561047e57600080fd5b610510565b600060035411801561049757506003548111155b15156104a257600080fd5b8060035403600381905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050151561050f57600080fd5b5b50565b60011515600460009054906101000a900460ff16151514151561053557600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614801561059657506003548160035401115b80156105bd575080600354013073ffffffffffffffffffffffffffffffffffffffff163110155b15156105c857600080fd5b806003540160038190555050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600354815600a165627a7a72305820c3b849e8440987ce43eae3097b77672a69234d516351368b03fe5b7de03807910029000000000000000000000000c65e620a3a55451316168d57e268f5702ef56a1129a01060f46676a5dff6f407f0f51eb6f37f5c8c54e238c70221e18e65fc29d3ea65a0557b01c50ff4ffaac8ed6e5d31237a4ecbac843ab1bfe8bb0165a0060df7c54f", "result": [ diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/deep_calls.json b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/deep_calls.json index 375a163614..12754e9da9 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/deep_calls.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/deep_calls.json @@ -104,8 +104,7 @@ "nonce": "0x38dee147326a8d40", "number": "25000", "stateRoot": "0xc5d6bbcd46236fcdcc80b332ffaaa5476b980b01608f9708408cfef01b58bd5b", - "timestamp": "1479891517", - "totalDifficulty": "1895410389427" + "timestamp": "1479891517" }, "input": "0xf88b8206628504a817c8008303d09094c212e03b9e060e36facad5fd8f4435412ca22e6b80a451a34eb80000000000000000000000000000000000000000000000280faf689c35ac00002aa0a7ee5b7877811bf671d121b40569462e722657044808dc1d6c4f1e4233ec145ba0417e7543d52b65738d9df419cbe40a708424f4d54b0fc145c0a64545a2bb1065", "result": [ diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/delegatecall.json b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/delegatecall.json index e5a37cbfdd..08ba48f123 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/delegatecall.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/delegatecall.json @@ -57,8 +57,7 @@ "nonce": "0x684129f283aaef18", "number": "11494", "stateRoot": "0x7057f31fe3dab1d620771adad35224aae43eb70e94861208bc84c557ff5b9d10", - "timestamp": "1479735912", - "totalDifficulty": "90744064339" + "timestamp": "1479735912" }, "input": "0xf889448504a817c800832dc6c094269296dddce321a6bcbaa2f0181127593d732cba80a47065cb480000000000000000000000001523e55a1ca4efbae03355775ae89f8d7699ad9e29a080ed81e4c5e9971a730efab4885566e2c868cd80bd4166d0ed8c287fdf181650a069d7c49215e3d4416ad239cd09dbb71b9f04c16b33b385d14f40b618a7a65115", "result": [ diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/delegatecall_parent_value.json b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/delegatecall_parent_value.json index 177912420a..c8d66ef2d5 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/delegatecall_parent_value.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/delegatecall_parent_value.json @@ -7,7 +7,6 @@ "stateRoot": "0xfc01993ad96a8fb8790a093cea4f505f8db1b0e1143c5f57bb1d173db0baa9e3", "miner": "0x877bd459c9b7d8576b44e59e09d076c25946f443", "difficulty": "1926740", - "totalDifficulty": "482216286599", "extraData": "0xd883010906846765746888676f312e31332e35856c696e7578", "gasLimit": "19388354", "timestamp": "1577558314", diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/gas.json b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/gas.json index d977dbe30d..250c402808 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/gas.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/gas.json @@ -10,7 +10,6 @@ "number": "1555274", "stateRoot": "0x795751f3f96a5de1fd3944ddd78cbfe4ef10491e1086be47609869a30929d0e5", "timestamp": "1590795228", - "totalDifficulty": "2242595605834", "alloc": { "0x0000000000000000000000000000000000000001": { "balance": "0x0", diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/include_precompiled.json b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/include_precompiled.json index 0f28c07a9b..8da637a9e0 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/include_precompiled.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/include_precompiled.json @@ -7,7 +7,6 @@ "stateRoot": "0x68418fb5cf4afa9b807dc079e8cdde0e148ac2c8afb378e675465b5bed1fbd02", "miner": "0x877bd459c9b7d8576b44e59e09d076c25946f443", "difficulty": "1813945", - "totalDifficulty": "469107641961", "extraData": "0xd883010906846765746888676f312e31332e35856c696e7578", "gasLimit": "6321166", "timestamp": "1577471202", diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/inner_create_oog_outer_throw.json b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/inner_create_oog_outer_throw.json index 6c4ce18063..3747d7f0f8 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/inner_create_oog_outer_throw.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/inner_create_oog_outer_throw.json @@ -49,8 +49,7 @@ "nonce": "0x28c446f1cb9748c1", "number": "2290743", "stateRoot": "0x4898aceede76739daef76448a367d10015a2c022c9e7909b99a10fbf6fb16708", - "timestamp": "1513616414", - "totalDifficulty": "7146523769022564" + "timestamp": "1513616414" }, "input": "0xf8aa0e8509502f9000830493e0941d3ddf7caf024f253487e18bc4a15b1a360c170a80b8443b91f506000000000000000000000000a14bdd7e5666d784dcce98ad24d383a6b1cd4182000000000000000000000000e4a13bc304682a903e9472f469c33801dd18d9e829a0524564944fa419f5c189b5074044f89210c6d6b2d77ee8f7f12a927d59b636dfa0015b28986807a424b18b186ee6642d76739df36cad802d20e8c00e79a61d7281", "result": [ diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/inner_instafail.json b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/inner_instafail.json index 611e50e2c0..1cea8175b3 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/inner_instafail.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/inner_instafail.json @@ -10,7 +10,6 @@ "number": "24973", "stateRoot": "0x532a5c3f75453a696428db078e32ae283c85cb97e4d8560dbdf022adac6df369", "timestamp": "1479891145", - "totalDifficulty": "1892250259406", "alloc": { "0x6c06b16512b332e6cd8293a2974872674716ce18": { "balance": "0x0", diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/inner_precompiled_wrong_gas.json b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/inner_precompiled_wrong_gas.json index 70442fdb9a..a8c11e8351 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/inner_precompiled_wrong_gas.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/inner_precompiled_wrong_gas.json @@ -7,7 +7,6 @@ "stateRoot": "0x68418fb5cf4afa9b807dc079e8cdde0e148ac2c8afb378e675465b5bed1fbd02", "miner": "0x877bd459c9b7d8576b44e59e09d076c25946f443", "difficulty": "1813945", - "totalDifficulty": "469107641961", "extraData": "0xd883010906846765746888676f312e31332e35856c696e7578", "gasLimit": "6321166", "timestamp": "1577471202", diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/inner_throw_outer_revert.json b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/inner_throw_outer_revert.json index bc94708718..5473ef6343 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/inner_throw_outer_revert.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/inner_throw_outer_revert.json @@ -52,8 +52,7 @@ "nonce": "0x810f923ff4b450a1", "number": "2295103", "stateRoot": "0xff403612573d76dfdaf4fea2429b77dbe9764021ae0e38dc8ac79a3cf551179e", - "timestamp": "1513681246", - "totalDifficulty": "7162347056825919" + "timestamp": "1513681246" }, "input": "0xf86d808504e3b292008307dfa69433056b5dcac09a9b4becad0e1dcf92c19bd0af76880e92596fd62900008029a0e5f27bb66431f7081bb7f1f242003056d7f3f35414c352cd3d1848b52716dac2a07d0be78980edb0bd2a0678fc53aa90ea9558ce346b0d947967216918ac74ccea", "result": [ diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/nested_create.json b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/nested_create.json index 3fcc61fc80..7dc6cc8098 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/nested_create.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/nested_create.json @@ -10,7 +10,6 @@ "number": "555461", "stateRoot": "0xba8272acd0dfeb5f04376328e8bfc5b276b177697000c204a060f6f7b629ae32", "timestamp": "1577423350", - "totalDifficulty": "462222992438", "alloc": { "0xcf5b3467dfa45cdc8e5358a7a1ba4deb02e5faed": { "balance": "0x0", diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/nested_create2_action_gas.json b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/nested_create2_action_gas.json index 0eaa3f867a..82692d181a 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/nested_create2_action_gas.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/nested_create2_action_gas.json @@ -10,7 +10,6 @@ "number": "1555160", "stateRoot": "0x95067c12148e2362fcd4a89df286ff0b1739ef097a40ca42ae7f698af9a9d913", "timestamp": "1590793999", - "totalDifficulty": "2242063623471", "alloc": { "0x8785e369f0ef0a4e5c5a5f929680427dc75273a5": { "balance": "0x0", diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/nested_create_action_gas.json b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/nested_create_action_gas.json index a00ea7a93b..d9595a7210 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/nested_create_action_gas.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/nested_create_action_gas.json @@ -10,7 +10,6 @@ "number": "1555169", "stateRoot": "0xc4b9703de3e59ff795baae2c3afa010cf039c37244a7a6af7f3f491a10601348", "timestamp": "1590794111", - "totalDifficulty": "2242105342155", "alloc": { "0x5ac5599fc9df172c89ee7ec55ad9104ccbfed40d": { "balance": "0x0", diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/nested_create_inerror.json b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/nested_create_inerror.json index f3a7d9a946..cb4954d9b7 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/nested_create_inerror.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/nested_create_inerror.json @@ -10,7 +10,6 @@ "number": "839246", "stateRoot": "0x4bb3b02ec70b837651233957fb61a6ea3fc6a4244c1f55df7a713c154829ec0a", "timestamp": "1581179375", - "totalDifficulty": "1023985623933", "alloc": { "0x76554b33410b6d90b7dc889bfed0451ad195f27e": { "balance": "0x0", diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/nested_pointer_issue.json b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/nested_pointer_issue.json index c3191d61bc..89f642db20 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/nested_pointer_issue.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/nested_pointer_issue.json @@ -7,7 +7,6 @@ "stateRoot": "0x7f54db248a004ca182fe87fdfa6efda97163908b4f0cc84b36a6d60699d5d1be", "miner": "0x0000000000000000000000000000000000000000", "difficulty": "1", - "totalDifficulty": "24766", "extraData": "0xf09f928e20407072796c616273206e6f64652d3020f09f928e000000000000001d32ac3baf238e163e18ed6d77b67b0b54b08ad9781dc4ffd93c5ede1ca12c5f21b36ac39c7ebb88dff65da91f5b9461f19873a02602230b931ba388a809119f00", "gasLimit": "8000000", "timestamp": "1549153003", diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/oog.json b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/oog.json index bd6059faef..ea02454d3b 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/oog.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/oog.json @@ -43,8 +43,7 @@ "nonce": "0xd1bdb150f6fd170e", "number": "2294630", "stateRoot": "0x1ab1a534e84cc787cda1db21e0d5920ab06017948075b759166cfea7274657a1", - "timestamp": "1513675347", - "totalDifficulty": "7160543502214733" + "timestamp": "1513675347" }, "input": "0xf8ab820109855d21dba00082ca1d9443064693d3d38ad6a7cb579e0d6d9718c8aa6b6280b844a9059cbb000000000000000000000000e77b1ac803616503510bed0086e3a7be2627a69900000000000000000000000000000000000000000000000000000009502f90001ba0ce3ad83f5530136467b7c2bb225f406bd170f4ad59c254e5103c34eeabb5bd69a0455154527224a42ab405cacf0fe92918a75641ce4152f8db292019a5527aa956", "result": [ diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/option_convert_parity_errors.json b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/option_convert_parity_errors.json index 8888d3e68a..e914ca52b6 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/option_convert_parity_errors.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/option_convert_parity_errors.json @@ -43,8 +43,7 @@ "nonce": "0xd1bdb150f6fd170e", "number": "2294630", "stateRoot": "0x1ab1a534e84cc787cda1db21e0d5920ab06017948075b759166cfea7274657a1", - "timestamp": "1513675347", - "totalDifficulty": "7160543502214733" + "timestamp": "1513675347" }, "tracerConfig": { "convertParityErrors": true diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/result_output.json b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/result_output.json index 62baf333b6..f6215a2b3f 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/result_output.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/result_output.json @@ -10,7 +10,6 @@ "number": "553415", "stateRoot": "0x8f89e79109c19fa00e72b400502448540dc4773ad92dddd341dbba20c710a3b5", "timestamp": "1577396195", - "totalDifficulty": "458361299240", "alloc": { "0x531f76bad925f6a925474996c7d738c1008045f6": { "balance": "0x0", diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/revert.json b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/revert.json index b0346d8603..75ca39feee 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/revert.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/revert.json @@ -41,8 +41,7 @@ "nonce": "0xbc5d43adc2c30c7d", "number": "2294500", "stateRoot": "0xca645b335888352ef9d8b1ef083e9019648180b259026572e3139717270de97d", - "timestamp": "1513673552", - "totalDifficulty": "7160066586979149" + "timestamp": "1513673552" }, "input": "0xf9018b0a8505d21dba00832dc6c094abbcd5b340c80b5f1c0545c04c987b87310296ae80b9012473b40a5c000000000000000000000000400de2e016bda6577407dfc379faba9899bc73ef0000000000000000000000002cc31912b2b0f3075a87b3640923d45a26cef3ee000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000064d79d8e6c7265636f76657279416464726573730000000000000000000000000000000000000000000000000000000000383e3ec32dc0f66d8fe60dbdc2f6815bdf73a988383e3ec32dc0f66d8fe60dbdc2f6815bdf73a988000000000000000000000000000000000000000000000000000000000000000000000000000000001ba0fd659d76a4edbd2a823e324c93f78ad6803b30ff4a9c8bce71ba82798975c70ca06571eecc0b765688ec6c78942c5ee8b585e00988c0141b518287e9be919bc48a", "result": [ diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/revert_reason.json b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/revert_reason.json index 6759b05e52..8e5c7cd28e 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/revert_reason.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/revert_reason.json @@ -46,8 +46,7 @@ "nonce": "0x4eb12e19c16d43da", "number": "2289805", "stateRoot": "0xc7f10f352bff82fac3c2999d3085093d12652e19c7fd32591de49dc5d91b4f1f", - "timestamp": "1513601261", - "totalDifficulty": "7143276353481064" + "timestamp": "1513601261" }, "input": "0xf888068449504f80832dc6c094f58833cf0c791881b494eb79d461e08a1f043f5280a45c19a95c000000000000000000000000f7579c3d8a669c89d5ed246a22eb6db8f6fedbf12da0264664db3e71fae1dbdaf2f53954be149ad3b7ba8a5054b4d89c70febfacc8b1a0212e8398757963f419681839ae8c5a54b411e252473c82d93dda68405ca63294", "result": [ diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/selfdestruct.json b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/selfdestruct.json index 3c5d6d9f2b..c8c6dc65c1 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/selfdestruct.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/selfdestruct.json @@ -10,7 +10,6 @@ "number": "1555145", "stateRoot": "0x565873b05f71b98595133e37a52d79c3476ce820c05ebedaddd35541b0e894a3", "timestamp": "1590793819", - "totalDifficulty": "2241994078605", "alloc": { "0x119f569a45e9d0089d51d7f9529f5ea9bf5785e2": { "balance": "0x0", diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/simple.json b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/simple.json index a7244e9747..1a9ddb8c7a 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/simple.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/simple.json @@ -52,8 +52,7 @@ "nonce": "0x4eb12e19c16d43da", "number": "2289805", "stateRoot": "0xc7f10f352bff82fac3c2999d3085093d12652e19c7fd32591de49dc5d91b4f1f", - "timestamp": "1513601261", - "totalDifficulty": "7143276353481064" + "timestamp": "1513601261" }, "input": "0xf88b8271908506fc23ac0083015f90943b873a919aa0512d5a0f09e6dcceaa4a6727fafe80a463e4bff40000000000000000000000000024f658a46fbb89d8ac105e98d7ac7cbbaf27c52aa0bdce0b59e8761854e857fe64015f06dd08a4fbb7624f6094893a79a72e6ad6bea01d9dde033cff7bb235a3163f348a6d7ab8d6b52bc0963a95b91612e40ca766a4", "result": [ diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/simple_onlytop.json b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/simple_onlytop.json index 5fbdf55d22..b2b462c34b 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/simple_onlytop.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/simple_onlytop.json @@ -52,8 +52,7 @@ "nonce": "0x4eb12e19c16d43da", "number": "2289805", "stateRoot": "0xc7f10f352bff82fac3c2999d3085093d12652e19c7fd32591de49dc5d91b4f1f", - "timestamp": "1513601261", - "totalDifficulty": "7143276353481064" + "timestamp": "1513601261" }, "input": "0xf88b8271908506fc23ac0083015f90943b873a919aa0512d5a0f09e6dcceaa4a6727fafe80a463e4bff40000000000000000000000000024f658a46fbb89d8ac105e98d7ac7cbbaf27c52aa0bdce0b59e8761854e857fe64015f06dd08a4fbb7624f6094893a79a72e6ad6bea01d9dde033cff7bb235a3163f348a6d7ab8d6b52bc0963a95b91612e40ca766a4", "tracerConfig": { diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/skip_no_balance_error.json b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/skip_no_balance_error.json index 6911ed4b32..a25f2383d6 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/skip_no_balance_error.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/skip_no_balance_error.json @@ -10,7 +10,6 @@ "number": "1555284", "stateRoot": "0x9fe125b361b72d5479b24ad9be9964b74228c73a2dfb0065060a79b4a6dfaa1e", "timestamp": "1590795374", - "totalDifficulty": "2242642335405", "alloc": { "0xe85df1413eebe1b191c26260e19783a274a6b041": { "balance": "0x0", diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/staticcall_precompiled.json b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/staticcall_precompiled.json index 45ffbe2db9..e3ac8b8300 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/staticcall_precompiled.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/staticcall_precompiled.json @@ -10,7 +10,6 @@ "number": "567687", "stateRoot": "0x7b4b193fe73ef87101c7c325954681861cc240c299d03459784b2b11c9c522ae", "timestamp": "1577578008", - "totalDifficulty": "485254950048", "alloc": { "0x8521f13dd5e4bc3dab3cf0f01a195a5af899e851": { "balance": "0x0", diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/suicide.json b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/suicide.json index 16d43767d5..f759536934 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/suicide.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/suicide.json @@ -7,7 +7,6 @@ "stateRoot": "0x40b5f53d610108947688a04fb68838ff9c0aa0dd6e54156b682537192171ff5c", "miner": "0x774c398d763161f55b66a646f17edda4addad2ca", "difficulty": "1928226", - "totalDifficulty": "457857582215", "extraData": "0xd983010907846765746888676f312e31332e358664617277696e", "gasLimit": "7999473", "timestamp": "1577392669", diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/throw.json b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/throw.json index a001178a42..52e1299eb1 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer_flat/throw.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer_flat/throw.json @@ -45,8 +45,7 @@ "nonce": "0x70849d5838dee2e9", "number": "25008", "stateRoot": "0x1e01d2161794768c5b917069e73d86e8dca80cd7f3168c0597de420ab93a3b7b", - "timestamp": "1479891641", - "totalDifficulty": "1896347038589" + "timestamp": "1479891641" }, "input": "0xf88b8206668504a817c8008303d09094c212e03b9e060e36facad5fd8f4435412ca22e6b80a451a34eb8000000000000000000000000000000000000000000000027fad02094277c000029a0692a3b4e7b2842f8dd7832e712c21e09f451f416c8976d5b8d02e8c0c2b4bea9a07645e90fc421b63dd755767fd93d3c03b4ec0c4d8fafa059558d08cf11d59750", "result": [ diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer_legacy/create.json b/eth/tracers/internal/tracetest/testdata/call_tracer_legacy/create.json index df0b2872b4..621a6a97a4 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer_legacy/create.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer_legacy/create.json @@ -41,8 +41,7 @@ "nonce": "0x93363bbd2c95f410", "number": "2294701", "stateRoot": "0x6b6737d5bde8058990483e915866bd1578014baeff57bd5e4ed228a2bfad635c", - "timestamp": "1513676127", - "totalDifficulty": "7160808139332585" + "timestamp": "1513676127" }, "input": "0xf907ef098504e3b29200830897be8080b9079c606060405260405160208061077c83398101604052808051906020019091905050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415151561007d57600080fd5b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001600460006101000a81548160ff02191690831515021790555050610653806101296000396000f300606060405260043610610083576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305e4382a146100855780631c02708d146100ae5780632e1a7d4d146100c35780635114cb52146100e6578063a37dda2c146100fe578063ae200e7914610153578063b5769f70146101a8575b005b341561009057600080fd5b6100986101d1565b6040518082815260200191505060405180910390f35b34156100b957600080fd5b6100c16101d7565b005b34156100ce57600080fd5b6100e460048080359060200190919050506102eb565b005b6100fc6004808035906020019091905050610513565b005b341561010957600080fd5b6101116105d6565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561015e57600080fd5b6101666105fc565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156101b357600080fd5b6101bb610621565b6040518082815260200191505060405180910390f35b60025481565b60011515600460009054906101000a900460ff1615151415156101f957600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806102a15750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b15156102ac57600080fd5b6000600460006101000a81548160ff0219169083151502179055506003543073ffffffffffffffffffffffffffffffffffffffff163103600281905550565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806103935750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b151561039e57600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561048357600060025411801561040757506002548111155b151561041257600080fd5b80600254036002819055506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050151561047e57600080fd5b610510565b600060035411801561049757506003548111155b15156104a257600080fd5b8060035403600381905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050151561050f57600080fd5b5b50565b60011515600460009054906101000a900460ff16151514151561053557600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614801561059657506003548160035401115b80156105bd575080600354013073ffffffffffffffffffffffffffffffffffffffff163110155b15156105c857600080fd5b806003540160038190555050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600354815600a165627a7a72305820c3b849e8440987ce43eae3097b77672a69234d516351368b03fe5b7de03807910029000000000000000000000000c65e620a3a55451316168d57e268f5702ef56a1129a01060f46676a5dff6f407f0f51eb6f37f5c8c54e238c70221e18e65fc29d3ea65a0557b01c50ff4ffaac8ed6e5d31237a4ecbac843ab1bfe8bb0165a0060df7c54f", "result": { diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer_legacy/deep_calls.json b/eth/tracers/internal/tracetest/testdata/call_tracer_legacy/deep_calls.json index 80fc0b0ada..82980679d4 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer_legacy/deep_calls.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer_legacy/deep_calls.json @@ -104,8 +104,7 @@ "nonce": "0x38dee147326a8d40", "number": "25000", "stateRoot": "0xc5d6bbcd46236fcdcc80b332ffaaa5476b980b01608f9708408cfef01b58bd5b", - "timestamp": "1479891517", - "totalDifficulty": "1895410389427" + "timestamp": "1479891517" }, "input": "0xf88b8206628504a817c8008303d09094c212e03b9e060e36facad5fd8f4435412ca22e6b80a451a34eb80000000000000000000000000000000000000000000000280faf689c35ac00002aa0a7ee5b7877811bf671d121b40569462e722657044808dc1d6c4f1e4233ec145ba0417e7543d52b65738d9df419cbe40a708424f4d54b0fc145c0a64545a2bb1065", "result": { diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer_legacy/delegatecall.json b/eth/tracers/internal/tracetest/testdata/call_tracer_legacy/delegatecall.json index 2cd28bacc4..4fa866df18 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer_legacy/delegatecall.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer_legacy/delegatecall.json @@ -57,8 +57,7 @@ "nonce": "0x684129f283aaef18", "number": "11494", "stateRoot": "0x7057f31fe3dab1d620771adad35224aae43eb70e94861208bc84c557ff5b9d10", - "timestamp": "1479735912", - "totalDifficulty": "90744064339" + "timestamp": "1479735912" }, "input": "0xf889448504a817c800832dc6c094269296dddce321a6bcbaa2f0181127593d732cba80a47065cb480000000000000000000000001523e55a1ca4efbae03355775ae89f8d7699ad9e29a080ed81e4c5e9971a730efab4885566e2c868cd80bd4166d0ed8c287fdf181650a069d7c49215e3d4416ad239cd09dbb71b9f04c16b33b385d14f40b618a7a65115", "result": { diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer_legacy/inner_create_oog_outer_throw.json b/eth/tracers/internal/tracetest/testdata/call_tracer_legacy/inner_create_oog_outer_throw.json index 07fda21d4b..b83b743632 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer_legacy/inner_create_oog_outer_throw.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer_legacy/inner_create_oog_outer_throw.json @@ -49,8 +49,7 @@ "nonce": "0x28c446f1cb9748c1", "number": "2290743", "stateRoot": "0x4898aceede76739daef76448a367d10015a2c022c9e7909b99a10fbf6fb16708", - "timestamp": "1513616414", - "totalDifficulty": "7146523769022564" + "timestamp": "1513616414" }, "input": "0xf8aa0e8509502f9000830493e0941d3ddf7caf024f253487e18bc4a15b1a360c170a80b8443b91f506000000000000000000000000a14bdd7e5666d784dcce98ad24d383a6b1cd4182000000000000000000000000e4a13bc304682a903e9472f469c33801dd18d9e829a0524564944fa419f5c189b5074044f89210c6d6b2d77ee8f7f12a927d59b636dfa0015b28986807a424b18b186ee6642d76739df36cad802d20e8c00e79a61d7281", "result": { diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer_legacy/inner_instafail.json b/eth/tracers/internal/tracetest/testdata/call_tracer_legacy/inner_instafail.json index 16e4136230..ff30558874 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer_legacy/inner_instafail.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer_legacy/inner_instafail.json @@ -10,7 +10,6 @@ "number": "24973", "stateRoot": "0x532a5c3f75453a696428db078e32ae283c85cb97e4d8560dbdf022adac6df369", "timestamp": "1479891145", - "totalDifficulty": "1892250259406", "alloc": { "0x6c06b16512b332e6cd8293a2974872674716ce18": { "balance": "0x0", diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer_legacy/inner_throw_outer_revert.json b/eth/tracers/internal/tracetest/testdata/call_tracer_legacy/inner_throw_outer_revert.json index a023ed6d9b..17442f15b9 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer_legacy/inner_throw_outer_revert.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer_legacy/inner_throw_outer_revert.json @@ -52,8 +52,7 @@ "nonce": "0x810f923ff4b450a1", "number": "2295103", "stateRoot": "0xff403612573d76dfdaf4fea2429b77dbe9764021ae0e38dc8ac79a3cf551179e", - "timestamp": "1513681246", - "totalDifficulty": "7162347056825919" + "timestamp": "1513681246" }, "input": "0xf86d808504e3b292008307dfa69433056b5dcac09a9b4becad0e1dcf92c19bd0af76880e92596fd62900008029a0e5f27bb66431f7081bb7f1f242003056d7f3f35414c352cd3d1848b52716dac2a07d0be78980edb0bd2a0678fc53aa90ea9558ce346b0d947967216918ac74ccea", "result": { diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer_legacy/oog.json b/eth/tracers/internal/tracetest/testdata/call_tracer_legacy/oog.json index 333bdd038c..e28958a69e 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer_legacy/oog.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer_legacy/oog.json @@ -43,8 +43,7 @@ "nonce": "0xd1bdb150f6fd170e", "number": "2294630", "stateRoot": "0x1ab1a534e84cc787cda1db21e0d5920ab06017948075b759166cfea7274657a1", - "timestamp": "1513675347", - "totalDifficulty": "7160543502214733" + "timestamp": "1513675347" }, "input": "0xf8ab820109855d21dba00082ca1d9443064693d3d38ad6a7cb579e0d6d9718c8aa6b6280b844a9059cbb000000000000000000000000e77b1ac803616503510bed0086e3a7be2627a69900000000000000000000000000000000000000000000000000000009502f90001ba0ce3ad83f5530136467b7c2bb225f406bd170f4ad59c254e5103c34eeabb5bd69a0455154527224a42ab405cacf0fe92918a75641ce4152f8db292019a5527aa956", "result": { diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer_legacy/revert.json b/eth/tracers/internal/tracetest/testdata/call_tracer_legacy/revert.json index 3207a298a9..f69bb72e0a 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer_legacy/revert.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer_legacy/revert.json @@ -41,8 +41,7 @@ "nonce": "0xbc5d43adc2c30c7d", "number": "2294500", "stateRoot": "0xca645b335888352ef9d8b1ef083e9019648180b259026572e3139717270de97d", - "timestamp": "1513673552", - "totalDifficulty": "7160066586979149" + "timestamp": "1513673552" }, "input": "0xf9018b0a8505d21dba00832dc6c094abbcd5b340c80b5f1c0545c04c987b87310296ae80b9012473b40a5c000000000000000000000000400de2e016bda6577407dfc379faba9899bc73ef0000000000000000000000002cc31912b2b0f3075a87b3640923d45a26cef3ee000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000064d79d8e6c7265636f76657279416464726573730000000000000000000000000000000000000000000000000000000000383e3ec32dc0f66d8fe60dbdc2f6815bdf73a988383e3ec32dc0f66d8fe60dbdc2f6815bdf73a988000000000000000000000000000000000000000000000000000000000000000000000000000000001ba0fd659d76a4edbd2a823e324c93f78ad6803b30ff4a9c8bce71ba82798975c70ca06571eecc0b765688ec6c78942c5ee8b585e00988c0141b518287e9be919bc48a", "result": { diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer_legacy/revert_reason.json b/eth/tracers/internal/tracetest/testdata/call_tracer_legacy/revert_reason.json index 5c7e5629e9..563ae9126e 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer_legacy/revert_reason.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer_legacy/revert_reason.json @@ -46,8 +46,7 @@ "nonce": "0x4eb12e19c16d43da", "number": "2289805", "stateRoot": "0xc7f10f352bff82fac3c2999d3085093d12652e19c7fd32591de49dc5d91b4f1f", - "timestamp": "1513601261", - "totalDifficulty": "7143276353481064" + "timestamp": "1513601261" }, "input": "0xf888068449504f80832dc6c094f58833cf0c791881b494eb79d461e08a1f043f5280a45c19a95c000000000000000000000000f7579c3d8a669c89d5ed246a22eb6db8f6fedbf12da0264664db3e71fae1dbdaf2f53954be149ad3b7ba8a5054b4d89c70febfacc8b1a0212e8398757963f419681839ae8c5a54b411e252473c82d93dda68405ca63294", "result": { diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer_legacy/selfdestruct.json b/eth/tracers/internal/tracetest/testdata/call_tracer_legacy/selfdestruct.json index 11b23a990e..be9acf1409 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer_legacy/selfdestruct.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer_legacy/selfdestruct.json @@ -47,8 +47,7 @@ "nonce": "0x4eb12e19c16d43da", "number": "2289805", "stateRoot": "0xc7f10f352bff82fac3c2999d3085093d12652e19c7fd32591de49dc5d91b4f1f", - "timestamp": "1513601261", - "totalDifficulty": "7143276353481064" + "timestamp": "1513601261" }, "input": "0xf88b8271908506fc23ac0083015f90943b873a919aa0512d5a0f09e6dcceaa4a6727fafe80a463e4bff40000000000000000000000000024f658a46fbb89d8ac105e98d7ac7cbbaf27c52aa0bdce0b59e8761854e857fe64015f06dd08a4fbb7624f6094893a79a72e6ad6bea01d9dde033cff7bb235a3163f348a6d7ab8d6b52bc0963a95b91612e40ca766a4", "result": { diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer_legacy/simple.json b/eth/tracers/internal/tracetest/testdata/call_tracer_legacy/simple.json index 37723f17dd..b152d43a3e 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer_legacy/simple.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer_legacy/simple.json @@ -52,8 +52,7 @@ "nonce": "0x4eb12e19c16d43da", "number": "2289805", "stateRoot": "0xc7f10f352bff82fac3c2999d3085093d12652e19c7fd32591de49dc5d91b4f1f", - "timestamp": "1513601261", - "totalDifficulty": "7143276353481064" + "timestamp": "1513601261" }, "input": "0xf88b8271908506fc23ac0083015f90943b873a919aa0512d5a0f09e6dcceaa4a6727fafe80a463e4bff40000000000000000000000000024f658a46fbb89d8ac105e98d7ac7cbbaf27c52aa0bdce0b59e8761854e857fe64015f06dd08a4fbb7624f6094893a79a72e6ad6bea01d9dde033cff7bb235a3163f348a6d7ab8d6b52bc0963a95b91612e40ca766a4", "result": { diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer_legacy/throw.json b/eth/tracers/internal/tracetest/testdata/call_tracer_legacy/throw.json index 499b449a6e..d439d2b284 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer_legacy/throw.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer_legacy/throw.json @@ -45,8 +45,7 @@ "nonce": "0x70849d5838dee2e9", "number": "25008", "stateRoot": "0x1e01d2161794768c5b917069e73d86e8dca80cd7f3168c0597de420ab93a3b7b", - "timestamp": "1479891641", - "totalDifficulty": "1896347038589" + "timestamp": "1479891641" }, "input": "0xf88b8206668504a817c8008303d09094c212e03b9e060e36facad5fd8f4435412ca22e6b80a451a34eb8000000000000000000000000000000000000000000000027fad02094277c000029a0692a3b4e7b2842f8dd7832e712c21e09f451f416c8976d5b8d02e8c0c2b4bea9a07645e90fc421b63dd755767fd93d3c03b4ec0c4d8fafa059558d08cf11d59750", "result": { diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer_withLog/calldata.json b/eth/tracers/internal/tracetest/testdata/call_tracer_withLog/calldata.json index dbece7229d..cef0c1c5a8 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer_withLog/calldata.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer_withLog/calldata.json @@ -10,7 +10,6 @@ "number": "995200", "stateRoot": "0x3579328470dd2aef5b9da69f5480cbe0d375e653b530ab3c1aee0da5e1ff4c94", "timestamp": "1455322761", - "totalDifficulty": "7077231809278509672", "alloc": { "0x200edd17f30485a8735878661960cd7a9a95733f": { "balance": "0x0", diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer_withLog/delegatecall.json b/eth/tracers/internal/tracetest/testdata/call_tracer_withLog/delegatecall.json index 2b03dbb8dd..0ae76e92f9 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer_withLog/delegatecall.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer_withLog/delegatecall.json @@ -10,7 +10,6 @@ "number": "2340152", "stateRoot": "0x38295a2634c9c62d48bcbf2ef2ae83768b9055c1f5e6469d17a5d1bcb052072e", "timestamp": "1475034708", - "totalDifficulty": "66488249547380413902", "alloc": { "0x01e60b511fced1eb2b5b40991eb1dfd171a6df42": { "balance": "0x0", diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer_withLog/frontier_create_outofstorage.json b/eth/tracers/internal/tracetest/testdata/call_tracer_withLog/frontier_create_outofstorage.json index a9092bbcf0..049f24d932 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer_withLog/frontier_create_outofstorage.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer_withLog/frontier_create_outofstorage.json @@ -10,7 +10,6 @@ "number": "469666", "stateRoot": "0xf9c50965ffae3f99310483a7836c545a025cc680303adaf3671dbeef99edf03a", "timestamp": "1446318401", - "totalDifficulty": "2462705215747880313", "alloc": { "0x0000000000000000000000000000000000000004": { "balance": "0x0" diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer_withLog/multi_contracts.json b/eth/tracers/internal/tracetest/testdata/call_tracer_withLog/multi_contracts.json index 263e88d6e1..5cc3013f80 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer_withLog/multi_contracts.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer_withLog/multi_contracts.json @@ -10,7 +10,6 @@ "number": "1881283", "stateRoot": "0x6e3832bc2e4e66170a1e716449083e08fbb70e7b2a9f1f34e0c57e66ce40c50f", "timestamp": "1468467284", - "totalDifficulty": "37186898441932102239", "alloc": { "0x0000000000000000000000000000000000000004": { "balance": "0x0" diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer_withLog/multilogs.json b/eth/tracers/internal/tracetest/testdata/call_tracer_withLog/multilogs.json index 66d4582008..c931ed63fc 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer_withLog/multilogs.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer_withLog/multilogs.json @@ -10,7 +10,6 @@ "number": "595531", "stateRoot": "0x79d00dd270bffc48d89fa55842f63f840981121378da8c6de4d479535f25ed6a", "timestamp": "1448471472", - "totalDifficulty": "3448100174991667199", "alloc": { "0x2a65aca4d5fc5b5c859090a6c34d164135398226": { "balance": "0x44dc051cccdfd2e132", diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer_withLog/notopic.json b/eth/tracers/internal/tracetest/testdata/call_tracer_withLog/notopic.json index 762ccbe58f..42fc872554 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer_withLog/notopic.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer_withLog/notopic.json @@ -10,7 +10,6 @@ "number": "1725115", "stateRoot": "0xca08a341c1f95fcba0821c4a27662ef162d39e1f9f5722717531f510d54112b0", "timestamp": "1466232982", - "totalDifficulty": "28554024908214037524", "alloc": { "0x0000000000000000000000000000000000000004": { "balance": "0x0" diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer_withLog/simple.json b/eth/tracers/internal/tracetest/testdata/call_tracer_withLog/simple.json index 64941dd4db..5300d341b8 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer_withLog/simple.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer_withLog/simple.json @@ -10,7 +10,6 @@ "number": "765824", "stateRoot": "0x8d96cb027a29f8ca0ccd6d31f9ea0656136ec8030ecda70bb9231849ed6f41a2", "timestamp": "1451389443", - "totalDifficulty": "4838314986494741271", "alloc": { "0xd1220a0cf47c7b9be7a2e6ba89f429762e7b9adb": { "balance": "0x14203bee2ea6fbe8c", diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer_withLog/tx_failed.json b/eth/tracers/internal/tracetest/testdata/call_tracer_withLog/tx_failed.json index 30346d07f1..d5c2f864c1 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer_withLog/tx_failed.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer_withLog/tx_failed.json @@ -10,7 +10,6 @@ "number": "1968179", "stateRoot": "0x6420003b1779cca3bcdab698c239bbc63623c0a7e4deeedbdb8190b9e7fd7520", "timestamp": "1469713675", - "totalDifficulty": "42284028928878034360", "alloc": { "0x10abb5efecdc09581f8b7cb95791fe2936790b4e": { "balance": "0x81f158e2814b4ab624c", diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer_withLog/tx_partial_failed.json b/eth/tracers/internal/tracetest/testdata/call_tracer_withLog/tx_partial_failed.json index 6faf898a0f..1267160d13 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer_withLog/tx_partial_failed.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer_withLog/tx_partial_failed.json @@ -10,7 +10,6 @@ "number": "1646451", "stateRoot": "0x2bd193b9911caf43204960cc7661ce864bf0bac7f9b60191aa02bbff24f061fb", "timestamp": "1465103859", - "totalDifficulty": "24813742796574158431", "alloc": { "0x01115b41bd2731353dd3e6abf44818fdc035aaf1": { "balance": "0x16d99e16e809000", diff --git a/eth/tracers/internal/tracetest/testdata/call_tracer_withLog/with_onlyTopCall.json b/eth/tracers/internal/tracetest/testdata/call_tracer_withLog/with_onlyTopCall.json index e73081107f..38d96a6bd0 100644 --- a/eth/tracers/internal/tracetest/testdata/call_tracer_withLog/with_onlyTopCall.json +++ b/eth/tracers/internal/tracetest/testdata/call_tracer_withLog/with_onlyTopCall.json @@ -10,7 +10,6 @@ "number": "995200", "stateRoot": "0x3579328470dd2aef5b9da69f5480cbe0d375e653b530ab3c1aee0da5e1ff4c94", "timestamp": "1455322761", - "totalDifficulty": "7077231809278509672", "alloc": { "0x200edd17f30485a8735878661960cd7a9a95733f": { "balance": "0x0", diff --git a/eth/tracers/internal/tracetest/testdata/prestate_tracer/blob_tx.json b/eth/tracers/internal/tracetest/testdata/prestate_tracer/blob_tx.json index c3e7387f02..444eba450b 100644 --- a/eth/tracers/internal/tracetest/testdata/prestate_tracer/blob_tx.json +++ b/eth/tracers/internal/tracetest/testdata/prestate_tracer/blob_tx.json @@ -14,7 +14,6 @@ "parentBeaconBlockRoot": "0x0000000000000000000000000000000000000000000000000000000000000000", "stateRoot": "0x577f42ab21ccfd946511c57869ace0bdf7c217c36f02b7cd3459df0ed1cffc1a", "timestamp": "1709626771", - "totalDifficulty": "1", "withdrawals": [], "withdrawalsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "alloc": { diff --git a/eth/tracers/internal/tracetest/testdata/prestate_tracer/create_create.json b/eth/tracers/internal/tracetest/testdata/prestate_tracer/create_create.json index 893c604443..b013d520c1 100644 --- a/eth/tracers/internal/tracetest/testdata/prestate_tracer/create_create.json +++ b/eth/tracers/internal/tracetest/testdata/prestate_tracer/create_create.json @@ -11,7 +11,6 @@ "number": "1", "stateRoot": "0xd2ebe0a7f3572ffe3e5b4c78147376d3fca767f236e4dd23f9151acfec7cb0d1", "timestamp": "1699617692", - "totalDifficulty": "0", "withdrawals": [], "withdrawalsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "alloc": { diff --git a/eth/tracers/internal/tracetest/testdata/prestate_tracer/create_existing_contract.json b/eth/tracers/internal/tracetest/testdata/prestate_tracer/create_existing_contract.json index a34d3b759e..64a3b16cb1 100644 --- a/eth/tracers/internal/tracetest/testdata/prestate_tracer/create_existing_contract.json +++ b/eth/tracers/internal/tracetest/testdata/prestate_tracer/create_existing_contract.json @@ -10,7 +10,6 @@ "number": "243825", "stateRoot": "0x47182fe2e6e740b8a76f82fe5c527d6ad548f805274f21792cf4047235b24fbf", "timestamp": "1442424328", - "totalDifficulty": "1035061827427752845", "alloc": { "0x082d4cdf07f386ffa9258f52a5c49db4ac321ec6": { "balance": "0xc820f93200f4000", diff --git a/eth/tracers/internal/tracetest/testdata/prestate_tracer/create_post_eip158.json b/eth/tracers/internal/tracetest/testdata/prestate_tracer/create_post_eip158.json index fb85b31a48..78e4a887f1 100644 --- a/eth/tracers/internal/tracetest/testdata/prestate_tracer/create_post_eip158.json +++ b/eth/tracers/internal/tracetest/testdata/prestate_tracer/create_post_eip158.json @@ -11,7 +11,6 @@ "number": "39137", "stateRoot": "0x715f00df764dbadd4863247a215ac44b5420beafde3ec458b15db7aafa89be0c", "timestamp": "1709022192", - "totalDifficulty": "78275", "alloc": { "0x2445e8c26a2bf3d1e59f1bb9b1d442caf90768e0": { "balance": "0x10f06447a8d44dba190", diff --git a/eth/tracers/internal/tracetest/testdata/prestate_tracer/simple.json b/eth/tracers/internal/tracetest/testdata/prestate_tracer/simple.json index 7204bfcbfe..9811f87c4f 100644 --- a/eth/tracers/internal/tracetest/testdata/prestate_tracer/simple.json +++ b/eth/tracers/internal/tracetest/testdata/prestate_tracer/simple.json @@ -52,8 +52,7 @@ "nonce": "0x4eb12e19c16d43da", "number": "2289805", "stateRoot": "0xc7f10f352bff82fac3c2999d3085093d12652e19c7fd32591de49dc5d91b4f1f", - "timestamp": "1513601261", - "totalDifficulty": "7143276353481064" + "timestamp": "1513601261" }, "input": "0xf88b8271908506fc23ac0083015f90943b873a919aa0512d5a0f09e6dcceaa4a6727fafe80a463e4bff40000000000000000000000000024f658a46fbb89d8ac105e98d7ac7cbbaf27c52aa0bdce0b59e8761854e857fe64015f06dd08a4fbb7624f6094893a79a72e6ad6bea01d9dde033cff7bb235a3163f348a6d7ab8d6b52bc0963a95b91612e40ca766a4", "result": { diff --git a/eth/tracers/internal/tracetest/testdata/prestate_tracer_legacy/simple.json b/eth/tracers/internal/tracetest/testdata/prestate_tracer_legacy/simple.json index 44b1f08dd3..a4cb3f60e4 100644 --- a/eth/tracers/internal/tracetest/testdata/prestate_tracer_legacy/simple.json +++ b/eth/tracers/internal/tracetest/testdata/prestate_tracer_legacy/simple.json @@ -52,8 +52,7 @@ "nonce": "0x4eb12e19c16d43da", "number": "2289805", "stateRoot": "0xc7f10f352bff82fac3c2999d3085093d12652e19c7fd32591de49dc5d91b4f1f", - "timestamp": "1513601261", - "totalDifficulty": "7143276353481064" + "timestamp": "1513601261" }, "input": "0xf88b8271908506fc23ac0083015f90943b873a919aa0512d5a0f09e6dcceaa4a6727fafe80a463e4bff40000000000000000000000000024f658a46fbb89d8ac105e98d7ac7cbbaf27c52aa0bdce0b59e8761854e857fe64015f06dd08a4fbb7624f6094893a79a72e6ad6bea01d9dde033cff7bb235a3163f348a6d7ab8d6b52bc0963a95b91612e40ca766a4", "result": { diff --git a/eth/tracers/internal/tracetest/testdata/prestate_tracer_with_diff_mode/create.json b/eth/tracers/internal/tracetest/testdata/prestate_tracer_with_diff_mode/create.json index 1b09622474..6eea6085b8 100644 --- a/eth/tracers/internal/tracetest/testdata/prestate_tracer_with_diff_mode/create.json +++ b/eth/tracers/internal/tracetest/testdata/prestate_tracer_with_diff_mode/create.json @@ -10,7 +10,6 @@ "number": "1061221", "stateRoot": "0x5402c04d481414248d824c3b61e924e0c9307adbc9fbaae774a74cce30a4163d", "timestamp": "1456458069", - "totalDifficulty": "7930751135586064334", "alloc": { "0x2a65aca4d5fc5b5c859090a6c34d164135398226": { "balance": "0x9fb6b81e112638b886", diff --git a/eth/tracers/internal/tracetest/testdata/prestate_tracer_with_diff_mode/create_post_eip158.json b/eth/tracers/internal/tracetest/testdata/prestate_tracer_with_diff_mode/create_post_eip158.json index f5adb1af65..19e1f08bb7 100644 --- a/eth/tracers/internal/tracetest/testdata/prestate_tracer_with_diff_mode/create_post_eip158.json +++ b/eth/tracers/internal/tracetest/testdata/prestate_tracer_with_diff_mode/create_post_eip158.json @@ -11,7 +11,6 @@ "number": "39137", "stateRoot": "0x715f00df764dbadd4863247a215ac44b5420beafde3ec458b15db7aafa89be0c", "timestamp": "1709022192", - "totalDifficulty": "78275", "alloc": { "0x2445e8c26a2bf3d1e59f1bb9b1d442caf90768e0": { "balance": "0x10f06447a8d44dba190", diff --git a/eth/tracers/internal/tracetest/testdata/prestate_tracer_with_diff_mode/create_suicide.json b/eth/tracers/internal/tracetest/testdata/prestate_tracer_with_diff_mode/create_suicide.json index fdeb0e5067..cf8f03bd09 100644 --- a/eth/tracers/internal/tracetest/testdata/prestate_tracer_with_diff_mode/create_suicide.json +++ b/eth/tracers/internal/tracetest/testdata/prestate_tracer_with_diff_mode/create_suicide.json @@ -10,7 +10,6 @@ "number": "243825", "stateRoot": "0x47182fe2e6e740b8a76f82fe5c527d6ad548f805274f21792cf4047235b24fbf", "timestamp": "1442424328", - "totalDifficulty": "1035061827427752845", "alloc": { "0x082d4cdf07f386ffa9258f52a5c49db4ac321ec6": { "balance": "0xc820f93200f4000", diff --git a/eth/tracers/internal/tracetest/testdata/prestate_tracer_with_diff_mode/inner_create.json b/eth/tracers/internal/tracetest/testdata/prestate_tracer_with_diff_mode/inner_create.json index 9c0030a0a8..e6d6f2435b 100644 --- a/eth/tracers/internal/tracetest/testdata/prestate_tracer_with_diff_mode/inner_create.json +++ b/eth/tracers/internal/tracetest/testdata/prestate_tracer_with_diff_mode/inner_create.json @@ -10,7 +10,6 @@ "number": "1062502", "stateRoot": "0x1df615df5fdbc8d5397bf3574f462f6d9696428eb8796d8e9252bccc8e3a8996", "timestamp": "1456480432", - "totalDifficulty": "7948153536501153741", "alloc": { "0x0000000000000000000000000000000000000004": { "balance": "0x0", diff --git a/eth/tracers/internal/tracetest/testdata/prestate_tracer_with_diff_mode/simple.json b/eth/tracers/internal/tracetest/testdata/prestate_tracer_with_diff_mode/simple.json index 01cc3c5058..22932ebc95 100644 --- a/eth/tracers/internal/tracetest/testdata/prestate_tracer_with_diff_mode/simple.json +++ b/eth/tracers/internal/tracetest/testdata/prestate_tracer_with_diff_mode/simple.json @@ -52,8 +52,7 @@ "nonce": "0x4eb12e19c16d43da", "number": "2289805", "stateRoot": "0xc7f10f352bff82fac3c2999d3085093d12652e19c7fd32591de49dc5d91b4f1f", - "timestamp": "1513601261", - "totalDifficulty": "7143276353481064" + "timestamp": "1513601261" }, "input": "0xf88b8271908506fc23ac0083015f90943b873a919aa0512d5a0f09e6dcceaa4a6727fafe80a463e4bff40000000000000000000000000024f658a46fbb89d8ac105e98d7ac7cbbaf27c52aa0bdce0b59e8761854e857fe64015f06dd08a4fbb7624f6094893a79a72e6ad6bea01d9dde033cff7bb235a3163f348a6d7ab8d6b52bc0963a95b91612e40ca766a4", "tracerConfig": { diff --git a/eth/tracers/internal/tracetest/testdata/prestate_tracer_with_diff_mode/suicide.json b/eth/tracers/internal/tracetest/testdata/prestate_tracer_with_diff_mode/suicide.json index 5021bda192..3f07146871 100644 --- a/eth/tracers/internal/tracetest/testdata/prestate_tracer_with_diff_mode/suicide.json +++ b/eth/tracers/internal/tracetest/testdata/prestate_tracer_with_diff_mode/suicide.json @@ -10,7 +10,6 @@ "number": "422908", "stateRoot": "0xd914c6440edf9f4a6f997a9b3ecb6e1a9ca2310f74b0b6890c0d0d4a3c28e4d3", "timestamp": "1445530335", - "totalDifficulty": "2148894717741690476", "alloc": { "0x2861bf89b6c640c79040d357c1e9513693ef5d3f": { "balance": "0x0", diff --git a/graphql/graphql.go b/graphql/graphql.go index f7cf164d31..90d70bf142 100644 --- a/graphql/graphql.go +++ b/graphql/graphql.go @@ -906,18 +906,6 @@ func (b *Block) LogsBloom(ctx context.Context) (hexutil.Bytes, error) { return header.Bloom.Bytes(), nil } -func (b *Block) TotalDifficulty(ctx context.Context) (hexutil.Big, error) { - hash, err := b.Hash(ctx) - if err != nil { - return hexutil.Big{}, err - } - td := b.r.backend.GetTd(ctx, hash) - if td == nil { - return hexutil.Big{}, fmt.Errorf("total difficulty not found %x", hash) - } - return hexutil.Big(*td), nil -} - func (b *Block) RawHeader(ctx context.Context) (hexutil.Bytes, error) { header, err := b.resolveHeader(ctx) if err != nil { diff --git a/graphql/graphql_test.go b/graphql/graphql_test.go index ae3a58a983..a6be589a0f 100644 --- a/graphql/graphql_test.go +++ b/graphql/graphql_test.go @@ -338,8 +338,8 @@ func TestGraphQLConcurrentResolvers(t *testing.T) { }, // Multiple fields of block race to resolve header and body. { - body: "{ block { number hash gasLimit ommerCount transactionCount totalDifficulty } }", - want: fmt.Sprintf(`{"block":{"number":"0x1","hash":"%s","gasLimit":"0xaf79e0","ommerCount":"0x0","transactionCount":"0x3","totalDifficulty":"0x200000"}}`, chain[len(chain)-1].Hash()), + body: "{ block { number hash gasLimit ommerCount transactionCount } }", + want: fmt.Sprintf(`{"block":{"number":"0x1","hash":"%s","gasLimit":"0xaf79e0","ommerCount":"0x0","transactionCount":"0x3"}}`, chain[len(chain)-1].Hash()), }, // Multiple fields of a block race to resolve the header and body. { diff --git a/graphql/schema.go b/graphql/schema.go index 8264f1c286..15e4557915 100644 --- a/graphql/schema.go +++ b/graphql/schema.go @@ -232,9 +232,6 @@ const schema string = ` mixHash: Bytes32! # Difficulty is a measure of the difficulty of mining this block. difficulty: BigInt! - # TotalDifficulty is the sum of all difficulty values up to and including - # this block. - totalDifficulty: BigInt! # OmmerCount is the number of ommers (AKA uncles) associated with this # block. If ommers are unavailable, this field will be null. ommerCount: Long diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index 7981f35ae3..a502952893 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -807,7 +807,7 @@ func decodeHash(s string) (h common.Hash, inputLength int, err error) { func (api *BlockChainAPI) GetHeaderByNumber(ctx context.Context, number rpc.BlockNumber) (map[string]interface{}, error) { header, err := api.b.HeaderByNumber(ctx, number) if header != nil && err == nil { - response := api.rpcMarshalHeader(ctx, header) + response := RPCMarshalHeader(header) if number == rpc.PendingBlockNumber { // Pending header need to nil out a few fields for _, field := range []string{"hash", "nonce", "miner"} { @@ -823,7 +823,7 @@ func (api *BlockChainAPI) GetHeaderByNumber(ctx context.Context, number rpc.Bloc func (api *BlockChainAPI) GetHeaderByHash(ctx context.Context, hash common.Hash) map[string]interface{} { header, _ := api.b.HeaderByHash(ctx, hash) if header != nil { - return api.rpcMarshalHeader(ctx, header) + return RPCMarshalHeader(header) } return nil } @@ -838,14 +838,14 @@ func (api *BlockChainAPI) GetHeaderByHash(ctx context.Context, hash common.Hash) func (api *BlockChainAPI) GetBlockByNumber(ctx context.Context, number rpc.BlockNumber, fullTx bool) (map[string]interface{}, error) { block, err := api.b.BlockByNumber(ctx, number) if block != nil && err == nil { - response, err := api.rpcMarshalBlock(ctx, block, true, fullTx) - if err == nil && number == rpc.PendingBlockNumber { + response := RPCMarshalBlock(block, true, fullTx, api.b.ChainConfig()) + if number == rpc.PendingBlockNumber { // Pending blocks need to nil out a few fields for _, field := range []string{"hash", "nonce", "miner"} { response[field] = nil } } - return response, err + return response, nil } return nil, err } @@ -855,7 +855,7 @@ func (api *BlockChainAPI) GetBlockByNumber(ctx context.Context, number rpc.Block func (api *BlockChainAPI) GetBlockByHash(ctx context.Context, hash common.Hash, fullTx bool) (map[string]interface{}, error) { block, err := api.b.BlockByHash(ctx, hash) if block != nil { - return api.rpcMarshalBlock(ctx, block, true, fullTx) + return RPCMarshalBlock(block, true, fullTx, api.b.ChainConfig()), nil } return nil, err } @@ -870,7 +870,7 @@ func (api *BlockChainAPI) GetUncleByBlockNumberAndIndex(ctx context.Context, blo return nil, nil } block = types.NewBlockWithHeader(uncles[index]) - return api.rpcMarshalBlock(ctx, block, false, false) + return RPCMarshalBlock(block, false, false, api.b.ChainConfig()), nil } return nil, err } @@ -885,7 +885,7 @@ func (api *BlockChainAPI) GetUncleByBlockHashAndIndex(ctx context.Context, block return nil, nil } block = types.NewBlockWithHeader(uncles[index]) - return api.rpcMarshalBlock(ctx, block, false, false) + return RPCMarshalBlock(block, false, false, api.b.ChainConfig()), nil } return nil, err } @@ -1442,24 +1442,6 @@ func RPCMarshalBlock(block *types.Block, inclTx bool, fullTx bool, config *param return fields } -// rpcMarshalHeader uses the generalized output filler, then adds the total difficulty field, which requires -// a `BlockchainAPI`. -func (api *BlockChainAPI) rpcMarshalHeader(ctx context.Context, header *types.Header) map[string]interface{} { - fields := RPCMarshalHeader(header) - fields["totalDifficulty"] = (*hexutil.Big)(api.b.GetTd(ctx, header.Hash())) - return fields -} - -// rpcMarshalBlock uses the generalized output filler, then adds the total difficulty field, which requires -// a `BlockchainAPI`. -func (api *BlockChainAPI) rpcMarshalBlock(ctx context.Context, b *types.Block, inclTx bool, fullTx bool) (map[string]interface{}, error) { - fields := RPCMarshalBlock(b, inclTx, fullTx, api.b.ChainConfig()) - if inclTx { - fields["totalDifficulty"] = (*hexutil.Big)(api.b.GetTd(ctx, b.Hash())) - } - return fields, nil -} - // RPCTransaction represents a transaction that will serialize to the RPC representation of a transaction type RPCTransaction struct { BlockHash *common.Hash `json:"blockHash"` diff --git a/internal/ethapi/backend.go b/internal/ethapi/backend.go index 2a45ba0921..0e991592b4 100644 --- a/internal/ethapi/backend.go +++ b/internal/ethapi/backend.go @@ -68,7 +68,6 @@ type Backend interface { StateAndHeaderByNumberOrHash(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (*state.StateDB, *types.Header, error) Pending() (*types.Block, types.Receipts, *state.StateDB) GetReceipts(ctx context.Context, hash common.Hash) (types.Receipts, error) - GetTd(ctx context.Context, hash common.Hash) *big.Int GetEVM(ctx context.Context, msg *core.Message, state *state.StateDB, header *types.Header, vmConfig *vm.Config, blockCtx *vm.BlockContext) *vm.EVM SubscribeChainEvent(ch chan<- core.ChainEvent) event.Subscription SubscribeChainHeadEvent(ch chan<- core.ChainHeadEvent) event.Subscription diff --git a/internal/ethapi/simulate.go b/internal/ethapi/simulate.go index bccf87f8ef..4371a42464 100644 --- a/internal/ethapi/simulate.go +++ b/internal/ethapi/simulate.go @@ -125,8 +125,6 @@ func (sim *simulator) execute(ctx context.Context, blocks []simBlock) ([]map[str var ( results = make([]map[string]interface{}, len(blocks)) parent = sim.base - // Assume same total difficulty for all simulated blocks. - td = sim.b.GetTd(ctx, sim.base.Hash()) ) for bi, block := range blocks { result, callResults, err := sim.processBlock(ctx, &block, headers[bi], parent, headers[:bi], timeout) @@ -134,7 +132,6 @@ func (sim *simulator) execute(ctx context.Context, blocks []simBlock) ([]map[str return nil, err } enc := RPCMarshalBlock(result, true, sim.fullTx, sim.chainConfig) - enc["totalDifficulty"] = (*hexutil.Big)(td) enc["calls"] = callResults results[bi] = enc diff --git a/internal/ethapi/testdata/eth_getBlockByHash-hash-1.json b/internal/ethapi/testdata/eth_getBlockByHash-hash-1.json index 73da1b1752..11c0545ffa 100644 --- a/internal/ethapi/testdata/eth_getBlockByHash-hash-1.json +++ b/internal/ethapi/testdata/eth_getBlockByHash-hash-1.json @@ -16,7 +16,6 @@ "size": "0x26a", "stateRoot": "0x4acfcd1a6ab9f5e62411021ecd8a749976ae50b0590e967471264b372d7ac55b", "timestamp": "0xa", - "totalDifficulty": "0x1", "transactions": [ "0x644a31c354391520d00e95b9affbbb010fc79ac268144ab8e28207f4cf51097e" ], diff --git a/internal/ethapi/testdata/eth_getBlockByHash-hash-genesis.json b/internal/ethapi/testdata/eth_getBlockByHash-hash-genesis.json index d2bdbacd73..134d60c67a 100644 --- a/internal/ethapi/testdata/eth_getBlockByHash-hash-genesis.json +++ b/internal/ethapi/testdata/eth_getBlockByHash-hash-genesis.json @@ -16,7 +16,6 @@ "size": "0x200", "stateRoot": "0xd883f48b83cc9c1e8389453beb4ad4e572462eec049ca4fffbe16ecefb3fe937", "timestamp": "0x0", - "totalDifficulty": "0x1", "transactions": [], "transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncles": [] diff --git a/internal/ethapi/testdata/eth_getBlockByHash-hash-latest-1-fullTx.json b/internal/ethapi/testdata/eth_getBlockByHash-hash-latest-1-fullTx.json index 8e0748def9..3c8d42c9a9 100644 --- a/internal/ethapi/testdata/eth_getBlockByHash-hash-latest-1-fullTx.json +++ b/internal/ethapi/testdata/eth_getBlockByHash-hash-latest-1-fullTx.json @@ -16,7 +16,6 @@ "size": "0x26a", "stateRoot": "0x78b2b19ef1a0276dbbc23a875dbf60ae5d10dafa0017098473c4871abd3e7b5c", "timestamp": "0x5a", - "totalDifficulty": "0x1", "transactions": [ { "blockHash": "0xedb9ccf3a85f67c095ad48abfb0fa09d47179bb0f902078d289042d12428aca5", diff --git a/internal/ethapi/testdata/eth_getBlockByHash-hash-latest.json b/internal/ethapi/testdata/eth_getBlockByHash-hash-latest.json index 6e914e37d0..13876b5a52 100644 --- a/internal/ethapi/testdata/eth_getBlockByHash-hash-latest.json +++ b/internal/ethapi/testdata/eth_getBlockByHash-hash-latest.json @@ -16,7 +16,6 @@ "size": "0x26a", "stateRoot": "0x118f1433ae23c4d1c12f5bd652baddb72611c55ac1cd6af6620d209db222f9e6", "timestamp": "0x64", - "totalDifficulty": "0x1", "transactions": [ "0x3ee4094ca1e0b07a66dd616a057e081e53144ca7e9685a126fd4dda9ca042644" ], diff --git a/internal/ethapi/testdata/eth_getBlockByNumber-number-0.json b/internal/ethapi/testdata/eth_getBlockByNumber-number-0.json index d2bdbacd73..134d60c67a 100644 --- a/internal/ethapi/testdata/eth_getBlockByNumber-number-0.json +++ b/internal/ethapi/testdata/eth_getBlockByNumber-number-0.json @@ -16,7 +16,6 @@ "size": "0x200", "stateRoot": "0xd883f48b83cc9c1e8389453beb4ad4e572462eec049ca4fffbe16ecefb3fe937", "timestamp": "0x0", - "totalDifficulty": "0x1", "transactions": [], "transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncles": [] diff --git a/internal/ethapi/testdata/eth_getBlockByNumber-number-1.json b/internal/ethapi/testdata/eth_getBlockByNumber-number-1.json index 73da1b1752..11c0545ffa 100644 --- a/internal/ethapi/testdata/eth_getBlockByNumber-number-1.json +++ b/internal/ethapi/testdata/eth_getBlockByNumber-number-1.json @@ -16,7 +16,6 @@ "size": "0x26a", "stateRoot": "0x4acfcd1a6ab9f5e62411021ecd8a749976ae50b0590e967471264b372d7ac55b", "timestamp": "0xa", - "totalDifficulty": "0x1", "transactions": [ "0x644a31c354391520d00e95b9affbbb010fc79ac268144ab8e28207f4cf51097e" ], diff --git a/internal/ethapi/testdata/eth_getBlockByNumber-number-latest-1.json b/internal/ethapi/testdata/eth_getBlockByNumber-number-latest-1.json index 8e0748def9..3c8d42c9a9 100644 --- a/internal/ethapi/testdata/eth_getBlockByNumber-number-latest-1.json +++ b/internal/ethapi/testdata/eth_getBlockByNumber-number-latest-1.json @@ -16,7 +16,6 @@ "size": "0x26a", "stateRoot": "0x78b2b19ef1a0276dbbc23a875dbf60ae5d10dafa0017098473c4871abd3e7b5c", "timestamp": "0x5a", - "totalDifficulty": "0x1", "transactions": [ { "blockHash": "0xedb9ccf3a85f67c095ad48abfb0fa09d47179bb0f902078d289042d12428aca5", diff --git a/internal/ethapi/testdata/eth_getBlockByNumber-tag-latest.json b/internal/ethapi/testdata/eth_getBlockByNumber-tag-latest.json index 6e914e37d0..13876b5a52 100644 --- a/internal/ethapi/testdata/eth_getBlockByNumber-tag-latest.json +++ b/internal/ethapi/testdata/eth_getBlockByNumber-tag-latest.json @@ -16,7 +16,6 @@ "size": "0x26a", "stateRoot": "0x118f1433ae23c4d1c12f5bd652baddb72611c55ac1cd6af6620d209db222f9e6", "timestamp": "0x64", - "totalDifficulty": "0x1", "transactions": [ "0x3ee4094ca1e0b07a66dd616a057e081e53144ca7e9685a126fd4dda9ca042644" ], diff --git a/internal/ethapi/testdata/eth_getBlockByNumber-tag-pending-fullTx.json b/internal/ethapi/testdata/eth_getBlockByNumber-tag-pending-fullTx.json index 1d524d6ece..60f18bc114 100644 --- a/internal/ethapi/testdata/eth_getBlockByNumber-tag-pending-fullTx.json +++ b/internal/ethapi/testdata/eth_getBlockByNumber-tag-pending-fullTx.json @@ -15,7 +15,6 @@ "size": "0x256", "stateRoot": "0x0000000000000000000000000000000000000000000000000000000000000000", "timestamp": "0x2a", - "totalDifficulty": null, "transactions": [ { "blockHash": "0x6cebd9f966ea686f44b981685e3f0eacea28591a7a86d7fbbe521a86e9f81165", diff --git a/internal/ethapi/testdata/eth_getBlockByNumber-tag-pending.json b/internal/ethapi/testdata/eth_getBlockByNumber-tag-pending.json index c0e2b07bb8..dda2d93213 100644 --- a/internal/ethapi/testdata/eth_getBlockByNumber-tag-pending.json +++ b/internal/ethapi/testdata/eth_getBlockByNumber-tag-pending.json @@ -15,7 +15,6 @@ "size": "0x256", "stateRoot": "0x0000000000000000000000000000000000000000000000000000000000000000", "timestamp": "0x2a", - "totalDifficulty": null, "transactions": [ "0x4afee081df5dff7a025964032871f7d4ba4d21baf5f6376a2f4a9f79fc506298" ], diff --git a/internal/ethapi/testdata/eth_getHeaderByHash-hash-0.json b/internal/ethapi/testdata/eth_getHeaderByHash-hash-0.json index 1bd68888b6..e1e64a3093 100644 --- a/internal/ethapi/testdata/eth_getHeaderByHash-hash-0.json +++ b/internal/ethapi/testdata/eth_getHeaderByHash-hash-0.json @@ -15,6 +15,5 @@ "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", "stateRoot": "0xd883f48b83cc9c1e8389453beb4ad4e572462eec049ca4fffbe16ecefb3fe937", "timestamp": "0x0", - "totalDifficulty": "0x1", "transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421" } \ No newline at end of file diff --git a/internal/ethapi/testdata/eth_getHeaderByHash-hash-1.json b/internal/ethapi/testdata/eth_getHeaderByHash-hash-1.json index cf662cad75..adfac5110c 100644 --- a/internal/ethapi/testdata/eth_getHeaderByHash-hash-1.json +++ b/internal/ethapi/testdata/eth_getHeaderByHash-hash-1.json @@ -15,6 +15,5 @@ "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", "stateRoot": "0x4acfcd1a6ab9f5e62411021ecd8a749976ae50b0590e967471264b372d7ac55b", "timestamp": "0xa", - "totalDifficulty": "0x1", "transactionsRoot": "0xca0ebcce920d2cdfbf9e1dbe90ed3441a1a576f344bd80e60508da814916f4e7" } \ No newline at end of file diff --git a/internal/ethapi/testdata/eth_getHeaderByHash-hash-latest-1.json b/internal/ethapi/testdata/eth_getHeaderByHash-hash-latest-1.json index 4721dd1e7a..39209a86db 100644 --- a/internal/ethapi/testdata/eth_getHeaderByHash-hash-latest-1.json +++ b/internal/ethapi/testdata/eth_getHeaderByHash-hash-latest-1.json @@ -15,6 +15,5 @@ "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", "stateRoot": "0x78b2b19ef1a0276dbbc23a875dbf60ae5d10dafa0017098473c4871abd3e7b5c", "timestamp": "0x5a", - "totalDifficulty": "0x1", "transactionsRoot": "0x0767ed8359337dc6a8fdc77fe52db611bed1be87aac73c4556b1bf1dd3d190a5" } \ No newline at end of file diff --git a/internal/ethapi/testdata/eth_getHeaderByHash-hash-latest.json b/internal/ethapi/testdata/eth_getHeaderByHash-hash-latest.json index 4dd5909159..5313348a50 100644 --- a/internal/ethapi/testdata/eth_getHeaderByHash-hash-latest.json +++ b/internal/ethapi/testdata/eth_getHeaderByHash-hash-latest.json @@ -15,6 +15,5 @@ "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", "stateRoot": "0x118f1433ae23c4d1c12f5bd652baddb72611c55ac1cd6af6620d209db222f9e6", "timestamp": "0x64", - "totalDifficulty": "0x1", "transactionsRoot": "0xb0893d21a4a44dc26a962a6e91abae66df87fb61ac9c60e936aee89c76331445" } \ No newline at end of file diff --git a/internal/ethapi/testdata/eth_getHeaderByNumber-number-0.json b/internal/ethapi/testdata/eth_getHeaderByNumber-number-0.json index 1bd68888b6..e1e64a3093 100644 --- a/internal/ethapi/testdata/eth_getHeaderByNumber-number-0.json +++ b/internal/ethapi/testdata/eth_getHeaderByNumber-number-0.json @@ -15,6 +15,5 @@ "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", "stateRoot": "0xd883f48b83cc9c1e8389453beb4ad4e572462eec049ca4fffbe16ecefb3fe937", "timestamp": "0x0", - "totalDifficulty": "0x1", "transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421" } \ No newline at end of file diff --git a/internal/ethapi/testdata/eth_getHeaderByNumber-number-1.json b/internal/ethapi/testdata/eth_getHeaderByNumber-number-1.json index cf662cad75..adfac5110c 100644 --- a/internal/ethapi/testdata/eth_getHeaderByNumber-number-1.json +++ b/internal/ethapi/testdata/eth_getHeaderByNumber-number-1.json @@ -15,6 +15,5 @@ "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", "stateRoot": "0x4acfcd1a6ab9f5e62411021ecd8a749976ae50b0590e967471264b372d7ac55b", "timestamp": "0xa", - "totalDifficulty": "0x1", "transactionsRoot": "0xca0ebcce920d2cdfbf9e1dbe90ed3441a1a576f344bd80e60508da814916f4e7" } \ No newline at end of file diff --git a/internal/ethapi/testdata/eth_getHeaderByNumber-number-latest-1.json b/internal/ethapi/testdata/eth_getHeaderByNumber-number-latest-1.json index 4721dd1e7a..39209a86db 100644 --- a/internal/ethapi/testdata/eth_getHeaderByNumber-number-latest-1.json +++ b/internal/ethapi/testdata/eth_getHeaderByNumber-number-latest-1.json @@ -15,6 +15,5 @@ "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", "stateRoot": "0x78b2b19ef1a0276dbbc23a875dbf60ae5d10dafa0017098473c4871abd3e7b5c", "timestamp": "0x5a", - "totalDifficulty": "0x1", "transactionsRoot": "0x0767ed8359337dc6a8fdc77fe52db611bed1be87aac73c4556b1bf1dd3d190a5" } \ No newline at end of file diff --git a/internal/ethapi/testdata/eth_getHeaderByNumber-tag-latest.json b/internal/ethapi/testdata/eth_getHeaderByNumber-tag-latest.json index 4dd5909159..5313348a50 100644 --- a/internal/ethapi/testdata/eth_getHeaderByNumber-tag-latest.json +++ b/internal/ethapi/testdata/eth_getHeaderByNumber-tag-latest.json @@ -15,6 +15,5 @@ "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", "stateRoot": "0x118f1433ae23c4d1c12f5bd652baddb72611c55ac1cd6af6620d209db222f9e6", "timestamp": "0x64", - "totalDifficulty": "0x1", "transactionsRoot": "0xb0893d21a4a44dc26a962a6e91abae66df87fb61ac9c60e936aee89c76331445" } \ No newline at end of file diff --git a/internal/ethapi/testdata/eth_getHeaderByNumber-tag-pending.json b/internal/ethapi/testdata/eth_getHeaderByNumber-tag-pending.json index da177f2189..289ff5fece 100644 --- a/internal/ethapi/testdata/eth_getHeaderByNumber-tag-pending.json +++ b/internal/ethapi/testdata/eth_getHeaderByNumber-tag-pending.json @@ -14,7 +14,6 @@ "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", "stateRoot": "0x0000000000000000000000000000000000000000000000000000000000000000", "timestamp": "0x2a", - "totalDifficulty": null, "transactionsRoot": "0x98d9f6dd0aa479c0fb448f2627e9f1964aca699fccab8f6e95861547a4699e37", "withdrawalsRoot": "0x73d756269cdfc22e7e17a3548e36f42f750ca06d7e3cd98d1b6d0eb5add9dc84" } \ No newline at end of file diff --git a/internal/jsre/deps/web3.js b/internal/jsre/deps/web3.js index b0fd8fcafc..a4141bac43 100644 --- a/internal/jsre/deps/web3.js +++ b/internal/jsre/deps/web3.js @@ -3854,7 +3854,6 @@ var outputBlockFormatter = function(block) { block.number = utils.toDecimal(block.number); block.difficulty = utils.toBigNumber(block.difficulty); - block.totalDifficulty = utils.toBigNumber(block.totalDifficulty); if (utils.isArray(block.transactions)) { block.transactions.forEach(function(item){ From f14f13bac74a091a726157ab548fe205a7d53cac Mon Sep 17 00:00:00 2001 From: Martin Holst Swende Date: Tue, 1 Oct 2024 15:14:30 +0200 Subject: [PATCH 15/18] params: go-ethereum v1.14.11 stable --- params/version.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/params/version.go b/params/version.go index 1fe2d3459d..b5c0dff7c0 100644 --- a/params/version.go +++ b/params/version.go @@ -21,10 +21,10 @@ import ( ) const ( - VersionMajor = 1 // Major version component of the current release - VersionMinor = 14 // Minor version component of the current release - VersionPatch = 11 // Patch version component of the current release - VersionMeta = "unstable" // Version metadata to append to the version string + VersionMajor = 1 // Major version component of the current release + VersionMinor = 14 // Minor version component of the current release + VersionPatch = 11 // Patch version component of the current release + VersionMeta = "stable" // Version metadata to append to the version string ) // Version holds the textual version string. From 096c4d266e204a99968b4e496f94e8a406310fdf Mon Sep 17 00:00:00 2001 From: Martin Holst Swende Date: Tue, 1 Oct 2024 15:19:15 +0200 Subject: [PATCH 16/18] params: begin v1.14.12 release cycle --- params/version.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/params/version.go b/params/version.go index b5c0dff7c0..e895503e7f 100644 --- a/params/version.go +++ b/params/version.go @@ -21,10 +21,10 @@ import ( ) const ( - VersionMajor = 1 // Major version component of the current release - VersionMinor = 14 // Minor version component of the current release - VersionPatch = 11 // Patch version component of the current release - VersionMeta = "stable" // Version metadata to append to the version string + VersionMajor = 1 // Major version component of the current release + VersionMinor = 14 // Minor version component of the current release + VersionPatch = 12 // Patch version component of the current release + VersionMeta = "unstable" // Version metadata to append to the version string ) // Version holds the textual version string. From eff0bed91bcbcd79f67a18bce00900a5e05f4549 Mon Sep 17 00:00:00 2001 From: rjl493456442 Date: Wed, 2 Oct 2024 00:16:16 +0800 Subject: [PATCH 17/18] core/rawdb: freezer index repair (#29792) This pull request removes the `fsync` of index files in freezer.ModifyAncients function for performance gain. Originally, fsync is added after each freezer write operation to ensure the written data is truly transferred into disk. Unfortunately, it turns out `fsync` can be relatively slow, especially on macOS (see https://github.com/ethereum/go-ethereum/issues/28754 for more information). In this pull request, fsync for index file is removed as it turns out index file can be recovered even after a unclean shutdown. But fsync for data file is still kept, as we have no meaningful way to validate the data correctness after unclean shutdown. --- **But why do we need the `fsync` in the first place?** As it's necessary for freezer to survive/recover after the machine crash (e.g. power failure). In linux, whenever the file write is performed, the file metadata update and data update are not necessarily performed at the same time. Typically, the metadata will be flushed/journalled ahead of the file data. Therefore, we make the pessimistic assumption that the file is first extended with invalid "garbage" data (normally zero bytes) and that afterwards the correct data replaces the garbage. We have observed that the index file of the freezer often contain garbage entry with zero value (filenumber = 0, offset = 0) after a machine power failure. It proves that the index file is extended without the data being flushed. And this corruption can destroy the whole freezer data eventually. Performing fsync after each write operation can reduce the time window for data to be transferred to the disk and ensure the correctness of the data in the disk to the greatest extent. --- **How can we maintain this guarantee without relying on fsync?** Because the items in the index file are strictly in order, we can leverage this characteristic to detect the corruption and truncate them when freezer is opened. Specifically these validation rules are performed for each index file: For two consecutive index items: - If their file numbers are the same, then the offset of the latter one MUST not be less than that of the former. - If the file number of the latter one is equal to that of the former plus one, then the offset of the latter one MUST not be 0. - If their file numbers are not equal, and the latter's file number is not equal to the former plus 1, the latter one is valid And also, for the first non-head item, it must refer to the earliest data file, or the next file if the earliest file is not sufficient to place the first item(very special case, only theoretical possible in tests) With these validation rules, we can detect the invalid item in index file with greatest possibility. --- But unfortunately, these scenarios are not covered and could still lead to a freezer corruption if it occurs: **All items in index file are in zero value** It's impossible to distinguish if they are truly zero (e.g. all the data entries maintained in freezer are zero size) or just the garbage left by OS. In this case, these index items will be kept by truncating the entire data file, namely the freezer is corrupted. However, we can consider that the probability of this situation occurring is quite low, and even if it occurs, the freezer can be considered to be close to an empty state. Rerun the state sync should be acceptable. **Index file is integral while relative data file is corrupted** It might be possible the data file is corrupted whose file size is extended correctly with garbage filled (e.g. zero bytes). In this case, it's impossible to detect the corruption by index validation. We can either choose to `fsync` the data file, or blindly believe that if index file is integral then the data file could be integral with very high chance. In this pull request, the first option is taken. --- core/rawdb/freezer_batch.go | 11 +-- core/rawdb/freezer_table.go | 137 ++++++++++++++++++++++++++++++- core/rawdb/freezer_table_test.go | 66 +++++++++++++++ triedb/pathdb/disklayer.go | 4 +- triedb/pathdb/nodebuffer.go | 13 ++- 5 files changed, 217 insertions(+), 14 deletions(-) diff --git a/core/rawdb/freezer_batch.go b/core/rawdb/freezer_batch.go index 84a63a4518..4e1b38df29 100644 --- a/core/rawdb/freezer_batch.go +++ b/core/rawdb/freezer_batch.go @@ -180,10 +180,10 @@ func (batch *freezerTableBatch) maybeCommit() error { return nil } -// commit writes the batched items to the backing freezerTable. +// commit writes the batched items to the backing freezerTable. Note index +// file isn't fsync'd after the file write, the recent write can be lost +// after the power failure. func (batch *freezerTableBatch) commit() error { - // Write data. The head file is fsync'd after write to ensure the - // data is truly transferred to disk. _, err := batch.t.head.Write(batch.dataBuffer) if err != nil { return err @@ -194,15 +194,10 @@ func (batch *freezerTableBatch) commit() error { dataSize := int64(len(batch.dataBuffer)) batch.dataBuffer = batch.dataBuffer[:0] - // Write indices. The index file is fsync'd after write to ensure the - // data indexes are truly transferred to disk. _, err = batch.t.index.Write(batch.indexBuffer) if err != nil { return err } - if err := batch.t.index.Sync(); err != nil { - return err - } indexSize := int64(len(batch.indexBuffer)) batch.indexBuffer = batch.indexBuffer[:0] diff --git a/core/rawdb/freezer_table.go b/core/rawdb/freezer_table.go index 4b9d510e82..a8ed17b371 100644 --- a/core/rawdb/freezer_table.go +++ b/core/rawdb/freezer_table.go @@ -17,6 +17,7 @@ package rawdb import ( + "bufio" "bytes" "encoding/binary" "errors" @@ -26,6 +27,7 @@ import ( "path/filepath" "sync" "sync/atomic" + "time" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/log" @@ -219,7 +221,13 @@ func (t *freezerTable) repair() error { return err } // New file can't trigger this path } - // Retrieve the file sizes and prepare for truncation + // Validate the index file as it might contain some garbage data after the + // power failures. + if err := t.repairIndex(); err != nil { + return err + } + // Retrieve the file sizes and prepare for truncation. Note the file size + // might be changed after index validation. if stat, err = t.index.Stat(); err != nil { return err } @@ -364,6 +372,133 @@ func (t *freezerTable) repair() error { return nil } +// repairIndex validates the integrity of the index file. According to the design, +// the initial entry in the file denotes the earliest data file along with the +// count of deleted items. Following this, all subsequent entries in the file must +// be in order. This function identifies any corrupted entries and truncates items +// occurring after the corruption point. +// +// corruption can occur because of the power failure. In the Linux kernel, the +// file metadata update and data update are not necessarily performed at the +// same time. Typically, the metadata will be flushed/journalled ahead of the file +// data. Therefore, we make the pessimistic assumption that the file is first +// extended with invalid "garbage" data (normally zero bytes) and that afterwards +// the correct data replaces the garbage. As all the items in index file are +// supposed to be in-order, the leftover garbage must be truncated before the +// index data is utilized. +// +// It's important to note an exception that's unfortunately undetectable: when +// all index entries in the file are zero. Distinguishing whether they represent +// leftover garbage or if all items in the table have zero size is impossible. +// In such instances, the file will remain unchanged to prevent potential data +// loss or misinterpretation. +func (t *freezerTable) repairIndex() error { + // Retrieve the file sizes and prepare for validation + stat, err := t.index.Stat() + if err != nil { + return err + } + size := stat.Size() + + // Move the read cursor to the beginning of the file + _, err = t.index.Seek(0, io.SeekStart) + if err != nil { + return err + } + fr := bufio.NewReader(t.index) + + var ( + start = time.Now() + buff = make([]byte, indexEntrySize) + prev indexEntry + head indexEntry + + read = func() (indexEntry, error) { + n, err := io.ReadFull(fr, buff) + if err != nil { + return indexEntry{}, err + } + if n != indexEntrySize { + return indexEntry{}, fmt.Errorf("failed to read from index, n: %d", n) + } + var entry indexEntry + entry.unmarshalBinary(buff) + return entry, nil + } + truncate = func(offset int64) error { + if t.readonly { + return fmt.Errorf("index file is corrupted at %d, size: %d", offset, size) + } + if err := truncateFreezerFile(t.index, offset); err != nil { + return err + } + log.Warn("Truncated index file", "offset", offset, "truncated", size-offset) + return nil + } + ) + for offset := int64(0); offset < size; offset += indexEntrySize { + entry, err := read() + if err != nil { + return err + } + if offset == 0 { + head = entry + continue + } + // Ensure that the first non-head index refers to the earliest file, + // or the next file if the earliest file has no space to place the + // first item. + if offset == indexEntrySize { + if entry.filenum != head.filenum && entry.filenum != head.filenum+1 { + log.Error("Corrupted index item detected", "earliest", head.filenum, "filenumber", entry.filenum) + return truncate(offset) + } + prev = entry + continue + } + // ensure two consecutive index items are in order + if err := t.checkIndexItems(prev, entry); err != nil { + log.Error("Corrupted index item detected", "err", err) + return truncate(offset) + } + prev = entry + } + // Move the read cursor to the end of the file. While theoretically, the + // cursor should reach the end by reading all the items in the file, perform + // the seek operation anyway as a precaution. + _, err = t.index.Seek(0, io.SeekEnd) + if err != nil { + return err + } + log.Debug("Verified index file", "items", size/indexEntrySize, "elapsed", common.PrettyDuration(time.Since(start))) + return nil +} + +// checkIndexItems validates the correctness of two consecutive index items based +// on the following rules: +// +// - The file number of two consecutive index items must either be the same or +// increase monotonically. If the file number decreases or skips in a +// non-sequential manner, the index item is considered invalid. +// +// - For index items with the same file number, the data offset must be in +// non-decreasing order. Note: Two index items with the same file number +// and the same data offset are permitted if the entry size is zero. +// +// - The first index item in a new data file must not have a zero data offset. +func (t *freezerTable) checkIndexItems(a, b indexEntry) error { + if b.filenum != a.filenum && b.filenum != a.filenum+1 { + return fmt.Errorf("index items with inconsistent file number, prev: %d, next: %d", a.filenum, b.filenum) + } + if b.filenum == a.filenum && b.offset < a.offset { + return fmt.Errorf("index items with unordered offset, prev: %d, next: %d", a.offset, b.offset) + } + if b.filenum == a.filenum+1 && b.offset == 0 { + return fmt.Errorf("index items with zero offset, file number: %d", b.filenum) + } + return nil +} + // preopen opens all files that the freezer will need. This method should be called from an init-context, // since it assumes that it doesn't have to bother with locking // The rationale for doing preopen is to not have to do it from within Retrieve, thus not needing to ever diff --git a/core/rawdb/freezer_table_test.go b/core/rawdb/freezer_table_test.go index 91b4943e59..fd6e3cf199 100644 --- a/core/rawdb/freezer_table_test.go +++ b/core/rawdb/freezer_table_test.go @@ -1367,3 +1367,69 @@ func TestRandom(t *testing.T) { t.Fatal(err) } } + +func TestIndexValidation(t *testing.T) { + const ( + items = 30 + dataSize = 10 + ) + garbage := indexEntry{ + filenum: 100, + offset: 200, + } + var cases = []struct { + offset int64 + data []byte + expItems int + }{ + // extend index file with zero bytes at the end + { + offset: (items + 1) * indexEntrySize, + data: make([]byte, indexEntrySize), + expItems: 30, + }, + // write garbage in the first non-head item + { + offset: indexEntrySize, + data: garbage.append(nil), + expItems: 0, + }, + // write garbage in the first non-head item + { + offset: (items/2 + 1) * indexEntrySize, + data: garbage.append(nil), + expItems: items / 2, + }, + } + for _, c := range cases { + fn := fmt.Sprintf("t-%d", rand.Uint64()) + f, err := newTable(os.TempDir(), fn, metrics.NewMeter(), metrics.NewMeter(), metrics.NewGauge(), 100, true, false) + if err != nil { + t.Fatal(err) + } + writeChunks(t, f, items, dataSize) + + // write corrupted data + f.index.WriteAt(c.data, c.offset) + f.Close() + + // reopen the table, corruption should be truncated + f, err = newTable(os.TempDir(), fn, metrics.NewMeter(), metrics.NewMeter(), metrics.NewGauge(), 100, true, false) + if err != nil { + t.Fatal(err) + } + for i := 0; i < c.expItems; i++ { + exp := getChunk(10, i) + got, err := f.Retrieve(uint64(i)) + if err != nil { + t.Fatalf("Failed to read from table, %v", err) + } + if !bytes.Equal(exp, got) { + t.Fatalf("Unexpected item data, want: %v, got: %v", exp, got) + } + } + if f.items.Load() != uint64(c.expItems) { + t.Fatalf("Unexpected item number, want: %d, got: %d", c.expItems, f.items.Load()) + } + } +} diff --git a/triedb/pathdb/disklayer.go b/triedb/pathdb/disklayer.go index b6ae39446c..eadcfacef7 100644 --- a/triedb/pathdb/disklayer.go +++ b/triedb/pathdb/disklayer.go @@ -202,7 +202,7 @@ func (dl *diskLayer) commit(bottom *diffLayer, force bool) (*diskLayer, error) { if !force && rawdb.ReadPersistentStateID(dl.db.diskdb) < oldest { force = true } - if err := ndl.buffer.flush(ndl.db.diskdb, ndl.cleans, ndl.id, force); err != nil { + if err := ndl.buffer.flush(ndl.db.diskdb, ndl.db.freezer, ndl.cleans, ndl.id, force); err != nil { return nil, err } // To remove outdated history objects from the end, we set the 'tail' parameter @@ -267,7 +267,7 @@ func (dl *diskLayer) setBufferSize(size int) error { if dl.stale { return errSnapshotStale } - return dl.buffer.setSize(size, dl.db.diskdb, dl.cleans, dl.id) + return dl.buffer.setSize(size, dl.db.diskdb, dl.db.freezer, dl.cleans, dl.id) } // size returns the approximate size of cached nodes in the disk layer. diff --git a/triedb/pathdb/nodebuffer.go b/triedb/pathdb/nodebuffer.go index d3492602c8..a4788ff9ba 100644 --- a/triedb/pathdb/nodebuffer.go +++ b/triedb/pathdb/nodebuffer.go @@ -194,9 +194,9 @@ func (b *nodebuffer) empty() bool { // setSize sets the buffer size to the provided number, and invokes a flush // operation if the current memory usage exceeds the new limit. -func (b *nodebuffer) setSize(size int, db ethdb.KeyValueStore, clean *fastcache.Cache, id uint64) error { +func (b *nodebuffer) setSize(size int, db ethdb.KeyValueStore, freezer ethdb.AncientStore, clean *fastcache.Cache, id uint64) error { b.limit = uint64(size) - return b.flush(db, clean, id, false) + return b.flush(db, freezer, clean, id, false) } // allocBatch returns a database batch with pre-allocated buffer. @@ -214,7 +214,7 @@ func (b *nodebuffer) allocBatch(db ethdb.KeyValueStore) ethdb.Batch { // flush persists the in-memory dirty trie node into the disk if the configured // memory threshold is reached. Note, all data must be written atomically. -func (b *nodebuffer) flush(db ethdb.KeyValueStore, clean *fastcache.Cache, id uint64, force bool) error { +func (b *nodebuffer) flush(db ethdb.KeyValueStore, freezer ethdb.AncientWriter, clean *fastcache.Cache, id uint64, force bool) error { if b.size <= b.limit && !force { return nil } @@ -227,6 +227,13 @@ func (b *nodebuffer) flush(db ethdb.KeyValueStore, clean *fastcache.Cache, id ui start = time.Now() batch = b.allocBatch(db) ) + // Explicitly sync the state freezer, ensuring that all written + // data is transferred to disk before updating the key-value store. + if freezer != nil { + if err := freezer.Sync(); err != nil { + return err + } + } nodes := writeNodes(batch, b.nodes, clean) rawdb.WritePersistentStateID(batch, id) From 6416813cbee3c548a3fe110bb779cd9f9fa47b04 Mon Sep 17 00:00:00 2001 From: Sina M <1591639+s1na@users.noreply.github.com> Date: Tue, 1 Oct 2024 18:27:25 +0200 Subject: [PATCH 18/18] internal/web3ext: rm unused modules (#30532) Remove console extensions for already deleted API namespaces (les, vflux and ethash). --- internal/web3ext/web3ext.go | 116 ------------------------------------ 1 file changed, 116 deletions(-) diff --git a/internal/web3ext/web3ext.go b/internal/web3ext/web3ext.go index 4a53e2c829..927ebc2ef0 100644 --- a/internal/web3ext/web3ext.go +++ b/internal/web3ext/web3ext.go @@ -20,7 +20,6 @@ package web3ext var Modules = map[string]string{ "admin": AdminJs, "clique": CliqueJs, - "ethash": EthashJs, "debug": DebugJs, "eth": EthJs, "miner": MinerJs, @@ -28,8 +27,6 @@ var Modules = map[string]string{ "personal": PersonalJs, "rpc": RpcJs, "txpool": TxpoolJs, - "les": LESJs, - "vflux": VfluxJs, "dev": DevJs, } @@ -90,34 +87,6 @@ web3._extend({ }); ` -const EthashJs = ` -web3._extend({ - property: 'ethash', - methods: [ - new web3._extend.Method({ - name: 'getWork', - call: 'ethash_getWork', - params: 0 - }), - new web3._extend.Method({ - name: 'getHashrate', - call: 'ethash_getHashrate', - params: 0 - }), - new web3._extend.Method({ - name: 'submitWork', - call: 'ethash_submitWork', - params: 3, - }), - new web3._extend.Method({ - name: 'submitHashrate', - call: 'ethash_submitHashrate', - params: 2, - }), - ] -}); -` - const AdminJs = ` web3._extend({ property: 'admin', @@ -790,91 +759,6 @@ web3._extend({ }); ` -const LESJs = ` -web3._extend({ - property: 'les', - methods: - [ - new web3._extend.Method({ - name: 'getCheckpoint', - call: 'les_getCheckpoint', - params: 1 - }), - new web3._extend.Method({ - name: 'clientInfo', - call: 'les_clientInfo', - params: 1 - }), - new web3._extend.Method({ - name: 'priorityClientInfo', - call: 'les_priorityClientInfo', - params: 3 - }), - new web3._extend.Method({ - name: 'setClientParams', - call: 'les_setClientParams', - params: 2 - }), - new web3._extend.Method({ - name: 'setDefaultParams', - call: 'les_setDefaultParams', - params: 1 - }), - new web3._extend.Method({ - name: 'addBalance', - call: 'les_addBalance', - params: 2 - }), - ], - properties: - [ - new web3._extend.Property({ - name: 'latestCheckpoint', - getter: 'les_latestCheckpoint' - }), - new web3._extend.Property({ - name: 'checkpointContractAddress', - getter: 'les_getCheckpointContractAddress' - }), - new web3._extend.Property({ - name: 'serverInfo', - getter: 'les_serverInfo' - }), - ] -}); -` - -const VfluxJs = ` -web3._extend({ - property: 'vflux', - methods: - [ - new web3._extend.Method({ - name: 'distribution', - call: 'vflux_distribution', - params: 2 - }), - new web3._extend.Method({ - name: 'timeout', - call: 'vflux_timeout', - params: 2 - }), - new web3._extend.Method({ - name: 'value', - call: 'vflux_value', - params: 2 - }), - ], - properties: - [ - new web3._extend.Property({ - name: 'requestStats', - getter: 'vflux_requestStats' - }), - ] -}); -` - const DevJs = ` web3._extend({ property: 'dev',