Skip to content
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
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ agave-banking-stage-ingress-types = { path = "banking-stage-ingress-types", vers
agave-cargo-registry = { path = "cargo-registry", version = "=3.0.0" }
agave-feature-set = { path = "feature-set", version = "=3.0.0" }
agave-geyser-plugin-interface = { path = "geyser-plugin-interface", version = "=3.0.0" }
agave-precompiles = { path = "precompiles", version = "=3.0.0" }
agave-precompiles = { path = "precompiles", version = "=2.2.2" }
agave-reserved-account-keys = { path = "reserved-account-keys", version = "=3.0.0" }
agave-thread-manager = { path = "thread-manager", version = "=3.0.0" }
agave-transaction-view = { path = "transaction-view", version = "=3.0.0" }
Expand Down Expand Up @@ -487,7 +487,7 @@ solana-quic-definitions = "2.2.1"
solana-rayon-threadlimit = { path = "rayon-threadlimit", version = "=3.0.0" }
solana-remote-wallet = { path = "remote-wallet", version = "=3.0.0", default-features = false }
solana-rent = "2.2.1"
solana-rent-collector = "2.2.1"
solana-rent-collector = { path = "svm-rent-collector", package = "solana-svm-rent-collector", version = "3.0.0" }
solana-rent-debits = "2.2.1"
solana-reward-info = "2.2.1"
solana-rpc = { path = "rpc", version = "=3.0.0" }
Expand Down
1 change: 1 addition & 0 deletions account-decoder-client-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ serde_derive = { workspace = true }
serde_json = { workspace = true }
solana-account = { workspace = true }
solana-pubkey = { workspace = true }
[target.'cfg(not(target_arch = "riscv32"))'.dependencies]
zstd = { workspace = true, optional = true }
4 changes: 2 additions & 2 deletions account-decoder-client-types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ impl UiAccountData {
UiAccountData::Binary(blob, encoding) => match encoding {
UiAccountEncoding::Base58 => bs58::decode(blob).into_vec().ok(),
UiAccountEncoding::Base64 => BASE64_STANDARD.decode(blob).ok(),
#[cfg(feature = "zstd")]
#[cfg(all(feature = "zstd", not(target_arch = "riscv32")))]
UiAccountEncoding::Base64Zstd => {
BASE64_STANDARD.decode(blob).ok().and_then(|zstd_data| {
let mut data = vec![];
Expand All @@ -51,7 +51,7 @@ impl UiAccountData {
.ok()
})
}
#[cfg(not(feature = "zstd"))]
#[cfg(any(not(feature = "zstd"), target_arch = "riscv32"))]
UiAccountEncoding::Base64Zstd => None,
UiAccountEncoding::Binary | UiAccountEncoding::JsonParsed => None,
},
Expand Down
3 changes: 2 additions & 1 deletion account-decoder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ spl-token-2022 = { workspace = true, features = ["no-entrypoint"] }
spl-token-group-interface = { workspace = true }
spl-token-metadata-interface = { workspace = true }
thiserror = { workspace = true }
zstd = { workspace = true }
[target.'cfg(not(target_arch = "riscv32"))'.dependencies]
zstd = { workspace = true }

[dev-dependencies]
assert_matches = { workspace = true }
Expand Down
27 changes: 20 additions & 7 deletions account-decoder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,29 @@ pub fn encode_ui_account<T: ReadableAccount>(
encoding,
),
UiAccountEncoding::Base64Zstd => {
let mut encoder = zstd::stream::write::Encoder::new(Vec::new(), 0).unwrap();
match encoder
.write_all(slice_data(account.data(), data_slice_config))
.and_then(|()| encoder.finish())
#[cfg(not(target_arch = "riscv32"))]
{
Ok(zstd_data) => UiAccountData::Binary(BASE64_STANDARD.encode(zstd_data), encoding),
Err(_) => UiAccountData::Binary(
let mut encoder = zstd::stream::write::Encoder::new(Vec::new(), 0).unwrap();
match encoder
.write_all(slice_data(account.data(), data_slice_config))
.and_then(|()| encoder.finish())
{
Ok(zstd_data) => {
UiAccountData::Binary(BASE64_STANDARD.encode(zstd_data), encoding)
}
Err(_) => UiAccountData::Binary(
BASE64_STANDARD.encode(slice_data(account.data(), data_slice_config)),
UiAccountEncoding::Base64,
),
}
}
#[cfg(target_arch = "riscv32")]
{
// Fallback to regular Base64 on RISC-V
UiAccountData::Binary(
BASE64_STANDARD.encode(slice_data(account.data(), data_slice_config)),
UiAccountEncoding::Base64,
),
)
}
}
UiAccountEncoding::JsonParsed => {
Expand Down
3 changes: 1 addition & 2 deletions core/src/banking_stage/consume_worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -755,8 +755,7 @@ mod tests {
solana_poh_config::PohConfig,
solana_pubkey::Pubkey,
solana_runtime::{
bank_forks::BankForks,
prioritization_fee_cache::PrioritizationFeeCache,
bank_forks::BankForks, prioritization_fee_cache::PrioritizationFeeCache,
vote_sender_types::ReplayVoteReceiver,
},
solana_runtime_transaction::runtime_transaction::RuntimeTransaction,
Expand Down
2 changes: 1 addition & 1 deletion measure/src/measure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ impl fmt::Display for Measure {

#[cfg(test)]
mod tests {
use {super::*};
use super::*;

// #[test]
// fn test_measure() {
Expand Down
2 changes: 1 addition & 1 deletion patches/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pub mod time;
pub mod time;
7 changes: 4 additions & 3 deletions precompiles/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[package]
name = "agave-precompiles"
name = "solana-precompiles"
description = "Solana precompiled programs."
documentation = "https://docs.rs/agave-precompiles"
version = { workspace = true }
version = "2.2.2"
authors = { workspace = true }
repository = { workspace = true }
homepage = { workspace = true }
Expand All @@ -20,6 +20,7 @@ bincode = { workspace = true }
digest = { workspace = true }
ed25519-dalek = { workspace = true }
libsecp256k1 = { workspace = true }
[target.'cfg(not(target_arch = "riscv32"))'.dependencies]
openssl = { workspace = true }
sha3 = { workspace = true }
solana-ed25519-program = { workspace = true }
Expand All @@ -28,7 +29,7 @@ solana-precompile-error = { workspace = true }
solana-pubkey = { workspace = true }
solana-sdk-ids = { workspace = true }
solana-secp256k1-program = { workspace = true, features = ["serde"] }
solana-secp256r1-program = { workspace = true, features = ["openssl-vendored"] }
solana-secp256r1-program = { workspace = true }

[dev-dependencies]
bytemuck = { workspace = true }
Expand Down
7 changes: 5 additions & 2 deletions precompiles/src/secp256k1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ pub mod tests {
crate::test_verify_with_alignment,
rand0_7::{thread_rng, Rng},
solana_keccak_hasher as keccak,
solana_secp256k1_program::{new_secp256k1_instruction_with_signature, sign_message, DATA_START},
solana_secp256k1_program::{
new_secp256k1_instruction_with_signature, sign_message, DATA_START,
},
};

fn test_case(
Expand Down Expand Up @@ -316,7 +318,8 @@ pub mod tests {
&signature,
recovery_id,
&eth_address,
); let feature_set = FeatureSet::all_enabled();
);
let feature_set = FeatureSet::all_enabled();
assert!(test_verify_with_alignment(
verify,
&instruction.data,
Expand Down
2 changes: 1 addition & 1 deletion precompiles/src/secp256r1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ pub fn verify(
_instruction_datas: &[&[u8]],
_feature_set: &FeatureSet,
) -> Result<(), PrecompileError> {
Err(PrecompileError::InvalidInstructionDataSize)
Err(PrecompileError::InvalidInstructionDataSize)
}

fn get_data_slice<'a>(
Expand Down
2 changes: 1 addition & 1 deletion programs/bpf_loader/src/syscalls/cpi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2940,7 +2940,7 @@ mod tests {
let lamports_cell_addr = key_addr + mem::size_of::<Pubkey>();
let owner_addr = lamports_cell_addr + mem::size_of::<VmBoxOfRefCell<&mut u64>>();
let data_cell_addr = owner_addr + mem::size_of::<Pubkey>();
let data_addr = data_cell_addr + mem::size_of::<VmBoxOfRefCell<VmSlice<u8>>>();
let data_addr = data_cell_addr + mem::size_of::<VmBoxOfRefCell<VmSlice<u8>>>();

let info = VmAccountInfo {
key: key_addr as u64,
Expand Down
2 changes: 1 addition & 1 deletion programs/bpf_loader/src/syscalls/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ macro_rules! translate_type_inner {
size_of::<$T>() as u64
)?;
if !$check_aligned {
Ok(unsafe { std::mem::transmute::<u64, &mut $T>(host_addr) })
Ok(unsafe { &mut *(host_addr as *mut $T) })
} else if !address_is_aligned::<$T>(host_addr) {
Err(SyscallError::UnalignedPointer.into())
} else {
Expand Down
1 change: 1 addition & 0 deletions storage-bigtable/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ solana-transaction-status = { workspace = true }
thiserror = { workspace = true }
tokio = { workspace = true }
tonic = { workspace = true, features = ["tls", "transport"] }
[target.'cfg(not(target_arch = "riscv32"))'.dependencies]
zstd = { workspace = true }

[dev-dependencies]
Expand Down
16 changes: 16 additions & 0 deletions storage-bigtable/src/compression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,17 @@ fn decompress_reader<'a, R: Read + 'a>(
) -> Result<Box<dyn Read + 'a>, io::Error> {
let buf_reader = BufReader::new(stream);
let decompress_reader: Box<dyn Read> = match method {
#[cfg(not(target_arch = "riscv32"))]
CompressionMethod::Bzip2 => Box::new(bzip2::bufread::BzDecoder::new(buf_reader)),
#[cfg(not(target_arch = "riscv32"))]
CompressionMethod::Gzip => Box::new(flate2::read::GzDecoder::new(buf_reader)),
#[cfg(not(target_arch = "riscv32"))]
CompressionMethod::Zstd => Box::new(zstd::stream::read::Decoder::new(buf_reader)?),
// Fallbacks for RISC-V - treat compressed data as uncompressed
#[cfg(target_arch = "riscv32")]
CompressionMethod::Bzip2 | CompressionMethod::Gzip | CompressionMethod::Zstd => {
Box::new(buf_reader)
}
CompressionMethod::NoCompression => Box::new(buf_reader),
};
Ok(decompress_reader)
Expand All @@ -45,21 +53,29 @@ pub fn decompress(data: &[u8]) -> Result<Vec<u8>, io::Error> {
pub fn compress(method: CompressionMethod, data: &[u8]) -> Result<Vec<u8>, io::Error> {
let mut compressed_data = bincode::serialize(&method).unwrap();
compressed_data.extend(match method {
#[cfg(not(target_arch = "riscv32"))]
CompressionMethod::Bzip2 => {
let mut e = bzip2::write::BzEncoder::new(Vec::new(), bzip2::Compression::best());
e.write_all(data)?;
e.finish()?
}
#[cfg(not(target_arch = "riscv32"))]
CompressionMethod::Gzip => {
let mut e = flate2::write::GzEncoder::new(Vec::new(), flate2::Compression::default());
e.write_all(data)?;
e.finish()?
}
#[cfg(not(target_arch = "riscv32"))]
CompressionMethod::Zstd => {
let mut e = zstd::stream::write::Encoder::new(Vec::new(), 0).unwrap();
e.write_all(data)?;
e.finish()?
}
// Fallbacks for RISC-V -- return uncompressed data
#[cfg(target_arch = "riscv32")]
CompressionMethod::Bzip2 | CompressionMethod::Gzip | CompressionMethod::Zstd => {
data.to_vec()
}
CompressionMethod::NoCompression => data.to_vec(),
});

Expand Down
2 changes: 1 addition & 1 deletion svm-rent-collector/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ edition = { workspace = true }
[dependencies]
solana-account = { workspace = true }
solana-clock = { workspace = true }
solana-epoch-schedule = { workspace = true }
solana-pubkey = { workspace = true }
solana-rent = { workspace = true }
solana-rent-collector = { workspace = true }
solana-sdk-ids = { workspace = true }
solana-transaction-context = { workspace = true }
solana-transaction-error = { workspace = true }
Expand Down
4 changes: 4 additions & 0 deletions svm-rent-collector/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@

pub mod rent_state;
pub mod svm_rent_collector;

pub use svm_rent_collector::rent_collector::{
CollectedInfo, RentCollector, RENT_EXEMPT_RENT_EPOCH,
};
5 changes: 2 additions & 3 deletions svm-rent-collector/src/svm_rent_collector.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
//! Plugin trait for rent collection within the Solana SVM.

use {
crate::rent_state::RentState,
crate::{rent_state::RentState, svm_rent_collector::rent_collector::CollectedInfo},
solana_account::{AccountSharedData, ReadableAccount},
solana_clock::Epoch,
solana_pubkey::Pubkey,
solana_rent::{Rent, RentDue},
solana_rent_collector::CollectedInfo,
solana_transaction_context::{IndexOfAccount, TransactionContext},
solana_transaction_error::{TransactionError, TransactionResult},
};

mod rent_collector;
pub mod rent_collector;

/// Rent collector trait. Represents an entity that can evaluate the rent state
/// of an account, determine rent due, and collect rent.
Expand Down
Loading