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

feat(decode): init calldata type guessing #188

Merged
merged 9 commits into from
Dec 1, 2023
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions common/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ lazy_static! {
/// contract on Ethereum.
pub static ref BYTECODE_REGEX: Regex = Regex::new(r"^(0x)?[0-9a-fA-F]{0,50000}$").unwrap();

/// The following regex is used to validate raw calldata
pub static ref CALLDATA_REGEX: Regex = Regex::new(r"^(0x)?[0-9a-fA-F]*$").unwrap();

/// The following regex is used to reduce null byte prefixes
pub static ref REDUCE_HEX_REGEX: Regex = Regex::new(r"^0x(00)*").unwrap();

Expand Down
6 changes: 6 additions & 0 deletions common/src/ether/evm/core/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ pub struct Memory {
// TODO: add bit-tracking for memory
}

impl Default for Memory {
fn default() -> Self {
Self::new()
}
}

impl Memory {
/// Creates a new [`Memory`] with an empty memory vector.
pub fn new() -> Memory {
Expand Down
6 changes: 6 additions & 0 deletions common/src/ether/evm/core/stack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ pub struct StackFrame {
pub operation: WrappedOpcode,
}

impl Default for Stack {
fn default() -> Self {
Self::new()
}
}

impl Stack {
/// Creates a new [`Stack`].
///
Expand Down
6 changes: 6 additions & 0 deletions common/src/ether/evm/core/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ pub struct Storage {
access_set: HashSet<[u8; 32]>,
}

impl Default for Storage {
fn default() -> Self {
Self::new()
}
}

impl Storage {
/// Creates a new [`Storage`] struct.
///
Expand Down
Loading
Loading