Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Add support for alt_bn128 syscalls #26629

Closed
Closed
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
101 changes: 101 additions & 0 deletions Cargo.lock

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

12 changes: 12 additions & 0 deletions program-runtime/src/compute_budget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@ pub struct ComputeBudget {
pub heap_cost: u64,
/// Memory operation syscall base cost
pub mem_op_base_cost: u64,
/// Number of compute units consumed to call alt_bn128_addition
pub alt_bn128_addition_cost: u64,
/// Number of compute units consumed to call alt_bn128_multiplication.
pub alt_bn128_multiplication_cost: u64,
/// Total cost will be alt_bn128_pairing_one_pair_cost_first
/// + alt_bn128_pairing_one_pair_cost_other * (num_elems - 1)
pub alt_bn128_pairing_one_pair_cost_first: u64,
pub alt_bn128_pairing_one_pair_cost_other: u64,
}

impl Default for ComputeBudget {
Expand Down Expand Up @@ -123,6 +131,10 @@ impl ComputeBudget {
heap_size: None,
heap_cost: 8,
mem_op_base_cost: 10,
alt_bn128_addition_cost: 334,
alt_bn128_multiplication_cost: 11_550,
alt_bn128_pairing_one_pair_cost_first: 36364,
alt_bn128_pairing_one_pair_cost_other: 12121,
}
}

Expand Down
152 changes: 151 additions & 1 deletion programs/bpf/Cargo.lock

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

1 change: 1 addition & 0 deletions programs/bpf/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ members = [
"rust/128bit",
"rust/128bit_dep",
"rust/alloc",
"rust/alt_bn128",
"rust/call_depth",
"rust/caller_access",
"rust/curve25519",
Expand Down
1 change: 1 addition & 0 deletions programs/bpf/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ fn main() {
let rust_programs = [
"128bit",
"alloc",
"alt_bn128",
"call_depth",
"caller_access",
"curve25519",
Expand Down
Loading