Fix debug_traceCall to handle underpriced transactions (#7510)

* Fix debug_traceCall to handle underpriced transactions

Signed-off-by: 7suyash7 <suyashnyn1@gmail.com>

* remove unused methods

Signed-off-by: 7suyash7 <suyashnyn1@gmail.com>

* Add test case and changelog entry for debug_traceCall fix

Signed-off-by: 7suyash7 <suyashnyn1@gmail.com>

---------

Signed-off-by: 7suyash7 <suyashnyn1@gmail.com>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Co-authored-by: Fabio Di Fabio <fabio.difabio@consensys.net>
pull/7616/head
Suyash Nayan 2 months ago committed by GitHub
parent 31c174b0c6
commit 5df2a71a4d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 3
      CHANGELOG.md
  2. 16
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceCall.java
  3. 42
      ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/debug/trace-call/debug_traceCall_noGasPrice.json

@ -9,8 +9,8 @@
### Additions and Improvements ### Additions and Improvements
- Remove privacy test classes support [#7569](https://github.com/hyperledger/besu/pull/7569) - Remove privacy test classes support [#7569](https://github.com/hyperledger/besu/pull/7569)
### Bug fixes ### Bug fixes
- Fix for `debug_traceCall` to handle transactions without specified gas price. [#7510](https://github.com/hyperledger/besu/pull/7510)
## 24.9.1 ## 24.9.1
@ -50,7 +50,6 @@
This release version has been deprecated release due to CI bug This release version has been deprecated release due to CI bug
## 24.8.0 ## 24.8.0
### Upcoming Breaking Changes ### Upcoming Breaking Changes

@ -29,18 +29,16 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.RpcErrorType;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.DebugTraceTransactionResult; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.DebugTraceTransactionResult;
import org.hyperledger.besu.ethereum.api.query.BlockchainQueries; import org.hyperledger.besu.ethereum.api.query.BlockchainQueries;
import org.hyperledger.besu.ethereum.debug.TraceOptions; import org.hyperledger.besu.ethereum.debug.TraceOptions;
import org.hyperledger.besu.ethereum.mainnet.ImmutableTransactionValidationParams;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule; import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import org.hyperledger.besu.ethereum.mainnet.TransactionValidationParams;
import org.hyperledger.besu.ethereum.transaction.PreCloseStateHandler; import org.hyperledger.besu.ethereum.transaction.PreCloseStateHandler;
import org.hyperledger.besu.ethereum.transaction.TransactionSimulator; import org.hyperledger.besu.ethereum.transaction.TransactionSimulator;
import org.hyperledger.besu.ethereum.vm.DebugOperationTracer; import org.hyperledger.besu.ethereum.vm.DebugOperationTracer;
import java.util.Optional; import java.util.Optional;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class DebugTraceCall extends AbstractTraceCall { public class DebugTraceCall extends AbstractTraceCall {
private static final Logger LOG = LoggerFactory.getLogger(DebugTraceCall.class);
public DebugTraceCall( public DebugTraceCall(
final BlockchainQueries blockchainQueries, final BlockchainQueries blockchainQueries,
@ -89,7 +87,6 @@ public class DebugTraceCall extends AbstractTraceCall {
maybeSimulatorResult.map( maybeSimulatorResult.map(
result -> { result -> {
if (result.isInvalid()) { if (result.isInvalid()) {
LOG.error("Invalid simulator result {}", result);
final JsonRpcError error = final JsonRpcError error =
new JsonRpcError( new JsonRpcError(
INTERNAL_ERROR, result.getValidationResult().getErrorMessage()); INTERNAL_ERROR, result.getValidationResult().getErrorMessage());
@ -103,4 +100,13 @@ public class DebugTraceCall extends AbstractTraceCall {
return new DebugTraceTransactionResult(transactionTrace); return new DebugTraceTransactionResult(transactionTrace);
}); });
} }
@Override
protected TransactionValidationParams buildTransactionValidationParams() {
return ImmutableTransactionValidationParams.builder()
.from(TransactionValidationParams.transactionSimulator())
.isAllowExceedingBalance(true)
.allowUnderpriced(true)
.build();
}
} }

@ -0,0 +1,42 @@
{
"request": {
"jsonrpc": "2.0",
"method": "debug_traceCall",
"params": [
{
"to": "0x0aae40965e6800cd9b1f4b05ff21581047e3f91e",
"data": "0x000000000000000000000000000000000000000000000000000000000001A00E"
},
"latest",
{
"disableMemory": true,
"disableStack": true,
"disableStorage": true
}
],
"id": 1
},
"response": {
"jsonrpc": "2.0",
"id": 1,
"result": {
"gas": 21164,
"failed": false,
"returnValue": "",
"structLogs": [
{
"pc": 0,
"op": "STOP",
"gas": 17592186023252,
"gasCost": 0,
"depth": 1,
"stack": null,
"memory": null,
"storage": null,
"reason": null
}
]
}
},
"statusCode": 200
}
Loading…
Cancel
Save