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

Add support for alt_bn128 syscalls (old) #25464

Closed
wants to merge 8 commits into from
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
74 changes: 74 additions & 0 deletions Cargo.lock

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

10 changes: 10 additions & 0 deletions program-runtime/src/compute_budget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ 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,
/// Number of compute units consumed to pairing one pair of input elements.
/// Total cost will be one_pair_cost * (num_elems - 1)
pub alt_bn128_pairing_one_pair_cost: u64,
}

impl Default for ComputeBudget {
Expand Down Expand Up @@ -92,6 +99,9 @@ impl ComputeBudget {
heap_size: None,
heap_cost: 8,
mem_op_base_cost: 10,
alt_bn128_addition_cost: 120,
alt_bn128_multiplication_cost: 200,
alt_bn128_pairing_one_pair_cost: 110,
}
}

Expand Down
88 changes: 88 additions & 0 deletions 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/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",
"custom_heap",
Expand Down
1 change: 1 addition & 0 deletions programs/bpf_loader/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ edition = "2021"

[dependencies]
bincode = "1.3.3"
bn-plus = "=0.4"
byteorder = "1.4.3"
log = "0.4.14"
libsecp256k1 = "0.6.0"
Expand Down
Loading