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

fix: [EXC-1842] Charge for ic0_cycles_burn128 #3542

Merged
merged 4 commits into from
Jan 21, 2025
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 rs/embedders/src/wasmtime_embedder/system_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1205,6 +1205,7 @@ pub fn syscalls<
linker
.func_wrap("ic0", "cycles_burn128", {
move |mut caller: Caller<'_, StoreData>, amount_high: u64, amount_low: u64, dst: I| {
charge_for_cpu(&mut caller, overhead::CYCLES_BURN128)?;
with_memory_and_system_api(&mut caller, |s, memory| {
let dst: usize = dst.try_into().expect("Failed to convert I to usize");
s.ic0_cycles_burn128(Cycles::from_parts(amount_high, amount_low), dst, memory)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ pub mod overhead {
pub const CALL_ON_CLEANUP: NumInstructions = NumInstructions::new(500);
pub const CALL_PERFORM: NumInstructions = NumInstructions::new(5_000);
pub const CALL_WITH_BEST_EFFORT_RESPONSE: NumInstructions = NumInstructions::new(500);
pub const CYCLES_BURN128: NumInstructions = NumInstructions::new(500);
pub const CANISTER_CYCLE_BALANCE: NumInstructions = NumInstructions::new(500);
pub const CANISTER_CYCLE_BALANCE128: NumInstructions = NumInstructions::new(500);
pub const CANISTER_SELF_COPY: NumInstructions = NumInstructions::new(500);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -946,7 +946,7 @@ pub fn execute_update_bench(c: &mut Criterion) {
Result::No,
Wasm64::Disabled,
),
19000006,
519000006,
),
common::Benchmark(
"wasm64/ic0_cycles_burn128()".into(),
Expand All @@ -956,7 +956,7 @@ pub fn execute_update_bench(c: &mut Criterion) {
Result::No,
Wasm64::Enabled,
),
19000006,
519000006,
),
common::Benchmark(
"wasm32/ic0_msg_deadline()".into(),
Expand Down
Loading