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

MCOPY (EIP-5656) #127

Merged
merged 1 commit into from
Aug 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions etk-asm/src/asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
mod error {
use crate::ops::Expression;
use crate::ParseError;
use etk_ops::shanghai::Op;
use etk_ops::cancun::Op;
use num_bigint::BigInt;
use snafu::{Backtrace, Snafu};

Expand Down Expand Up @@ -132,7 +132,7 @@ mod error {
pub use self::error::Error;
use crate::ops::expression::{self, Terminal};
use crate::ops::{self, AbstractOp, Assemble, Expression, Imm, MacroDefinition};
use etk_ops::shanghai::Op;
use etk_ops::cancun::Op;
use rand::Rng;
use snafu::OptionExt;
use std::collections::{hash_map, HashMap, HashSet, VecDeque};
Expand Down Expand Up @@ -185,7 +185,7 @@ impl From<Vec<u8>> for RawOp {
/// ```rust
/// use etk_asm::asm::Assembler;
/// use etk_asm::ops::AbstractOp;
/// use etk_ops::shanghai::{Op, GetPc};
/// use etk_ops::cancun::{Op, GetPc};
/// # use etk_asm::asm::Error;
/// #
/// # use hex_literal::hex;
Expand Down Expand Up @@ -711,7 +711,7 @@ mod tests {
InstructionMacroDefinition, InstructionMacroInvocation, Terminal,
};
use assert_matches::assert_matches;
use etk_ops::shanghai::*;
use etk_ops::cancun::*;
use hex_literal::hex;
use num_bigint::{BigInt, Sign};

Expand Down
2 changes: 1 addition & 1 deletion etk-asm/src/ast.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::ops::{Abstract, AbstractOp, ExpressionMacroDefinition, InstructionMacroDefinition};
use etk_ops::shanghai::Op;
use etk_ops::cancun::Op;
use std::path::PathBuf;

#[derive(Debug, Clone, PartialEq)]
Expand Down
6 changes: 3 additions & 3 deletions etk-asm/src/disasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ mod error {
}
}

use etk_ops::shanghai::Op;
use etk_ops::cancun::Op;

pub use self::error::Error;

Expand Down Expand Up @@ -96,7 +96,7 @@ impl<'a> Iterator for Iter<'a> {
///
/// ## Example
/// ```rust
/// use etk_ops::shanghai::{Op, GetPc, Stop};
/// use etk_ops::cancun::{Op, GetPc, Stop};
/// use etk_asm::disasm::Disassembler;
/// # use etk_asm::disasm::Offset;
///
Expand Down Expand Up @@ -158,7 +158,7 @@ impl Disassembler {

#[cfg(test)]
mod tests {
use etk_ops::shanghai::*;
use etk_ops::cancun::*;

use hex_literal::hex;

Expand Down
4 changes: 2 additions & 2 deletions etk-asm/src/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

mod error {
use super::expression;
use etk_ops::shanghai::Op;
use etk_ops::cancun::Op;
use num_bigint::BigInt;
use snafu::{Backtrace, Snafu};

Expand Down Expand Up @@ -43,7 +43,7 @@ mod types;

pub(crate) use self::error::Error;

use etk_ops::shanghai::{Op, Operation, Push32};
use etk_ops::cancun::{Op, Operation, Push32};

pub use self::error::UnknownSpecifierError;
pub use self::expression::{Context, Expression, Terminal};
Expand Down
2 changes: 1 addition & 1 deletion etk-asm/src/parse/asm.pest
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ op = @{
"jumpi" | "jump" | "pc" | "msize" | "gas" | swap | dup | log |
"create2" | "callcode" | "call" | "return" | "delegatecall" | "create" |
"staticcall" | "revert" | "selfdestruct" | "byte" | "chainid" | "selfbalance" |
"basefee" | "invalid" | "push0"
"basefee" | "invalid" | "push0" | "mcopy"
}
push = ${ "push" ~ word_size ~ WHITESPACE ~ expression }
swap = @{ "swap" ~ half_word_size }
Expand Down
4 changes: 2 additions & 2 deletions etk-asm/src/parse/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use self::{
};
use crate::ast::Node;
use crate::ops::AbstractOp;
use etk_ops::shanghai::Op;
use etk_ops::cancun::Op;
use num_bigint::BigInt;
use pest::{iterators::Pair, Parser};

Expand Down Expand Up @@ -86,7 +86,7 @@ mod tests {
InstructionMacroDefinition, InstructionMacroInvocation, Terminal,
};
use assert_matches::assert_matches;
use etk_ops::shanghai::*;
use etk_ops::cancun::*;
use hex_literal::hex;
use num_bigint::Sign;
use std::path::PathBuf;
Expand Down
1 change: 1 addition & 0 deletions etk-asm/tests/asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ fn every_op() -> Result<(), Error> {
59
5a
5b
5e

60 aa
61 aabb
Expand Down
1 change: 1 addition & 0 deletions etk-asm/tests/asm/every-op/main.etk
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ pc
msize
gas
jumpdest
mcopy

push1 0xAA
push2 0xAABB
Expand Down
4 changes: 2 additions & 2 deletions etk-dasm/src/bin/disease/selectors.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use etk_4byte::reverse_selector;

use etk_ops::shanghai::{Op, Operation};
use etk_ops::cancun::{Op, Operation};

use std::fmt;

Expand Down Expand Up @@ -69,7 +69,7 @@ impl fmt::Display for DisplayOp {

#[cfg(test)]
mod tests {
use etk_ops::shanghai::*;
use etk_ops::cancun::*;

use hex_literal::hex;

Expand Down
9 changes: 7 additions & 2 deletions etk-dasm/src/blocks/annotated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//! (ie. stack/memory/storage).
use crate::sym::{Expr, Var};

use etk_ops::shanghai::*;
use etk_ops::cancun::*;

use std::collections::VecDeque;

Expand Down Expand Up @@ -522,6 +522,12 @@ impl<'a> Annotator<'a> {
Op::JumpDest(_) => {
// No-op
}
Op::MCopy(_) => {
let _dest_offset = stack.pop();
let _offset = stack.pop();
let _len = stack.pop();
// TODO: Set memory
}

Op::Push0(_) => stack.push_const(&[0; 1]),
Op::Push1(Push1(imm)) => stack.push_const(imm),
Expand Down Expand Up @@ -815,7 +821,6 @@ impl<'a> Annotator<'a> {
| Op::Invalid4f(_)
| Op::Invalid5c(_)
| Op::Invalid5d(_)
| Op::Invalid5e(_)
| Op::InvalidA5(_)
| Op::InvalidA6(_)
| Op::InvalidA7(_)
Expand Down
4 changes: 2 additions & 2 deletions etk-dasm/src/blocks/basic.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! A list of EVM instructions with a single point of entry and a single exit.
use etk_asm::disasm::Offset;

use etk_ops::shanghai::{Op, Operation};
use etk_ops::cancun::{Op, Operation};

/// A list of EVM instructions with a single point of entry and a single exit.
#[derive(Debug, Eq, PartialEq)]
Expand Down Expand Up @@ -107,7 +107,7 @@ impl Separator {

#[cfg(test)]
mod tests {
use etk_ops::shanghai::*;
use etk_ops::cancun::*;

use super::*;

Expand Down
1 change: 1 addition & 0 deletions etk-ops/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -851,4 +851,5 @@ fn generate_fork(fork_name: &str) -> Result<(), Error> {
fn main() {
generate_fork("london").unwrap();
generate_fork("shanghai").unwrap();
generate_fork("cancun").unwrap();
}
Loading
Loading