Refactor - Move interfaces of address-lookup-table into the program SDK (#33165)

* Adds a module `address_lookup_table` to the SDK.

* Adds a module `address_lookup_table::instruction` to the SDK.

* Adds a module `address_lookup_table::error` to the SDK.

* Adds a module `address_lookup_table::state` to the SDK.

* Moves AddressLookupTable into SDK as well.

* Moves AddressLookupTableAccount into address_lookup_table.

* Adds deprecation messages.

* Disentangles dependencies across cargo files.
This commit is contained in:
Alexander Meißner 2023-09-11 21:10:40 +02:00 committed by GitHub
parent 18f321525a
commit bbb57be0a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
40 changed files with 219 additions and 186 deletions

6
Cargo.lock generated
View File

@ -5085,7 +5085,6 @@ dependencies = [
"serde", "serde",
"serde_derive", "serde_derive",
"serde_json", "serde_json",
"solana-address-lookup-table-program",
"solana-config-program", "solana-config-program",
"solana-sdk", "solana-sdk",
"spl-token", "spl-token",
@ -5184,7 +5183,6 @@ dependencies = [
"serde_derive", "serde_derive",
"siphasher", "siphasher",
"solana-accounts-db", "solana-accounts-db",
"solana-address-lookup-table-program",
"solana-bpf-loader-program", "solana-bpf-loader-program",
"solana-bucket-map", "solana-bucket-map",
"solana-compute-budget-program", "solana-compute-budget-program",
@ -5542,7 +5540,6 @@ dependencies = [
"serde_derive", "serde_derive",
"serde_json", "serde_json",
"solana-account-decoder", "solana-account-decoder",
"solana-address-lookup-table-program",
"solana-bpf-loader-program", "solana-bpf-loader-program",
"solana-clap-utils", "solana-clap-utils",
"solana-cli-config", "solana-cli-config",
@ -5755,7 +5752,6 @@ dependencies = [
"serde_json", "serde_json",
"serial_test", "serial_test",
"solana-accounts-db", "solana-accounts-db",
"solana-address-lookup-table-program",
"solana-bloom", "solana-bloom",
"solana-client", "solana-client",
"solana-core", "solana-core",
@ -6693,7 +6689,6 @@ dependencies = [
"soketto", "soketto",
"solana-account-decoder", "solana-account-decoder",
"solana-accounts-db", "solana-accounts-db",
"solana-address-lookup-table-program",
"solana-client", "solana-client",
"solana-entry", "solana-entry",
"solana-faucet", "solana-faucet",
@ -7264,7 +7259,6 @@ dependencies = [
"serde_derive", "serde_derive",
"serde_json", "serde_json",
"solana-account-decoder", "solana-account-decoder",
"solana-address-lookup-table-program",
"solana-sdk", "solana-sdk",
"spl-associated-token-account", "spl-associated-token-account",
"spl-memo", "spl-memo",

View File

@ -19,7 +19,6 @@ lazy_static = { workspace = true }
serde = { workspace = true } serde = { workspace = true }
serde_derive = { workspace = true } serde_derive = { workspace = true }
serde_json = { workspace = true } serde_json = { workspace = true }
solana-address-lookup-table-program = { workspace = true }
solana-config-program = { workspace = true } solana-config-program = { workspace = true }
solana-sdk = { workspace = true } solana-sdk = { workspace = true }
spl-token = { workspace = true, features = ["no-entrypoint"] } spl-token = { workspace = true, features = ["no-entrypoint"] }

View File

@ -8,14 +8,15 @@ use {
inflector::Inflector, inflector::Inflector,
serde_json::Value, serde_json::Value,
solana_sdk::{ solana_sdk::{
instruction::InstructionError, pubkey::Pubkey, stake, system_program, sysvar, vote, address_lookup_table, instruction::InstructionError, pubkey::Pubkey, stake, system_program,
sysvar, vote,
}, },
std::collections::HashMap, std::collections::HashMap,
thiserror::Error, thiserror::Error,
}; };
lazy_static! { lazy_static! {
static ref ADDRESS_LOOKUP_PROGRAM_ID: Pubkey = solana_address_lookup_table_program::id(); static ref ADDRESS_LOOKUP_PROGRAM_ID: Pubkey = address_lookup_table::program::id();
static ref BPF_UPGRADEABLE_LOADER_PROGRAM_ID: Pubkey = solana_sdk::bpf_loader_upgradeable::id(); static ref BPF_UPGRADEABLE_LOADER_PROGRAM_ID: Pubkey = solana_sdk::bpf_loader_upgradeable::id();
static ref CONFIG_PROGRAM_ID: Pubkey = solana_config_program::id(); static ref CONFIG_PROGRAM_ID: Pubkey = solana_config_program::id();
static ref STAKE_PROGRAM_ID: Pubkey = stake::program::id(); static ref STAKE_PROGRAM_ID: Pubkey = stake::program::id();

View File

@ -1,7 +1,6 @@
use { use {
crate::parse_account_data::{ParsableAccount, ParseAccountError}, crate::parse_account_data::{ParsableAccount, ParseAccountError},
solana_address_lookup_table_program::state::AddressLookupTable, solana_sdk::{address_lookup_table::state::AddressLookupTable, instruction::InstructionError},
solana_sdk::instruction::InstructionError,
}; };
pub fn parse_address_lookup_table( pub fn parse_address_lookup_table(
@ -62,8 +61,10 @@ impl<'a> From<AddressLookupTable<'a>> for UiLookupTable {
mod test { mod test {
use { use {
super::*, super::*,
solana_address_lookup_table_program::state::{LookupTableMeta, LOOKUP_TABLE_META_SIZE}, solana_sdk::{
solana_sdk::pubkey::Pubkey, address_lookup_table::state::{LookupTableMeta, LOOKUP_TABLE_META_SIZE},
pubkey::Pubkey,
},
std::borrow::Cow, std::borrow::Cow,
}; };

View File

@ -45,7 +45,6 @@ regex = { workspace = true }
serde = { workspace = true, features = ["rc"] } serde = { workspace = true, features = ["rc"] }
serde_derive = { workspace = true } serde_derive = { workspace = true }
siphasher = { workspace = true } siphasher = { workspace = true }
solana-address-lookup-table-program = { workspace = true }
solana-bpf-loader-program = { workspace = true } solana-bpf-loader-program = { workspace = true }
solana-bucket-map = { workspace = true } solana-bucket-map = { workspace = true }
solana-compute-budget-program = { workspace = true } solana-compute-budget-program = { workspace = true }

View File

@ -24,7 +24,6 @@ use {
dashmap::DashMap, dashmap::DashMap,
itertools::Itertools, itertools::Itertools,
log::*, log::*,
solana_address_lookup_table_program::{error::AddressLookupError, state::AddressLookupTable},
solana_program_runtime::{ solana_program_runtime::{
compute_budget::{self, ComputeBudget}, compute_budget::{self, ComputeBudget},
loaded_programs::LoadedProgramsForTxBatch, loaded_programs::LoadedProgramsForTxBatch,
@ -32,6 +31,7 @@ use {
solana_sdk::{ solana_sdk::{
account::{Account, AccountSharedData, ReadableAccount, WritableAccount}, account::{Account, AccountSharedData, ReadableAccount, WritableAccount},
account_utils::StateMut, account_utils::StateMut,
address_lookup_table::{self, error::AddressLookupError, state::AddressLookupTable},
bpf_loader_upgradeable::{self, UpgradeableLoaderState}, bpf_loader_upgradeable::{self, UpgradeableLoaderState},
clock::{BankId, Slot}, clock::{BankId, Slot},
feature_set::{ feature_set::{
@ -781,7 +781,7 @@ impl Accounts {
.map(|(account, _rent)| account) .map(|(account, _rent)| account)
.ok_or(AddressLookupError::LookupTableAccountNotFound)?; .ok_or(AddressLookupError::LookupTableAccountNotFound)?;
if table_account.owner() == &solana_address_lookup_table_program::id() { if table_account.owner() == &address_lookup_table::program::id() {
let current_slot = ancestors.max_slot(); let current_slot = ancestors.max_slot();
let lookup_table = AddressLookupTable::deserialize(table_account.data()) let lookup_table = AddressLookupTable::deserialize(table_account.data())
.map_err(|_ix_err| AddressLookupError::InvalidAccountData)?; .map_err(|_ix_err| AddressLookupError::InvalidAccountData)?;
@ -1475,12 +1475,12 @@ mod tests {
transaction_results::{DurableNonceFee, TransactionExecutionDetails}, transaction_results::{DurableNonceFee, TransactionExecutionDetails},
}, },
assert_matches::assert_matches, assert_matches::assert_matches,
solana_address_lookup_table_program::state::LookupTableMeta,
solana_program_runtime::prioritization_fee::{ solana_program_runtime::prioritization_fee::{
PrioritizationFeeDetails, PrioritizationFeeType, PrioritizationFeeDetails, PrioritizationFeeType,
}, },
solana_sdk::{ solana_sdk::{
account::{AccountSharedData, WritableAccount}, account::{AccountSharedData, WritableAccount},
address_lookup_table::state::LookupTableMeta,
compute_budget::ComputeBudgetInstruction, compute_budget::ComputeBudgetInstruction,
epoch_schedule::EpochSchedule, epoch_schedule::EpochSchedule,
genesis_config::ClusterType, genesis_config::ClusterType,
@ -2356,7 +2356,7 @@ mod tests {
let invalid_table_key = Pubkey::new_unique(); let invalid_table_key = Pubkey::new_unique();
let invalid_table_account = let invalid_table_account =
AccountSharedData::new(1, 0, &solana_address_lookup_table_program::id()); AccountSharedData::new(1, 0, &address_lookup_table::program::id());
accounts.store_slow_uncached(0, &invalid_table_key, &invalid_table_account); accounts.store_slow_uncached(0, &invalid_table_key, &invalid_table_account);
let address_table_lookup = MessageAddressTableLookup { let address_table_lookup = MessageAddressTableLookup {
@ -2395,7 +2395,7 @@ mod tests {
AccountSharedData::create( AccountSharedData::create(
1, 1,
table_state.serialize_for_tests().unwrap(), table_state.serialize_for_tests().unwrap(),
solana_address_lookup_table_program::id(), address_lookup_table::program::id(),
false, false,
0, 0,
) )

View File

@ -29,7 +29,6 @@ serde = { workspace = true }
serde_derive = { workspace = true } serde_derive = { workspace = true }
serde_json = { workspace = true } serde_json = { workspace = true }
solana-account-decoder = { workspace = true } solana-account-decoder = { workspace = true }
solana-address-lookup-table-program = { workspace = true }
solana-bpf-loader-program = { workspace = true } solana-bpf-loader-program = { workspace = true }
solana-clap-utils = { workspace = true } solana-clap-utils = { workspace = true }
solana-cli-config = { workspace = true } solana-cli-config = { workspace = true }

View File

@ -1,21 +1,28 @@
use { use {
crate::cli::{CliCommand, CliCommandInfo, CliConfig, CliError, ProcessResult}, crate::cli::{CliCommand, CliCommandInfo, CliConfig, CliError, ProcessResult},
clap::{App, AppSettings, Arg, ArgMatches, SubCommand}, clap::{App, AppSettings, Arg, ArgMatches, SubCommand},
solana_address_lookup_table_program::{
instruction::{
close_lookup_table, create_lookup_table, create_lookup_table_signed,
deactivate_lookup_table, extend_lookup_table, freeze_lookup_table,
},
state::AddressLookupTable,
},
solana_clap_utils::{self, input_parsers::*, input_validators::*, keypair::*}, solana_clap_utils::{self, input_parsers::*, input_validators::*, keypair::*},
solana_cli_output::{CliAddressLookupTable, CliAddressLookupTableCreated, CliSignature}, solana_cli_output::{CliAddressLookupTable, CliAddressLookupTableCreated, CliSignature},
solana_remote_wallet::remote_wallet::RemoteWalletManager, solana_remote_wallet::remote_wallet::RemoteWalletManager,
solana_rpc_client::rpc_client::RpcClient, solana_rpc_client::rpc_client::RpcClient,
solana_rpc_client_api::config::RpcSendTransactionConfig, solana_rpc_client_api::config::RpcSendTransactionConfig,
solana_sdk::{ solana_sdk::{
account::from_account, clock::Clock, commitment_config::CommitmentConfig, message::Message, account::from_account,
pubkey::Pubkey, signer::Signer, sysvar, transaction::Transaction, address_lookup_table::{
self,
instruction::{
close_lookup_table, create_lookup_table, create_lookup_table_signed,
deactivate_lookup_table, extend_lookup_table, freeze_lookup_table,
},
state::AddressLookupTable,
},
clock::Clock,
commitment_config::CommitmentConfig,
message::Message,
pubkey::Pubkey,
signer::Signer,
sysvar,
transaction::Transaction,
}, },
std::{rc::Rc, sync::Arc}, std::{rc::Rc, sync::Arc},
}; };
@ -604,7 +611,7 @@ fn process_freeze_lookup_table(
let lookup_table_account = get_lookup_table_result.value.ok_or_else(|| { let lookup_table_account = get_lookup_table_result.value.ok_or_else(|| {
format!("Lookup table account {lookup_table_pubkey} not found, was it already closed?") format!("Lookup table account {lookup_table_pubkey} not found, was it already closed?")
})?; })?;
if !solana_address_lookup_table_program::check_id(&lookup_table_account.owner) { if !address_lookup_table::program::check_id(&lookup_table_account.owner) {
return Err(format!( return Err(format!(
"Lookup table account {lookup_table_pubkey} is not owned by the Address Lookup Table program", "Lookup table account {lookup_table_pubkey} is not owned by the Address Lookup Table program",
) )
@ -662,7 +669,7 @@ fn process_extend_lookup_table(
let lookup_table_account = get_lookup_table_result.value.ok_or_else(|| { let lookup_table_account = get_lookup_table_result.value.ok_or_else(|| {
format!("Lookup table account {lookup_table_pubkey} not found, was it already closed?") format!("Lookup table account {lookup_table_pubkey} not found, was it already closed?")
})?; })?;
if !solana_address_lookup_table_program::check_id(&lookup_table_account.owner) { if !address_lookup_table::program::check_id(&lookup_table_account.owner) {
return Err(format!( return Err(format!(
"Lookup table account {lookup_table_pubkey} is not owned by the Address Lookup Table program", "Lookup table account {lookup_table_pubkey} is not owned by the Address Lookup Table program",
) )
@ -721,7 +728,7 @@ fn process_deactivate_lookup_table(
let lookup_table_account = get_lookup_table_result.value.ok_or_else(|| { let lookup_table_account = get_lookup_table_result.value.ok_or_else(|| {
format!("Lookup table account {lookup_table_pubkey} not found, was it already closed?") format!("Lookup table account {lookup_table_pubkey} not found, was it already closed?")
})?; })?;
if !solana_address_lookup_table_program::check_id(&lookup_table_account.owner) { if !address_lookup_table::program::check_id(&lookup_table_account.owner) {
return Err(format!( return Err(format!(
"Lookup table account {lookup_table_pubkey} is not owned by the Address Lookup Table program", "Lookup table account {lookup_table_pubkey} is not owned by the Address Lookup Table program",
) )
@ -774,7 +781,7 @@ fn process_close_lookup_table(
let lookup_table_account = get_lookup_table_result.value.ok_or_else(|| { let lookup_table_account = get_lookup_table_result.value.ok_or_else(|| {
format!("Lookup table account {lookup_table_pubkey} not found, was it already closed?") format!("Lookup table account {lookup_table_pubkey} not found, was it already closed?")
})?; })?;
if !solana_address_lookup_table_program::check_id(&lookup_table_account.owner) { if !address_lookup_table::program::check_id(&lookup_table_account.owner) {
return Err(format!( return Err(format!(
"Lookup table account {lookup_table_pubkey} is not owned by the Address Lookup Table program", "Lookup table account {lookup_table_pubkey} is not owned by the Address Lookup Table program",
) )
@ -827,7 +834,7 @@ fn process_show_lookup_table(
let lookup_table_account = get_lookup_table_result.value.ok_or_else(|| { let lookup_table_account = get_lookup_table_result.value.ok_or_else(|| {
format!("Lookup table account {lookup_table_pubkey} not found, was it already closed?") format!("Lookup table account {lookup_table_pubkey} not found, was it already closed?")
})?; })?;
if !solana_address_lookup_table_program::check_id(&lookup_table_account.owner) { if !address_lookup_table::program::check_id(&lookup_table_account.owner) {
return Err(format!( return Err(format!(
"Lookup table account {lookup_table_pubkey} is not owned by the Address Lookup Table program", "Lookup table account {lookup_table_pubkey} is not owned by the Address Lookup Table program",
) )

View File

@ -42,7 +42,6 @@ serde = { workspace = true }
serde_bytes = { workspace = true } serde_bytes = { workspace = true }
serde_derive = { workspace = true } serde_derive = { workspace = true }
solana-accounts-db = { workspace = true } solana-accounts-db = { workspace = true }
solana-address-lookup-table-program = { workspace = true }
solana-bloom = { workspace = true } solana-bloom = { workspace = true }
solana-client = { workspace = true } solana-client = { workspace = true }
solana-cost-model = { workspace = true } solana-cost-model = { workspace = true }

View File

@ -737,7 +737,6 @@ mod tests {
unprocessed_transaction_storage::ThreadType, unprocessed_transaction_storage::ThreadType,
}, },
crossbeam_channel::{unbounded, Receiver}, crossbeam_channel::{unbounded, Receiver},
solana_address_lookup_table_program::state::{AddressLookupTable, LookupTableMeta},
solana_cost_model::cost_model::CostModel, solana_cost_model::cost_model::CostModel,
solana_entry::entry::{next_entry, next_versioned_entry}, solana_entry::entry::{next_entry, next_versioned_entry},
solana_ledger::{ solana_ledger::{
@ -754,6 +753,10 @@ mod tests {
solana_runtime::prioritization_fee_cache::PrioritizationFeeCache, solana_runtime::prioritization_fee_cache::PrioritizationFeeCache,
solana_sdk::{ solana_sdk::{
account::AccountSharedData, account::AccountSharedData,
address_lookup_table::{
self,
state::{AddressLookupTable, LookupTableMeta},
},
instruction::InstructionError, instruction::InstructionError,
message::{v0, v0::MessageAddressTableLookup, MessageHeader, VersionedMessage}, message::{v0, v0::MessageAddressTableLookup, MessageHeader, VersionedMessage},
poh_config::PohConfig, poh_config::PohConfig,
@ -844,7 +847,7 @@ mod tests {
) -> AccountSharedData { ) -> AccountSharedData {
let data = address_lookup_table.serialize_for_tests().unwrap(); let data = address_lookup_table.serialize_for_tests().unwrap();
let mut account = let mut account =
AccountSharedData::new(1, data.len(), &solana_address_lookup_table_program::id()); AccountSharedData::new(1, data.len(), &address_lookup_table::program::id());
account.set_data(data); account.set_data(data);
bank.store_account(&account_address, &account); bank.store_account(&account_address, &account);

View File

@ -105,11 +105,14 @@ impl ReadWriteAccountSet {
mod tests { mod tests {
use { use {
super::ReadWriteAccountSet, super::ReadWriteAccountSet,
solana_address_lookup_table_program::state::{AddressLookupTable, LookupTableMeta},
solana_ledger::genesis_utils::GenesisConfigInfo, solana_ledger::genesis_utils::GenesisConfigInfo,
solana_runtime::{bank::Bank, genesis_utils::create_genesis_config}, solana_runtime::{bank::Bank, genesis_utils::create_genesis_config},
solana_sdk::{ solana_sdk::{
account::AccountSharedData, account::AccountSharedData,
address_lookup_table::{
self,
state::{AddressLookupTable, LookupTableMeta},
},
hash::Hash, hash::Hash,
message::{ message::{
v0::{self, MessageAddressTableLookup}, v0::{self, MessageAddressTableLookup},
@ -178,7 +181,7 @@ mod tests {
let address_table_key = Pubkey::new_unique(); let address_table_key = Pubkey::new_unique();
let data = address_lookup_table.serialize_for_tests().unwrap(); let data = address_lookup_table.serialize_for_tests().unwrap();
let mut account = let mut account =
AccountSharedData::new(1, data.len(), &solana_address_lookup_table_program::id()); AccountSharedData::new(1, data.len(), &address_lookup_table::program::id());
account.set_data(data); account.set_data(data);
bank.store_account(&address_table_key, &account); bank.store_account(&address_table_key, &account);

View File

@ -3,8 +3,8 @@
use { use {
lazy_static::lazy_static, lazy_static::lazy_static,
solana_sdk::{ solana_sdk::{
bpf_loader, bpf_loader_deprecated, bpf_loader_upgradeable, compute_budget, ed25519_program, address_lookup_table, bpf_loader, bpf_loader_deprecated, bpf_loader_upgradeable,
loader_v4, pubkey::Pubkey, secp256k1_program, compute_budget, ed25519_program, loader_v4, pubkey::Pubkey, secp256k1_program,
}, },
std::collections::HashMap, std::collections::HashMap,
}; };
@ -37,7 +37,7 @@ lazy_static! {
(solana_vote_program::id(), solana_vote_program::vote_processor::DEFAULT_COMPUTE_UNITS), (solana_vote_program::id(), solana_vote_program::vote_processor::DEFAULT_COMPUTE_UNITS),
(solana_system_program::id(), solana_system_program::system_processor::DEFAULT_COMPUTE_UNITS), (solana_system_program::id(), solana_system_program::system_processor::DEFAULT_COMPUTE_UNITS),
(compute_budget::id(), solana_compute_budget_program::DEFAULT_COMPUTE_UNITS), (compute_budget::id(), solana_compute_budget_program::DEFAULT_COMPUTE_UNITS),
(solana_address_lookup_table_program::id(), solana_address_lookup_table_program::processor::DEFAULT_COMPUTE_UNITS), (address_lookup_table::program::id(), solana_address_lookup_table_program::processor::DEFAULT_COMPUTE_UNITS),
(bpf_loader_upgradeable::id(), solana_bpf_loader_program::UPGRADEABLE_LOADER_COMPUTE_UNITS), (bpf_loader_upgradeable::id(), solana_bpf_loader_program::UPGRADEABLE_LOADER_COMPUTE_UNITS),
(bpf_loader_deprecated::id(), solana_bpf_loader_program::DEPRECATED_LOADER_COMPUTE_UNITS), (bpf_loader_deprecated::id(), solana_bpf_loader_program::DEPRECATED_LOADER_COMPUTE_UNITS),
(bpf_loader::id(), solana_bpf_loader_program::DEFAULT_LOADER_COMPUTE_UNITS), (bpf_loader::id(), solana_bpf_loader_program::DEFAULT_LOADER_COMPUTE_UNITS),

View File

@ -50,6 +50,11 @@ Create and manage accounts that track validator voting state and rewards.
- Program id: `Vote111111111111111111111111111111111111111` - Program id: `Vote111111111111111111111111111111111111111`
- Instructions: [VoteInstruction](https://docs.rs/solana-vote-program/VERSION_FOR_DOCS_RS/solana_vote_program/vote_instruction/enum.VoteInstruction.html) - Instructions: [VoteInstruction](https://docs.rs/solana-vote-program/VERSION_FOR_DOCS_RS/solana_vote_program/vote_instruction/enum.VoteInstruction.html)
## Address Lookup Table Program
- Program id: `AddressLookupTab1e1111111111111111111111111`
- Instructions: [AddressLookupTableInstruction](https://docs.rs/solana-sdk/VERSION_FOR_DOCS_RS/solana_sdk/address_lookup_table/instruction/enum.ProgramInstruction.html)
## BPF Loader ## BPF Loader
Deploys, upgrades, and executes programs on the chain. Deploys, upgrades, and executes programs on the chain.

View File

@ -4,9 +4,9 @@ use {
add_lookup_table_account, assert_ix_error, new_address_lookup_table, add_lookup_table_account, assert_ix_error, new_address_lookup_table,
overwrite_slot_hashes_with_slots, setup_test_context, overwrite_slot_hashes_with_slots, setup_test_context,
}, },
solana_address_lookup_table_program::instruction::close_lookup_table,
solana_program_test::*, solana_program_test::*,
solana_sdk::{ solana_sdk::{
address_lookup_table::instruction::close_lookup_table,
clock::Clock, clock::Clock,
instruction::InstructionError, instruction::InstructionError,
pubkey::Pubkey, pubkey::Pubkey,

View File

@ -1,13 +1,13 @@
#![allow(dead_code)] #![allow(dead_code)]
use { use {
solana_address_lookup_table_program::{ solana_address_lookup_table_program::processor::process_instruction,
id,
processor::process_instruction,
state::{AddressLookupTable, LookupTableMeta},
},
solana_program_test::*, solana_program_test::*,
solana_sdk::{ solana_sdk::{
account::AccountSharedData, account::AccountSharedData,
address_lookup_table::{
program::id,
state::{AddressLookupTable, LookupTableMeta},
},
clock::Slot, clock::Slot,
hash::Hash, hash::Hash,
instruction::{Instruction, InstructionError}, instruction::{Instruction, InstructionError},
@ -80,11 +80,7 @@ pub async fn add_lookup_table_account(
let rent = context.banks_client.get_rent().await.unwrap(); let rent = context.banks_client.get_rent().await.unwrap();
let rent_exempt_balance = rent.minimum_balance(data.len()); let rent_exempt_balance = rent.minimum_balance(data.len());
let mut account = AccountSharedData::new( let mut account = AccountSharedData::new(rent_exempt_balance, data.len(), &id());
rent_exempt_balance,
data.len(),
&solana_address_lookup_table_program::id(),
);
account.set_data_from_slice(&data); account.set_data_from_slice(&data);
context.set_account(&account_address, &account); context.set_account(&account_address, &account);

View File

@ -1,16 +1,22 @@
use { use {
assert_matches::assert_matches, assert_matches::assert_matches,
common::{assert_ix_error, overwrite_slot_hashes_with_slots, setup_test_context}, common::{assert_ix_error, overwrite_slot_hashes_with_slots, setup_test_context},
solana_address_lookup_table_program::{ solana_address_lookup_table_program::processor::process_instruction,
id,
instruction::{create_lookup_table, create_lookup_table_signed},
processor::process_instruction,
state::{AddressLookupTable, LOOKUP_TABLE_META_SIZE},
},
solana_program_test::*, solana_program_test::*,
solana_sdk::{ solana_sdk::{
clock::Slot, feature_set, instruction::InstructionError, pubkey::Pubkey, rent::Rent, address_lookup_table::{
signature::Signer, signer::keypair::Keypair, transaction::Transaction, instruction::{create_lookup_table, create_lookup_table_signed},
program::id,
state::{AddressLookupTable, LOOKUP_TABLE_META_SIZE},
},
clock::Slot,
feature_set,
instruction::InstructionError,
pubkey::Pubkey,
rent::Rent,
signature::Signer,
signer::keypair::Keypair,
transaction::Transaction,
}, },
}; };

View File

@ -3,11 +3,9 @@ use {
common::{ common::{
add_lookup_table_account, assert_ix_error, new_address_lookup_table, setup_test_context, add_lookup_table_account, assert_ix_error, new_address_lookup_table, setup_test_context,
}, },
solana_address_lookup_table_program::{
instruction::deactivate_lookup_table, state::AddressLookupTable,
},
solana_program_test::*, solana_program_test::*,
solana_sdk::{ solana_sdk::{
address_lookup_table::{instruction::deactivate_lookup_table, state::AddressLookupTable},
instruction::InstructionError, instruction::InstructionError,
pubkey::Pubkey, pubkey::Pubkey,
signature::{Keypair, Signer}, signature::{Keypair, Signer},

View File

@ -3,13 +3,13 @@ use {
common::{ common::{
add_lookup_table_account, assert_ix_error, new_address_lookup_table, setup_test_context, add_lookup_table_account, assert_ix_error, new_address_lookup_table, setup_test_context,
}, },
solana_address_lookup_table_program::{
instruction::extend_lookup_table,
state::{AddressLookupTable, LookupTableMeta},
},
solana_program_test::*, solana_program_test::*,
solana_sdk::{ solana_sdk::{
account::{ReadableAccount, WritableAccount}, account::{ReadableAccount, WritableAccount},
address_lookup_table::{
instruction::extend_lookup_table,
state::{AddressLookupTable, LookupTableMeta},
},
clock::Clock, clock::Clock,
instruction::{Instruction, InstructionError}, instruction::{Instruction, InstructionError},
pubkey::{Pubkey, PUBKEY_BYTES}, pubkey::{Pubkey, PUBKEY_BYTES},

View File

@ -3,11 +3,9 @@ use {
common::{ common::{
add_lookup_table_account, assert_ix_error, new_address_lookup_table, setup_test_context, add_lookup_table_account, assert_ix_error, new_address_lookup_table, setup_test_context,
}, },
solana_address_lookup_table_program::{
instruction::freeze_lookup_table, state::AddressLookupTable,
},
solana_program_test::*, solana_program_test::*,
solana_sdk::{ solana_sdk::{
address_lookup_table::{instruction::freeze_lookup_table, state::AddressLookupTable},
instruction::InstructionError, instruction::InstructionError,
pubkey::Pubkey, pubkey::Pubkey,
signature::{Keypair, Signer}, signature::{Keypair, Signer},

View File

@ -2,12 +2,14 @@
#![cfg_attr(RUSTC_WITH_SPECIALIZATION, feature(specialization))] #![cfg_attr(RUSTC_WITH_SPECIALIZATION, feature(specialization))]
#![cfg_attr(RUSTC_NEEDS_PROC_MACRO_HYGIENE, feature(proc_macro_hygiene))] #![cfg_attr(RUSTC_NEEDS_PROC_MACRO_HYGIENE, feature(proc_macro_hygiene))]
use solana_program::declare_id;
pub mod error;
pub mod instruction;
#[cfg(not(target_os = "solana"))]
pub mod processor; pub mod processor;
pub mod state;
declare_id!("AddressLookupTab1e1111111111111111111111111"); #[deprecated(
since = "1.17.0",
note = "Please use `solana_sdk::address_lookup_table` instead"
)]
pub use solana_sdk::address_lookup_table::{
error, instruction,
program::{check_id, id, ID},
state,
};

View File

@ -1,13 +1,14 @@
use { use {
crate::{
instruction::ProgramInstruction,
state::{
AddressLookupTable, LookupTableMeta, LookupTableStatus, ProgramState,
LOOKUP_TABLE_MAX_ADDRESSES, LOOKUP_TABLE_META_SIZE,
},
},
solana_program_runtime::{declare_process_instruction, ic_msg, invoke_context::InvokeContext}, solana_program_runtime::{declare_process_instruction, ic_msg, invoke_context::InvokeContext},
solana_sdk::{ solana_sdk::{
address_lookup_table::{
instruction::ProgramInstruction,
program::{check_id, id},
state::{
AddressLookupTable, LookupTableMeta, LookupTableStatus, ProgramState,
LOOKUP_TABLE_MAX_ADDRESSES, LOOKUP_TABLE_META_SIZE,
},
},
clock::Slot, clock::Slot,
feature_set, feature_set,
instruction::InstructionError, instruction::InstructionError,
@ -117,7 +118,7 @@ impl Processor {
&derivation_slot.to_le_bytes(), &derivation_slot.to_le_bytes(),
&[bump_seed], &[bump_seed],
], ],
&crate::id(), &id(),
)?; )?;
if table_key != derived_table_key { if table_key != derived_table_key {
@ -132,7 +133,7 @@ impl Processor {
if invoke_context if invoke_context
.feature_set .feature_set
.is_active(&feature_set::relax_authority_signer_check_for_lookup_table_creation::id()) .is_active(&feature_set::relax_authority_signer_check_for_lookup_table_creation::id())
&& crate::check_id(&lookup_table_owner) && check_id(&lookup_table_owner)
{ {
return Ok(()); return Ok(());
} }
@ -157,7 +158,7 @@ impl Processor {
)?; )?;
invoke_context.native_invoke( invoke_context.native_invoke(
system_instruction::assign(&table_key, &crate::id()).into(), system_instruction::assign(&table_key, &id()).into(),
&[table_key], &[table_key],
)?; )?;
@ -178,7 +179,7 @@ impl Processor {
let lookup_table_account = let lookup_table_account =
instruction_context.try_borrow_instruction_account(transaction_context, 0)?; instruction_context.try_borrow_instruction_account(transaction_context, 0)?;
if *lookup_table_account.get_owner() != crate::id() { if *lookup_table_account.get_owner() != id() {
return Err(InstructionError::InvalidAccountOwner); return Err(InstructionError::InvalidAccountOwner);
} }
drop(lookup_table_account); drop(lookup_table_account);
@ -233,7 +234,7 @@ impl Processor {
let lookup_table_account = let lookup_table_account =
instruction_context.try_borrow_instruction_account(transaction_context, 0)?; instruction_context.try_borrow_instruction_account(transaction_context, 0)?;
let table_key = *lookup_table_account.get_key(); let table_key = *lookup_table_account.get_key();
if *lookup_table_account.get_owner() != crate::id() { if *lookup_table_account.get_owner() != id() {
return Err(InstructionError::InvalidAccountOwner); return Err(InstructionError::InvalidAccountOwner);
} }
drop(lookup_table_account); drop(lookup_table_account);
@ -348,7 +349,7 @@ impl Processor {
let lookup_table_account = let lookup_table_account =
instruction_context.try_borrow_instruction_account(transaction_context, 0)?; instruction_context.try_borrow_instruction_account(transaction_context, 0)?;
if *lookup_table_account.get_owner() != crate::id() { if *lookup_table_account.get_owner() != id() {
return Err(InstructionError::InvalidAccountOwner); return Err(InstructionError::InvalidAccountOwner);
} }
drop(lookup_table_account); drop(lookup_table_account);
@ -397,7 +398,7 @@ impl Processor {
let lookup_table_account = let lookup_table_account =
instruction_context.try_borrow_instruction_account(transaction_context, 0)?; instruction_context.try_borrow_instruction_account(transaction_context, 0)?;
if *lookup_table_account.get_owner() != crate::id() { if *lookup_table_account.get_owner() != id() {
return Err(InstructionError::InvalidAccountOwner); return Err(InstructionError::InvalidAccountOwner);
} }
drop(lookup_table_account); drop(lookup_table_account);

View File

@ -4456,7 +4456,6 @@ dependencies = [
"serde", "serde",
"serde_derive", "serde_derive",
"serde_json", "serde_json",
"solana-address-lookup-table-program",
"solana-config-program", "solana-config-program",
"solana-sdk", "solana-sdk",
"spl-token", "spl-token",
@ -4505,7 +4504,6 @@ dependencies = [
"serde", "serde",
"serde_derive", "serde_derive",
"siphasher", "siphasher",
"solana-address-lookup-table-program",
"solana-bpf-loader-program", "solana-bpf-loader-program",
"solana-bucket-map", "solana-bucket-map",
"solana-compute-budget-program", "solana-compute-budget-program",
@ -4812,7 +4810,6 @@ dependencies = [
"serde_bytes", "serde_bytes",
"serde_derive", "serde_derive",
"solana-accounts-db", "solana-accounts-db",
"solana-address-lookup-table-program",
"solana-bloom", "solana-bloom",
"solana-client", "solana-client",
"solana-cost-model", "solana-cost-model",
@ -5684,7 +5681,6 @@ name = "solana-sbf-rust-dep-crate"
version = "1.17.0" version = "1.17.0"
dependencies = [ dependencies = [
"byteorder 1.4.3", "byteorder 1.4.3",
"solana-address-lookup-table-program",
"solana-program", "solana-program",
] ]
@ -6255,7 +6251,6 @@ dependencies = [
"serde_derive", "serde_derive",
"serde_json", "serde_json",
"solana-account-decoder", "solana-account-decoder",
"solana-address-lookup-table-program",
"solana-sdk", "solana-sdk",
"spl-associated-token-account", "spl-associated-token-account",
"spl-memo", "spl-memo",

View File

@ -28,7 +28,6 @@ serde_json = "1.0.56"
solana_rbpf = "=0.7.1" solana_rbpf = "=0.7.1"
solana-account-decoder = { path = "../../account-decoder", version = "=1.17.0" } solana-account-decoder = { path = "../../account-decoder", version = "=1.17.0" }
solana-accounts-db = { path = "../../accounts-db", version = "=1.17.0" } solana-accounts-db = { path = "../../accounts-db", version = "=1.17.0" }
solana-address-lookup-table-program = { path = "../../programs/address-lookup-table", version = "=1.17.0" }
solana-bpf-loader-program = { path = "../bpf_loader", version = "=1.17.0" } solana-bpf-loader-program = { path = "../bpf_loader", version = "=1.17.0" }
solana-cli-output = { path = "../../cli-output", version = "=1.17.0" } solana-cli-output = { path = "../../cli-output", version = "=1.17.0" }
solana-ledger = { path = "../../ledger", version = "=1.17.0" } solana-ledger = { path = "../../ledger", version = "=1.17.0" }

View File

@ -12,7 +12,6 @@ edition = { workspace = true }
[dependencies] [dependencies]
byteorder = { workspace = true } byteorder = { workspace = true }
# list of crates which must be buildable for bpf programs # list of crates which must be buildable for bpf programs
solana-address-lookup-table-program = { workspace = true }
solana-program = { workspace = true } solana-program = { workspace = true }
[lib] [lib]

View File

@ -61,7 +61,6 @@ tokio-util = { workspace = true, features = ["codec", "compat"] }
[dev-dependencies] [dev-dependencies]
serial_test = { workspace = true } serial_test = { workspace = true }
solana-address-lookup-table-program = { workspace = true }
solana-net-utils = { workspace = true } solana-net-utils = { workspace = true }
solana-stake-program = { workspace = true } solana-stake-program = { workspace = true }
symlink = { workspace = true } symlink = { workspace = true }

View File

@ -4631,7 +4631,6 @@ pub mod tests {
jsonrpc_core_client::transports::local, jsonrpc_core_client::transports::local,
serde::de::DeserializeOwned, serde::de::DeserializeOwned,
solana_accounts_db::{inline_spl_token, inline_spl_token_2022}, solana_accounts_db::{inline_spl_token, inline_spl_token_2022},
solana_address_lookup_table_program::state::{AddressLookupTable, LookupTableMeta},
solana_entry::entry::next_versioned_entry, solana_entry::entry::next_versioned_entry,
solana_gossip::socketaddr, solana_gossip::socketaddr,
solana_ledger::{ solana_ledger::{
@ -4653,6 +4652,10 @@ pub mod tests {
}, },
solana_sdk::{ solana_sdk::{
account::{Account, WritableAccount}, account::{Account, WritableAccount},
address_lookup_table::{
self,
state::{AddressLookupTable, LookupTableMeta},
},
clock::MAX_RECENT_BLOCKHASHES, clock::MAX_RECENT_BLOCKHASHES,
compute_budget::ComputeBudgetInstruction, compute_budget::ComputeBudgetInstruction,
fee_calculator::{FeeRateGovernor, DEFAULT_BURN_PERCENT}, fee_calculator::{FeeRateGovernor, DEFAULT_BURN_PERCENT},
@ -4934,7 +4937,7 @@ pub mod tests {
AccountSharedData::create( AccountSharedData::create(
min_balance_lamports, min_balance_lamports,
address_table_data, address_table_data,
solana_address_lookup_table_program::id(), address_lookup_table::program::id(),
false, false,
0, 0,
) )

View File

@ -1,7 +1,7 @@
use { use {
super::Bank, super::Bank,
solana_address_lookup_table_program::error::AddressLookupError,
solana_sdk::{ solana_sdk::{
address_lookup_table::error::AddressLookupError,
message::{ message::{
v0::{LoadedAddresses, MessageAddressTableLookup}, v0::{LoadedAddresses, MessageAddressTableLookup},
AddressLoaderError, AddressLoaderError,

View File

@ -91,7 +91,7 @@ pub static BUILTINS: &[BuiltinPrototype] = &[
}, },
BuiltinPrototype { BuiltinPrototype {
feature_id: None, feature_id: None,
program_id: solana_address_lookup_table_program::id(), program_id: solana_sdk::address_lookup_table::program::id(),
name: "address_lookup_table_program", name: "address_lookup_table_program",
entrypoint: solana_address_lookup_table_program::processor::process_instruction, entrypoint: solana_address_lookup_table_program::processor::process_instruction,
}, },

View File

@ -1,12 +1,12 @@
use { use {
crate::id, crate::{
serde::{Deserialize, Serialize}, address_lookup_table::program::id,
solana_program::{
clock::Slot, clock::Slot,
instruction::{AccountMeta, Instruction}, instruction::{AccountMeta, Instruction},
pubkey::Pubkey, pubkey::Pubkey,
system_program, system_program,
}, },
serde::{Deserialize, Serialize},
}; };
#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Clone)] #[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Clone)]
@ -78,6 +78,33 @@ pub fn derive_lookup_table_address(
) )
} }
/// Constructs an instruction to create a table account and returns
/// the instruction and the table account's derived address.
fn create_lookup_table_common(
authority_address: Pubkey,
payer_address: Pubkey,
recent_slot: Slot,
authority_is_signer: bool,
) -> (Instruction, Pubkey) {
let (lookup_table_address, bump_seed) =
derive_lookup_table_address(&authority_address, recent_slot);
let instruction = Instruction::new_with_bincode(
id(),
&ProgramInstruction::CreateLookupTable {
recent_slot,
bump_seed,
},
vec![
AccountMeta::new(lookup_table_address, false),
AccountMeta::new_readonly(authority_address, authority_is_signer),
AccountMeta::new(payer_address, true),
AccountMeta::new_readonly(system_program::id(), false),
],
);
(instruction, lookup_table_address)
}
/// Constructs an instruction to create a table account and returns /// Constructs an instruction to create a table account and returns
/// the instruction and the table account's derived address. /// the instruction and the table account's derived address.
/// ///
@ -110,33 +137,6 @@ pub fn create_lookup_table(
create_lookup_table_common(authority_address, payer_address, recent_slot, false) create_lookup_table_common(authority_address, payer_address, recent_slot, false)
} }
/// Constructs an instruction to create a table account and returns
/// the instruction and the table account's derived address.
fn create_lookup_table_common(
authority_address: Pubkey,
payer_address: Pubkey,
recent_slot: Slot,
authority_is_signer: bool,
) -> (Instruction, Pubkey) {
let (lookup_table_address, bump_seed) =
derive_lookup_table_address(&authority_address, recent_slot);
let instruction = Instruction::new_with_bincode(
id(),
&ProgramInstruction::CreateLookupTable {
recent_slot,
bump_seed,
},
vec![
AccountMeta::new(lookup_table_address, false),
AccountMeta::new_readonly(authority_address, authority_is_signer),
AccountMeta::new(payer_address, true),
AccountMeta::new_readonly(system_program::id(), false),
],
);
(instruction, lookup_table_address)
}
/// Constructs an instruction that freezes an address lookup /// Constructs an instruction that freezes an address lookup
/// table so that it can never be closed or extended again. Empty /// table so that it can never be closed or extended again. Empty
/// lookup tables cannot be frozen. /// lookup tables cannot be frozen.

View File

@ -0,0 +1,20 @@
//! The [address lookup table program][np].
//!
//! [np]: https://docs.solana.com/developing/runtime-facilities/programs#address-lookup-table-program
pub mod error;
pub mod instruction;
pub mod state;
pub mod program {
crate::declare_id!("AddressLookupTab1e1111111111111111111111111");
}
/// The definition of address lookup table accounts.
///
/// As used by the `crate::message::v0` message format.
#[derive(Debug, PartialEq, Eq, Clone)]
pub struct AddressLookupTableAccount {
pub key: crate::pubkey::Pubkey,
pub addresses: Vec<crate::pubkey::Pubkey>,
}

View File

@ -1,8 +1,8 @@
use { use {
crate::error::AddressLookupError,
serde::{Deserialize, Serialize}, serde::{Deserialize, Serialize},
solana_frozen_abi_macro::{AbiEnumVisitor, AbiExample}, solana_frozen_abi_macro::{AbiEnumVisitor, AbiExample},
solana_program::{ solana_program::{
address_lookup_table::error::AddressLookupError,
clock::Slot, clock::Slot,
instruction::InstructionError, instruction::InstructionError,
pubkey::Pubkey, pubkey::Pubkey,
@ -17,16 +17,6 @@ pub const LOOKUP_TABLE_MAX_ADDRESSES: usize = 256;
/// The serialized size of lookup table metadata /// The serialized size of lookup table metadata
pub const LOOKUP_TABLE_META_SIZE: usize = 56; pub const LOOKUP_TABLE_META_SIZE: usize = 56;
/// Program account states
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Clone, AbiExample, AbiEnumVisitor)]
#[allow(clippy::large_enum_variant)]
pub enum ProgramState {
/// Account is not initialized.
Uninitialized,
/// Initialized `LookupTable` account.
LookupTable(LookupTableMeta),
}
/// Activation status of a lookup table /// Activation status of a lookup table
#[derive(Debug, PartialEq, Eq, Clone)] #[derive(Debug, PartialEq, Eq, Clone)]
pub enum LookupTableStatus { pub enum LookupTableStatus {
@ -112,6 +102,16 @@ impl LookupTableMeta {
} }
} }
/// Program account states
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Clone, AbiExample, AbiEnumVisitor)]
#[allow(clippy::large_enum_variant)]
pub enum ProgramState {
/// Account is not initialized.
Uninitialized,
/// Initialized `LookupTable` account.
LookupTable(LookupTableMeta),
}
#[derive(Debug, PartialEq, Eq, Clone, AbiExample)] #[derive(Debug, PartialEq, Eq, Clone, AbiExample)]
pub struct AddressLookupTable<'a> { pub struct AddressLookupTable<'a> {
pub meta: LookupTableMeta, pub meta: LookupTableMeta,
@ -218,7 +218,7 @@ impl<'a> AddressLookupTable<'a> {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use {super::*, solana_sdk::hash::Hash}; use {super::*, crate::hash::Hash};
impl AddressLookupTable<'_> { impl AddressLookupTable<'_> {
fn new_for_tests(meta: LookupTableMeta, num_addresses: usize) -> Self { fn new_for_tests(meta: LookupTableMeta, num_addresses: usize) -> Self {

View File

@ -1,13 +0,0 @@
//! The definition of address lookup table accounts.
//!
//! As used by the [`v0` message format][v0].
//!
//! [v0]: crate::message::v0
use solana_program::pubkey::Pubkey;
#[derive(Debug, PartialEq, Eq, Clone)]
pub struct AddressLookupTableAccount {
pub key: Pubkey,
pub addresses: Vec<Pubkey>,
}

View File

@ -113,7 +113,7 @@ pub mod solana_rpc_client_nonce_utils {
/// programs. /// programs.
pub mod solana_sdk { pub mod solana_sdk {
pub use crate::{ pub use crate::{
address_lookup_table_account, hash, instruction, keccak, message, nonce, hash, instruction, keccak, message, nonce,
pubkey::{self, Pubkey}, pubkey::{self, Pubkey},
system_instruction, system_program, system_instruction, system_program,
sysvar::{ sysvar::{
@ -273,10 +273,20 @@ pub mod solana_sdk {
} }
} }
} }
#[deprecated(
since = "1.17.0",
note = "Please use `solana_sdk::address_lookup_table` instead"
)]
pub use crate::address_lookup_table as address_lookup_table_account;
} }
#[deprecated(
since = "1.17.0",
note = "Please use `solana_sdk::address_lookup_table` instead"
)]
pub mod solana_address_lookup_table_program { pub mod solana_address_lookup_table_program {
crate::declare_id!("AddressLookupTab1e1111111111111111111111111"); pub use crate::address_lookup_table::program::{check_id, id, ID};
pub mod state { pub mod state {
use { use {

View File

@ -471,7 +471,7 @@
extern crate self as solana_program; extern crate self as solana_program;
pub mod account_info; pub mod account_info;
pub mod address_lookup_table_account; pub mod address_lookup_table;
pub mod alt_bn128; pub mod alt_bn128;
pub(crate) mod atomic_u64; pub(crate) mod atomic_u64;
pub mod big_mod_exp; pub mod big_mod_exp;
@ -534,6 +534,14 @@ pub mod sysvar;
pub mod vote; pub mod vote;
pub mod wasm; pub mod wasm;
#[deprecated(
since = "1.17.0",
note = "Please use `solana_sdk::address_lookup_table::AddressLookupTableAccount` instead"
)]
pub mod address_lookup_table_account {
pub use crate::address_lookup_table::AddressLookupTableAccount;
}
#[cfg(target_os = "solana")] #[cfg(target_os = "solana")]
pub use solana_sdk_macro::wasm_bindgen_stub as wasm_bindgen; pub use solana_sdk_macro::wasm_bindgen_stub as wasm_bindgen;
/// Re-export of [wasm-bindgen]. /// Re-export of [wasm-bindgen].

View File

@ -179,24 +179,22 @@ impl Message {
/// ///
/// # Examples /// # Examples
/// ///
/// This example uses the [`solana_address_lookup_table_program`], [`solana_rpc_client`], [`solana_sdk`], and [`anyhow`] crates. /// This example uses the [`solana_rpc_client`], [`solana_sdk`], and [`anyhow`] crates.
/// ///
/// [`solana_address_lookup_table_program`]: https://docs.rs/solana-address-lookup-table-program
/// [`solana_rpc_client`]: https://docs.rs/solana-rpc-client /// [`solana_rpc_client`]: https://docs.rs/solana-rpc-client
/// [`solana_sdk`]: https://docs.rs/solana-sdk /// [`solana_sdk`]: https://docs.rs/solana-sdk
/// [`anyhow`]: https://docs.rs/anyhow /// [`anyhow`]: https://docs.rs/anyhow
/// ///
/// ``` /// ```
/// # use solana_program::example_mocks::{ /// # use solana_program::example_mocks::{
/// # solana_address_lookup_table_program,
/// # solana_rpc_client, /// # solana_rpc_client,
/// # solana_sdk, /// # solana_sdk,
/// # }; /// # };
/// # use std::borrow::Cow; /// # use std::borrow::Cow;
/// # use solana_sdk::account::Account; /// # use solana_sdk::account::Account;
/// use anyhow::Result; /// use anyhow::Result;
/// use solana_address_lookup_table_program::state::AddressLookupTable;
/// use solana_rpc_client::rpc_client::RpcClient; /// use solana_rpc_client::rpc_client::RpcClient;
/// use solana_program::address_lookup_table::{self, state::{AddressLookupTable, LookupTableMeta}};
/// use solana_sdk::{ /// use solana_sdk::{
/// address_lookup_table_account::AddressLookupTableAccount, /// address_lookup_table_account::AddressLookupTableAccount,
/// instruction::{AccountMeta, Instruction}, /// instruction::{AccountMeta, Instruction},
@ -215,9 +213,10 @@ impl Message {
/// # client.set_get_account_response(address_lookup_table_key, Account { /// # client.set_get_account_response(address_lookup_table_key, Account {
/// # lamports: 1, /// # lamports: 1,
/// # data: AddressLookupTable { /// # data: AddressLookupTable {
/// # meta: LookupTableMeta::default(),
/// # addresses: Cow::Owned(instruction.accounts.iter().map(|meta| meta.pubkey).collect()), /// # addresses: Cow::Owned(instruction.accounts.iter().map(|meta| meta.pubkey).collect()),
/// # }.serialize_for_tests().unwrap(), /// # }.serialize_for_tests().unwrap(),
/// # owner: solana_address_lookup_table_program::ID, /// # owner: address_lookup_table::program::id(),
/// # executable: false, /// # executable: false,
/// # rent_epoch: 1, /// # rent_epoch: 1,
/// # }); /// # });

View File

@ -40,20 +40,21 @@ extern crate self as solana_sdk;
pub use signer::signers; pub use signer::signers;
// These solana_program imports could be *-imported, but that causes a bunch of // These solana_program imports could be *-imported, but that causes a bunch of
// confusing duplication in the docs due to a rustdoc bug. #26211 // confusing duplication in the docs due to a rustdoc bug. #26211
#[allow(deprecated)]
pub use solana_program::address_lookup_table_account;
#[cfg(not(target_os = "solana"))] #[cfg(not(target_os = "solana"))]
pub use solana_program::program_stubs; pub use solana_program::program_stubs;
pub use solana_program::{ pub use solana_program::{
account_info, address_lookup_table_account, alt_bn128, big_mod_exp, blake3, borsh, borsh0_10, account_info, address_lookup_table, alt_bn128, big_mod_exp, blake3, borsh, borsh0_10, borsh0_9,
borsh0_9, bpf_loader, bpf_loader_deprecated, bpf_loader_upgradeable, clock, config, bpf_loader, bpf_loader_deprecated, bpf_loader_upgradeable, clock, config, custom_heap_default,
custom_heap_default, custom_panic_default, debug_account_data, declare_deprecated_sysvar_id, custom_panic_default, debug_account_data, declare_deprecated_sysvar_id, declare_sysvar_id,
declare_sysvar_id, decode_error, ed25519_program, epoch_rewards, epoch_schedule, decode_error, ed25519_program, epoch_rewards, epoch_schedule, fee_calculator, impl_sysvar_get,
fee_calculator, impl_sysvar_get, incinerator, instruction, keccak, lamports, incinerator, instruction, keccak, lamports, loader_instruction, loader_upgradeable_instruction,
loader_instruction, loader_upgradeable_instruction, loader_v4, loader_v4_instruction, message, loader_v4, loader_v4_instruction, message, msg, native_token, nonce, poseidon, program,
msg, native_token, nonce, poseidon, program, program_error, program_memory, program_option, program_error, program_memory, program_option, program_pack, rent, sanitize, sdk_ids,
program_pack, rent, sanitize, sdk_ids, secp256k1_program, secp256k1_recover, serde_varint, secp256k1_program, secp256k1_recover, serde_varint, serialize_utils, short_vec, slot_hashes,
serialize_utils, short_vec, slot_hashes, slot_history, stable_layout, stake, stake_history, slot_history, stable_layout, stake, stake_history, syscalls, system_instruction,
syscalls, system_instruction, system_program, sysvar, unchecked_div_by_const, vote, system_program, sysvar, unchecked_div_by_const, vote, wasm_bindgen,
wasm_bindgen,
}; };
pub mod account; pub mod account;

View File

@ -22,7 +22,6 @@ serde = { workspace = true }
serde_derive = { workspace = true } serde_derive = { workspace = true }
serde_json = { workspace = true } serde_json = { workspace = true }
solana-account-decoder = { workspace = true } solana-account-decoder = { workspace = true }
solana-address-lookup-table-program = { workspace = true }
solana-sdk = { workspace = true } solana-sdk = { workspace = true }
spl-associated-token-account = { workspace = true, features = ["no-entrypoint"] } spl-associated-token-account = { workspace = true, features = ["no-entrypoint"] }
spl-memo = { workspace = true, features = ["no-entrypoint"] } spl-memo = { workspace = true, features = ["no-entrypoint"] }

View File

@ -4,8 +4,10 @@ use {
}, },
bincode::deserialize, bincode::deserialize,
serde_json::json, serde_json::json,
solana_address_lookup_table_program::instruction::ProgramInstruction, solana_sdk::{
solana_sdk::{instruction::CompiledInstruction, message::AccountKeys}, address_lookup_table::instruction::ProgramInstruction, instruction::CompiledInstruction,
message::AccountKeys,
},
}; };
pub fn parse_address_lookup_table( pub fn parse_address_lookup_table(
@ -115,8 +117,9 @@ fn check_num_address_lookup_table_accounts(
mod test { mod test {
use { use {
super::*, super::*,
solana_address_lookup_table_program::instruction, solana_sdk::{
solana_sdk::{message::Message, pubkey::Pubkey, system_program}, address_lookup_table::instruction, message::Message, pubkey::Pubkey, system_program,
},
std::str::FromStr, std::str::FromStr,
}; };

View File

@ -13,8 +13,8 @@ use {
serde_json::Value, serde_json::Value,
solana_account_decoder::parse_token::spl_token_ids, solana_account_decoder::parse_token::spl_token_ids,
solana_sdk::{ solana_sdk::{
instruction::CompiledInstruction, message::AccountKeys, pubkey::Pubkey, stake, address_lookup_table, instruction::CompiledInstruction, message::AccountKeys,
system_program, vote, pubkey::Pubkey, stake, system_program, vote,
}, },
std::{ std::{
collections::HashMap, collections::HashMap,
@ -24,7 +24,7 @@ use {
}; };
lazy_static! { lazy_static! {
static ref ADDRESS_LOOKUP_PROGRAM_ID: Pubkey = solana_address_lookup_table_program::id(); static ref ADDRESS_LOOKUP_PROGRAM_ID: Pubkey = address_lookup_table::program::id();
static ref ASSOCIATED_TOKEN_PROGRAM_ID: Pubkey = spl_associated_token_id(); static ref ASSOCIATED_TOKEN_PROGRAM_ID: Pubkey = spl_associated_token_id();
static ref BPF_LOADER_PROGRAM_ID: Pubkey = solana_sdk::bpf_loader::id(); static ref BPF_LOADER_PROGRAM_ID: Pubkey = solana_sdk::bpf_loader::id();
static ref BPF_UPGRADEABLE_LOADER_PROGRAM_ID: Pubkey = solana_sdk::bpf_loader_upgradeable::id(); static ref BPF_UPGRADEABLE_LOADER_PROGRAM_ID: Pubkey = solana_sdk::bpf_loader_upgradeable::id();