diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index ee86e72a8902..6cdd0bd4a8b9 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -6,6 +6,9 @@ jobs: linter-check: runs-on: ubuntu-latest steps: + - uses: actions/setup-go@v2 + with: + go-version: '1.16.x' - uses: actions/checkout@v2 - name: Run linter run: go run build/ci.go lint \ No newline at end of file diff --git a/.github/workflows/on-master.yaml b/.github/workflows/on-master.yaml index a040e6d75a4a..62da01757d38 100644 --- a/.github/workflows/on-master.yaml +++ b/.github/workflows/on-master.yaml @@ -3,6 +3,7 @@ name: Docker Build and publish to Github on: push: branches: + - v1.10.9-statediff - v1.10.8-statediff - v1.10.7-statediff - v1.10.6-statediff diff --git a/.github/workflows/on-pr.yml b/.github/workflows/on-pr.yml index 7f9ea6fae25b..75b4da6c821a 100644 --- a/.github/workflows/on-pr.yml +++ b/.github/workflows/on-pr.yml @@ -15,7 +15,7 @@ jobs: name: Run geth unit test strategy: matrix: - go-version: [ 1.15.x] + go-version: [ 1.16.x] platform: [ubuntu-latest] runs-on: ${{ matrix.platform }} env: @@ -43,7 +43,7 @@ jobs: GOPATH: /tmp/go strategy: matrix: - go-version: [ 1.15.x] + go-version: [ 1.16.x] platform: [ubuntu-latest] runs-on: ${{ matrix.platform }} steps: diff --git a/statediff/builder.go b/statediff/builder.go index bb21e34e121a..7befb6b3c765 100644 --- a/statediff/builder.go +++ b/statediff/builder.go @@ -112,7 +112,7 @@ func (sdb *builder) buildStateTrie(it trie.NodeIterator) ([]StateNode, []CodeAnd } switch node.NodeType { case Leaf: - var account state.Account + var account types.StateAccount if err := rlp.DecodeBytes(nodeElements[1].([]byte), &account); err != nil { return nil, nil, fmt.Errorf("error decoding account for leaf node at path %x nerror: %v", node.Path, err) } @@ -305,7 +305,7 @@ func (sdb *builder) createdAndUpdatedState(a, b trie.NodeIterator, watchedAddres if node.NodeType == Leaf { // created vs updated is important for leaf nodes since we need to diff their storage // so we need to map all changed accounts at B to their leafkey, since account can change pathes but not leafkey - var account state.Account + var account types.StateAccount if err := rlp.DecodeBytes(nodeElements[1].([]byte), &account); err != nil { return nil, nil, fmt.Errorf("error decoding account for leaf node at path %x nerror: %v", node.Path, err) } @@ -350,7 +350,7 @@ func (sdb *builder) createdAndUpdatedStateWithIntermediateNodes(a, b trie.NodeIt case Leaf: // created vs updated is important for leaf nodes since we need to diff their storage // so we need to map all changed accounts at B to their leafkey, since account can change paths but not leafkey - var account state.Account + var account types.StateAccount if err := rlp.DecodeBytes(nodeElements[1].([]byte), &account); err != nil { return nil, nil, fmt.Errorf("error decoding account for leaf node at path %x nerror: %v", node.Path, err) } @@ -401,7 +401,7 @@ func (sdb *builder) deletedOrUpdatedState(a, b trie.NodeIterator, diffPathsAtB m switch node.NodeType { case Leaf: // map all different accounts at A to their leafkey - var account state.Account + var account types.StateAccount if err := rlp.DecodeBytes(nodeElements[1].([]byte), &account); err != nil { return nil, fmt.Errorf("error decoding account for leaf node at path %x nerror: %v", node.Path, err) } diff --git a/statediff/builder_test.go b/statediff/builder_test.go index 1cd8ea0f14f4..6a88bbba0ad8 100644 --- a/statediff/builder_test.go +++ b/statediff/builder_test.go @@ -25,7 +25,6 @@ import ( "testing" "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/state" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/rlp" @@ -79,7 +78,7 @@ var ( slot0StorageValue, }) - contractAccountAtBlock2, _ = rlp.EncodeToBytes(state.Account{ + contractAccountAtBlock2, _ = rlp.EncodeToBytes(types.StateAccount{ Nonce: 1, Balance: big.NewInt(0), CodeHash: common.HexToHash("0xaaea5efba4fd7b45d7ec03918ac5d8b31aa93b48986af0e6b591f0f087c80127").Bytes(), @@ -89,7 +88,7 @@ var ( common.Hex2Bytes("3114658a74d9cc9f7acf2c5cd696c3494d7c344d78bfec3add0d91ec4e8d1c45"), contractAccountAtBlock2, }) - contractAccountAtBlock3, _ = rlp.EncodeToBytes(state.Account{ + contractAccountAtBlock3, _ = rlp.EncodeToBytes(types.StateAccount{ Nonce: 1, Balance: big.NewInt(0), CodeHash: common.HexToHash("0xaaea5efba4fd7b45d7ec03918ac5d8b31aa93b48986af0e6b591f0f087c80127").Bytes(), @@ -99,7 +98,7 @@ var ( common.Hex2Bytes("3114658a74d9cc9f7acf2c5cd696c3494d7c344d78bfec3add0d91ec4e8d1c45"), contractAccountAtBlock3, }) - contractAccountAtBlock4, _ = rlp.EncodeToBytes(state.Account{ + contractAccountAtBlock4, _ = rlp.EncodeToBytes(types.StateAccount{ Nonce: 1, Balance: big.NewInt(0), CodeHash: common.HexToHash("0xaaea5efba4fd7b45d7ec03918ac5d8b31aa93b48986af0e6b591f0f087c80127").Bytes(), @@ -109,7 +108,7 @@ var ( common.Hex2Bytes("3114658a74d9cc9f7acf2c5cd696c3494d7c344d78bfec3add0d91ec4e8d1c45"), contractAccountAtBlock4, }) - contractAccountAtBlock5, _ = rlp.EncodeToBytes(state.Account{ + contractAccountAtBlock5, _ = rlp.EncodeToBytes(types.StateAccount{ Nonce: 1, Balance: big.NewInt(0), CodeHash: common.HexToHash("0xaaea5efba4fd7b45d7ec03918ac5d8b31aa93b48986af0e6b591f0f087c80127").Bytes(), @@ -120,7 +119,7 @@ var ( contractAccountAtBlock5, }) - minerAccountAtBlock1, _ = rlp.EncodeToBytes(state.Account{ + minerAccountAtBlock1, _ = rlp.EncodeToBytes(types.StateAccount{ Nonce: 0, Balance: big.NewInt(2000002625000000000), CodeHash: testhelpers.NullCodeHash.Bytes(), @@ -130,7 +129,7 @@ var ( common.Hex2Bytes("3380c7b7ae81a58eb98d9c78de4a1fd7fd9535fc953ed2be602daaa41767312a"), minerAccountAtBlock1, }) - minerAccountAtBlock2, _ = rlp.EncodeToBytes(state.Account{ + minerAccountAtBlock2, _ = rlp.EncodeToBytes(types.StateAccount{ Nonce: 0, Balance: big.NewInt(4000111203461610525), CodeHash: testhelpers.NullCodeHash.Bytes(), @@ -141,7 +140,7 @@ var ( minerAccountAtBlock2, }) - account1AtBlock1, _ = rlp.EncodeToBytes(state.Account{ + account1AtBlock1, _ = rlp.EncodeToBytes(types.StateAccount{ Nonce: 0, Balance: testhelpers.Block1Account1Balance, CodeHash: testhelpers.NullCodeHash.Bytes(), @@ -151,7 +150,7 @@ var ( common.Hex2Bytes("3926db69aaced518e9b9f0f434a473e7174109c943548bb8f23be41ca76d9ad2"), account1AtBlock1, }) - account1AtBlock2, _ = rlp.EncodeToBytes(state.Account{ + account1AtBlock2, _ = rlp.EncodeToBytes(types.StateAccount{ Nonce: 2, Balance: big.NewInt(999555797000009000), CodeHash: testhelpers.NullCodeHash.Bytes(), @@ -161,7 +160,7 @@ var ( common.Hex2Bytes("3926db69aaced518e9b9f0f434a473e7174109c943548bb8f23be41ca76d9ad2"), account1AtBlock2, }) - account1AtBlock5, _ = rlp.EncodeToBytes(state.Account{ + account1AtBlock5, _ = rlp.EncodeToBytes(types.StateAccount{ Nonce: 2, Balance: big.NewInt(2999566008847709960), CodeHash: testhelpers.NullCodeHash.Bytes(), @@ -171,7 +170,7 @@ var ( common.Hex2Bytes("3926db69aaced518e9b9f0f434a473e7174109c943548bb8f23be41ca76d9ad2"), account1AtBlock5, }) - account1AtBlock6, _ = rlp.EncodeToBytes(state.Account{ + account1AtBlock6, _ = rlp.EncodeToBytes(types.StateAccount{ Nonce: 3, Balance: big.NewInt(2999537516847709960), CodeHash: testhelpers.NullCodeHash.Bytes(), @@ -182,7 +181,7 @@ var ( account1AtBlock6, }) - account2AtBlock2, _ = rlp.EncodeToBytes(state.Account{ + account2AtBlock2, _ = rlp.EncodeToBytes(types.StateAccount{ Nonce: 0, Balance: big.NewInt(1000), CodeHash: testhelpers.NullCodeHash.Bytes(), @@ -192,7 +191,7 @@ var ( common.Hex2Bytes("3957f3e2f04a0764c3a0491b175f69926da61efbcc8f61fa1455fd2d2b4cdd45"), account2AtBlock2, }) - account2AtBlock3, _ = rlp.EncodeToBytes(state.Account{ + account2AtBlock3, _ = rlp.EncodeToBytes(types.StateAccount{ Nonce: 0, Balance: big.NewInt(2000013574009435976), CodeHash: testhelpers.NullCodeHash.Bytes(), @@ -202,7 +201,7 @@ var ( common.Hex2Bytes("3957f3e2f04a0764c3a0491b175f69926da61efbcc8f61fa1455fd2d2b4cdd45"), account2AtBlock3, }) - account2AtBlock4, _ = rlp.EncodeToBytes(state.Account{ + account2AtBlock4, _ = rlp.EncodeToBytes(types.StateAccount{ Nonce: 0, Balance: big.NewInt(4000048088163070348), CodeHash: testhelpers.NullCodeHash.Bytes(), @@ -212,7 +211,7 @@ var ( common.Hex2Bytes("3957f3e2f04a0764c3a0491b175f69926da61efbcc8f61fa1455fd2d2b4cdd45"), account2AtBlock4, }) - account2AtBlock6, _ = rlp.EncodeToBytes(state.Account{ + account2AtBlock6, _ = rlp.EncodeToBytes(types.StateAccount{ Nonce: 0, Balance: big.NewInt(6000063293259748636), CodeHash: testhelpers.NullCodeHash.Bytes(), @@ -223,7 +222,7 @@ var ( account2AtBlock6, }) - bankAccountAtBlock0, _ = rlp.EncodeToBytes(state.Account{ + bankAccountAtBlock0, _ = rlp.EncodeToBytes(types.StateAccount{ Nonce: 0, Balance: big.NewInt(testhelpers.TestBankFunds.Int64()), CodeHash: testhelpers.NullCodeHash.Bytes(), @@ -235,7 +234,7 @@ var ( }) block1BankBalance = big.NewInt(testhelpers.TestBankFunds.Int64() - testhelpers.BalanceChange10000 - testhelpers.GasFees) - bankAccountAtBlock1, _ = rlp.EncodeToBytes(state.Account{ + bankAccountAtBlock1, _ = rlp.EncodeToBytes(types.StateAccount{ Nonce: 1, Balance: block1BankBalance, CodeHash: testhelpers.NullCodeHash.Bytes(), @@ -247,7 +246,7 @@ var ( }) block2BankBalance = block1BankBalance.Int64() - testhelpers.BalanceChange1Ether - testhelpers.GasFees - bankAccountAtBlock2, _ = rlp.EncodeToBytes(state.Account{ + bankAccountAtBlock2, _ = rlp.EncodeToBytes(types.StateAccount{ Nonce: 2, Balance: big.NewInt(block2BankBalance), CodeHash: testhelpers.NullCodeHash.Bytes(), @@ -257,7 +256,7 @@ var ( common.Hex2Bytes("30bf49f440a1cd0527e4d06e2765654c0f56452257516d793a9b8d604dcfdf2a"), bankAccountAtBlock2, }) - bankAccountAtBlock3, _ = rlp.EncodeToBytes(state.Account{ + bankAccountAtBlock3, _ = rlp.EncodeToBytes(types.StateAccount{ Nonce: 3, Balance: big.NewInt(999914255999990000), CodeHash: testhelpers.NullCodeHash.Bytes(), @@ -267,7 +266,7 @@ var ( common.Hex2Bytes("30bf49f440a1cd0527e4d06e2765654c0f56452257516d793a9b8d604dcfdf2a"), bankAccountAtBlock3, }) - bankAccountAtBlock4, _ = rlp.EncodeToBytes(state.Account{ + bankAccountAtBlock4, _ = rlp.EncodeToBytes(types.StateAccount{ Nonce: 6, Balance: big.NewInt(999826859999990000), CodeHash: testhelpers.NullCodeHash.Bytes(), @@ -277,7 +276,7 @@ var ( common.Hex2Bytes("30bf49f440a1cd0527e4d06e2765654c0f56452257516d793a9b8d604dcfdf2a"), bankAccountAtBlock4, }) - bankAccountAtBlock5, _ = rlp.EncodeToBytes(state.Account{ + bankAccountAtBlock5, _ = rlp.EncodeToBytes(types.StateAccount{ Nonce: 7, Balance: big.NewInt(999805027999990000), CodeHash: testhelpers.NullCodeHash.Bytes(), @@ -1727,7 +1726,7 @@ var ( slot00StorageValue, }) - contractAccountAtBlock01, _ = rlp.EncodeToBytes(state.Account{ + contractAccountAtBlock01, _ = rlp.EncodeToBytes(types.StateAccount{ Nonce: 1, Balance: big.NewInt(0), CodeHash: common.HexToHash("0xaaea5efba4fd7b45d7ec03918ac5d8b31aa93b48986af0e6b591f0f087c80127").Bytes(), @@ -1738,7 +1737,7 @@ var ( contractAccountAtBlock01, }) - bankAccountAtBlock01, _ = rlp.EncodeToBytes(state.Account{ + bankAccountAtBlock01, _ = rlp.EncodeToBytes(types.StateAccount{ Nonce: 1, Balance: big.NewInt(3999629697375000000), CodeHash: testhelpers.NullCodeHash.Bytes(), @@ -1748,7 +1747,7 @@ var ( common.Hex2Bytes("30bf49f440a1cd0527e4d06e2765654c0f56452257516d793a9b8d604dcfdf2a"), bankAccountAtBlock01, }) - bankAccountAtBlock02, _ = rlp.EncodeToBytes(state.Account{ + bankAccountAtBlock02, _ = rlp.EncodeToBytes(types.StateAccount{ Nonce: 2, Balance: big.NewInt(5999607323457344852), CodeHash: testhelpers.NullCodeHash.Bytes(), diff --git a/statediff/indexer/indexer.go b/statediff/indexer/indexer.go index 82761df77323..bab5fa938e65 100644 --- a/statediff/indexer/indexer.go +++ b/statediff/indexer/indexer.go @@ -23,8 +23,12 @@ import ( "math/big" "time" + "github.com/ipfs/go-cid" + node "github.com/ipfs/go-ipld-format" + "github.com/jmoiron/sqlx" + "github.com/multiformats/go-multihash" + "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/state" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/log" @@ -36,10 +40,6 @@ import ( "github.com/ethereum/go-ethereum/statediff/indexer/postgres" "github.com/ethereum/go-ethereum/statediff/indexer/shared" sdtypes "github.com/ethereum/go-ethereum/statediff/types" - "github.com/ipfs/go-cid" - node "github.com/ipfs/go-ipld-format" - "github.com/jmoiron/sqlx" - "github.com/multiformats/go-multihash" ) var ( @@ -487,7 +487,7 @@ func (sdi *StateDiffIndexer) PushStateNode(tx *BlockTx, stateNode sdtypes.StateN if len(i) != 2 { return fmt.Errorf("eth IPLDPublisher expected state leaf node rlp to decode into two elements") } - var account state.Account + var account types.StateAccount if err := rlp.DecodeBytes(i[1].([]byte), &account); err != nil { return fmt.Errorf("error decoding state account rlp: %s", err.Error()) } diff --git a/statediff/indexer/ipfs/ipld/shared.go b/statediff/indexer/ipfs/ipld/shared.go index 41887be2d706..993e00b42085 100644 --- a/statediff/indexer/ipfs/ipld/shared.go +++ b/statediff/indexer/ipfs/ipld/shared.go @@ -20,6 +20,9 @@ import ( "bytes" "errors" + "github.com/ipfs/go-cid" + mh "github.com/multiformats/go-multihash" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/rawdb" "github.com/ethereum/go-ethereum/ethdb" @@ -27,8 +30,6 @@ import ( sdtrie "github.com/ethereum/go-ethereum/statediff/trie" sdtypes "github.com/ethereum/go-ethereum/statediff/types" "github.com/ethereum/go-ethereum/trie" - "github.com/ipfs/go-cid" - mh "github.com/multiformats/go-multihash" ) // IPLD Codecs for Ethereum @@ -131,7 +132,7 @@ func (lt *localTrie) rootHash() []byte { func (lt *localTrie) commit() error { // commit trie nodes to trieDB var err error - _, err = lt.trie.Commit(nil) + _, _, err = lt.trie.Commit(nil) if err != nil { return err } diff --git a/statediff/indexer/mocks/test_data.go b/statediff/indexer/mocks/test_data.go index e658640b9692..2d544b6ea04b 100644 --- a/statediff/indexer/mocks/test_data.go +++ b/statediff/indexer/mocks/test_data.go @@ -27,7 +27,6 @@ import ( "github.com/ethereum/go-ethereum/trie" "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/state" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/log" @@ -113,7 +112,7 @@ var ( ContractRoot = "0x821e2556a290c86405f8160a2d662042a431ba456b9db265c79bb837c04be5f0" ContractCodeHash = common.HexToHash("0x753f98a8d4328b15636e46f66f2cb4bc860100aa17967cc145fcd17d1d4710ea") ContractLeafKey = testhelpers.AddressToLeafKey(ContractAddress) - ContractAccount, _ = rlp.EncodeToBytes(state.Account{ + ContractAccount, _ = rlp.EncodeToBytes(types.StateAccount{ Nonce: nonce1, Balance: big.NewInt(0), CodeHash: ContractCodeHash.Bytes(), @@ -130,7 +129,7 @@ var ( AccountCodeHash = common.HexToHash("0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470") AccountLeafKey = testhelpers.Account2LeafKey RemovedLeafKey = testhelpers.Account1LeafKey - Account, _ = rlp.EncodeToBytes(state.Account{ + Account, _ = rlp.EncodeToBytes(types.StateAccount{ Nonce: nonce0, Balance: big.NewInt(1000), CodeHash: AccountCodeHash.Bytes(), diff --git a/statediff/mainnet_tests/builder_test.go b/statediff/mainnet_tests/builder_test.go index bb6443f753d4..859f0048976d 100644 --- a/statediff/mainnet_tests/builder_test.go +++ b/statediff/mainnet_tests/builder_test.go @@ -30,7 +30,6 @@ import ( "github.com/ethereum/go-ethereum/consensus/ethash" "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/state" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/crypto" @@ -51,7 +50,7 @@ var ( emptyStorage = make([]sdtypes.StorageNode, 0) // block 1 data - block1CoinbaseAccount, _ = rlp.EncodeToBytes(state.Account{ + block1CoinbaseAccount, _ = rlp.EncodeToBytes(types.StateAccount{ Nonce: 0, Balance: big.NewInt(5000000000000000000), CodeHash: testhelpers.NullCodeHash.Bytes(), @@ -123,7 +122,7 @@ var ( }) // block 2 data - block2CoinbaseAccount, _ = rlp.EncodeToBytes(state.Account{ + block2CoinbaseAccount, _ = rlp.EncodeToBytes(types.StateAccount{ Nonce: 0, Balance: big.NewInt(5000000000000000000), CodeHash: testhelpers.NullCodeHash.Bytes(), @@ -135,7 +134,7 @@ var ( }) block2CoinbaseLeafNodeHash = crypto.Keccak256(block2CoinbaseLeafNode) block2MovedPremineBalance, _ = new(big.Int).SetString("4000000000000000000000", 10) - block2MovedPremineAccount, _ = rlp.EncodeToBytes(state.Account{ + block2MovedPremineAccount, _ = rlp.EncodeToBytes(types.StateAccount{ Nonce: 0, Balance: block2MovedPremineBalance, CodeHash: testhelpers.NullCodeHash.Bytes(), @@ -229,7 +228,7 @@ var ( // block3 data // path 060e0f blcok3CoinbaseBalance, _ = new(big.Int).SetString("5156250000000000000", 10) - block3CoinbaseAccount, _ = rlp.EncodeToBytes(state.Account{ + block3CoinbaseAccount, _ = rlp.EncodeToBytes(types.StateAccount{ Nonce: 0, Balance: blcok3CoinbaseBalance, CodeHash: testhelpers.NullCodeHash.Bytes(), @@ -242,7 +241,7 @@ var ( block3CoinbaseLeafNodeHash = crypto.Keccak256(block3CoinbaseLeafNode) // path 0c0e050703 block3MovedPremineBalance1, _ = new(big.Int).SetString("3750000000000000000", 10) - block3MovedPremineAccount1, _ = rlp.EncodeToBytes(state.Account{ + block3MovedPremineAccount1, _ = rlp.EncodeToBytes(types.StateAccount{ Nonce: 0, Balance: block3MovedPremineBalance1, CodeHash: testhelpers.NullCodeHash.Bytes(), @@ -255,7 +254,7 @@ var ( block3MovedPremineLeafNodeHash1 = crypto.Keccak256(block3MovedPremineLeafNode1) // path 0c0e050708 block3MovedPremineBalance2, _ = new(big.Int).SetString("1999944000000000000000", 10) - block3MovedPremineAccount2, _ = rlp.EncodeToBytes(state.Account{ + block3MovedPremineAccount2, _ = rlp.EncodeToBytes(types.StateAccount{ Nonce: 0, Balance: block3MovedPremineBalance2, CodeHash: testhelpers.NullCodeHash.Bytes(), diff --git a/statediff/service.go b/statediff/service.go index cc7b821a3481..edf1ca8f4155 100644 --- a/statediff/service.go +++ b/statediff/service.go @@ -605,7 +605,7 @@ func (sds *Service) StreamCodeAndCodeHash(blockNumber uint64, outChan chan<- Cod return default: } - account := new(state.Account) + account := new(types.StateAccount) if err := rlp.DecodeBytes(leafIt.Value, account); err != nil { log.Error("error decoding state account", "err", err) return diff --git a/statediff/testhelpers/mocks/service_test.go b/statediff/testhelpers/mocks/service_test.go index a4f2c0d49b78..3543036e3920 100644 --- a/statediff/testhelpers/mocks/service_test.go +++ b/statediff/testhelpers/mocks/service_test.go @@ -26,7 +26,6 @@ import ( "testing" "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/state" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/rlp" "github.com/ethereum/go-ethereum/rpc" @@ -39,7 +38,7 @@ var ( emptyStorage = make([]sdtypes.StorageNode, 0) block0, block1 *types.Block minerLeafKey = testhelpers.AddressToLeafKey(common.HexToAddress("0x0")) - account1, _ = rlp.EncodeToBytes(state.Account{ + account1, _ = rlp.EncodeToBytes(types.StateAccount{ Nonce: uint64(0), Balance: big.NewInt(10000), CodeHash: common.HexToHash("0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470").Bytes(), @@ -49,7 +48,7 @@ var ( common.Hex2Bytes("3926db69aaced518e9b9f0f434a473e7174109c943548bb8f23be41ca76d9ad2"), account1, }) - minerAccount, _ = rlp.EncodeToBytes(state.Account{ + minerAccount, _ = rlp.EncodeToBytes(types.StateAccount{ Nonce: uint64(0), Balance: big.NewInt(2000002625000000000), CodeHash: common.HexToHash("0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470").Bytes(), @@ -59,7 +58,7 @@ var ( common.Hex2Bytes("3380c7b7ae81a58eb98d9c78de4a1fd7fd9535fc953ed2be602daaa41767312a"), minerAccount, }) - bankAccount, _ = rlp.EncodeToBytes(state.Account{ + bankAccount, _ = rlp.EncodeToBytes(types.StateAccount{ Nonce: uint64(1), Balance: big.NewInt(1999978999999990000), CodeHash: common.HexToHash("0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470").Bytes(), diff --git a/statediff/types.go b/statediff/types.go index 148567dd7df8..ef825604119b 100644 --- a/statediff/types.go +++ b/statediff/types.go @@ -24,7 +24,7 @@ import ( "math/big" "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/state" + ctypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/statediff/types" ) @@ -105,7 +105,7 @@ type AccountMap map[string]accountWrapper // accountWrapper is used to temporary associate the unpacked node with its raw values type accountWrapper struct { - Account *state.Account + Account *ctypes.StateAccount NodeType types.NodeType Path []byte NodeValue []byte