Skip to content

Commit

Permalink
Merge branch 'era_vm_zk_server_v2' into era_vm_rollbackable_priv_fields
Browse files Browse the repository at this point in the history
  • Loading branch information
gianbelinche committed Sep 4, 2024
2 parents 591f7db + f6be6d9 commit cd60040
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 20 deletions.
4 changes: 2 additions & 2 deletions core/lib/multivm/src/glue/tracers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ pub trait IntoLatestTracer<S: WriteStorage, H: HistoryMode> {
}

pub trait IntoEraVmTracer<S: WriteStorage, H: HistoryMode> {
fn era_vm(&self) -> Box<dyn crate::era_vm::tracers::traits::VmTracer<S>>;
fn into_era_vm(&self) -> Box<dyn crate::era_vm::tracers::traits::VmTracer<S>>;
}

pub trait IntoVmVirtualBlocksTracer<S: WriteStorage, H: HistoryMode> {
Expand Down Expand Up @@ -117,7 +117,7 @@ where
H: HistoryMode,
T: crate::era_vm::tracers::traits::VmTracer<S> + Clone + 'static,
{
fn era_vm(&self) -> Box<dyn crate::era_vm::tracers::traits::VmTracer<S>> {
fn into_era_vm(&self) -> Box<dyn crate::era_vm::tracers::traits::VmTracer<S>> {
Box::new(self.clone())
}
}
Expand Down
28 changes: 12 additions & 16 deletions core/lib/multivm/src/tracers/call_tracer/era_vm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ impl Tracer for CallTracer {
.map(|call| call.frame.gas_left.0.saturating_add(current_ergs))
.unwrap_or(current_ergs) as u64;

// we need to to this cast because `Call` uses another library
// we need to do this cast because `Call` uses another library
let far_call_variant = match far_call as u8 {
0 => FarCallOpcode::Normal,
1 => FarCallOpcode::Delegate,
2 => FarCallOpcode::Mimic,
_ => unreachable!(),
_ => FarCallOpcode::Normal, // Should never happen
};

let mut current_call = Call {
Expand Down Expand Up @@ -94,7 +94,7 @@ impl CallTracer {
CallType::Call(far_call)
}
} else {
unreachable!()
return;
};
let calldata = if current.heap_id == 0 || current.frame.gas_left.0 == 0 {
vec![]
Expand Down Expand Up @@ -127,22 +127,18 @@ impl CallTracer {
let fat_data_pointer = execution.get_register(1);

// if `fat_data_pointer` is not a pointer then there is no output
let output = if fat_data_pointer.is_pointer {
let fat_data_pointer = FatPointer::decode(fat_data_pointer.value);
if fat_data_pointer.len == 0 && fat_data_pointer.offset == 0 {
Some(
execution
let output = match fat_data_pointer.is_pointer {
true => {
let fat_data_pointer = FatPointer::decode(fat_data_pointer.value);
match (fat_data_pointer.len, fat_data_pointer.offset) {
(0, 0) => execution
.heaps
.get(fat_data_pointer.page)
.unwrap()
.read_unaligned_from_pointer(&fat_data_pointer)
.unwrap(),
)
} else {
None
.and_then(|ptr| ptr.read_unaligned_from_pointer(&fat_data_pointer).ok()),
_ => None,
}
}
} else {
None
_ => None,
};

match ret_opcode {
Expand Down
2 changes: 1 addition & 1 deletion core/lib/multivm/src/tracers/multivm_dispatcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ impl<S: WriteStorage, H: HistoryMode> From<TracerDispatcher<S, H>>
for crate::era_vm::tracers::dispatcher::TracerDispatcher<S>
{
fn from(value: TracerDispatcher<S, H>) -> Self {
Self::new(value.tracers.into_iter().map(|x| x.era_vm()).collect())
Self::new(value.tracers.into_iter().map(|x| x.into_era_vm()).collect())
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ impl PubdataTracer {
),
enumeration_index: vm
.storage
.borrow_mut()
.get_enumeration_index(&StorageKey::new(
AccountTreeId::new(address),
u256_to_h256(key),
Expand Down

0 comments on commit cd60040

Please sign in to comment.