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: use both traceStartBlock calls where appropriate #1711

Merged
merged 5 commits into from
Jan 24, 2025

Conversation

lu-pinto
Copy link
Collaborator

I rolled back usage of traceStartBlock(BlockHeader, BlockBody, Address) where appropriate because I feel we shouldn't be changing TraceServiceImpl on the Besu side just to fix the linea tracer. This avoids an inconsistency between traceStartBlock and traceEndBlock and also opening a can of worms going through yet another round of consensus as to why it was done like that in the first place.

I see that your tracer implementations were implementing both cases at the same time, so it's hard to see which is definitely being used, but given that we have to modify TraceServiceImpl to make things work I would say traceStartBlock(BlockHeader, BlockBody) was definitely being used.

Also with this you don't need another release from linea-besu to make the tracer work as both traceStartBlock(BlockHeader, BlockBody, Address) and traceStartBlock(ProcessableBlockHeader, Address) already exist.

Copy link

cla-assistant bot commented Jan 15, 2025

CLA assistant check
All committers have signed the CLA.

Copy link

cla-assistant bot commented Jan 15, 2025

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

public void traceStartBlock(
final BlockHeader blockHeader, final BlockBody blockBody, final Address miningBeneficiary) {
try {
this.hub.traceStartBlock(blockHeader, miningBeneficiary);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Here you use the 2 parameter variant of traceStartBlock ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@OlivierBBB
Copy link
Collaborator

I rolled back usage of traceStartBlock(BlockHeader, BlockBody, Address) where appropriate

It seems that on the contrary we are now using traceStartBlock(BlockHeader, BlockBody, Address) far more than before, no ?

@OlivierBBB
Copy link
Collaborator

Also I count 15 occurrences of the previously dominant signature

traceStartBlock(BlockHeader, Address)

In the repo (prior to this PR.) Will those have to be switched over to

traceStartBlock(BlockHeader, BlockBody, Address)

?

@lu-pinto
Copy link
Collaborator Author

I rolled back usage of traceStartBlock(BlockHeader, BlockBody, Address) where appropriate

It seems that on the contrary we are now using traceStartBlock(BlockHeader, BlockBody, Address) far more than before, no ?

I did a grep for occurrences of traceStartBlock and it seems we are using the same amount:

$ git checkout c8748ddc^
$ grep -r -A 1 'traceStartBlock' reference-tests/src/ arithmetization/src/ testing/src/
./reference-tests/src/test/java/net/consensys/linea/GeneralStateReferenceTestTools.java:    zkTracer.traceStartBlock(blockHeader, blockBody);
./reference-tests/src/test/java/net/consensys/linea/BlockchainReferenceTestTools.java:        zkTracer.traceStartBlock(block.getHeader());
./arithmetization/src/main/java/net/consensys/linea/zktracer/ConflationAwareOperationTracer.java:    public void traceStartBlock(final BlockHeader blockHeader, final BlockBody blockBody) {
./arithmetization/src/main/java/net/consensys/linea/zktracer/ConflationAwareOperationTracer.java:      this.tracers.forEach(tracer -> tracer.traceStartBlock(blockHeader, blockBody));
./arithmetization/src/main/java/net/consensys/linea/zktracer/ConflationAwareOperationTracer.java:    public void traceStartBlock(final ProcessableBlockHeader processableBlockHeader) {
./arithmetization/src/main/java/net/consensys/linea/zktracer/ConflationAwareOperationTracer.java:      this.tracers.forEach(tracer -> tracer.traceStartBlock(processableBlockHeader));
./arithmetization/src/main/java/net/consensys/linea/zktracer/module/txndata/TxnData.java:  public final void traceStartBlock(final ProcessableBlockHeader blockHeader) {
./arithmetization/src/main/java/net/consensys/linea/zktracer/module/DebugMode.java:  public void traceStartBlock(ProcessableBlockHeader processableBlockHeader, final BlockBody body) {
./arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/Hub.java:  public void traceStartBlock(final ProcessableBlockHeader processableBlockHeader) {
./arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/Hub.java:      m.traceStartBlock(processableBlockHeader);
./arithmetization/src/main/java/net/consensys/linea/zktracer/module/blockhash/Blockhash.java:  public void traceStartBlock(final ProcessableBlockHeader processableBlockHeader) {
./arithmetization/src/main/java/net/consensys/linea/zktracer/container/module/Module.java:  default void traceStartBlock(final ProcessableBlockHeader processableBlockHeader) {}
./arithmetization/src/main/java/net/consensys/linea/zktracer/ZkTracer.java:  public void traceStartBlock(final ProcessableBlockHeader processableBlockHeader) {
./arithmetization/src/main/java/net/consensys/linea/zktracer/ZkTracer.java:      this.hub.traceStartBlock(processableBlockHeader);
./arithmetization/src/main/java/net/consensys/linea/zktracer/ZkTracer.java:  public void traceStartBlock(final BlockHeader blockHeader, final BlockBody blockBody) {
./arithmetization/src/main/java/net/consensys/linea/zktracer/ZkTracer.java:      this.hub.traceStartBlock(blockHeader);
./arithmetization/src/main/java/net/consensys/linea/zktracer/ZkTracer.java:      this.debugMode.ifPresent(x -> x.traceStartBlock(blockHeader, blockBody));
./arithmetization/src/main/java/net/consensys/linea/blockcapture/BlockCapturer.java:  public void traceStartBlock(BlockHeader blockHeader, BlockBody blockBody) {
./testing/src/main/java/net/consensys/linea/testing/ReplayExecutionEnvironment.java:      tracer.traceStartBlock(header, body);
./testing/src/main/java/net/consensys/linea/testing/GeneralStateReferenceTestTools.java:    tracer.traceStartBlock(blockHeader, blockBody);

$ git checkout fix/trace-start-block
$ grep -r -A 1 'traceStartBlock' reference-tests/src/ arithmetization/src/ testing/src/
reference-tests/src//test/java/net/consensys/linea/GeneralStateReferenceTestTools.java:    zkTracer.traceStartBlock(blockHeader, blockBody, blockHeader.getCoinbase());
reference-tests/src//test/java/net/consensys/linea/BlockchainReferenceTestTools.java:        zkTracer.traceStartBlock(block.getHeader(), block.getHeader().getCoinbase());
arithmetization/src//main/java/net/consensys/linea/zktracer/ConflationAwareOperationTracer.java:    public void traceStartBlock(final BlockHeader blockHeader, final BlockBody blockBody, final Address miningBeneficiary) {
arithmetization/src//main/java/net/consensys/linea/zktracer/ConflationAwareOperationTracer.java:          tracer -> tracer.traceStartBlock(blockHeader, blockBody, miningBeneficiary));
arithmetization/src//main/java/net/consensys/linea/zktracer/ConflationAwareOperationTracer.java:    public void traceStartBlock(final ProcessableBlockHeader processableBlockHeader, final Address miningBeneficiary) {
arithmetization/src//main/java/net/consensys/linea/zktracer/ConflationAwareOperationTracer.java:          tracer -> tracer.traceStartBlock(processableBlockHeader, miningBeneficiary));
arithmetization/src//main/java/net/consensys/linea/zktracer/module/txndata/TxnData.java:  public final void traceStartBlock(final ProcessableBlockHeader blockHeader, final Address miningBeneficiary) {
arithmetization/src//main/java/net/consensys/linea/zktracer/module/DebugMode.java:  public void traceStartBlock(ProcessableBlockHeader processableBlockHeader,
arithmetization/src//main/java/net/consensys/linea/zktracer/module/hub/Hub.java:  public void traceStartBlock(final ProcessableBlockHeader processableBlockHeader, final Address miningBeneficiary) {
arithmetization/src//main/java/net/consensys/linea/zktracer/module/hub/Hub.java:      m.traceStartBlock(processableBlockHeader, miningBeneficiary);
arithmetization/src//main/java/net/consensys/linea/zktracer/module/blockhash/Blockhash.java:  public void traceStartBlock(final ProcessableBlockHeader processableBlockHeader, final Address miningBeneficiary) {
arithmetization/src//main/java/net/consensys/linea/zktracer/container/module/Module.java:  default void traceStartBlock(final ProcessableBlockHeader processableBlockHeader, final Address miningBeneficiary) {}
arithmetization/src//main/java/net/consensys/linea/zktracer/ZkTracer.java:  public void traceStartBlock(final ProcessableBlockHeader processableBlockHeader, final Address miningBeneficiary) {
arithmetization/src//main/java/net/consensys/linea/zktracer/ZkTracer.java:      this.hub.traceStartBlock(processableBlockHeader, miningBeneficiary);
arithmetization/src//main/java/net/consensys/linea/zktracer/ZkTracer.java:  public void traceStartBlock(final BlockHeader blockHeader, final BlockBody blockBody, final Address miningBeneficiary) {
arithmetization/src//main/java/net/consensys/linea/zktracer/ZkTracer.java:      this.hub.traceStartBlock(blockHeader, miningBeneficiary);
arithmetization/src//main/java/net/consensys/linea/zktracer/ZkTracer.java:      this.debugMode.ifPresent(x -> x.traceStartBlock(blockHeader, blockBody, miningBeneficiary));
arithmetization/src//main/java/net/consensys/linea/blockcapture/BlockCapturer.java:  public void traceStartBlock(BlockHeader blockHeader, BlockBody blockBody, final Address miningBeneficiary) {
testing/src//main/java/net/consensys/linea/testing/ReplayExecutionEnvironment.java:      tracer.traceStartBlock(header, body, miningBeneficiary);
testing/src//main/java/net/consensys/linea/testing/GeneralStateReferenceTestTools.java:    tracer.traceStartBlock(blockHeader, blockBody, blockHeader.getCoinbase());

@lu-pinto
Copy link
Collaborator Author

Also I count 15 occurrences of the previously dominant signature

traceStartBlock(BlockHeader, Address)

In the repo (prior to this PR.) Will those have to be switched over to

traceStartBlock(BlockHeader, BlockBody, Address)

?

That's a good question - I don't think you will have to do anything from now on. But I suspect that, after this PR, you have some trace methods declared that are not used. But at the same time I want to avoid having to change TraceServiceImpl just for that

@lu-pinto lu-pinto marked this pull request as ready for review January 16, 2025 11:32
Copy link
Collaborator

@OlivierBBB OlivierBBB left a comment

Choose a reason for hiding this comment

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

LGTM

@OlivierBBB OlivierBBB enabled auto-merge (squash) January 24, 2025 08:44
 fix compilation in BlockCapturer

Signed-off-by: Luis Pinto <[email protected]>
Copy link

@OlivierBBB OlivierBBB merged commit 6b7248e into arith-dev Jan 24, 2025
10 checks passed
@OlivierBBB OlivierBBB deleted the fix/trace-start-block branch January 24, 2025 15:02
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.

2 participants