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

Ecall demo with Keccak-f #717

Open
wants to merge 35 commits into
base: master
Choose a base branch
from

Conversation

naure
Copy link
Collaborator

@naure naure commented Dec 9, 2024

Trace generation

  • Expand StepRecord to support multiple accesses to registers and memory (beyond standard instructions).
  • Introduce a module for syscall witness generation. See fn handle_syscall(…)
  • Witness generation for Keccak-f. Same format as sp1.
  • Runtime wrapper function syscall_keccak_permute.
  • Test program using Keccak-f and concrete values.

Circuit part (standalone diff here)

There is a placeholder for upcoming precompile circuits. The real implementation must have the same effects as this one (same memory writes, etc).

  • LargeEcallDummy is an extension of the dummy circuit to support precompiles.
  • Support any number of registers and memory accesses.
  • New testing technique using the real trace generator instead of artificial StepRecord’s. See keccak_step.

This was linked to issues Dec 10, 2024
@naure naure requested a review from lispc December 10, 2024 11:23
Copy link
Collaborator

@matthiasgoergens matthiasgoergens left a comment

Choose a reason for hiding this comment

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

Looks good overall, please see comments.

@naure
Copy link
Collaborator Author

naure commented Dec 16, 2024

@kunxian-xia Merged all recent changes, ready for review.

pub fn handle_syscall(vm: &VMState, function_code: u32) -> Result<SyscallEffects> {
match function_code {
KECCAK_PERMUTE => Ok(keccak_permute::keccak_permute(vm)),
_ => Err(anyhow::anyhow!("Unknown syscall: {}", function_code)),
Copy link
Collaborator

Choose a reason for hiding this comment

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

i think usually weak-typed anyhow err is not suitable for core lib functions, more suitable for app level errors.
We can add a TODO like "TODO: re-design err types when more precompile designs are done".

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.

Precompile Trace Generation. Precompile Architecture
3 participants