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

Precompile calls were not traced when insuficient gas #7462

Merged

Conversation

lu-pinto
Copy link
Contributor

@lu-pinto lu-pinto commented Aug 14, 2024

PR description

This fixes a tracing problem while replaying a transaction that executes a precompiled contract but it runs out of gas. We were getting an empty TraceFrame array back from the tracer because the halt condition was never traced.

Fixed Issue(s)

fixes #7318

Thanks for sending a pull request! Have you done the following?

  • Checked out our contribution guidelines?
  • Considered documentation and added the doc-change-required label to this PR if updates are required.
  • Considered the changelog and included an update if required.
  • For database changes (e.g. KeyValueSegmentIdentifier) considered compatibility and performed forwards and backwards compatibility tests

Locally, you can run these tests to catch failures early:

  • unit tests: ./gradlew build
  • acceptance tests: ./gradlew acceptanceTest
  • integration tests: ./gradlew integrationTest
  • reference tests: ./gradlew ethereum:referenceTests:referenceTests

@lu-pinto lu-pinto force-pushed the fix-precompile-out-of-gas-not-traced branch 3 times, most recently from 8b2f1b4 to b4eb8df Compare August 14, 2024 10:40
Signed-off-by: Luis Pinto <luis.pinto@consensys.net>
@lu-pinto lu-pinto force-pushed the fix-precompile-out-of-gas-not-traced branch from b4eb8df to 98c472e Compare August 14, 2024 10:45
@lu-pinto lu-pinto marked this pull request as ready for review August 14, 2024 10:45
@@ -38,7 +38,7 @@ public class StateDiffGenerator {
public Stream<Trace> generateStateDiff(final TransactionTrace transactionTrace) {
final List<TraceFrame> traceFrames = transactionTrace.getTraceFrames();
if (traceFrames.isEmpty()) {
return Stream.empty();
throw new RuntimeException("expected to have at least one processed frame");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change in behavior is not essential to the precompile trace fix. Please consider moving it to one of the other RPC PRs.

 revert RuntimeException in StateDiffGenerator

Signed-off-by: Luis Pinto <luis.pinto@consensys.net>
@lu-pinto lu-pinto enabled auto-merge (squash) August 14, 2024 16:32
@lu-pinto lu-pinto merged commit b99cdf6 into hyperledger:main Aug 14, 2024
40 checks passed
gconnect pushed a commit to gconnect/besu that referenced this pull request Aug 26, 2024
* Precompile calls were not traced when insuficient gas

Signed-off-by: Luis Pinto <luis.pinto@consensys.net>

* fixup! Precompile calls were not traced when insuficient gas

 revert RuntimeException in StateDiffGenerator

Signed-off-by: Luis Pinto <luis.pinto@consensys.net>

---------

Signed-off-by: Luis Pinto <luis.pinto@consensys.net>
Signed-off-by: gconnect <agatevureglory@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Erroneous stateDiff in API calls for failed transactions
2 participants