ethereum / go-ethereum

Go implementation of the Ethereum protocol
https://geth.ethereum.org
GNU Lesser General Public License v3.0
47.2k stars 19.99k forks source link

Simulated backend Rollback() function should set gas tip back to the parameter passed by config #30429

Open dahu33 opened 1 week ago

dahu33 commented 1 week ago

System information

Geth version: 1.14.8 OS & Version: OSX

Expected behaviour

Calling the Rollback() function on the simulated backend should set gas tip back to parameter passed by config as it was the case before https://github.com/ethereum/go-ethereum/pull/28202 was merged.

Actual behaviour

Currently the gas tip is arbitrary set to 1 Gwei after calling the Rollback() function, which is not even the default config parameter (1 wei).

There is a TODO in the code left by @MariusVanDerWijden here: https://github.com/ethereum/go-ethereum/blob/a9523b6428238a762e1a1e55e46ead47630c3a23/eth/catalyst/simulated_beacon.go#L276-L277

Steps to reproduce the behaviour

1) Create a new simulated client with the default values. 2) Call Rollback() 3) Make a TX using the suggested gas tip.

You will get the error transaction underpriced: gas tip cap 1000000, minimum needed 1000000000.

rjl493456442 commented 2 days ago

Would you like to submit the pull request to fix it?

dahu33 commented 1 day ago

Would you like to submit the pull request to fix it?

Would love to but might need a bit of guidance on what would be the preferred strategy. I see two solutions so far: 1) saving the gas tip value inside the TxPool struct and exposing a getter func (p *TxPool) GetGasTip() *big.Int 2) saving the initial gas tip value inside the SimulatedBeacon struct