Skip to content

Add a debugger tool to check Kernel (user code) execution against StructLogs #697

Open
LindaGuiga wants to merge 22 commits intodevelopfrom
kernel-debug
Open

Add a debugger tool to check Kernel (user code) execution against StructLogs #697
LindaGuiga wants to merge 22 commits intodevelopfrom
kernel-debug

Conversation

@LindaGuiga
Copy link
Copy Markdown
Contributor

This PR aims at handling #221 .

It adds a flag --get-struct-logs to get the transaction StructLogs when fetching generation inputs. Then, during interpreter execution, if running in debugger mode and StructLogs are available, it checks at each step the PC, opcode, gas, stack and possible errors against the StructLogs.

(Helped debug failing block 678.)

@github-actions github-actions Bot added crate: trace_decoder Anything related to the trace_decoder crate. crate: evm_arithmetization Anything related to the evm_arithmetization crate. crate: zero_bin Anything related to the zero-bin subcrates. labels Oct 3, 2024
Ok(structlogs)
}

pub mod zerostructlog {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think you should check @einar-polygon's pr for a different way of doing this

Comment thread evm_arithmetization/src/cpu/kernel/interpreter.rs Outdated
Comment thread evm_arithmetization/src/cpu/kernel/interpreter.rs Outdated
Comment thread evm_arithmetization/src/cpu/kernel/interpreter.rs Outdated
Comment thread evm_arithmetization/src/cpu/kernel/interpreter.rs Outdated
Comment thread evm_arithmetization/src/cpu/kernel/interpreter.rs Outdated
Comment thread evm_arithmetization/src/cpu/kernel/interpreter.rs Outdated
Comment thread evm_arithmetization/src/cpu/kernel/interpreter.rs Outdated
Comment thread evm_arithmetization/src/generation/segments.rs Outdated
Comment thread evm_arithmetization/src/lib.rs Outdated
Comment thread evm_arithmetization/src/cpu/kernel/interpreter.rs Outdated
Comment thread evm_arithmetization/src/cpu/kernel/interpreter.rs
Comment thread evm_arithmetization/src/cpu/kernel/interpreter.rs Outdated
Comment thread evm_arithmetization/src/cpu/kernel/interpreter.rs Outdated
Comment thread evm_arithmetization/src/cpu/kernel/interpreter.rs
}

// Gets the struct logs with the necessary logs for debugging.
pub async fn get_structlog_for_debug<ProviderT, TransportT>(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You should probably rebase this and merge with @einar-polygon branch and PR #682. There structlogs retrieval is optimized to be one call per block.

Comment thread zero/src/bin/rpc.rs
@@ -81,6 +84,7 @@ struct Cli {
pub(crate) async fn fetch_block_prover_inputs<ProviderT, TransportT>(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This will conflict with the work in #682, so you probably need to rebase on top of that.

Comment thread zero/src/bin/trie_diff.rs Outdated
Comment thread zero/src/prover.rs Outdated
Comment thread zero/src/prover/cli.rs
Comment on lines +50 to +52
/// If true, returns the struct_logs along with the generation data.
#[arg(long, help_heading = HELP_HEADING, default_value_t = false)]
get_struct_logs: bool,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think @einar-polygon has alternative cli option which will conflict with this one.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, Einar's PR definitely conflicts with this one, but I wanted to open the PR against develop since the changes are unrelated to Einar's. I will rebase when his is ready, but I think merging now with his PR might create a lot of "noise" for reviewers, don't you think?

Copy link
Copy Markdown
Contributor

@atanmarko atanmarko Oct 8, 2024

Choose a reason for hiding this comment

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

Maybe you could make the PR against his branch (rebase on top), then merge to develop after his PR is included there?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P.S. In the cases like this with major conflicts, I usually start clean (from his branch), then I cherry pick my changes one by one on top.

Comment thread evm_arithmetization/src/structlog.rs Outdated
@Nashtare Nashtare added this to the Testing and Validation milestone Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

crate: evm_arithmetization Anything related to the evm_arithmetization crate. crate: trace_decoder Anything related to the trace_decoder crate. crate: zero_bin Anything related to the zero-bin subcrates.

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

4 participants