-
Notifications
You must be signed in to change notification settings - Fork 883
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
Use different transaction simulators for different behavior of rpc gas cap #7691
Conversation
5381c51
to
0959c98
Compare
rpc-gas-cap
option should not incoditionally override smaller …
0959c98
to
14d3193
Compare
rpc-gas-cap
option should not incoditionally override smaller …rpc-gas-cap
option should not incoditionally override smaller tx gas limit
rpc-gas-cap
option should not incoditionally override smaller tx gas limitrpc-gas-cap
option should not inconditionally override smaller tx gas limit
…x gas limit Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
14d3193
to
513ce1f
Compare
if (rpcGasCap > 0) { | ||
gasLimit = rpcGasCap; | ||
simulationGasLimit = Math.min(txGasLimit, rpcGasCap); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a real need to make RPC gas limit above block size limit, especially on eth_call. I wonder if we cannot make eth_estimateGas using a different variante of the transaction simulator
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using different transaction simulators is doable, let me try to implement that way
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ahamlat I have implemented your suggestion and now eth_call
behaves differently of other call in regards of how rpc-gas-cap
is applied
rpc-gas-cap
option should not inconditionally override smaller tx gas limita7d3eac
to
a521353
Compare
…s cap Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
a521353
to
d00c324
Compare
rpcGasCap); | ||
return simulationGasLimit; | ||
} | ||
return txGasLimit; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm trying to understand the logic here. If rpcGasCap == 0
we return txGasLimit and do not consider txGasCap
? If so, can we move the final long txGasCap = txGasLimit >= 0 ? txGasLimit : blockGasLimit
to be inside the if?
Also, could you please add a summary to the PR description.
|
||
public TransactionSimulator build() { | ||
final SimulationGasLimitCalculator simulationGasLimitCalculator; | ||
if (rpcGasCap > 0 && rpcGasCapMode.equals(RpcGasCapMode.UNBOUNDED)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a long
+ enum encodes same amount of information as Long
or Optional null or Optional.empty()
may mean no bound. Introduction of RpcGasCapMode
is verbose, but maybe it makes it more obvious
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
However possibility to set it to (0, BOUNDED) makes it errorprone. Optional or a nullable Long is less errorprone from this perspective
blockchainQueries.getBlockchain(), | ||
blockchainQueries.getWorldStateArchive(), | ||
protocolSchedule) | ||
.rpcGasCap(apiConfiguration.getGasCap(), BOUNDED) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we want to use BOUNDED for eth_estimateGas
? Isn't linea_estimateGas
supposed to behave the same as eth_estimateGas
?
public interface SimulationGasLimitCalculator { | ||
long calculate(final long txGasLimit, final long blockGasLimit); | ||
|
||
static long bounded(final long txGasLimit, final long blockGasLimit, final long rpcGasCap) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think if we replace 0 values with Long.MAX_VALUE
the logic would be as simple as taking a min over 3 values. Would it be simpler to read?
Thanks all for reviewing, but after studying a bit more and looking at what Geth does, I am closing this and changing approach in this new PR #7703 |
…tx gas limit
PR description
Fixed Issue(s)
Thanks for sending a pull request! Have you done the following?
doc-change-required
label to this PR if updates are required.Locally, you can run these tests to catch failures early:
./gradlew build
./gradlew acceptanceTest
./gradlew integrationTest
./gradlew ethereum:referenceTests:referenceTests