Skip to content

merge: dev #474

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

Merged
merged 9 commits into from
Jul 20, 2025
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
2 changes: 1 addition & 1 deletion .github/workflows/ci-fmt.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
on:
push:
branches: [master]
branches: [master, dev]
pull_request:
types: [opened, reopened, synchronize, ready_for_review]

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-lint.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
on:
push:
branches: [master]
branches: [master, dev]
pull_request:
types: [opened, reopened, synchronize, ready_for_review]

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-test-integration.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
on:
push:
branches: [master]
branches: [master, dev]
pull_request:
types: [opened, reopened, synchronize, ready_for_review]

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-test-unit.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
on:
push:
branches: [master]
branches: [master, dev]
pull_request:
types: [opened, reopened, synchronize, ready_for_review]

Expand Down
36 changes: 32 additions & 4 deletions Cargo.lock

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

11 changes: 9 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ members = [
"magicblock-committor-program",
"magicblock-committor-service",
"magicblock-config",
"magicblock-config-macro",
"magicblock-core",
"magicblock-geyser-plugin",
"magicblock-ledger",
Expand Down Expand Up @@ -64,6 +65,8 @@ borsh-derive = "1.5.1"
bs58 = "0.4.0"
byteorder = "1.5.0"
cargo-lock = "10.0.0"
clap = "4.5.40"
convert_case = "0.8.0"
conjunto-transwise = { git = "https://github.com/magicblock-labs/conjunto.git", rev = "bf82b45" }
console-subscriber = "0.2.0"
crossbeam-channel = "0.5.11"
Expand Down Expand Up @@ -107,6 +110,7 @@ magicblock-committor-program = { path = "./magicblock-committor-program", featur
] }
magicblock-committor-service = { path = "./magicblock-committor-service" }
magicblock-config = { path = "./magicblock-config" }
magicblock-config-macro = { path = "./magicblock-config-macro" }
magicblock-core = { path = "./magicblock-core" }
magicblock-delegation-program = { git = "https://github.com/magicblock-labs/delegation-program.git", rev = "4af7f1c" }
magic-domain-program = { git = "https://github.com/magicblock-labs/magic-domain-program.git", rev = "ea04d46", default-features = false }
Expand All @@ -129,10 +133,12 @@ num-format = "0.4.4"
num-traits = "0.2"
num_cpus = "1.16.0"
paste = "1.0"
proc-macro2 = "1.0"
prometheus = "0.13.4"
# Needs to match https://crates.io/crates/solana-storage-bigtable/2.1.13/dependencies
prost = "0.11.9"
protobuf-src = "1.1"
quote = "1.0"
rand = "0.8.5"
rayon = "1.10.0"
rustc_version = "0.4"
Expand All @@ -142,7 +148,7 @@ serde = "1.0.217"
serde_derive = "1.0"
serde_json = "1.0"
sha3 = "0.10.8"
solana-account = { git = "https://github.com/magicblock-labs/solana-account.git", rev = "7bdfefc" }
solana-account = { git = "https://github.com/magicblock-labs/solana-account.git", rev = "176540a" }
solana-accounts-db = { version = "2.2" }
solana-account-decoder = { version = "2.2" }
solana-address-lookup-table-program = { version = "2.2" }
Expand Down Expand Up @@ -182,6 +188,7 @@ spl-token-2022 = "=6.0"
static_assertions = "1.1.0"
strum = "0.24"
strum_macros = "0.24"
syn = "2.0"
tempfile = "3.10.1"
test-tools = { path = "./test-tools" }
test-tools-core = { path = "./test-tools-core" }
Expand All @@ -203,6 +210,6 @@ vergen = "8.3.1"
# some solana dependencies have solana-storage-proto as dependency
# we need to patch them with our version, because they use protobuf-src v1.1.0
# and we use protobuf-src v2.1.1. Otherwise compilation fails
solana-account = { git = "https://github.com/magicblock-labs/solana-account.git", rev = "7bdfefc" }
solana-account = { git = "https://github.com/magicblock-labs/solana-account.git", rev = "176540a" }
solana-storage-proto = { path = "./storage-proto" }
solana-svm = { git = "https://github.com/magicblock-labs/magicblock-svm.git" }
2 changes: 1 addition & 1 deletion configs/ephem-devnet.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[accounts]
remote = "devnet"
remote.cluster = "devnet"
lifecycle = "ephemeral"
commit = { frequency_millis = 50_000 }

Expand Down
2 changes: 1 addition & 1 deletion configs/ephem-localnet.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[accounts]
remote = "http://localhost:7799"
remote.url = "http://localhost:7799"
lifecycle = "ephemeral"
commit = { frequency_millis = 50_000 }

Expand Down
2 changes: 1 addition & 1 deletion configs/ephem-testnet.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[accounts]
remote = "testnet"
remote.cluster = "testnet"
lifecycle = "ephemeral"
commit = { frequency_millis = 50_000 }

Expand Down
1 change: 1 addition & 0 deletions magicblock-account-cloner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ magicblock-account-fetcher = { workspace = true }
magicblock-account-updates = { workspace = true }
magicblock-account-dumper = { workspace = true }
magicblock-accounts-api = { workspace = true }
magicblock-config = { workspace = true }
magicblock-core = { workspace = true }
magicblock-committor-service = { workspace = true }
magicblock-metrics = { workspace = true }
Expand Down
64 changes: 35 additions & 29 deletions magicblock-account-cloner/src/remote_account_cloner_worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use magicblock_account_fetcher::AccountFetcher;
use magicblock_account_updates::{AccountUpdates, AccountUpdatesResult};
use magicblock_accounts_api::InternalAccountProvider;
use magicblock_committor_service::ChangesetCommittor;
use magicblock_config::{AccountsCloneConfig, PrepareLookupTables};
use magicblock_metrics::metrics;
use magicblock_mutator::idl::{get_pubkey_anchor_idl, get_pubkey_shank_idl};
use solana_sdk::{
Expand Down Expand Up @@ -108,6 +109,7 @@ pub struct RemoteAccountClonerWorker<IAP, AFE, AUP, ADU, CC> {
last_clone_output: CloneOutputMap,
validator_identity: Pubkey,
monitored_accounts: RefCell<LruCache<Pubkey, ()>>,
clone_config: AccountsCloneConfig,
}

// SAFETY:
Expand Down Expand Up @@ -146,6 +148,7 @@ where
permissions: AccountClonerPermissions,
validator_authority: Pubkey,
max_monitored_accounts: usize,
clone_config: AccountsCloneConfig,
) -> Self {
let (clone_request_sender, clone_request_receiver) = flume::unbounded();
let fetch_retries = 50;
Expand All @@ -169,6 +172,7 @@ where
last_clone_output: Default::default(),
validator_identity: validator_authority,
monitored_accounts: LruCache::new(max_monitored_accounts).into(),
clone_config,
}
}

Expand Down Expand Up @@ -710,43 +714,45 @@ where

// Allow the committer service to reserve pubkeys in lookup tables
// that could be needed when we commit this account
// NOTE: we start reserving pubkeys so the transaction can complete while we
// clone the account.
let reserve_pubkeys_handle = if let Some(committor) =
self.changeset_committor.as_ref()
{
let committor = Arc::clone(committor);
let pubkey = *pubkey;
let owner = delegation_record.owner;
Some(tokio::spawn(map_committor_request_result(
committor.reserve_pubkeys_for_committee(pubkey, owner),
committor,
)))
} else {
None
};
if let Some(committor) = self.changeset_committor.as_ref() {
if self.clone_config.prepare_lookup_tables
== PrepareLookupTables::Always
{
let committor = Arc::clone(committor);
let pubkey = *pubkey;
let owner = delegation_record.owner;
tokio::spawn(async move {
match map_committor_request_result(
committor.reserve_pubkeys_for_committee(
pubkey, owner,
),
committor,
)
.await
{
Ok(initiated) => {
trace!(
"Reserving lookup keys for {pubkey} took {:?}",
initiated.elapsed()
);
}
Err(err) => {
error!("Failed to reserve lookup keys for {pubkey}: {err:?}");
}
};
});
}
}

let sig = self.do_clone_delegated_account(
self.do_clone_delegated_account(
pubkey,
// TODO(GabrielePicco): Avoid cloning
&Account {
lamports: delegation_record.lamports,
..account.clone()
},
delegation_record,
)?;

if let Some(handle) = reserve_pubkeys_handle {
let initiated = handle.await.map_err(|err| {
AccountClonerError::JoinError(format!("{err} {err:?}"))
})??;
trace!(
"Reserving lookup keys for {pubkey} took {:?}",
initiated.elapsed()
);
}

sig
)?
}
};
// Return the result
Expand Down
2 changes: 2 additions & 0 deletions magicblock-account-cloner/tests/remote_account_cloner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use magicblock_account_fetcher::AccountFetcherStub;
use magicblock_account_updates::AccountUpdatesStub;
use magicblock_accounts_api::InternalAccountProviderStub;
use magicblock_committor_service::stubs::ChangesetCommittorStub;
use magicblock_config::AccountsCloneConfig;
use magicblock_mutator::idl::{get_pubkey_anchor_idl, get_pubkey_shank_idl};
use solana_sdk::{
bpf_loader_upgradeable::get_program_data_address,
Expand Down Expand Up @@ -49,6 +50,7 @@ fn setup_custom(
permissions,
Pubkey::new_unique(),
1024,
AccountsCloneConfig::default(),
);
let cloner_client = RemoteAccountClonerClient::new(&cloner_worker);
// Run the worker in a separate task
Expand Down
14 changes: 12 additions & 2 deletions magicblock-account-dumper/src/account_dumper_bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,12 @@ impl AccountDumper for AccountDumperBank {
None,
self.bank.last_blockhash(),
);
self.execute_transaction(transaction)
let result = self.execute_transaction(transaction)?;
if let Some(mut acc) = self.bank.get_account(pubkey) {
acc.set_delegated(false);
self.bank.store_account(*pubkey, acc);
}
Ok(result)
}

fn dump_delegated_account(
Expand All @@ -111,7 +116,12 @@ impl AccountDumper for AccountDumperBank {
overrides,
self.bank.last_blockhash(),
);
self.execute_transaction(transaction)
let result = self.execute_transaction(transaction)?;
if let Some(mut acc) = self.bank.get_account(pubkey) {
acc.set_delegated(true);
self.bank.store_account(*pubkey, acc);
}
Ok(result)
}

fn dump_program_accounts(
Expand Down
Loading
Loading