Compare commits
2 Commits
79e4a33b8f
...
c3f364ecc5
Author | SHA1 | Date | |
---|---|---|---|
c3f364ecc5 | |||
78218a3162 |
@ -5,17 +5,18 @@ import (
|
|||||||
"math/big"
|
"math/big"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/holiman/uint256"
|
|
||||||
"github.com/lib/pq"
|
|
||||||
"github.com/multiformats/go-multihash"
|
|
||||||
"github.com/stretchr/testify/require"
|
|
||||||
|
|
||||||
"github.com/cerc-io/plugeth-statediff/indexer/database/sql/postgres"
|
"github.com/cerc-io/plugeth-statediff/indexer/database/sql/postgres"
|
||||||
"github.com/cerc-io/plugeth-statediff/indexer/ipld"
|
"github.com/cerc-io/plugeth-statediff/indexer/ipld"
|
||||||
|
"github.com/cerc-io/plugeth-statediff/indexer/shared"
|
||||||
|
"github.com/cerc-io/plugeth-statediff/indexer/shared/schema"
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
"github.com/ethereum/go-ethereum/core/types"
|
"github.com/ethereum/go-ethereum/core/types"
|
||||||
"github.com/ethereum/go-ethereum/crypto"
|
"github.com/ethereum/go-ethereum/crypto"
|
||||||
"github.com/ethereum/go-ethereum/rlp"
|
"github.com/ethereum/go-ethereum/rlp"
|
||||||
|
"github.com/holiman/uint256"
|
||||||
|
"github.com/lib/pq"
|
||||||
|
"github.com/multiformats/go-multihash"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
state "github.com/cerc-io/ipld-eth-statedb/direct_by_leaf"
|
state "github.com/cerc-io/ipld-eth-statedb/direct_by_leaf"
|
||||||
util "github.com/cerc-io/ipld-eth-statedb/internal"
|
util "github.com/cerc-io/ipld-eth-statedb/internal"
|
||||||
@ -343,24 +344,7 @@ func insertHeaderCID(db sql.Database, blockHash, parentHash string, blockNumber
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
sql := `INSERT INTO eth.header_cids (
|
_, err = db.Exec(testCtx, schema.TableHeader.PreparedInsert(false),
|
||||||
block_number,
|
|
||||||
block_hash,
|
|
||||||
parent_hash,
|
|
||||||
cid,
|
|
||||||
td,
|
|
||||||
node_ids,
|
|
||||||
reward,
|
|
||||||
state_root,
|
|
||||||
tx_root,
|
|
||||||
receipt_root,
|
|
||||||
uncles_hash,
|
|
||||||
bloom,
|
|
||||||
timestamp,
|
|
||||||
coinbase,
|
|
||||||
canonical
|
|
||||||
) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15)`
|
|
||||||
_, err = db.Exec(testCtx, sql,
|
|
||||||
blockNumber,
|
blockNumber,
|
||||||
blockHash,
|
blockHash,
|
||||||
parentHash,
|
parentHash,
|
||||||
@ -374,6 +358,7 @@ func insertHeaderCID(db sql.Database, blockHash, parentHash string, blockNumber
|
|||||||
Header.Time,
|
Header.Time,
|
||||||
Header.Coinbase.String(),
|
Header.Coinbase.String(),
|
||||||
canon,
|
canon,
|
||||||
|
shared.MaybeStringHash(Header.WithdrawalsHash),
|
||||||
)
|
)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -392,19 +377,7 @@ type stateModel struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func insertStateCID(db sql.Database, cidModel stateModel) error {
|
func insertStateCID(db sql.Database, cidModel stateModel) error {
|
||||||
sql := `INSERT INTO eth.state_cids (
|
_, err := db.Exec(testCtx, schema.TableStateNode.PreparedInsert(false),
|
||||||
block_number,
|
|
||||||
header_id,
|
|
||||||
state_leaf_key,
|
|
||||||
cid,
|
|
||||||
diff,
|
|
||||||
balance,
|
|
||||||
nonce,
|
|
||||||
code_hash,
|
|
||||||
storage_root,
|
|
||||||
removed
|
|
||||||
) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)`
|
|
||||||
_, err := db.Exec(testCtx, sql,
|
|
||||||
cidModel.BlockNumber,
|
cidModel.BlockNumber,
|
||||||
cidModel.BlockHash,
|
cidModel.BlockHash,
|
||||||
cidModel.LeafKey,
|
cidModel.LeafKey,
|
||||||
@ -431,17 +404,7 @@ type storageModel struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func insertStorageCID(db sql.Database, cidModel storageModel) error {
|
func insertStorageCID(db sql.Database, cidModel storageModel) error {
|
||||||
sql := `INSERT INTO eth.storage_cids (
|
_, err := db.Exec(testCtx, schema.TableStorageNode.PreparedInsert(false),
|
||||||
block_number,
|
|
||||||
header_id,
|
|
||||||
state_leaf_key,
|
|
||||||
storage_leaf_key,
|
|
||||||
cid,
|
|
||||||
diff,
|
|
||||||
val,
|
|
||||||
removed
|
|
||||||
) VALUES ($1, $2, $3, $4, $5, $6, $7, $8)`
|
|
||||||
_, err := db.Exec(testCtx, sql,
|
|
||||||
cidModel.BlockNumber,
|
cidModel.BlockNumber,
|
||||||
cidModel.BlockHash,
|
cidModel.BlockHash,
|
||||||
cidModel.LeafKey,
|
cidModel.LeafKey,
|
||||||
|
4
go.mod
4
go.mod
@ -5,7 +5,7 @@ go 1.21
|
|||||||
require (
|
require (
|
||||||
github.com/VictoriaMetrics/fastcache v1.12.2
|
github.com/VictoriaMetrics/fastcache v1.12.2
|
||||||
github.com/cerc-io/ipfs-ethdb/v5 v5.1.0-alpha
|
github.com/cerc-io/ipfs-ethdb/v5 v5.1.0-alpha
|
||||||
github.com/cerc-io/plugeth-statediff v0.3.1
|
github.com/cerc-io/plugeth-statediff v0.3.2
|
||||||
github.com/crate-crypto/go-ipa v0.0.0-20231025140028-3c0104f4b233
|
github.com/crate-crypto/go-ipa v0.0.0-20231025140028-3c0104f4b233
|
||||||
github.com/davecgh/go-spew v1.1.1
|
github.com/davecgh/go-spew v1.1.1
|
||||||
github.com/ethereum/go-ethereum v1.13.14
|
github.com/ethereum/go-ethereum v1.13.14
|
||||||
@ -111,5 +111,3 @@ require (
|
|||||||
lukechampine.com/blake3 v1.2.2 // indirect
|
lukechampine.com/blake3 v1.2.2 // indirect
|
||||||
rsc.io/tmplfunc v0.0.3 // indirect
|
rsc.io/tmplfunc v0.0.3 // indirect
|
||||||
)
|
)
|
||||||
|
|
||||||
replace github.com/cerc-io/plugeth-statediff => github.com/cerc-io/plugeth-statediff v0.3.2-0.20240711085659-6fe622e4bf33
|
|
||||||
|
4
go.sum
4
go.sum
@ -22,8 +22,8 @@ github.com/cerc-io/eth-testing v0.5.1 h1:xxcQf9ymJS0911yWIrUiGvCvqfvEjYmHvhBJkCD
|
|||||||
github.com/cerc-io/eth-testing v0.5.1/go.mod h1:p86je2PjSM7u8Qd7rMIG/Zw+tQlBoS5Emkh1ECnC5t0=
|
github.com/cerc-io/eth-testing v0.5.1/go.mod h1:p86je2PjSM7u8Qd7rMIG/Zw+tQlBoS5Emkh1ECnC5t0=
|
||||||
github.com/cerc-io/ipfs-ethdb/v5 v5.1.0-alpha h1:+XhYHvzC3zFIvcWEb466SNDfeLrvcW3xe/d0cbVVVRA=
|
github.com/cerc-io/ipfs-ethdb/v5 v5.1.0-alpha h1:+XhYHvzC3zFIvcWEb466SNDfeLrvcW3xe/d0cbVVVRA=
|
||||||
github.com/cerc-io/ipfs-ethdb/v5 v5.1.0-alpha/go.mod h1:w5g07b6Uz+c6r/ySml58TEOJdUYAibYYF05H5ULVv2I=
|
github.com/cerc-io/ipfs-ethdb/v5 v5.1.0-alpha/go.mod h1:w5g07b6Uz+c6r/ySml58TEOJdUYAibYYF05H5ULVv2I=
|
||||||
github.com/cerc-io/plugeth-statediff v0.3.2-0.20240711085659-6fe622e4bf33 h1:t0hSbThg5uX4r34eIFI0Pj2WbTIquDc+lKChLqieaMc=
|
github.com/cerc-io/plugeth-statediff v0.3.2 h1:GuOUqDT6nJRCikyaNxDI2pA7TRnOTWOcyJGlJtwSzHY=
|
||||||
github.com/cerc-io/plugeth-statediff v0.3.2-0.20240711085659-6fe622e4bf33/go.mod h1:r6Mzc6k4V9KD+iN9AXa/LmmRISDsQnnIwKzZMFjJ+eE=
|
github.com/cerc-io/plugeth-statediff v0.3.2/go.mod h1:r6Mzc6k4V9KD+iN9AXa/LmmRISDsQnnIwKzZMFjJ+eE=
|
||||||
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
|
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
|
||||||
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||||
github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I=
|
github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I=
|
||||||
|
Loading…
Reference in New Issue
Block a user