-
Notifications
You must be signed in to change notification settings - Fork 896
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
Add rpc-gas-cap
via transaction simulator
#6156
Add rpc-gas-cap
via transaction simulator
#6156
Conversation
Signed-off-by: Gabriel Fukushima <[email protected]>
Signed-off-by: Gabriel Fukushima <[email protected]>
Signed-off-by: Gabriel Fukushima <[email protected]>
Signed-off-by: Gabriel Fukushima <[email protected]>
Signed-off-by: Gabriel Fukushima <[email protected]>
Signed-off-by: Gabriel Fukushima <[email protected]>
|
Signed-off-by: Gabriel Fukushima <[email protected]>
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.
Looks straight forward enough, just want to understand what TransactionSimulatorTest is testing before approving.
nit: From a readability POV, I like the idea of a GasCappedTransactionSimulator class.
/** | ||
* Add Rpc gasLimit cap . | ||
* | ||
* @param rpcGasCap the rpc max logs range |
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.
typo
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.
good catch
@@ -1587,6 +1587,20 @@ public void rpcMaxLogsRangeOptionMustBeUsed() { | |||
assertThat(commandErrorOutput.toString(UTF_8)).isEmpty(); | |||
} | |||
|
|||
@Test | |||
public void rpcGasCapOptionMustBeUsed() { |
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.
Bit confused what this test name means...it's optional right? In what sense must it be used?
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.
This was added following the pattern that a lot of other CLI options follow. Agree that the name could be better but I take that it means that the option must be used when specified and throw no error.
@@ -96,7 +97,8 @@ public EthJsonRpcMethods( | |||
final TransactionPool transactionPool, | |||
final MiningCoordinator miningCoordinator, | |||
final Set<Capability> supportedCapabilities, | |||
final Optional<Long> maxLogRange) { | |||
final Optional<Long> maxLogRange, | |||
final Optional<Long> gasCap) { |
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.
Was wondering if it might make sense to use Long.MAX_VALUE instead of a optional field...but also like that this same pattern as maxLogRange.
ethereum/core/src/main/java/org/hyperledger/besu/ethereum/transaction/TransactionSimulator.java
Show resolved
Hide resolved
...m/core/src/test/java/org/hyperledger/besu/ethereum/transaction/TransactionSimulatorTest.java
Show resolved
Hide resolved
...m/core/src/test/java/org/hyperledger/besu/ethereum/transaction/TransactionSimulatorTest.java
Outdated
Show resolved
Hide resolved
...m/core/src/test/java/org/hyperledger/besu/ethereum/transaction/TransactionSimulatorTest.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Gabriel Fukushima <[email protected]>
Signed-off-by: Gabriel Fukushima <[email protected]>
…xt to tests Signed-off-by: Gabriel Fukushima <[email protected]>
...m/core/src/test/java/org/hyperledger/besu/ethereum/transaction/TransactionSimulatorTest.java
Outdated
Show resolved
Hide resolved
...m/core/src/test/java/org/hyperledger/besu/ethereum/transaction/TransactionSimulatorTest.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Gabriel Fukushima <[email protected]>
Signed-off-by: Gabriel Fukushima <[email protected]>
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.
LGTM
Signed-off-by: Gabriel Fukushima <[email protected]>
…or' into rpcGasCap_via_transactionSimulator # Conflicts: # CHANGELOG.md
* Add `rpc-gas-cap` to enable user to cap gasLimit of certain RPC methods Signed-off-by: Gabriel Fukushima <[email protected]> --------- Signed-off-by: Gabriel Fukushima <[email protected]> Signed-off-by: Justin Florentine <[email protected]>
* Add `rpc-gas-cap` to enable user to cap gasLimit of certain RPC methods Signed-off-by: Gabriel Fukushima <[email protected]> --------- Signed-off-by: Gabriel Fukushima <[email protected]>
* Add `rpc-gas-cap` to enable user to cap gasLimit of certain RPC methods Signed-off-by: Gabriel Fukushima <[email protected]> --------- Signed-off-by: Gabriel Fukushima <[email protected]> Signed-off-by: Justin Florentine <[email protected]>
* Add `rpc-gas-cap` to enable user to cap gasLimit of certain RPC methods Signed-off-by: Gabriel Fukushima <[email protected]> --------- Signed-off-by: Gabriel Fukushima <[email protected]>
PR description
This PR adds
rpc-gas-cap
directly into the transaction simulator, which seems a better approach than the one used in #6130.Fixed Issue(s)
Fixes #6042