Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Simulations for the REVM arithmetic #547

Merged
merged 14 commits into from
Jun 7, 2024

Conversation

olympichek
Copy link
Collaborator

@olympichek olympichek commented May 20, 2024

Simulations for the REVM arithmetic operations and functions they depend on.
Work in progress on #545

This pull request also separates simulations from things related to links in core library and REVM.
For REVM, the following structure is used:

  • revm
    • translations
    • links
    • simulations

Additionally, it adds definition of Lens structure and lift_lens monadic operation to use in REVM and other simulations to represent modifications of the substate.

@olympichek olympichek marked this pull request as ready for review May 20, 2024 18:57
@olympichek olympichek changed the title Simulations for the REVM arithmetic Draft: Simulations for the REVM arithmetic May 20, 2024
pub struct Bytes(pub bytes::Bytes);
*)

Module Bytes.
Copy link
Collaborator

Choose a reason for hiding this comment

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

It seems there are many crates on which we depend, like bytes here or alloy_primitives later. To keep things simple, instead of translating all these crates, you can create a CoqOfRust/revm/simulations/dependencies.v where we put all the simulations that are about the dependencies (except for alloc and core that we have translated).

Admitted.
End Bytes.

Module Bytecode.
Copy link
Collaborator

Choose a reason for hiding this comment

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

In a CoqOfRust/revm/primitives folder, so that we follow the folder name that they are using. We should move also what we have put into CoqOfRust/revm/ to CoqOfRust/revm/interpreter/ as there is only the translation of the interpreter folder.

CoqOfRust/revm/simulations/arithmetic.v Outdated Show resolved Hide resolved
CoqOfRust/revm/simulations/arithmetic.v Outdated Show resolved Hide resolved
CoqOfRust/revm/simulations/arithmetic.v Outdated Show resolved Hide resolved
CoqOfRust/revm/simulations/arithmetic.v Outdated Show resolved Hide resolved
CoqOfRust/revm/simulations/arithmetic.v Outdated Show resolved Hide resolved
CoqOfRust/revm/simulations/arithmetic.v Outdated Show resolved Hide resolved
CoqOfRust/revm/simulations/arithmetic.v Outdated Show resolved Hide resolved

Module Interpreter.
Record t : Set := {
instruction_pointer : list Z;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
instruction_pointer : list Z;
instruction_pointer : Z;

I think the best way here is to interpret that as an index in the bytecode. We will write specifically how it relates to the Rust's translation.

Somewhat incomplete and possibly incorrect simulations for
the `Interpreter` type and all the types it depends on
Simulation for the `record_cost()` function that is used in
the implementation of the `gas!` macro that is used in arithmetic
Following REVM original project structure
@olympichek olympichek force-pushed the valerii-huhnin@revm-arithmetic-simulations branch from 23b16e2 to 87dc12f Compare June 4, 2024 14:04
@olympichek olympichek changed the title Draft: Simulations for the REVM arithmetic Simulations for the REVM arithmetic Jun 6, 2024
@olympichek olympichek merged commit 7c4d86b into main Jun 7, 2024
1 check passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants