Skip to content

Recognise the proxy slot pattern #95

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
Sep 21, 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
1 change: 1 addition & 0 deletions src/analyzer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ impl Analyzer<state::VMReady> {
impl Analyzer<state::ExecutionComplete> {
/// Takes thew results of execution and uses them to prepare a new inference
/// engine.
#[allow(clippy::missing_panics_doc)] // Explicit closure can never return Err
#[must_use]
pub fn prepare_unifier(self) -> Analyzer<state::InferenceReady> {
unsafe {
Expand Down
7 changes: 5 additions & 2 deletions src/constant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ pub const DEFAULT_CONDITIONAL_JUMP_PER_TARGET_FORK_LIMIT: usize = 50;
/// culled.
pub const DEFAULT_VALUE_SIZE_LIMIT: usize = 250;

/// The number of loop iterations the analyzer will wait before polling the
/// watchdog.
/// The default number of loop iterations the analyzer will wait before polling
/// the watchdog.
pub const DEFAULT_WATCHDOG_POLL_LOOP_ITERATIONS: usize = 100;

/// The value that solidity uses to type tag `string` in ABI encoding.
pub const SOLIDITY_STRING_POINTER: usize = 0x20;
9 changes: 7 additions & 2 deletions src/inference/lift/dynamic_array_access.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,13 @@ impl Lift for DynamicArrayIndex {
} else {
return None;
}
.clone()
.constant_fold();
.clone();

let data = match data.data() {
RSVD::Concat { values } if values.len() == 1 => values[0].clone().constant_fold(),
RSVD::Concat { .. } => return None,
_ => data,
};

let access = RSVD::DynamicArrayIndex {
slot: data.transform_data(lift_dyn_array_accesses),
Expand Down
3 changes: 3 additions & 0 deletions src/inference/lift/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ pub mod mapping_index;
pub mod mapping_offset;
pub mod mul_shifted;
pub mod packed_encoding;
pub mod proxy_slots;
pub mod recognise_hashed_slots;
pub mod storage_slots;
pub mod sub_word;
Expand All @@ -27,6 +28,7 @@ use crate::{
mapping_offset::MappingOffset,
mul_shifted::MulShiftedValue,
packed_encoding::PackedEncoding,
proxy_slots::ProxySlots,
recognise_hashed_slots::StorageSlotHashes,
storage_slots::StorageSlots,
sub_word::SubWordValue,
Expand Down Expand Up @@ -130,6 +132,7 @@ impl Default for LiftingPasses {
Self {
passes: vec![
StorageSlotHashes::new(),
ProxySlots::new(),
MappingIndex::new(),
SubWordValue::new(),
MulShiftedValue::new(),
Expand Down
Loading