Fix various ledger-tool error due to no builtins (#12759)
* Fix various ledger-tool error due to no builtins * Add missing file...
This commit is contained in:
@ -31,6 +31,7 @@ reed-solomon-erasure = { version = "4.0.2", features = ["simd-accel"] }
|
||||
serde = "1.0.112"
|
||||
serde_bytes = "0.11.4"
|
||||
sha2 = "0.8.2"
|
||||
solana-bpf-loader-program = { path = "../programs/bpf_loader", version = "1.5.0" }
|
||||
solana-transaction-status = { path = "../transaction-status", version = "1.5.0" }
|
||||
solana-logger = { path = "../logger", version = "1.5.0" }
|
||||
solana-measure = { path = "../measure", version = "1.5.0" }
|
||||
|
@ -66,7 +66,7 @@ pub fn load(
|
||||
compression,
|
||||
genesis_config,
|
||||
process_options.debug_keys.clone(),
|
||||
process_options.additional_builtins.as_ref(),
|
||||
Some(&crate::builtins::get(genesis_config.cluster_type)),
|
||||
)
|
||||
.expect("Load from snapshot failed");
|
||||
|
||||
|
@ -16,7 +16,7 @@ use solana_metrics::{datapoint_error, inc_new_counter_debug};
|
||||
use solana_rayon_threadlimit::get_thread_count;
|
||||
use solana_runtime::{
|
||||
bank::{
|
||||
Bank, Builtins, InnerInstructionsList, TransactionBalancesSet, TransactionLogMessages,
|
||||
Bank, InnerInstructionsList, TransactionBalancesSet, TransactionLogMessages,
|
||||
TransactionProcessResult, TransactionResults,
|
||||
},
|
||||
bank_forks::BankForks,
|
||||
@ -320,7 +320,6 @@ pub struct ProcessOptions {
|
||||
pub new_hard_forks: Option<Vec<Slot>>,
|
||||
pub frozen_accounts: Vec<Pubkey>,
|
||||
pub debug_keys: Option<Arc<HashSet<Pubkey>>>,
|
||||
pub additional_builtins: Option<Builtins>,
|
||||
}
|
||||
|
||||
pub fn process_blockstore(
|
||||
@ -344,7 +343,7 @@ pub fn process_blockstore(
|
||||
account_paths,
|
||||
&opts.frozen_accounts,
|
||||
opts.debug_keys.clone(),
|
||||
opts.additional_builtins.as_ref(),
|
||||
Some(&crate::builtins::get(genesis_config.cluster_type)),
|
||||
);
|
||||
let bank0 = Arc::new(bank0);
|
||||
info!("processing ledger for slot 0...");
|
||||
|
44
ledger/src/builtins.rs
Normal file
44
ledger/src/builtins.rs
Normal file
@ -0,0 +1,44 @@
|
||||
use solana_runtime::{
|
||||
bank::{Builtin, Builtins, Entrypoint},
|
||||
feature_set,
|
||||
};
|
||||
use solana_sdk::{genesis_config::ClusterType, pubkey::Pubkey};
|
||||
|
||||
/// Builtin programs that are always available
|
||||
fn genesis_builtins(cluster_type: ClusterType) -> Vec<Builtin> {
|
||||
let builtins = if cluster_type != ClusterType::MainnetBeta {
|
||||
vec![
|
||||
solana_bpf_loader_deprecated_program!(),
|
||||
solana_bpf_loader_program!(),
|
||||
]
|
||||
} else {
|
||||
// Remove this `else` block and the `cluster_type` argument to this function once
|
||||
// `feature_set::bpf_loader2_program::id()` is active on Mainnet Beta
|
||||
vec![solana_bpf_loader_deprecated_program!()]
|
||||
};
|
||||
|
||||
builtins
|
||||
.into_iter()
|
||||
.map(|b| Builtin::new(&b.0, b.1, Entrypoint::Loader(b.2)))
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// Builtin programs activated dynamically by feature
|
||||
fn feature_builtins() -> Vec<(Builtin, Pubkey)> {
|
||||
let builtins = vec![(
|
||||
solana_bpf_loader_program!(),
|
||||
feature_set::bpf_loader2_program::id(),
|
||||
)];
|
||||
|
||||
builtins
|
||||
.into_iter()
|
||||
.map(|(b, p)| (Builtin::new(&b.0, b.1, Entrypoint::Loader(b.2)), p))
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub(crate) fn get(cluster_type: ClusterType) -> Builtins {
|
||||
Builtins {
|
||||
genesis_builtins: genesis_builtins(cluster_type),
|
||||
feature_builtins: feature_builtins(),
|
||||
}
|
||||
}
|
@ -1,3 +1,6 @@
|
||||
#[macro_use]
|
||||
extern crate solana_bpf_loader_program;
|
||||
|
||||
pub mod bank_forks_utils;
|
||||
pub mod bigtable_upload;
|
||||
pub mod block_error;
|
||||
@ -7,6 +10,7 @@ pub mod ancestor_iterator;
|
||||
pub mod blockstore_db;
|
||||
pub mod blockstore_meta;
|
||||
pub mod blockstore_processor;
|
||||
pub mod builtins;
|
||||
pub mod entry;
|
||||
pub mod erasure;
|
||||
pub mod genesis_utils;
|
||||
|
Reference in New Issue
Block a user