Skip to content

Conversation

@x-senpai-x
Copy link

No description provided.

Copilot AI review requested due to automatic review settings December 12, 2025 17:46
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes syscall ID mismatches and refactors cpu.rs to use the SyscallCode enum for better type safety and maintainability. The changes update syscall IDs from a 0x1X and 0x2X range to a 0x100X range and replace raw numeric matching with enum-based pattern matching.

  • Updated syscall IDs for hash functions (KECCAK256, SHA256, RIPEMD160, BLAKE2B, BLAKE3) from 0x10-0x14 to 0x1000-0x1006
  • Updated syscall IDs for Ethereum precompiles (ECRECOVER, MODEXP) from 0x20-0x21 to 0x1001, 0x1004
  • Refactored cpu.rs syscall handling to use SyscallCode enum instead of raw u32 values

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
crates/executor/src/syscall.rs Updated syscall ID values in both the enum definitions and the from_u32 implementation to use the new 0x100X range instead of 0x1X/0x2X
crates/executor/src/cpu.rs Added SyscallCode import and refactored the syscall match statement to use SyscallCode::from_u32() with enum pattern matching instead of raw numeric values

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +794 to 797
Some(SyscallCode::EXIT) => {
// Linux exit syscall - allow this for program termination
return Err(ExecutorError::Ecall { pc: self.pc, syscall_id });
}
Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

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

The BLAKE3 syscall (0x1006) is defined in SyscallCode enum and mapped in from_u32, but there's no corresponding handler case in the cpu.rs match statement. This means calls to BLAKE3 will fall through to the default case and return an error. A handler case for SyscallCode::BLAKE3 should be added, similar to the other hash function implementations (KECCAK256, SHA256, RIPEMD160, BLAKE2B). Additionally, integration tests for BLAKE3 are missing while other hash functions have test coverage (test_keccak.rs, test_sha256.rs, test_ripemd160.rs, test_blake2b.rs).

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

1 participant