Skip to content
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

Fix debug_traceCall to handle underpriced transactions #7510

Merged
merged 6 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
### Additions and Improvements
- Remove privacy test classes support [#7569](https://github.com/hyperledger/besu/pull/7569)


### Bug fixes
- Fix for `debug_traceCall` to handle transactions without specified gas price. [#7510](https://github.com/hyperledger/besu/pull/7510)

## 24.9.1

Expand Down Expand Up @@ -50,7 +50,6 @@

This release version has been deprecated release due to CI bug


## 24.8.0

### Upcoming Breaking Changes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,16 @@
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.DebugTraceTransactionResult;
import org.hyperledger.besu.ethereum.api.query.BlockchainQueries;
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.TransactionValidationParams;
import org.hyperledger.besu.ethereum.transaction.PreCloseStateHandler;
import org.hyperledger.besu.ethereum.transaction.TransactionSimulator;
import org.hyperledger.besu.ethereum.vm.DebugOperationTracer;

import java.util.Optional;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class DebugTraceCall extends AbstractTraceCall {
private static final Logger LOG = LoggerFactory.getLogger(DebugTraceCall.class);

public DebugTraceCall(
final BlockchainQueries blockchainQueries,
Expand Down Expand Up @@ -89,7 +87,6 @@ protected PreCloseStateHandler<Object> getSimulatorResultHandler(
maybeSimulatorResult.map(
result -> {
if (result.isInvalid()) {
LOG.error("Invalid simulator result {}", result);
final JsonRpcError error =
new JsonRpcError(
INTERNAL_ERROR, result.getValidationResult().getErrorMessage());
Expand All @@ -103,4 +100,13 @@ protected PreCloseStateHandler<Object> getSimulatorResultHandler(
return new DebugTraceTransactionResult(transactionTrace);
});
}

@Override
protected TransactionValidationParams buildTransactionValidationParams() {
return ImmutableTransactionValidationParams.builder()
.from(TransactionValidationParams.transactionSimulator())
.isAllowExceedingBalance(true)
.allowUnderpriced(true)
.build();
}
}
Original file line number Diff line number Diff line change
@@ -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