Skip to content
This repository was archived by the owner on Jan 27, 2026. It is now read-only.
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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

# Environment variables that will be set on all runners
env:
RUST_VERSION: 1.71.0 # Specify the Rust version to be used on CI.
RUST_VERSION: 1.82.0 # Specify the Rust version to be used on CI.
CARGO_TERM_COLOR: always # Always colour Cargo's output.
CARGO_INCREMENTAL: 0 # Always run without incremental builds on CI.
CARGO_PROFILE_DEV_DEBUG: 0 # Don't embed debug info even though the build is a dev build.
Expand Down Expand Up @@ -106,8 +106,8 @@ jobs:
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
profile: minimal
toolchain: ${{ env.RUST_VERSION }}
override: true
components: rustfmt
- name: Restore Cache
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ readme = "README.md"
# to let authors opt in to backwards-incompatible changes. Crates using one edition can interoperate with crates using
# another edition, thereby ensuring that there's no ecosystem split.
edition = "2021"
rust-version = "1.71.0"
rust-version = "1.82.0"

# Prevent publishing by accident.
publish = false
Expand Down
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ currently being supported with security updates.
## Reporting a Vulnerability

Vulnerabilities can currently be reported as security advisories at
[this link](https://github.com/smlxl/storage-layout-extractor/security/advisories/new).
[this link](https://github.com/duneanalytics/storage-layout-extractor/security/advisories/new).
6 changes: 3 additions & 3 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ Getting set up with this project is pretty simple.
1. Clone the repository. If you don't want to contribute directly you can use HTTPS clones:

```shell
git clone https://github.com/smlxlio/storage-layout-extractor
git clone https://github.com/duneanalytics/storage-layout-extractor
```

If you _do_ want to contribute directly to the tree, we recommend cloning over SSH:

```shell
git clone git@github.com:smlxlio/storage-layout-extractor.git
git clone git@github.com:duneanalytics/storage-layout-extractor.git
```

2. Building the project is then as simple as entering the project directory and using `cargo`.
Expand All @@ -40,7 +40,7 @@ Getting set up with this project is pretty simple.
## Getting Your Work on `main`

For contributions this repository works on a
[Pull Request](https://github.com/smlxl/storage-layout-extractor/pulls) and subsequent review
[Pull Request](https://github.com/duneanalytics/storage-layout-extractor/pulls) and subsequent review
model, supported by CI to check that things avoid being broken. The process works as follows:

1. If necessary, you fork the repository, but if you have access please create a branch.
Expand Down
5 changes: 0 additions & 5 deletions rustfmt.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,18 @@

# High-level configuration, telling rustfmt which featureset to use.
edition = "2021"
version = "Two"

# Configuration controlling general code style.
brace_style = "SameLineWhere"
chain_width = 70
combine_control_expr = true
condense_wildcard_suffixes = true
control_brace_style = "AlwaysSameLine"
empty_item_single_line = true
enum_discrim_align_threshold = 20
fn_single_line = false
force_multiline_blocks = false
format_strings = true
hex_literal_case = "Lower"
indent_style = "Block"
inline_attribute_width = 0
match_arm_blocks = true
reorder_impl_items = true
single_line_let_else_max_width = 70
Expand Down Expand Up @@ -53,4 +49,3 @@ comment_width = 80
format_code_in_doc_comments = true
normalize_comments = true
normalize_doc_attributes = true
wrap_comments = true
19 changes: 6 additions & 13 deletions src/disassembly/disassembler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,15 @@ use std::rc::Rc;

use crate::{
constant::{
DUP_OPCODE_BASE_VALUE,
LOG_OPCODE_BASE_VALUE,
PUSH_OPCODE_BASE_VALUE,
PUSH_OPCODE_MAX_BYTES,
SWAP_OPCODE_BASE_VALUE,
DUP_OPCODE_BASE_VALUE, LOG_OPCODE_BASE_VALUE, PUSH_OPCODE_BASE_VALUE,
PUSH_OPCODE_MAX_BYTES, SWAP_OPCODE_BASE_VALUE,
},
error::{
container::Locatable,
disassembly::{Error, Result},
},
opcode::{
arithmetic as arith,
control,
environment as env,
logic,
memory as mem,
DynOpcode,
Opcode,
arithmetic as arith, control, environment as env, logic, memory as mem, DynOpcode, Opcode,
},
};

Expand Down Expand Up @@ -210,7 +201,9 @@ pub fn disassemble(bytes: &[u8]) -> Result<Vec<DynOpcode>> {
// as invalid
if !push_bytes.is_empty() && push_bytes.len() != push_size as usize {
add_op(ops, control::Invalid::new(last_push));
push_bytes.iter().for_each(|b| add_op(ops, control::Invalid::new(*b)));
for b in &push_bytes {
add_op(ops, control::Invalid::new(*b));
}
} else if push_size != 0 {
let opcode = mem::PushN::new(push_size, push_bytes.clone())
.map_err(|e| e.locate(last_push_start))?;
Expand Down
2 changes: 1 addition & 1 deletion src/disassembly/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ impl ExecutionThread {

let range_usize: Range<usize> = Range {
start: range.start as usize,
end: range.end as usize,
end: range.end as usize,
};

Some(&self.instructions[range_usize])
Expand Down
2 changes: 1 addition & 1 deletion src/error/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ where
fn locate(self, instruction_pointer: u32) -> Self::Located {
self.map_err(|e| Located {
location: instruction_pointer,
payload: e,
payload: e,
})
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/error/disassembly.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ impl container::Locatable for Error {
fn locate(self, instruction_pointer: u32) -> Self::Located {
container::Located {
location: instruction_pointer,
payload: self,
payload: self,
}
}
}
2 changes: 1 addition & 1 deletion src/error/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ impl container::Locatable for Error {
fn locate(self, instruction_pointer: u32) -> Self::Located {
container::Located {
location: instruction_pointer,
payload: self,
payload: self,
}
}
}
2 changes: 1 addition & 1 deletion src/error/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ impl container::Locatable for Error {
fn locate(self, instruction_pointer: u32) -> Self::Located {
container::Located {
location: instruction_pointer,
payload: self,
payload: self,
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/error/unification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ impl container::Locatable for Error {
fn locate(self, instruction_pointer: u32) -> Self::Located {
container::Located {
location: instruction_pointer,
payload: self,
payload: self,
}
}
}
2 changes: 1 addition & 1 deletion src/extractor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ impl<S: State> Extractor<S> {
pub unsafe fn set_state<NS: State>(self, new_state: NS) -> Extractor<NS> {
Extractor {
contract: self.contract,
state: new_state,
state: new_state,
}
}

Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@

#![warn(clippy::all, clippy::cargo, clippy::pedantic)]
#![allow(clippy::module_name_repetitions)] // Allows for better API naming
#![allow(clippy::multiple_crate_versions)] // Transitive dependency versions may differ

pub mod constant;
pub mod data;
Expand Down
14 changes: 7 additions & 7 deletions src/opcode/arithmetic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ impl Opcode for Div {
instruction_pointer,
RSVD::Divide {
dividend: a,
divisor: b,
divisor: b,
},
);

Expand Down Expand Up @@ -267,7 +267,7 @@ impl Opcode for SDiv {
instruction_pointer,
RSVD::SignedDivide {
dividend: a,
divisor: b,
divisor: b,
},
);

Expand Down Expand Up @@ -327,7 +327,7 @@ impl Opcode for Mod {
instruction_pointer,
RSVD::Modulo {
dividend: a,
divisor: b,
divisor: b,
},
);

Expand Down Expand Up @@ -390,7 +390,7 @@ impl Opcode for SMod {
instruction_pointer,
RSVD::SignedModulo {
dividend: a,
divisor: b,
divisor: b,
},
);

Expand Down Expand Up @@ -461,7 +461,7 @@ impl Opcode for AddMod {
instruction_pointer,
RSVD::Modulo {
dividend: add,
divisor: n,
divisor: n,
},
);

Expand Down Expand Up @@ -532,7 +532,7 @@ impl Opcode for MulMod {
instruction_pointer,
RSVD::Modulo {
dividend: mul,
divisor: n,
divisor: n,
},
);

Expand Down Expand Up @@ -591,7 +591,7 @@ impl Opcode for Exp {
let result = vm.build().symbolic_exec(
instruction_pointer,
RSVD::Exp {
value: a,
value: a,
exponent: b,
},
);
Expand Down
9 changes: 5 additions & 4 deletions src/opcode/control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ impl Opcode for JumpI {
// If we get an error here, we need to change what we do based on whether it is
// in this thread or the target thread.
let result = match payload.payload {
execution::Error::NoConcreteJumpDestination { .. }
execution::Error::NoConcreteJumpDestination
| execution::Error::NonExistentJumpTarget { .. }
| execution::Error::InvalidJumpTarget { .. }
| execution::Error::InvalidOffsetForJump { .. } => Ok(payload),
Expand Down Expand Up @@ -384,7 +384,7 @@ fn store_return_data(
let dest_offset = vm.build().symbolic_exec(
instruction_pointer,
RSVD::Add {
left: ret_offset.constant_fold(),
left: ret_offset.constant_fold(),
right: to_add_to_offset,
},
);
Expand All @@ -396,7 +396,7 @@ fn store_return_data(
instruction_pointer,
RSVD::ReturnData {
offset: src_offset,
size: num_32.clone(),
size: num_32.clone(),
},
);
let memory = vm.state()?.memory_mut();
Expand Down Expand Up @@ -898,9 +898,10 @@ impl Opcode for Nop {
#[cfg(test)]
mod test {
use crate::{
bytecode,
disassembly::InstructionStream,
error::execution,
opcode::{control, macros::bytecode, test_util as util, Opcode},
opcode::{control, test_util as util, Opcode},
vm::value::{known::KnownWord, Provenance, RSV, RSVD},
};

Expand Down
6 changes: 3 additions & 3 deletions src/opcode/logic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -598,14 +598,14 @@ impl Opcode for Byte {
let offset_times_0x08 = vm.build().symbolic_exec(
instruction_pointer,
RSVD::Multiply {
left: offset,
left: offset,
right: const_0x08,
},
);
let shift = vm.build().symbolic_exec(
instruction_pointer,
RSVD::Subtract {
left: const_0xf8,
left: const_0xf8,
right: offset_times_0x08,
},
);
Expand All @@ -615,7 +615,7 @@ impl Opcode for Byte {
let result = vm.build().symbolic_exec(
instruction_pointer,
RSVD::And {
left: shifted,
left: shifted,
right: const_0xff,
},
);
Expand Down
1 change: 0 additions & 1 deletion src/opcode/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,3 @@ macro_rules! bytecode {
}

// Export it scoped
pub use bytecode;
Loading
Loading