fixes after rebase

This commit is contained in:
i-norden 2023-04-01 14:09:13 -05:00
parent 71ce820b5c
commit c58a4f2533
4 changed files with 17 additions and 12 deletions

View File

@ -21,6 +21,7 @@ import (
"math/big"
"time"
"github.com/cerc-io/ipld-eth-db-validator/pkg/prom"
"github.com/cerc-io/ipld-eth-server/v4/pkg/shared"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/rpc"
@ -28,7 +29,6 @@ import (
"github.com/ethereum/go-ethereum/statediff/indexer/database/sql/postgres"
"github.com/jmoiron/sqlx"
"github.com/spf13/viper"
"github.com/cerc-io/ipld-eth-db-validator/pkg/prom"
)
var IntegrationTestChainConfig = &params.ChainConfig{

View File

@ -267,8 +267,14 @@ func EthAPI(ctx context.Context, db *sqlx.DB, chainCfg *params.ChainConfig) (*ip
}
backend.Config.ChainConfig = setChainConfig(genesisBlock.Hash())
}
return ipldEth.NewPublicEthAPI(backend, nil, false, false, false)
conf := ipldEth.APIConfig{
SupportsStateDiff: false,
ForwardEthCalls: false,
ForwardGetStorageAt: false,
ProxyOnError: false,
StateDiffTimeout: 0,
}
return ipldEth.NewPublicEthAPI(backend, nil, conf)
}
// fetchHeadBlockNumber gets the latest block number from the db
@ -307,16 +313,16 @@ func applyTransaction(block *types.Block, backend *ipldEth.Backend) (*state.Stat
signer := types.MakeSigner(backend.Config.ChainConfig, block.Number())
for idx, tx := range block.Transactions() {
for _, tx := range block.Transactions() {
// Assemble the transaction call message and return if the requested offset
msg, _ := tx.AsMessage(signer, block.BaseFee())
msg, _ := core.TransactionToMessage(tx, signer, block.BaseFee())
txContext := core.NewEVMTxContext(msg)
ctx := core.NewEVMBlockContext(block.Header(), backend, getAuthor(backend, block.Header()))
// Not yet the searched for transaction, execute on top of the current state
newEVM := vm.NewEVM(ctx, txContext, stateDB, backend.Config.ChainConfig, vm.Config{})
stateDB.Prepare(tx.Hash(), idx)
rules := backend.Config.ChainConfig.Rules(block.Number(), true, block.Time())
stateDB.Prepare(rules, msg.From, block.Coinbase(), msg.To, nil, nil)
if _, err := core.ApplyMessage(newEVM, msg, new(core.GasPool).AddGas(block.GasLimit())); err != nil {
return nil, fmt.Errorf("transaction %#x failed: %w", tx.Hash(), err)
}
@ -364,8 +370,6 @@ func setChainConfig(ghash common.Hash) *params.ChainConfig {
switch {
case ghash == params.MainnetGenesisHash:
return params.MainnetChainConfig
case ghash == params.RopstenGenesisHash:
return params.RopstenChainConfig
case ghash == params.SepoliaGenesisHash:
return params.SepoliaChainConfig
case ghash == params.RinkebyGenesisHash:

View File

@ -2,9 +2,10 @@ package validator_test
import (
"crypto/ecdsa"
"github.com/ethereum/go-ethereum/statediff/test_helpers"
"math/big"
"github.com/ethereum/go-ethereum/statediff/test_helpers"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/consensus/ethash"
"github.com/ethereum/go-ethereum/core"
@ -71,7 +72,7 @@ func createLondonTransaction(block *core.BlockGen, addr *common.Address, key *ec
func MakeChain(n int, parent *types.Block, chainGen func(int, *core.BlockGen)) ([]*types.Block, []types.Receipts, *core.BlockChain) {
config := validator.TestChainConfig
blocks, receipts := core.GenerateChain(config, parent, ethash.NewFaker(), Testdb, n, chainGen)
chain, _ := core.NewBlockChain(Testdb, nil, validator.TestChainConfig, ethash.NewFaker(), vm.Config{}, nil, nil)
chain, _ := core.NewBlockChain(Testdb, nil, nil, nil, ethash.NewFaker(), vm.Config{}, nil, nil)
return append([]*types.Block{parent}, blocks...), receipts, chain
}

View File

@ -11,9 +11,9 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/cerc-io/ipld-eth-db-validator/pkg/validator"
"github.com/cerc-io/ipld-eth-server/v4/pkg/eth/test_helpers"
"github.com/cerc-io/ipld-eth-server/v4/pkg/shared"
"github.com/cerc-io/ipld-eth-db-validator/pkg/validator"
)
var _ = Describe("RefIntegrity", func() {