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

Add witness tracing #8336

Open
wants to merge 3 commits into
base: verkle
Choose a base branch
from

Conversation

lu-pinto
Copy link
Contributor

@lu-pinto lu-pinto commented Feb 20, 2025

PR description

This PR adds tracing of accesses to the witness with every executed frame. This can also be used along with RPC methods like trace_* and debug_*.

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:

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

@lu-pinto lu-pinto changed the base branch from main to verkle February 20, 2025 16:23
@lu-pinto lu-pinto marked this pull request as ready for review February 20, 2025 17:14
@matkt
Copy link
Contributor

matkt commented Feb 24, 2025

maybe it will be nice if we can have a consensus regarding the format of the result with other clients

@@ -79,6 +84,7 @@
"stack" : [ "0000000000000000000000000000000000000000000000000000000000000020", "0000000000000000000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000000000000000020" ],
"memory" : [ ],
"storage" : { },
"statelessWitness" : [ ],
Copy link
Contributor

Choose a reason for hiding this comment

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

is it needed to add it if it's empty ? It seems that we are increasing the size of the response for nothing. It seems to be the same for memory and storage. I remember @ahamlat did some optmisation on tracing but not sure it was related to that

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes it removed empties and nulls - it took some time but I eventually found both. Changed in next PR

Copy link
Contributor

@ahamlat ahamlat Mar 3, 2025

Choose a reason for hiding this comment

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

What do you mean "Changed in next PR" ? I did a quick check and it seems to be already implemented in this PR.

Copy link
Contributor Author

@lu-pinto lu-pinto Mar 3, 2025

Choose a reason for hiding this comment

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

Yes, comment doesn't make much sense. I meant next update to the PR.

Signed-off-by: Luis Pinto <luis.pinto@consensys.net>
@lu-pinto lu-pinto force-pushed the add-witness-tracing branch 2 times, most recently from f92e3fd to 45e26d8 Compare February 25, 2025 22:29
@lu-pinto
Copy link
Contributor Author

maybe it will be nice if we can have a consensus regarding the format of the result with other clients

Good idea. I think we can do that later and just add it to the conversation. I feel this will block this PR which is a good improvement for the next devnet. It's a new concept anyway, doesn't need to be perfect right now

@lu-pinto lu-pinto force-pushed the add-witness-tracing branch from 45e26d8 to 9689171 Compare February 26, 2025 09:45
Signed-off-by: Luis Pinto <luis.pinto@consensys.net>
@lu-pinto lu-pinto force-pushed the add-witness-tracing branch from 9689171 to b13b4ad Compare February 26, 2025 10:45
private Optional<List<AccessEvent<?>>> captureStatelessWitness(final MessageFrame frame) {
List<AccessEvent<?>> leafAccesses = frame.getAccessWitness().getLeafAccesses();
if (!options.traceStatelessWitness() || leafAccesses.isEmpty()) {
return Optional.empty();
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

}
},
"statusCode": 200
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this a new test ? What is the goal of this test ?

Copy link
Contributor Author

@lu-pinto lu-pinto Mar 3, 2025

Choose a reason for hiding this comment

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

This is running with default values. Is there a case for that already?

EDIT: I see there _default.json which is essentially the same. Probably the result of a rename or something after rebasing the changes. I'll remove the _complete.json one

}
},
"statusCode": 200
}
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be great to add a test with

"disableStatelessWitness": false

Copy link
Contributor Author

@lu-pinto lu-pinto Mar 3, 2025

Choose a reason for hiding this comment

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

So I think that's what _complete.json/_default.json do which just uses default values and witness is enabled by default. But since we currently don't have a verkle blockchain, the result is empty, so it's not printed.

 remove duplicate test fixture with default

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

Successfully merging this pull request may close these issues.

3 participants