get fixture data from test data repo
rename eth-testing module
This commit is contained in:
parent
480b38cb8a
commit
9c4e00cd69
4
go.mod
4
go.mod
@ -3,7 +3,7 @@ module github.com/cerc-io/plugeth-statediff
|
|||||||
go 1.19
|
go 1.19
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/cerc-io/eth-test-data v0.1.0
|
github.com/cerc-io/eth-testing v0.1.1
|
||||||
github.com/ethereum/go-ethereum v1.11.6
|
github.com/ethereum/go-ethereum v1.11.6
|
||||||
github.com/georgysavva/scany v0.2.9
|
github.com/georgysavva/scany v0.2.9
|
||||||
github.com/golang/mock v1.6.0
|
github.com/golang/mock v1.6.0
|
||||||
@ -124,7 +124,7 @@ require (
|
|||||||
)
|
)
|
||||||
|
|
||||||
replace (
|
replace (
|
||||||
github.com/cerc-io/eth-test-data => git.vdb.to/cerc-io/eth-test-data v0.1.1
|
github.com/cerc-io/eth-testing => git.vdb.to/cerc-io/eth-testing v0.1.2-0.20230908220257-dc9413db69e2
|
||||||
github.com/ethereum/go-ethereum => git.vdb.to/cerc-io/plugeth v0.0.0-20230808125822-691dc334fab1
|
github.com/ethereum/go-ethereum => git.vdb.to/cerc-io/plugeth v0.0.0-20230808125822-691dc334fab1
|
||||||
github.com/openrelayxyz/plugeth-utils => git.vdb.to/cerc-io/plugeth-utils v0.0.0-20230706160122-cd41de354c46
|
github.com/openrelayxyz/plugeth-utils => git.vdb.to/cerc-io/plugeth-utils v0.0.0-20230706160122-cd41de354c46
|
||||||
)
|
)
|
||||||
|
4
go.sum
4
go.sum
@ -1,5 +1,5 @@
|
|||||||
git.vdb.to/cerc-io/eth-test-data v0.1.1 h1:J0dO1ozKdimMgvxO1rubTgLrOp7vljRm1g0OfTaUp7k=
|
git.vdb.to/cerc-io/eth-testing v0.1.2-0.20230908220257-dc9413db69e2 h1:TTInuMaNk5AvG3jT8FDoTSZRjeDCF3vYMWgOwWSfhQg=
|
||||||
git.vdb.to/cerc-io/eth-test-data v0.1.1/go.mod h1:8BypMWF/Xz4CGSn3ad4yXz0deCFFk1DxujOCU8+ydGE=
|
git.vdb.to/cerc-io/eth-testing v0.1.2-0.20230908220257-dc9413db69e2/go.mod h1:3g/KV144JSEREXK9OClsZ7YlZIfSR5qa1GiS0wSSPGE=
|
||||||
git.vdb.to/cerc-io/plugeth v0.0.0-20230808125822-691dc334fab1 h1:KLjxHwp9Zp7xhECccmJS00RiL+VwTuUGLU7qeIctg8g=
|
git.vdb.to/cerc-io/plugeth v0.0.0-20230808125822-691dc334fab1 h1:KLjxHwp9Zp7xhECccmJS00RiL+VwTuUGLU7qeIctg8g=
|
||||||
git.vdb.to/cerc-io/plugeth v0.0.0-20230808125822-691dc334fab1/go.mod h1:cYXZu70+6xmDgIgrTD81GPasv16piiAFJnKyAbwVPMU=
|
git.vdb.to/cerc-io/plugeth v0.0.0-20230808125822-691dc334fab1/go.mod h1:cYXZu70+6xmDgIgrTD81GPasv16piiAFJnKyAbwVPMU=
|
||||||
git.vdb.to/cerc-io/plugeth-utils v0.0.0-20230706160122-cd41de354c46 h1:KYcbbne/RXd7AuxbUd/3hgk1jPN+33k2CKiNsUsMCC0=
|
git.vdb.to/cerc-io/plugeth-utils v0.0.0-20230706160122-cd41de354c46 h1:KYcbbne/RXd7AuxbUd/3hgk1jPN+33k2CKiNsUsMCC0=
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -17,13 +17,10 @@
|
|||||||
package statediff_test
|
package statediff_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
|
||||||
"io"
|
|
||||||
"log"
|
|
||||||
"math/big"
|
"math/big"
|
||||||
"os"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/cerc-io/eth-testing/chaindata/mainnet"
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
"github.com/ethereum/go-ethereum/consensus/ethash"
|
"github.com/ethereum/go-ethereum/consensus/ethash"
|
||||||
"github.com/ethereum/go-ethereum/core"
|
"github.com/ethereum/go-ethereum/core"
|
||||||
@ -47,7 +44,6 @@ func init() {
|
|||||||
var (
|
var (
|
||||||
db ethdb.Database
|
db ethdb.Database
|
||||||
genesisBlock, block0, block1, block2, block3 *types.Block
|
genesisBlock, block0, block1, block2, block3 *types.Block
|
||||||
block1CoinbaseAddr, block2CoinbaseAddr, block3CoinbaseAddr common.Address
|
|
||||||
block1CoinbaseHash, block2CoinbaseHash, block3CoinbaseHash common.Hash
|
block1CoinbaseHash, block2CoinbaseHash, block3CoinbaseHash common.Hash
|
||||||
builder statediff.Builder
|
builder statediff.Builder
|
||||||
emptyStorage []sdtypes.StorageLeafNode
|
emptyStorage []sdtypes.StorageLeafNode
|
||||||
@ -425,50 +421,19 @@ var (
|
|||||||
func init() {
|
func init() {
|
||||||
db = rawdb.NewMemoryDatabase()
|
db = rawdb.NewMemoryDatabase()
|
||||||
genesisBlock = core.DefaultGenesisBlock().MustCommit(db)
|
genesisBlock = core.DefaultGenesisBlock().MustCommit(db)
|
||||||
genBy, err := rlp.EncodeToBytes(genesisBlock)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
var block0RLP []byte
|
|
||||||
block0, block0RLP, err = loadBlockFromRLPFile("./block0_rlp")
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
if !bytes.Equal(genBy, block0RLP) {
|
|
||||||
log.Fatal("mainnet genesis blocks do not match")
|
|
||||||
}
|
|
||||||
block1, _, err = loadBlockFromRLPFile("./block1_rlp")
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
block1CoinbaseAddr = block1.Coinbase()
|
|
||||||
block1CoinbaseHash = crypto.Keccak256Hash(block1CoinbaseAddr.Bytes())
|
|
||||||
block2, _, err = loadBlockFromRLPFile("./block2_rlp")
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
block2CoinbaseAddr = block2.Coinbase()
|
|
||||||
block2CoinbaseHash = crypto.Keccak256Hash(block2CoinbaseAddr.Bytes()) // 0x08d4679cbcf198c1741a6f4e4473845659a30caa8b26f8d37a0be2e2bc0d8892
|
|
||||||
block3, _, err = loadBlockFromRLPFile("./block3_rlp")
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
block3CoinbaseAddr = block3.Coinbase()
|
|
||||||
block3CoinbaseHash = crypto.Keccak256Hash(block3CoinbaseAddr.Bytes())
|
|
||||||
}
|
|
||||||
|
|
||||||
func loadBlockFromRLPFile(filename string) (*types.Block, []byte, error) {
|
blocks := mainnet.GetBlocks()
|
||||||
f, err := os.Open(filename)
|
block0 = blocks[0]
|
||||||
if err != nil {
|
block1 = blocks[1]
|
||||||
return nil, nil, err
|
block2 = blocks[2]
|
||||||
}
|
block3 = blocks[3]
|
||||||
defer f.Close()
|
|
||||||
blockRLP, err := io.ReadAll(f)
|
// 0x4be8251692195afc818c92b485fcb8a4691af89cbe5a2ab557b83a4261be2a9a
|
||||||
if err != nil {
|
block1CoinbaseHash = crypto.Keccak256Hash(block1.Coinbase().Bytes())
|
||||||
return nil, nil, err
|
// 0x08d4679cbcf198c1741a6f4e4473845659a30caa8b26f8d37a0be2e2bc0d8892
|
||||||
}
|
block2CoinbaseHash = crypto.Keccak256Hash(block2.Coinbase().Bytes())
|
||||||
block := new(types.Block)
|
// 0x6efa174f00e64521a535f35e67c1aa241951c791639b2f3d060f49c5d9fa8b9e
|
||||||
return block, blockRLP, rlp.DecodeBytes(blockRLP, block)
|
block3CoinbaseHash = crypto.Keccak256Hash(block3.Coinbase().Bytes())
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBuilderOnMainnetBlocks(t *testing.T) {
|
func TestBuilderOnMainnetBlocks(t *testing.T) {
|
||||||
|
@ -3,7 +3,7 @@ package utils_test
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/cerc-io/eth-test-data/fixture/mainnet"
|
"github.com/cerc-io/eth-testing/chaindata/mainnet"
|
||||||
"github.com/ethereum/go-ethereum/consensus/ethash"
|
"github.com/ethereum/go-ethereum/consensus/ethash"
|
||||||
"github.com/ethereum/go-ethereum/core"
|
"github.com/ethereum/go-ethereum/core"
|
||||||
"github.com/ethereum/go-ethereum/core/rawdb"
|
"github.com/ethereum/go-ethereum/core/rawdb"
|
||||||
@ -181,7 +181,7 @@ func TestCompareDifferenceIterators(t *testing.T) {
|
|||||||
|
|
||||||
db := rawdb.NewMemoryDatabase()
|
db := rawdb.NewMemoryDatabase()
|
||||||
core.DefaultGenesisBlock().MustCommit(db)
|
core.DefaultGenesisBlock().MustCommit(db)
|
||||||
blocks := mainnet.LoadBlocks(2)
|
blocks := mainnet.GetBlocks()
|
||||||
chain, _ := core.NewBlockChain(db, nil, nil, nil, ethash.NewFaker(), vm.Config{}, nil, nil)
|
chain, _ := core.NewBlockChain(db, nil, nil, nil, ethash.NewFaker(), vm.Config{}, nil, nil)
|
||||||
_, err := chain.InsertChain(blocks[1:])
|
_, err := chain.InsertChain(blocks[1:])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user