-
Notifications
You must be signed in to change notification settings - Fork 20.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sim backend returns 1 for SuggestGasPrice not Basefee #23752
Comments
Can I work on this? |
Sure! |
fixed |
I just stumbled across this. Given that this is a simulated backend, how is the original base fee set? I am doing a simple chain creation and getting a base fee of some absurdly high number, something like 875000000. What particularly threw me off was the function description:
That definitely is not 1. I am not doing anything fancy, as simple as: privateKey, err := crypto.GenerateKey()
if err != nil {
return nil, err
}
auth, err := bind.NewKeyedTransactorWithChainID(privateKey, big.NewInt(1337))
if err != nil {
return nil, err
}
balance := new(big.Int)
balance.SetString("10000000000000000000", 10) // 10 eth in wei
address := auth.From
genesisAlloc := map[common.Address]core.GenesisAccount{
address: {
Balance: balance,
},
}
blockGasLimit := uint64(4712388)
client := backends.NewSimulatedBackend(genesisAlloc, blockGasLimit) Stepping through, it looks like it creates it here as part of func NewSimulatedBackendWithDatabase(database ethdb.Database, alloc core.GenesisAlloc, gasLimit uint64) *SimulatedBackend {
genesis := core.Genesis{Config: params.AllEthashProtocolChanges, GasLimit: gasLimit, Alloc: alloc}
genesis.MustCommit(database)
blockchain, _ := core.NewBlockChain(database, nil, genesis.Config, ethash.NewFaker(), vm.Config{}, nil, nil)
backend := &SimulatedBackend{
database: database,
blockchain: blockchain,
config: genesis.Config,
events: filters.NewEventSystem(&filterBackend{database, blockchain}, false),
}
backend.rollback(blockchain.CurrentBlock())
return backend
} Is this a bug in how |
-> Does not work post 1559, just return
pendingBlock.Header.Basefee
or somethingThe text was updated successfully, but these errors were encountered: