* Remove unactivated ristretto syscall (#16727)
(cherry picked from commit be4df39a4c
)
# Conflicts:
# programs/bpf/Cargo.lock
# programs/bpf/rust/ristretto/Cargo.toml
# programs/bpf/tests/programs.rs
# programs/bpf_loader/src/syscalls.rs
# sdk/src/feature_set.rs
* fix conflicts
Co-authored-by: Jack May <jack@solana.com>
This commit is contained in:
26
Cargo.lock
generated
26
Cargo.lock
generated
@ -900,19 +900,6 @@ dependencies = [
|
|||||||
"zeroize",
|
"zeroize",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "curve25519-dalek"
|
|
||||||
version = "3.0.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "c8492de420e9e60bc9a1d66e2dbb91825390b738a388606600663fc529b4b307"
|
|
||||||
dependencies = [
|
|
||||||
"byteorder",
|
|
||||||
"digest 0.9.0",
|
|
||||||
"rand_core 0.5.1",
|
|
||||||
"subtle 2.2.2",
|
|
||||||
"zeroize",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dashmap"
|
name = "dashmap"
|
||||||
version = "4.0.2"
|
version = "4.0.2"
|
||||||
@ -1066,7 +1053,7 @@ version = "1.0.0-pre.4"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "21a8a37f4e8b35af971e6db5e3897e7a6344caa3f92f6544f88125a1f5f0035a"
|
checksum = "21a8a37f4e8b35af971e6db5e3897e7a6344caa3f92f6544f88125a1f5f0035a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"curve25519-dalek 2.1.0",
|
"curve25519-dalek",
|
||||||
"ed25519",
|
"ed25519",
|
||||||
"rand 0.7.3",
|
"rand 0.7.3",
|
||||||
"serde",
|
"serde",
|
||||||
@ -3959,7 +3946,6 @@ version = "1.5.20"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"bincode",
|
"bincode",
|
||||||
"byteorder",
|
"byteorder",
|
||||||
"curve25519-dalek 3.0.0",
|
|
||||||
"log 0.4.11",
|
"log 0.4.11",
|
||||||
"num-derive",
|
"num-derive",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
@ -4240,7 +4226,7 @@ dependencies = [
|
|||||||
"backtrace",
|
"backtrace",
|
||||||
"bytes 0.4.12",
|
"bytes 0.4.12",
|
||||||
"cc",
|
"cc",
|
||||||
"curve25519-dalek 2.1.0",
|
"curve25519-dalek",
|
||||||
"ed25519-dalek",
|
"ed25519-dalek",
|
||||||
"either",
|
"either",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
@ -4755,7 +4741,7 @@ name = "solana-perf"
|
|||||||
version = "1.5.20"
|
version = "1.5.20"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bincode",
|
"bincode",
|
||||||
"curve25519-dalek 2.1.0",
|
"curve25519-dalek",
|
||||||
"dlopen",
|
"dlopen",
|
||||||
"dlopen_derive",
|
"dlopen_derive",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
@ -4800,7 +4786,7 @@ dependencies = [
|
|||||||
"borsh-derive",
|
"borsh-derive",
|
||||||
"bs58",
|
"bs58",
|
||||||
"bv",
|
"bv",
|
||||||
"curve25519-dalek 2.1.0",
|
"curve25519-dalek",
|
||||||
"hex",
|
"hex",
|
||||||
"itertools 0.9.0",
|
"itertools 0.9.0",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
@ -4834,7 +4820,7 @@ dependencies = [
|
|||||||
"borsh-derive",
|
"borsh-derive",
|
||||||
"bs58",
|
"bs58",
|
||||||
"bv",
|
"bv",
|
||||||
"curve25519-dalek 2.1.0",
|
"curve25519-dalek",
|
||||||
"hex",
|
"hex",
|
||||||
"itertools 0.9.0",
|
"itertools 0.9.0",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
@ -4996,7 +4982,7 @@ dependencies = [
|
|||||||
"bv",
|
"bv",
|
||||||
"byteorder",
|
"byteorder",
|
||||||
"chrono",
|
"chrono",
|
||||||
"curve25519-dalek 2.1.0",
|
"curve25519-dalek",
|
||||||
"derivation-path",
|
"derivation-path",
|
||||||
"digest 0.9.0",
|
"digest 0.9.0",
|
||||||
"ed25519-dalek",
|
"ed25519-dalek",
|
||||||
|
31
programs/bpf/Cargo.lock
generated
31
programs/bpf/Cargo.lock
generated
@ -627,19 +627,6 @@ dependencies = [
|
|||||||
"zeroize",
|
"zeroize",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "curve25519-dalek"
|
|
||||||
version = "3.0.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "c8492de420e9e60bc9a1d66e2dbb91825390b738a388606600663fc529b4b307"
|
|
||||||
dependencies = [
|
|
||||||
"byteorder 1.3.4",
|
|
||||||
"digest 0.9.0",
|
|
||||||
"rand_core 0.5.1",
|
|
||||||
"subtle 2.2.2",
|
|
||||||
"zeroize",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dashmap"
|
name = "dashmap"
|
||||||
version = "4.0.2"
|
version = "4.0.2"
|
||||||
@ -752,7 +739,7 @@ version = "1.0.0-pre.4"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "21a8a37f4e8b35af971e6db5e3897e7a6344caa3f92f6544f88125a1f5f0035a"
|
checksum = "21a8a37f4e8b35af971e6db5e3897e7a6344caa3f92f6544f88125a1f5f0035a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"curve25519-dalek 2.1.0",
|
"curve25519-dalek",
|
||||||
"ed25519",
|
"ed25519",
|
||||||
"rand 0.7.3",
|
"rand 0.7.3",
|
||||||
"serde",
|
"serde",
|
||||||
@ -2628,7 +2615,6 @@ version = "1.5.20"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"bincode",
|
"bincode",
|
||||||
"byteorder 1.3.4",
|
"byteorder 1.3.4",
|
||||||
"curve25519-dalek 3.0.0",
|
|
||||||
"log",
|
"log",
|
||||||
"num-derive 0.3.0",
|
"num-derive 0.3.0",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
@ -2852,15 +2838,6 @@ dependencies = [
|
|||||||
"solana-program 1.5.20",
|
"solana-program 1.5.20",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "solana-bpf-rust-ristretto"
|
|
||||||
version = "1.5.20"
|
|
||||||
dependencies = [
|
|
||||||
"curve25519-dalek 3.0.0",
|
|
||||||
"getrandom 0.1.14",
|
|
||||||
"solana-program 1.5.20",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "solana-bpf-rust-ro-modify"
|
name = "solana-bpf-rust-ro-modify"
|
||||||
version = "1.5.20"
|
version = "1.5.20"
|
||||||
@ -3017,7 +2994,7 @@ dependencies = [
|
|||||||
"backtrace",
|
"backtrace",
|
||||||
"bytes 0.4.12",
|
"bytes 0.4.12",
|
||||||
"cc",
|
"cc",
|
||||||
"curve25519-dalek 2.1.0",
|
"curve25519-dalek",
|
||||||
"ed25519-dalek",
|
"ed25519-dalek",
|
||||||
"either",
|
"either",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
@ -3187,7 +3164,7 @@ dependencies = [
|
|||||||
"borsh-derive",
|
"borsh-derive",
|
||||||
"bs58",
|
"bs58",
|
||||||
"bv",
|
"bv",
|
||||||
"curve25519-dalek 2.1.0",
|
"curve25519-dalek",
|
||||||
"hex",
|
"hex",
|
||||||
"itertools 0.9.0",
|
"itertools 0.9.0",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
@ -3220,7 +3197,7 @@ dependencies = [
|
|||||||
"borsh-derive",
|
"borsh-derive",
|
||||||
"bs58",
|
"bs58",
|
||||||
"bv",
|
"bv",
|
||||||
"curve25519-dalek 2.1.0",
|
"curve25519-dalek",
|
||||||
"hex",
|
"hex",
|
||||||
"itertools 0.9.0",
|
"itertools 0.9.0",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
|
@ -65,7 +65,6 @@ members = [
|
|||||||
"rust/param_passing",
|
"rust/param_passing",
|
||||||
"rust/param_passing_dep",
|
"rust/param_passing_dep",
|
||||||
"rust/rand",
|
"rust/rand",
|
||||||
"rust/ristretto",
|
|
||||||
"rust/ro_modify",
|
"rust/ro_modify",
|
||||||
"rust/sanity",
|
"rust/sanity",
|
||||||
"rust/sha256",
|
"rust/sha256",
|
||||||
|
@ -81,7 +81,6 @@ fn main() {
|
|||||||
"panic",
|
"panic",
|
||||||
"param_passing",
|
"param_passing",
|
||||||
"rand",
|
"rand",
|
||||||
"ristretto",
|
|
||||||
"ro_modify",
|
"ro_modify",
|
||||||
"sanity",
|
"sanity",
|
||||||
"sha256",
|
"sha256",
|
||||||
|
@ -1,21 +0,0 @@
|
|||||||
[package]
|
|
||||||
name = "solana-bpf-rust-ristretto"
|
|
||||||
version = "1.5.20"
|
|
||||||
description = "Solana BPF test program written in Rust"
|
|
||||||
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
|
|
||||||
repository = "https://github.com/solana-labs/solana"
|
|
||||||
license = "Apache-2.0"
|
|
||||||
homepage = "https://solana.com/"
|
|
||||||
documentation = "https://docs.rs/solana-bpf-rust-ristretto"
|
|
||||||
edition = "2018"
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
curve25519-dalek = "3"
|
|
||||||
getrandom = { version = "0.1.14", features = ["dummy"] }
|
|
||||||
solana-program = { path = "../../../../sdk/program", version = "=1.5.20" }
|
|
||||||
|
|
||||||
[lib]
|
|
||||||
crate-type = ["cdylib"]
|
|
||||||
|
|
||||||
[package.metadata.docs.rs]
|
|
||||||
targets = ["x86_64-unknown-linux-gnu"]
|
|
@ -1,2 +0,0 @@
|
|||||||
[target.bpfel-unknown-unknown.dependencies.std]
|
|
||||||
features = []
|
|
@ -1,46 +0,0 @@
|
|||||||
//! @brief Example Rust-based BPF program that performs a ristretto multiply
|
|
||||||
|
|
||||||
pub mod ristretto;
|
|
||||||
|
|
||||||
use crate::ristretto::ristretto_mul;
|
|
||||||
use curve25519_dalek::{constants::RISTRETTO_BASEPOINT_POINT, scalar::Scalar};
|
|
||||||
use solana_program::{
|
|
||||||
account_info::AccountInfo, entrypoint, entrypoint::ProgramResult, msg, pubkey::Pubkey,
|
|
||||||
};
|
|
||||||
|
|
||||||
fn test_ristretto_mul() -> ProgramResult {
|
|
||||||
let point = RISTRETTO_BASEPOINT_POINT;
|
|
||||||
let scalar = Scalar::zero();
|
|
||||||
let result = ristretto_mul(&point, &scalar)?;
|
|
||||||
assert_ne!(point, result);
|
|
||||||
|
|
||||||
let point = RISTRETTO_BASEPOINT_POINT;
|
|
||||||
let scalar = Scalar::one();
|
|
||||||
let result = ristretto_mul(&point, &scalar)?;
|
|
||||||
assert_eq!(point, result);
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
entrypoint!(process_instruction);
|
|
||||||
fn process_instruction(
|
|
||||||
_program_id: &Pubkey,
|
|
||||||
_accounts: &[AccountInfo],
|
|
||||||
_instruction_data: &[u8],
|
|
||||||
) -> ProgramResult {
|
|
||||||
msg!("Ristretto multiply");
|
|
||||||
|
|
||||||
test_ristretto_mul()?;
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod test {
|
|
||||||
use super::*;
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_ristretto() {
|
|
||||||
test_ristretto_mul().unwrap();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,44 +0,0 @@
|
|||||||
use curve25519_dalek::{ristretto::RistrettoPoint, scalar::Scalar};
|
|
||||||
use solana_program::program_error::ProgramError;
|
|
||||||
|
|
||||||
/// Multiply a ristretto point with a scalar
|
|
||||||
///
|
|
||||||
/// @param point - Ristretto point
|
|
||||||
/// @param scalar - Scalar to mulitply against
|
|
||||||
/// @return - result of the multiplication
|
|
||||||
#[inline]
|
|
||||||
pub fn ristretto_mul(
|
|
||||||
point: &RistrettoPoint,
|
|
||||||
scalar: &Scalar,
|
|
||||||
) -> Result<RistrettoPoint, ProgramError> {
|
|
||||||
// Perform the calculation inline, calling this from within a program is
|
|
||||||
// not supported
|
|
||||||
#[cfg(not(target_arch = "bpf"))]
|
|
||||||
{
|
|
||||||
Ok(point * scalar)
|
|
||||||
}
|
|
||||||
// Call via a system call to perform the calculation
|
|
||||||
#[cfg(target_arch = "bpf")]
|
|
||||||
{
|
|
||||||
extern "C" {
|
|
||||||
fn sol_ristretto_mul(
|
|
||||||
point_addr: *const u8,
|
|
||||||
scalar_addr: *const u8,
|
|
||||||
result_addr: *mut u8,
|
|
||||||
) -> u64;
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut result = RistrettoPoint::default();
|
|
||||||
let status = unsafe {
|
|
||||||
sol_ristretto_mul(
|
|
||||||
point as *const _ as *const u8,
|
|
||||||
scalar as *const _ as *const u8,
|
|
||||||
&mut result as *const _ as *mut u8,
|
|
||||||
)
|
|
||||||
};
|
|
||||||
match status {
|
|
||||||
solana_program::entrypoint::SUCCESS => Ok(result),
|
|
||||||
_ => Err(status.into()),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -27,7 +27,6 @@ use solana_sdk::{
|
|||||||
client::SyncClient,
|
client::SyncClient,
|
||||||
clock::{DEFAULT_SLOTS_PER_EPOCH, MAX_PROCESSING_AGE},
|
clock::{DEFAULT_SLOTS_PER_EPOCH, MAX_PROCESSING_AGE},
|
||||||
entrypoint::{MAX_PERMITTED_DATA_INCREASE, SUCCESS},
|
entrypoint::{MAX_PERMITTED_DATA_INCREASE, SUCCESS},
|
||||||
feature_set::try_find_program_address_syscall_enabled,
|
|
||||||
instruction::{AccountMeta, CompiledInstruction, Instruction, InstructionError},
|
instruction::{AccountMeta, CompiledInstruction, Instruction, InstructionError},
|
||||||
keyed_account::KeyedAccount,
|
keyed_account::KeyedAccount,
|
||||||
message::Message,
|
message::Message,
|
||||||
@ -429,7 +428,6 @@ fn test_program_bpf_sanity() {
|
|||||||
("solana_bpf_rust_panic", false),
|
("solana_bpf_rust_panic", false),
|
||||||
("solana_bpf_rust_param_passing", true),
|
("solana_bpf_rust_param_passing", true),
|
||||||
("solana_bpf_rust_rand", true),
|
("solana_bpf_rust_rand", true),
|
||||||
("solana_bpf_rust_ristretto", true),
|
|
||||||
("solana_bpf_rust_sanity", true),
|
("solana_bpf_rust_sanity", true),
|
||||||
("solana_bpf_rust_sha256", true),
|
("solana_bpf_rust_sha256", true),
|
||||||
("solana_bpf_rust_sysval", true),
|
("solana_bpf_rust_sysval", true),
|
||||||
@ -1233,7 +1231,6 @@ fn assert_instruction_count() {
|
|||||||
("solana_bpf_rust_many_args", 237),
|
("solana_bpf_rust_many_args", 237),
|
||||||
("solana_bpf_rust_noop", 488),
|
("solana_bpf_rust_noop", 488),
|
||||||
("solana_bpf_rust_param_passing", 48),
|
("solana_bpf_rust_param_passing", 48),
|
||||||
("solana_bpf_rust_ristretto", 19409),
|
|
||||||
("solana_bpf_rust_sanity", 938),
|
("solana_bpf_rust_sanity", 938),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
@ -2184,41 +2181,3 @@ fn test_program_upgradeable_locks() {
|
|||||||
panic!("no meta");
|
panic!("no meta");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "bpf_rust")]
|
|
||||||
#[test]
|
|
||||||
fn test_program_bpf_syscall_feature_activation() {
|
|
||||||
solana_logger::setup();
|
|
||||||
|
|
||||||
let GenesisConfigInfo {
|
|
||||||
genesis_config,
|
|
||||||
mint_keypair,
|
|
||||||
..
|
|
||||||
} = create_genesis_config(50);
|
|
||||||
let mut bank = Bank::new(&genesis_config);
|
|
||||||
bank.deactivate_feature(&try_find_program_address_syscall_enabled::id());
|
|
||||||
let (name, id, entrypoint) = solana_bpf_loader_program!();
|
|
||||||
bank.add_builtin(&name, id, entrypoint);
|
|
||||||
let bank = Arc::new(bank);
|
|
||||||
let bank_client = BankClient::new_shared(&bank);
|
|
||||||
|
|
||||||
let program_id = load_bpf_program(
|
|
||||||
&bank_client,
|
|
||||||
&bpf_loader::id(),
|
|
||||||
&mint_keypair,
|
|
||||||
"solana_bpf_rust_noop",
|
|
||||||
);
|
|
||||||
let instruction = Instruction::new(program_id, &0u8, vec![]);
|
|
||||||
let result = bank_client.send_and_confirm_instruction(&mint_keypair, instruction);
|
|
||||||
assert!(result.is_ok());
|
|
||||||
|
|
||||||
let mut bank = Bank::new_from_parent(&bank, &Pubkey::default(), 1);
|
|
||||||
bank.activate_feature(&try_find_program_address_syscall_enabled::id());
|
|
||||||
|
|
||||||
let bank = Arc::new(bank);
|
|
||||||
let bank_client = BankClient::new_shared(&bank);
|
|
||||||
let instruction = Instruction::new(program_id, &1u8, vec![]);
|
|
||||||
let result = bank_client.send_and_confirm_instruction(&mint_keypair, instruction);
|
|
||||||
println!("result: {:?}", result);
|
|
||||||
assert!(result.is_ok());
|
|
||||||
}
|
|
||||||
|
@ -12,7 +12,6 @@ edition = "2018"
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
bincode = "1.3.1"
|
bincode = "1.3.1"
|
||||||
byteorder = "1.3.4"
|
byteorder = "1.3.4"
|
||||||
curve25519-dalek = "3"
|
|
||||||
log = "0.4.11"
|
log = "0.4.11"
|
||||||
num-derive = "0.3"
|
num-derive = "0.3"
|
||||||
num-traits = "0.2"
|
num-traits = "0.2"
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
use crate::{alloc, BpfError};
|
use crate::{alloc, BpfError};
|
||||||
use alloc::Alloc;
|
use alloc::Alloc;
|
||||||
use curve25519_dalek::{ristretto::RistrettoPoint, scalar::Scalar};
|
|
||||||
use solana_rbpf::{
|
use solana_rbpf::{
|
||||||
ebpf::MM_HEAP_START,
|
ebpf::MM_HEAP_START,
|
||||||
error::EbpfError,
|
error::EbpfError,
|
||||||
@ -18,9 +17,9 @@ use solana_sdk::{
|
|||||||
entrypoint::{MAX_PERMITTED_DATA_INCREASE, SUCCESS},
|
entrypoint::{MAX_PERMITTED_DATA_INCREASE, SUCCESS},
|
||||||
feature_set::{
|
feature_set::{
|
||||||
abort_on_all_cpi_failures, cpi_data_cost, limit_cpi_loader_invoke, per_byte_logging_cost,
|
abort_on_all_cpi_failures, cpi_data_cost, limit_cpi_loader_invoke, per_byte_logging_cost,
|
||||||
pubkey_log_syscall_enabled, ristretto_mul_syscall_enabled, sha256_syscall_enabled,
|
pubkey_log_syscall_enabled, sha256_syscall_enabled, sol_log_compute_units_syscall,
|
||||||
sol_log_compute_units_syscall, try_find_program_address_syscall_enabled,
|
try_find_program_address_syscall_enabled, use_loaded_executables,
|
||||||
use_loaded_executables, use_loaded_program_accounts,
|
use_loaded_program_accounts,
|
||||||
},
|
},
|
||||||
hash::{Hasher, HASH_BYTES},
|
hash::{Hasher, HASH_BYTES},
|
||||||
ic_msg,
|
ic_msg,
|
||||||
@ -123,11 +122,6 @@ pub fn register_syscalls(
|
|||||||
syscall_registry.register_syscall_by_name(b"sol_sha256", SyscallSha256::call)?;
|
syscall_registry.register_syscall_by_name(b"sol_sha256", SyscallSha256::call)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
if invoke_context.is_feature_active(&ristretto_mul_syscall_enabled::id()) {
|
|
||||||
syscall_registry
|
|
||||||
.register_syscall_by_name(b"sol_ristretto_mul", SyscallRistrettoMul::call)?;
|
|
||||||
}
|
|
||||||
|
|
||||||
syscall_registry.register_syscall_by_name(
|
syscall_registry.register_syscall_by_name(
|
||||||
b"sol_create_program_address",
|
b"sol_create_program_address",
|
||||||
SyscallCreateProgramAddress::call,
|
SyscallCreateProgramAddress::call,
|
||||||
@ -237,17 +231,6 @@ pub fn bind_syscall_context_objects<'a>(
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
bind_feature_gated_syscall_context_object!(
|
|
||||||
vm,
|
|
||||||
invoke_context,
|
|
||||||
&ristretto_mul_syscall_enabled::id(),
|
|
||||||
Box::new(SyscallRistrettoMul {
|
|
||||||
cost: 0,
|
|
||||||
compute_meter: invoke_context.get_compute_meter(),
|
|
||||||
loader_id,
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
|
|
||||||
vm.bind_syscall_context_object(
|
vm.bind_syscall_context_object(
|
||||||
Box::new(SyscallCreateProgramAddress {
|
Box::new(SyscallCreateProgramAddress {
|
||||||
cost: bpf_compute_budget.create_program_address_units,
|
cost: bpf_compute_budget.create_program_address_units,
|
||||||
@ -821,43 +804,6 @@ impl<'a> SyscallObject<BpfError> for SyscallSha256<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Ristretto point multiply
|
|
||||||
pub struct SyscallRistrettoMul<'a> {
|
|
||||||
cost: u64,
|
|
||||||
compute_meter: Rc<RefCell<dyn ComputeMeter>>,
|
|
||||||
loader_id: &'a Pubkey,
|
|
||||||
}
|
|
||||||
impl<'a> SyscallObject<BpfError> for SyscallRistrettoMul<'a> {
|
|
||||||
fn call(
|
|
||||||
&mut self,
|
|
||||||
point_addr: u64,
|
|
||||||
scalar_addr: u64,
|
|
||||||
result_addr: u64,
|
|
||||||
_arg4: u64,
|
|
||||||
_arg5: u64,
|
|
||||||
memory_mapping: &MemoryMapping,
|
|
||||||
result: &mut Result<u64, EbpfError<BpfError>>,
|
|
||||||
) {
|
|
||||||
question_mark!(self.compute_meter.consume(self.cost), result);
|
|
||||||
|
|
||||||
let point = question_mark!(
|
|
||||||
translate_type::<RistrettoPoint>(memory_mapping, point_addr, self.loader_id),
|
|
||||||
result
|
|
||||||
);
|
|
||||||
let scalar = question_mark!(
|
|
||||||
translate_type::<Scalar>(memory_mapping, scalar_addr, self.loader_id),
|
|
||||||
result
|
|
||||||
);
|
|
||||||
let output = question_mark!(
|
|
||||||
translate_type_mut::<RistrettoPoint>(memory_mapping, result_addr, self.loader_id),
|
|
||||||
result
|
|
||||||
);
|
|
||||||
*output = point * scalar;
|
|
||||||
|
|
||||||
*result = Ok(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Cross-program invocation syscalls
|
// Cross-program invocation syscalls
|
||||||
|
|
||||||
struct AccountReferences<'a> {
|
struct AccountReferences<'a> {
|
||||||
|
@ -63,10 +63,6 @@ pub mod no_overflow_rent_distribution {
|
|||||||
solana_sdk::declare_id!("4kpdyrcj5jS47CZb2oJGfVxjYbsMm2Kx97gFyZrxxwXz");
|
solana_sdk::declare_id!("4kpdyrcj5jS47CZb2oJGfVxjYbsMm2Kx97gFyZrxxwXz");
|
||||||
}
|
}
|
||||||
|
|
||||||
pub mod ristretto_mul_syscall_enabled {
|
|
||||||
solana_sdk::declare_id!("HRe7A6aoxgjKzdjbBv6HTy7tJ4YWqE6tVmYCGho6S9Aq");
|
|
||||||
}
|
|
||||||
|
|
||||||
pub mod max_invoke_depth_4 {
|
pub mod max_invoke_depth_4 {
|
||||||
solana_sdk::declare_id!("EdM9xggY5y7AhNMskRG8NgGMnaP4JFNsWi8ZZtyT1af5");
|
solana_sdk::declare_id!("EdM9xggY5y7AhNMskRG8NgGMnaP4JFNsWi8ZZtyT1af5");
|
||||||
}
|
}
|
||||||
@ -197,7 +193,6 @@ lazy_static! {
|
|||||||
(bpf_compute_budget_balancing::id(), "compute budget balancing"),
|
(bpf_compute_budget_balancing::id(), "compute budget balancing"),
|
||||||
(sha256_syscall_enabled::id(), "sha256 syscall"),
|
(sha256_syscall_enabled::id(), "sha256 syscall"),
|
||||||
(no_overflow_rent_distribution::id(), "no overflow rent distribution"),
|
(no_overflow_rent_distribution::id(), "no overflow rent distribution"),
|
||||||
(ristretto_mul_syscall_enabled::id(), "ristretto multiply syscall"),
|
|
||||||
(max_invoke_depth_4::id(), "max invoke call depth 4"),
|
(max_invoke_depth_4::id(), "max invoke call depth 4"),
|
||||||
(max_program_call_depth_64::id(), "max program call depth 64"),
|
(max_program_call_depth_64::id(), "max program call depth 64"),
|
||||||
(sol_log_compute_units_syscall::id(), "sol_log_compute_units syscall (#13243)"),
|
(sol_log_compute_units_syscall::id(), "sol_log_compute_units syscall (#13243)"),
|
||||||
|
Reference in New Issue
Block a user