-
Notifications
You must be signed in to change notification settings - Fork 20.1k
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
eth_createAccessList
fails when using block_hash and not setting txn fees
#30145
Comments
Before someone clicks that link:
|
I check this issue, and find out you catch well the reason why the error (you issued) occurred. It is because the gasPrice is less than baseFee at that point of the request (by the latest block)! But IMO, I don't think it is a bug.. because it is just a moment the error comes out and if you try again with updated gasPrice then it will succeed. So, this api(eth_createAccessList) is just working well based on latest block(user requested)'s baseFee and doesn't have to (perhaps could not) know which block number the users actually requests when they not specify the block number. I just add the testCase for covering the error gasPrice is less than the baseFee. Plz check this PR #30194 |
Yes, and if the user does not specify the block number everything works as it should. This issue is ONLY about the case when the user DOES specify the block number and DOES NOT set
Yes, that's the reason for this error and is the intended behavior (it is also what your test checks).
That's correct. What I'm trying to describe in this issue is that when my request does not contain a Since I, the caller, never set the gasPrice and there is logic for this case (
In my opinion the first option is the cleanest and since the block number/hash is known in the api function ( go-ethereum/internal/ethapi/api.go Lines 1506 to 1515 in bcaf374
At the moment the caller (via json rpc) has to have the block's header to fill in the gasPrice value, just to prevent |
When gasPrice is not set, the baseFee is also initialized by this code. So, the error cannot be occurred like my test code (updated). Lines 136 to 158 in ef583e9
Actually |
This doesn't always manage to avoid breaking this invariant (as evident by the error message), so either
Unless I'm mistaken the following code causes the first of these conditionsThis sets gasPrice or MaxFeePerGas using the latest header: go-ethereum/internal/ethapi/transaction_args.go Lines 186 to 187 in bcaf374
go-ethereum/internal/ethapi/transaction_args.go Lines 226 to 242 in bcaf374
go-ethereum/internal/ethapi/transaction_args.go Lines 265 to 290 in bcaf374
This computes the gasPrice using a different header. During the transition this could even mean that the transaction arguments default to post-London and the gas price is calculated pre-London (though that likely wouldn't be a significant problem with go-ethereum/internal/ethapi/api.go Line 1543 in bcaf374
go-ethereum/internal/ethapi/transaction_args.go Lines 424 to 449 in 7ee9a6e
And finally, this code would set default for GasPrice, but it is never called because the previous code has already set a (wrong) default for it. Lines 136 to 147 in ef583e9
Thus not preventing the |
I'm not sure if the situation described above can happen in your test case. It certainly won't always happen. As far as I can tell it only happens when:
For context: I've had this happen only occasionally, perhaps once in 200-500 requests (so far only tested it on Sepolia) |
I think your code analysis is correct. As you know the api is using But I would add one more thing: if gasPrice is nil, gasPrice is not filled with the default value, but with the MaxFeePerGas value according to EIP1559 (by the IsLondon). So if the user does not specify a gasPrice, baseFee is eventually initialized because the nil value is retained, because of the To say exactly what we are discussing, "Should the createAccessList api reset the gasPrice for the block baseFee for incorrect gasPrice input from the user?". I think the answer you're looking for is “YES", but I'd say “NO". gasPrice is what the user is willing to pay, and I think it's problematic to arbitrarily modify that in the API. So more fundamentally, I think of this case as "incorrect user input" and the current API is handling the error well. So when I first posted the testcase code, I arbitrarily set a low value for gasPrice to show that the API is handling the error "correctly". I think this is a clear disagreement between us.
|
I think the main issue is that Unless not setting a gasPrice (i.e. nil/null) in the json is explicitly incorrect usage of the API, for which I've so far found no evidence or documentation. I'm completely on your side that if the api user does specify a I'd argue that a The current behavior (for |
What is it you want to achieve by this? I don't understand the usecase, please elaborate. |
Execution of EVM view functions in a resource limited environment without trusting the Go-Ethereum node. To avoid having too many round trips I need the list of storage slots + accounts accessed by the EVM (=> Since those merkle proofs need to be checked against the block hash I don't want Go-Ethereum to choose the block hash (it still is one of the most recent ones), thus making it easier to combine the storage proofs with the correct block. Since I'm only executing EVM view functions I don't really care about anything related to fees (only a gas-limit to avoid DoS), which is how I found this bug. But I still have to provide the fees just so Go-Ethereum doesn't randomly fail to evaluate the view function, returning an error instead of the list of storage slots accessed. For me that isn't a big issue (I have the fee information that is needed to avoid this bug), but random fails is still not what you'd expect when the api allows requests that don't include those fields. |
System information
Geth version: current master (also happens in releases)
Commit hash : cf03784
Expected behaviour
eth_createAccessList
to succeed when given a block hash (that wasn't pruned) and a basic transaction (onlyto
andinput
) that does not revert.Actual behaviour
Returns the following error:
Note that this does not always happen:
Relevant files
set_defaults
that doesn't get the block that was requested:go-ethereum/internal/ethapi/api.go
Lines 1506 to 1515 in bcaf374
go-ethereum/internal/ethapi/transaction_args.go
Lines 186 to 187 in bcaf374
go-ethereum/internal/ethapi/transaction_args.go
Lines 268 to 272 in bcaf374
The cause of this bug:
When requesting the access list for anything but the most recent block and not specifying fee details, Go-Ethereum automatically adds the fee values using the most recent block (rather than the specified one). When the block base-fee changed durin gthat time the resulting
maxFeePerGas
can (and does often enough to be a problem) be below thebaseFee
of the block we're actually executing against, thus causing this error.Additional Information
Potentially related (but I think it's a different issue/cause): #25319
The text was updated successfully, but these errors were encountered: