Closed andy-uphold closed 9 months ago
Can we get some more information on the real issue here?
Making a call on a contract that requires passing in gas information is VERY strange.
I find it hard to believe that geth is to blame for this - can you show us how geth is enforcing this? - as this would severely limit how calls are made.
From experimenting with this, because you pass in the maxFeePerGas, the call is now requiring that you actually have enough fees to pay for the transaction, which is very frustrating.
I have also noticed that this is only a problem when I have made the call via alchemy or mainnet.optimism.io endpoints, whereas:
https://optimistic.etherscan.io/address/0x420000000000000000000000000000000000000f#readProxyContract
is fine.
It's not really an "issue", it's a change in behavior of upstream geth's rpc api and a new quirk that JSON-RPC API callers need to handle. This is the context I got from client engineers:
Yeah I think this is actually correct behaviour from geth - executing a transaction with 0 gas price as you’re trying to do in eth_call will effect the EVM context being created because it’s not a realistic situation post EIP1559. You can imagine some contracts subtracting the base fee from the gas price to find the inclusion fee that would hit underflow errors if the base fee wasn’t set to zero when there’s no gas price.
Here's the base fee being explicitly set to 0 when using eth_call in our code:
where NoBaseFee gets set:
and here's the upstream geth code:
https://github.com/ethereum-optimism/op-geth/commit/470dba8fc1890938a65bbf4293a4759a9b9615a1
Thanks for the reply :)
Don't you think it's an issue when a user has to have a certain amount of funds in their account in order to call a read-only method on a contract?
If this is due to an Optimism specific fork of geth, then this should be fixed there, right?
The issue really is that you are asking people to set a value in their request which is at least as big as the value that they want to know.
This is especially an issue as passing in an arbitrarily large value (ideally max uint256 to cover all eventualities) to get the lower precise value is not possible due to needing funds.
What funding do you need? These are just requests that I've made from my terminal. Its not connected to an account at all. op-geth
is a minimal diff from geth
and we aim to keep the upstream code mostly the same with our implementation.
$ curl https://mainnet.optimism.io \
-X POST \
-H "Content-Type: application/json" \
--data '{"method":"eth_call","params":[{"data":"0x6ef25c3a","to":"0x420000000000000000000000000000000000000f"},"latest"],"jsonrpc":"2.0","id":1}' | jq
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 239 100 103 100 136 394 520 --:--:-- --:--:-- --:--:-- 919
{
"jsonrpc": "2.0",
"result": "0x0000000000000000000000000000000000000000000000000000000000000000",
"id": 1
}
gasPrice
$ curl https://mainnet.optimism.io \
-X POST \
-H "Content-Type: application/json" \
--data '{"method":"eth_call","params":[{"data":"0x6ef25c3a","to":"0x420000000000000000000000000000000000000f", "gasPrice":"0x1"},"latest"],"jsonrpc":"2.0","id":1}' | jq
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 373 100 219 100 154 674 473 --:--:-- --:--:-- --:--:-- 1151
{
"jsonrpc": "2.0",
"error": {
"code": -32000,
"message": "err: max fee per gas less than block base fee: address 0x0000000000000000000000000000000000000000, maxFeePerGas: 1, baseFee: 99969359 (supplied gas 50000000)"
},
"id": 1
}
gasPrice
curl https://mainnet.optimism.io \
-X POST \
-H "Content-Type: application/json" \
--data '{"method":"eth_call","params":[{"data":"0x6ef25c3a","to":"0x420000000000000000000000000000000000000f", "gasPrice":"0x100000000"},"latest"],"jsonrpc":"2.0","id":1}' | jq
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 265 100 103 100 162 368 579 --:--:-- --:--:-- --:--:-- 949
{
"jsonrpc": "2.0",
"result": "0x0000000000000000000000000000000000000000000000000000000005fdb229",
"id": 1
}
Discussed in https://github.com/ethereum-optimism/developers/discussions/224