Skip to content

Implement evm64 opcodes and gasometer #321

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

Merged
merged 1 commit into from
May 25, 2025
Merged

Implement evm64 opcodes and gasometer #321

merged 1 commit into from
May 25, 2025

Conversation

sorpaas
Copy link
Member

@sorpaas sorpaas commented May 25, 2025

No description provided.

@sorpaas sorpaas merged commit 2be4bed into master May 25, 2025
3 checks passed
@sorpaas sorpaas requested a review from Copilot May 25, 2025 12:05
Copy link

@Copilot 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 adds support for EVM64 by registering new opcodes and implementing a gasometer, and updates the crate’s dependencies and features.

  • Registers EVM64 arithmetic and control flow opcodes in mode_etable (lib.rs)
  • Implements eval in gasometer.rs with static and dynamic gas costs
  • Updates Cargo.toml to configure primitive-types and disable default features for evm

Reviewed Changes

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

File Description
features/evm64/src/lib.rs Added registrations for new EVM64 opcodes in the table
features/evm64/src/gasometer.rs Implemented gasometer logic, static cost table, and dynamic EXP cost
features/evm64/Cargo.toml Configured dependencies and feature flags for EVM64
Comments suppressed due to low confidence (3)

features/evm64/src/gasometer.rs:15

  • No unit tests cover the new eval logic in the gasometer, especially the dynamic cost path for EXP. Add tests to verify both static and dynamic gas calculations.
pub fn eval<'config, S, H, Tr>(

features/evm64/src/gasometer.rs:23

  • The constant _G_BASE64 is never used. Consider removing it to avoid dead code.
const _G_BASE64: u64 = 1;

features/evm64/Cargo.toml:14

  • Disabling default features for evm may omit needed functionality; consider documenting which features are required or validating that all necessary APIs remain available.
evm = { path = "../..", default-features = false }

@@ -1,15 +1,86 @@
use evm::{
interpreter::{etable::Control, machine::Machine},
interpreter::{error::ExitException, etable::Control, machine::Machine, opcode::Opcode},
standard::GasometerState,
};

Copy link
Preview

Copilot AI May 25, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider adding a doc comment for the try_or_fail macro to explain its intended use and error-flow behavior.

Suggested change
/// A macro to simplify error handling in the `eval` function.
///
/// This macro evaluates an expression and:
/// - Returns the value if the expression evaluates to `Ok`.
/// - Exits the current function with `Control::Exit` if the expression evaluates to `Err`.
///
/// # Parameters
/// - `$e`: An expression that evaluates to a `Result`.
///
/// # Example
/// ```
/// try_or_fail!(some_function_that_returns_result());
/// ```

Copilot uses AI. Check for mistakes.

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