Skip to content

feat: committor service #366

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 104 commits into from
Jul 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
104 commits
Select commit Hold shift + click to select a range
45bdf72
test: add realloc ix to flexi counter
thlorenz Mar 10, 2025
2e61882
chore: resort workspace depencencies
thlorenz May 7, 2025
6806acf
chore: retire old remote scheduled commits processor and add new one
thlorenz May 7, 2025
8cdc141
feat: initial impl of commits processor based on committor service
thlorenz May 7, 2025
c0d08a4
feat: initializing committor service at startup
thlorenz May 7, 2025
9eed608
test: logging signature of failed init_committees tx
thlorenz May 8, 2025
dae8ea8
test: adapt to expect two signatures when finalizing
thlorenz May 9, 2025
80e6777
feat: ensure ephemeral validator is funded on chain
thlorenz May 9, 2025
3078a1c
test: add single account commit test
thlorenz May 9, 2025
8391124
test: warn when we have issues fetching a transaction
thlorenz May 9, 2025
e5aa347
fix: adding change for validator fund check
thlorenz May 9, 2025
be98740
feat: fully integrating committor service
thlorenz May 9, 2025
5ce7a20
chore: update ix tests cargo
thlorenz May 12, 2025
b54cd3b
chore: comment with requirements for schedule commit tests
thlorenz May 12, 2025
dc2da58
chore: improve test logs
thlorenz May 13, 2025
560fd6b
chore: include compute unit price when initializing committor
thlorenz May 13, 2025
b3445c1
fix: mark accounts to be undelegated
thlorenz May 13, 2025
24bb27a
chore: properly handle some unwraps
thlorenz May 14, 2025
cc389e7
test: general improvements + fixes
thlorenz May 14, 2025
f7304cf
chore: use trait for committor service and create stub to use in tests
thlorenz May 14, 2025
04b0116
chore: update ensure accounts tests to use stub
thlorenz May 14, 2025
d770b95
chore: re-enable account cloner and ensure accounts tests
thlorenz May 14, 2025
88dd40b
chore: move committor repo crates into magicblock monorepo
thlorenz May 14, 2025
e6f1edd
chore: move committor service integration tests
thlorenz May 14, 2025
1c4dd78
chore: noting escrow/fee payer related test requirements
thlorenz May 14, 2025
8c620fe
chore: minor cleanup in test runner
thlorenz May 15, 2025
f3e17d1
ix: load committor program for schedule commits
thlorenz May 15, 2025
6d109f9
ix: allow configuring loaded accounts
thlorenz May 15, 2025
0dceb8b
ix: match ephem validator keypair to the one we use on chain
thlorenz May 15, 2025
7fdc795
ix: ensure we always pass same loaded chain accounts to chain + ephen…
thlorenz May 15, 2025
47ccee4
ix: update dlp binary
thlorenz May 15, 2025
c85b529
ix: add committor tests to run_tests
thlorenz May 15, 2025
cf609d4
ix: move table mania tests to integration
thlorenz May 15, 2025
b968ea5
ix: run table mania as part of test suite
thlorenz May 15, 2025
d3bacca
Merge branch 'master' into thlorenz/committor
thlorenz May 15, 2025
7bde596
chore: fmt
thlorenz May 15, 2025
52fd831
chore: update delegation program reference
thlorenz May 15, 2025
714dd68
chore: opt out of doctests for added crates
thlorenz May 15, 2025
0f94802
ix: add rule to make committor program
thlorenz May 15, 2025
c8ddb16
fix: error misspelling
thlorenz May 15, 2025
b246170
chore: address some greptiles
thlorenz May 15, 2025
d3892d1
ix: check in missing config
thlorenz May 15, 2025
ca5e9f4
chore: more greptiles
thlorenz May 15, 2025
bc48d58
ix: move table mania/committor tests last since they are the slowest
thlorenz May 15, 2025
9fb082a
chore: rollback delegation program version
thlorenz May 15, 2025
ee396da
chore: cleanup stray log
thlorenz May 15, 2025
8635738
ix: give more compile time before expecting validator to listen
thlorenz May 15, 2025
7f3e0eb
chore: greptiles
thlorenz May 15, 2025
28504c1
chore: improved error handling in table mania manager
thlorenz May 16, 2025
bc1324d
fix: greptiles
thlorenz May 16, 2025
644ad1c
chore: demote some no longer urgent TODOs
thlorenz May 16, 2025
4f8ecc8
feat: committor service persists into ledger path
thlorenz May 16, 2025
3cf473d
chore: remove duplicate code in magic validator
thlorenz May 16, 2025
a7b4aa5
feat: limiting stale reallocs until we bail
thlorenz May 16, 2025
776bbf1
tmp: disabling ledger restore tests to isolate issues
thlorenz May 16, 2025
aeeb5ae
tmp: disable all workflows but integration tests while isolating issues
thlorenz May 16, 2025
aedf9a2
fix: ordering of worker startups
thlorenz May 16, 2025
1e9921d
Revert "tmp: disabling ledger restore tests to isolate issues"
thlorenz May 16, 2025
0e0ef0f
Revert "tmp: disable all workflows but integration tests while isolat…
thlorenz May 16, 2025
2bfd49f
chore: address nits
thlorenz Jun 4, 2025
05bbaec
Merge branch 'master' into thlorenz/committor
thlorenz Jun 4, 2025
4d1b44f
chore: update cargo lock files
thlorenz Jun 4, 2025
9e091fc
chore: match mdp version
thlorenz Jun 4, 2025
263ade9
Merge branch 'master' into thlorenz/committor
thlorenz Jun 18, 2025
67b98bd
Merge branch 'master' into thlorenz/committor
GabrielePicco Jun 18, 2025
9ee833d
chore: move can_clone method to clone permissions itself
thlorenz Jun 18, 2025
8610bce
feat: only launch committor service if we aren't in offline mode
thlorenz Jun 18, 2025
10bdf51
chore: update committor program id
thlorenz Jun 18, 2025
2e99570
Merge branch 'master' into thlorenz/committor
thlorenz Jul 2, 2025
d594ba8
chore: use up todate tmpdir method to keep directory
thlorenz Jul 2, 2025
ff313fd
chore: remove obsolete DecoderError impl
thlorenz Jul 2, 2025
088be94
chore: disable type complexity warning
thlorenz Jul 2, 2025
7a725ae
ix: allow specifying integration tests to run
thlorenz Jul 3, 2025
1ab5d7e
feat: log amount of accounts we tried to commit when it fails
thlorenz Jul 3, 2025
cd219cc
test: printing script to start test validator for specific setup
thlorenz Jul 3, 2025
c0eec86
test: reproduced committor service issue of too large tx in ix test
thlorenz Jul 3, 2025
fe9860f
fix: wrongful combination of multiple bundles into single changeset
thlorenz Jul 3, 2025
c52cf0e
fix: run all tests when RUN_TESTS is not set
thlorenz Jul 4, 2025
b34ed17
chore: track reserve pubkeys time via initiated field
thlorenz Jul 7, 2025
6d35f9e
fix: handle async committor actor msgs on separate tasks to not block…
thlorenz Jul 7, 2025
a84707c
feat: table mania determine CUs via test
thlorenz Jul 7, 2025
8b89125
chore: various fixes
thlorenz Jul 7, 2025
27dd1d8
feat: compute budget instructions for create + extend
thlorenz Jul 7, 2025
59f8edf
chore: remove obsolete lookup_table.rs
thlorenz Jul 8, 2025
edb7a06
feat: include compute budget instructions for deactivate/close table
thlorenz Jul 8, 2025
6a583c9
feat: start reserving pubkeys before clone operation for perf
thlorenz Jul 8, 2025
c8e4435
fix: error spelling
thlorenz Jul 8, 2025
6449d59
feat: gert tx information when committor service fails in account cloner
thlorenz Jul 8, 2025
92d5487
fix: ix tests using old lookup table
thlorenz Jul 8, 2025
1b51fc6
chore: table mania ix test logs logs and CUs used
thlorenz Jul 8, 2025
d7a3c1f
fix: adjust compute budget (+300 CUs for compute budget ixs)
thlorenz Jul 8, 2025
179091e
fix: lookup table update extend signatures
thlorenz Jul 8, 2025
d5366f3
fix: most issues in table mania ix tests
thlorenz Jul 8, 2025
2fde756
chore: update max extend pubkeys due to added budget ixs
thlorenz Jul 8, 2025
7ce2319
feat: close returns sig
thlorenz Jul 8, 2025
d5a69ca
chore: update close test and usage
thlorenz Jul 8, 2025
0f2cee6
chore: enable mb api test harness
thlorenz Jul 8, 2025
e4db119
test: don't crash if init transaction is not found
thlorenz Jul 8, 2025
c636d25
feat: allow skipping tests in test-runner
thlorenz Jul 9, 2025
63736eb
nit: correct poison error message
thlorenz Jul 9, 2025
115bfe4
fix: assertion ensuring all pubkeys are present in table
thlorenz Jul 9, 2025
78073ed
fix: method renaming in ix tests
thlorenz Jul 9, 2025
2fc16f5
chore: improve debug assertion for extension issue
thlorenz Jul 9, 2025
b6b58ab
fix: ensuring all stored keys are in table
thlorenz Jul 9, 2025
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
1,142 changes: 781 additions & 361 deletions Cargo.lock

Large diffs are not rendered by default.

67 changes: 44 additions & 23 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ members = [
"magicblock-accounts-db",
"magicblock-api",
"magicblock-bank",
"magicblock-committor-program",
"magicblock-committor-service",
"magicblock-config",
"magicblock-core",
"magicblock-geyser-plugin",
Expand All @@ -25,6 +27,8 @@ members = [
"magicblock-processor",
"magicblock-pubsub",
"magicblock-rpc",
"magicblock-rpc-client",
"magicblock-table-mania",
"magicblock-tokens",
"magicblock-transaction-status",
"magicblock-version",
Expand Down Expand Up @@ -55,18 +59,18 @@ assert_matches = "1.5.0"
async-trait = "0.1.77"
base64 = "0.21.7"
bincode = "1.3.3"
borsh = { version = "1.5.1", features = ["derive", "unstable__schema"] }
borsh-derive = "1.5.1"
bs58 = "0.4.0"
byteorder = "1.5.0"
cargo-lock = "10.0.0"
expiring-hashmap = { path = "./utils/expiring-hashmap" }
conjunto-transwise = { git = "https://github.com/magicblock-labs/conjunto.git", rev = "bf82b45" }
console-subscriber = "0.2.0"
isocountry = "0.3.2"
crossbeam-channel = "0.5.11"
ed25519-dalek = "1.0.1"
enum-iterator = "1.5.0"
env_logger = "0.11.2"
magic-domain-program = { git = "https://github.com/magicblock-labs/magic-domain-program.git", rev = "ea04d46", default-features = false }
magicblock-delegation-program = { git = "https://github.com/magicblock-labs/delegation-program.git", rev = "4af7f1c" }
expiring-hashmap = { path = "./utils/expiring-hashmap" }
fd-lock = "4.0.2"
flume = "0.11"
fs_extra = "1.3.0"
Expand All @@ -77,6 +81,7 @@ hostname = "0.4.0"
http-body-util = "0.1.2"
hyper = "1.4.1"
hyper-util = "0.1.9"
isocountry = "0.3.2"
itertools = "0.14"
jsonrpc-core = "18.0.0"
jsonrpc-core-client = "18.0.0"
Expand All @@ -88,21 +93,6 @@ lazy_static = "1.4.0"
libc = "0.2.153"
libloading = "0.7.4"
log = "0.4.20"
num_cpus = "1.16.0"
num-derive = "0.4"
num-format = "0.4.4"
num-traits = "0.2"
paste = "1.0"
prometheus = "0.13.4"
# Needs to match https://crates.io/crates/solana-storage-bigtable/2.1.13/dependencies
prost = "0.11.9"
rand = "0.8.5"
rayon = "1.10.0"
rustc_version = "0.4"
semver = "1.0.22"
serde = "1.0.217"
serde_derive = "1.0"
serde_json = "1.0"
magicblock-account-cloner = { path = "./magicblock-account-cloner" }
magicblock-account-dumper = { path = "./magicblock-account-dumper" }
magicblock-account-fetcher = { path = "./magicblock-account-fetcher" }
Expand All @@ -112,8 +102,14 @@ magicblock-accounts-api = { path = "./magicblock-accounts-api" }
magicblock-accounts-db = { path = "./magicblock-accounts-db" }
magicblock-api = { path = "./magicblock-api" }
magicblock-bank = { path = "./magicblock-bank" }
magicblock-committor-program = { path = "./magicblock-committor-program", features = [
Copy link
Contributor

@taco-paco taco-paco May 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: we now have services ending with committor and committer, like RemoteAccountCommitter.
committor must be a typo

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, everything in the committor-service is committor. RemoteAccountCommitter existed before.
It's a solana thing as we are buildooors. I'm trying to keep our codebase fun :)

"no-entrypoint",
] }
magicblock-committor-service = { path = "./magicblock-committor-service" }
magicblock-config = { path = "./magicblock-config" }
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 }
magicblock-geyser-plugin = { path = "./magicblock-geyser-plugin" }
magicblock-ledger = { path = "./magicblock-ledger" }
magicblock-metrics = { path = "./magicblock-metrics" }
Expand All @@ -123,10 +119,29 @@ magicblock-processor = { path = "./magicblock-processor" }
magicblock-program = { path = "./programs/magicblock" }
magicblock-pubsub = { path = "./magicblock-pubsub" }
magicblock-rpc = { path = "./magicblock-rpc" }
magicblock-rpc-client = { path = "./magicblock-rpc-client" }
magicblock-table-mania = { path = "./magicblock-table-mania" }
magicblock-tokens = { path = "./magicblock-tokens" }
magicblock-transaction-status = { path = "./magicblock-transaction-status" }
magicblock-version = { path = "./magicblock-version" }
num-derive = "0.4"
num-format = "0.4.4"
num-traits = "0.2"
num_cpus = "1.16.0"
paste = "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"
rand = "0.8.5"
rayon = "1.10.0"
rustc_version = "0.4"
rusqlite = { version = "0.34.0", features = ["bundled"] } # bundled sqlite 3.44
semver = "1.0.22"
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-accounts-db = { version = "2.2" }
solana-account-decoder = { version = "2.2" }
Expand All @@ -143,33 +158,39 @@ solana-log-collector = { version = "2.2" }
solana-measure = { version = "2.2" }
solana-metrics = { version = "2.2" }
solana-perf = { version = "2.2" }
solana-program = "2.2"
solana-program-runtime = { version = "2.2" }
solana-program-test = "2.2"
solana-pubkey = { version = "2.2" }
solana-rayon-threadlimit = { version = "2.2" }
solana-pubsub-client = { version = "2.2" }
solana-rpc = "2.2"
solana-rpc-client = { version = "2.2" }
solana-rpc-client-api = { version = "2.2" }
solana-sdk = { version = "2.2" }
solana-svm = { git = "https://github.com/magicblock-labs/magicblock-svm.git", rev = "e93eb57", features = [ "dev-context-only-utils" ] }
solana-svm = { git = "https://github.com/magicblock-labs/magicblock-svm.git", rev = "e93eb57", features = [
"dev-context-only-utils",
] }
solana-svm-transaction = { version = "2.2" }
solana-storage-proto = { path = "storage-proto" }
solana-system-program = { version = "2.2" }
solana-timings = "2.2"
solana-transaction-status = { version = "2.2" }
solana-transaction-status-client-types = "2.2"
spl-token = "=7.0"
spl-token-2022 = "=6.0"
static_assertions = "1.1.0"
strum = "0.24"
strum_macros = "0.24"
tempfile = "3.10.1"
test-tools = { path = "./test-tools" }
test-tools-core = { path = "./test-tools-core" }
thiserror = "1.0.57"
toml = "0.8.13"
# Update solana-tokio patch below when updating this version
tokio = "1.0"
tokio-stream = "0.1.15"
tokio-util = "0.7.10"
toml = "0.8.13"
# Tonic version 11 conflicts with lower level deps of solana and 0.9.x is the last
# version that allows prost 0.11.x to be used
tonic = "0.9.2"
Expand All @@ -182,6 +203,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-storage-proto = { path = "./storage-proto" }
solana-account = { git = "https://github.com/magicblock-labs/solana-account.git", rev = "7bdfefc" }
solana-svm = { git = "https://github.com/magicblock-labs/magicblock-svm.git", features = [ "dev-context-only-utils" ] }
solana-storage-proto = { path = "./storage-proto" }
solana-svm = { git = "https://github.com/magicblock-labs/magicblock-svm.git" }
4 changes: 4 additions & 0 deletions magicblock-account-cloner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ magicblock-account-updates = { workspace = true }
magicblock-account-dumper = { workspace = true }
magicblock-accounts-api = { workspace = true }
magicblock-core = { workspace = true }
magicblock-committor-service = { workspace = true }
magicblock-metrics = { workspace = true }
magicblock-mutator = { workspace = true }
solana-sdk = { workspace = true }
Expand All @@ -26,3 +27,6 @@ thiserror = { workspace = true }
lru = "0.14"

[dev-dependencies]
magicblock-committor-service = { workspace = true, features = [
"dev-context-only-utils",
] }
65 changes: 64 additions & 1 deletion magicblock-account-cloner/src/account_cloner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@ use futures_util::future::BoxFuture;
use magicblock_account_dumper::AccountDumperError;
use magicblock_account_fetcher::AccountFetcherError;
use magicblock_account_updates::AccountUpdatesError;
use magicblock_committor_service::{
error::{CommittorServiceError, CommittorServiceResult},
ChangesetCommittor,
};
use magicblock_core::magic_program;
use solana_sdk::{clock::Slot, pubkey::Pubkey, signature::Signature};
use thiserror::Error;
use tokio::sync::oneshot::Sender;
use tokio::sync::oneshot::{self, Sender};

#[derive(Debug, Clone, Error)]
pub enum AccountClonerError {
Expand All @@ -21,6 +25,9 @@ pub enum AccountClonerError {
#[error(transparent)]
RecvError(#[from] tokio::sync::oneshot::error::RecvError),

#[error("JoinError ({0})")]
JoinError(String),

#[error(transparent)]
AccountFetcherError(#[from] AccountFetcherError),

Expand All @@ -30,6 +37,9 @@ pub enum AccountClonerError {
#[error(transparent)]
AccountDumperError(#[from] AccountDumperError),

#[error("CommittorServiceError {0}")]
CommittorServiceError(String),

#[error("ProgramDataDoesNotExist")]
ProgramDataDoesNotExist,

Expand Down Expand Up @@ -66,6 +76,50 @@ pub enum AccountClonerUnclonableReason {
DelegatedAccountsNotClonedWhileHydrating,
}

pub async fn map_committor_request_result<T, CC: ChangesetCommittor>(
res: oneshot::Receiver<CommittorServiceResult<T>>,
changeset_committor: Arc<CC>,
) -> AccountClonerResult<T> {
match res.await.map_err(|err| {
// Send request error
AccountClonerError::CommittorServiceError(format!(
"error sending request {err:?}"
))
})? {
Ok(val) => Ok(val),
Err(err) => {
// Commit error
match err {
CommittorServiceError::TableManiaError(table_mania_err) => {
let Some(sig) = table_mania_err.signature() else {
return Err(AccountClonerError::CommittorServiceError(
format!("{:?}", table_mania_err),
));
};
let cus =
changeset_committor.get_transaction_cus(&sig).await;
let logs =
changeset_committor.get_transaction_logs(&sig).await;
let cus_str = cus
.map(|cus| format!("{:?}", cus))
.unwrap_or("N/A".to_string());
let logs_str = logs
.map(|logs| format!("{:#?}", logs))
.unwrap_or("N/A".to_string());
Err(AccountClonerError::CommittorServiceError(format!(
"{:?}\nCUs: {cus_str}\nLogs: {logs_str}",
table_mania_err
)))
}
_ => Err(AccountClonerError::CommittorServiceError(format!(
"{:?}",
err
))),
}
}
}
}

#[derive(Debug, Clone)]
pub struct AccountClonerPermissions {
pub allow_cloning_refresh: bool,
Expand All @@ -75,6 +129,15 @@ pub struct AccountClonerPermissions {
pub allow_cloning_program_accounts: bool,
}

impl AccountClonerPermissions {
pub fn can_clone(&self) -> bool {
self.allow_cloning_feepayer_accounts
|| self.allow_cloning_undelegated_accounts
|| self.allow_cloning_delegated_accounts
|| self.allow_cloning_program_accounts
}
}

#[derive(Debug, Clone)]
pub enum AccountClonerOutput {
Cloned {
Expand Down
6 changes: 4 additions & 2 deletions magicblock-account-cloner/src/remote_account_cloner_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use magicblock_account_dumper::AccountDumper;
use magicblock_account_fetcher::AccountFetcher;
use magicblock_account_updates::AccountUpdates;
use magicblock_accounts_api::InternalAccountProvider;
use magicblock_committor_service::ChangesetCommittor;
use solana_sdk::pubkey::Pubkey;
use tokio::sync::oneshot::channel;

Expand All @@ -25,14 +26,15 @@ pub struct RemoteAccountClonerClient {
}

impl RemoteAccountClonerClient {
pub fn new<IAP, AFE, AUP, ADU>(
worker: &RemoteAccountClonerWorker<IAP, AFE, AUP, ADU>,
pub fn new<IAP, AFE, AUP, ADU, CC>(
worker: &RemoteAccountClonerWorker<IAP, AFE, AUP, ADU, CC>,
) -> Self
where
IAP: InternalAccountProvider,
AFE: AccountFetcher,
AUP: AccountUpdates,
ADU: AccountDumper,
CC: ChangesetCommittor,
{
Self {
clone_request_sender: worker.get_clone_request_sender(),
Expand Down
Loading