Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
386 commits
Select commit Hold shift + click to select a range
00287a4
chore: quick fix to handle program updates on subscription
thlorenz Sep 17, 2025
5073887
chore: cleanup program clone on sub update
thlorenz Sep 19, 2025
0b4e516
feat: assign chain auth as part of loader v4 deploy
thlorenz Sep 19, 2025
d21d0e2
feat: prepping lookup tables on clone of regular delegated account
thlorenz Sep 19, 2025
960490b
feat: hook up simplified schedule commit processing (removed feepayer)
thlorenz Sep 19, 2025
7f8e45b
fix: _old_ program cloning test
thlorenz Sep 19, 2025
7dfc4ad
chore: remove obsolete cloning tests
thlorenz Sep 19, 2025
a297272
chore: renumber cloning tests
thlorenz Sep 19, 2025
d27b6cc
chore: remove diagnostics hack
thlorenz Sep 19, 2025
a2f39d1
chore: parallelize cloning
thlorenz Sep 19, 2025
8ee7304
chore: minor cleanup
thlorenz Sep 19, 2025
e28ea80
chore: add test that reproduces lockup
thlorenz Sep 22, 2025
0fe90b1
chore: another test to triage lockup
thlorenz Sep 22, 2025
27eaf78
chore: multiple tests to diagnose tx lockup
thlorenz Sep 22, 2025
0b87bae
chore: add missing custom cloner module
thlorenz Sep 22, 2025
c0863b1
chore: add cloning test util
thlorenz Sep 22, 2025
bcb7553
fix: increase the ready queue for txn executor to avoid deadlocks
bmuddha Sep 22, 2025
93a2b1d
chore: improve tx scheduling logging
thlorenz Sep 23, 2025
3006231
chore: finalize parallel cloning tests
thlorenz Sep 23, 2025
d306eed
chore: add tasks to standup ephem for schedule commit tests
thlorenz Sep 26, 2025
e606575
chore: sync escrowed airdrop
thlorenz Sep 26, 2025
43277ec
chore: schedule commit context uses escrowed airdrop
thlorenz Sep 26, 2025
04730fd
chore: remove obsolete fee payer test
thlorenz Sep 26, 2025
2a8bf01
chore: remove obsolete escrow initialization in schedule commit tests
thlorenz Sep 26, 2025
6b443e8
feat: add way to delegate airdropped account
thlorenz Sep 26, 2025
e6e0aff
chore: make task to compile sbf programs
thlorenz Sep 26, 2025
4c1b478
chore: allow separate PR when inititing schedule commit PDA
thlorenz Sep 26, 2025
863644f
chore: adapt schedule commit ix context initialization
thlorenz Sep 26, 2025
aef1606
chore: delegate committees working
thlorenz Sep 26, 2025
459b58b
chore: more checks + lots as part of schedule commit setup
thlorenz Sep 26, 2025
d5d6f88
feat: set magic context account delegated
thlorenz Sep 26, 2025
f0e0305
chore: refresh ephem blockhash for each tx in schedule-commit tests
thlorenz Sep 27, 2025
b6b7506
chore: fix clippy warning
thlorenz Sep 27, 2025
2548e79
chore: remove cached blockhashes
thlorenz Sep 27, 2025
1f92a44
chore: colored backtraces
thlorenz Sep 27, 2025
0d1e771
chore: comment clarification
thlorenz Sep 27, 2025
5c54a9f
chore: logs + more fresh blockhashes
thlorenz Sep 27, 2025
a74077c
chore: simulate tx after confirming fails a few times
thlorenz Sep 27, 2025
928547e
chore: move ouit static transaction methods from integration context
thlorenz Sep 27, 2025
a8b4d15
chore: add logs to schedule commit inc ix for debugging
thlorenz Sep 27, 2025
5607063
chore: improved logging around tests
thlorenz Sep 27, 2025
da9a10e
chore: allow two possible errors when modifiying delegated acc on chain
thlorenz Sep 27, 2025
5fecca1
feat: subscribe to account being undelegated
thlorenz Sep 27, 2025
662944b
feat: unsubscribing when we receive sub update with _now_ delegated a…
thlorenz Sep 27, 2025
4cfac7b
chore: cleanup tests which now passes, but inconsistently
thlorenz Sep 27, 2025
d15e29e
chore: commit and undelegate test passing
thlorenz Sep 28, 2025
4a67d01
chore: fix more tests + turn on backtrace prettifier in more cases
thlorenz Sep 28, 2025
f5d5bbc
chore: include attempt to repro issue
thlorenz Sep 28, 2025
fc585a3
chore: add notes for improvements
thlorenz Sep 28, 2025
9ad32f3
fix: guaranteeing scheduled commit tranaction uniqueness
thlorenz Sep 28, 2025
14f1bc8
chore: update notes for babur
thlorenz Sep 28, 2025
19738c0
chore: remove no longer needed repro attempt
thlorenz Sep 28, 2025
cadc7cd
chore: fix commit security tests
thlorenz Sep 28, 2025
fe02829
chore: fix chainlink tests
thlorenz Sep 28, 2025
35d05e3
fix: issues tests setup
thlorenz Sep 28, 2025
84546a1
chore: remove obsolete frequent commit issues test
thlorenz Sep 28, 2025
9fd489b
chore: add some logs to config tests
thlorenz Sep 28, 2025
f83120b
chore: fix validator offline configs
thlorenz Sep 28, 2025
b66e8d5
chore: add task to start magicblock-api validators
thlorenz Sep 28, 2025
41d59b5
chore: update progress docs
thlorenz Sep 28, 2025
e8ca627
chore: schedule intent test improvement note
thlorenz Sep 28, 2025
b7201f1
chore: update notes with test state
thlorenz Sep 28, 2025
b7efced
chore: pubsub tests startup two validators
thlorenz Sep 28, 2025
014c7e3
chore: pubsub account tests passing
thlorenz Sep 28, 2025
32ad8a9
chore: fix pubsub log tests
thlorenz Sep 28, 2025
8a2eae5
chore: fix slot + program subscribe tests - cancel is brittle in all
thlorenz Sep 28, 2025
c3834ee
chore: stabilize pubsub cancel
thlorenz Sep 28, 2025
de8e5e3
fix: pubsub ephem setup
thlorenz Sep 28, 2025
429b33f
chore: fix remaining pubsub tests
thlorenz Sep 28, 2025
17dd52b
fixes: fix ledger/adb slot mismatch + update ix debuggin notes
bmuddha Sep 29, 2025
9eee79d
chore: update work items
thlorenz Sep 29, 2025
9766794
fixes: fix ledger/adb slot mismatch + update ix debuggin notes
bmuddha Sep 29, 2025
a962537
feat: persist failed transactions to the ledger
bmuddha Sep 29, 2025
aee453d
feat: allow storing zero lamport accounts
thlorenz Sep 30, 2025
d18fe12
chore: add optional collection to mark empty when not found
thlorenz Sep 30, 2025
82edc21
chore: fix clippy in executor
thlorenz Sep 30, 2025
7a19b24
chore: pass through mark as empty
thlorenz Sep 30, 2025
0f1f25a
chore: remove obsolet force_refetch flag
thlorenz Sep 30, 2025
f5523fb
chore: fix all calls to pass mark empty accounts
thlorenz Sep 30, 2025
cf227fb
feat: impl + testing mark empty behavior
thlorenz Sep 30, 2025
e2426cd
feat: mark feepayers as empty accounts when not found + ix test
thlorenz Sep 30, 2025
6a3f27b
feat: prepare lookup tables when configured
thlorenz Oct 1, 2025
4061362
chore: fix clippy
thlorenz Oct 1, 2025
0603ee0
feat: remove all non-delegated accounts when resuming with existing a…
thlorenz Oct 1, 2025
04443c3
chore: first 2 ledger restore tests working
thlorenz Oct 1, 2025
676f49d
chore: fix name
thlorenz Oct 1, 2025
1c01030
chore: extract functionality + use to pass multi tranfers ledger rest…
thlorenz Oct 1, 2025
a031b7d
chore: fix minor typo in error message
thlorenz Oct 1, 2025
8da42fc
chore: single block tx order test fixed
thlorenz Oct 1, 2025
ec0976e
chore: update progress
thlorenz Oct 1, 2025
74e8f09
chore: counter tests passing
thlorenz Oct 2, 2025
0e499ea
feat: remove undelegate accounts _after_ ledger replay completed
thlorenz Oct 2, 2025
ae87eb6
chore: update progress
thlorenz Oct 2, 2025
03bc653
chore: update deploy test skip message
thlorenz Oct 2, 2025
a6bff5d
chore: verify programs present during ledger replay
thlorenz Oct 2, 2025
3af00bc
chore: delegated accounts test fixed
thlorenz Oct 2, 2025
c722016
chore: fix commit delegated restore test
thlorenz Oct 2, 2025
766d161
chore: restore test surfaced clean bank issue
thlorenz Oct 2, 2025
8d8cf49
chore: don't clean blacklisted accounts on restore
thlorenz Oct 2, 2025
21b953c
chore: fix calls to updated chainlink method
thlorenz Oct 2, 2025
d632a57
chore: fix readonly update after test
thlorenz Oct 2, 2025
7fa6dc7
chore: update undelegate before restart test indicating why this cann…
thlorenz Oct 2, 2025
ee55cba
chore: update notes for babur
thlorenz Oct 2, 2025
3664298
chore: fix ledger account flush test
thlorenz Oct 3, 2025
b31f32a
chore: fix timestamp ledger test
thlorenz Oct 3, 2025
70d9c43
chore: fix restore ledger with new keypair test
thlorenz Oct 3, 2025
65365a1
chore: fix resume strategies test
thlorenz Oct 3, 2025
c1688ee
chore: ignore undelegate between restarts test for now
thlorenz Oct 3, 2025
6cfca11
Merge branch 'master' into thlorenz/chainlink
bmuddha Oct 3, 2025
5cf98a2
feat: add RPC specific metrics
bmuddha Oct 2, 2025
ce235d0
chore: fix merge conflicts in cargo lock
thlorenz Oct 6, 2025
f2bcc6c
chore: fix more merge issues to build validator
thlorenz Oct 6, 2025
722f806
chore: fix merge issues for test-integration
thlorenz Oct 6, 2025
0f61748
chore: fix compile issue due to merge
thlorenz Oct 6, 2025
6928135
feat: ledger test validators start at different ports
thlorenz Oct 6, 2025
071bfb0
chore: initial changes to allow running ledger tests in parallel
thlorenz Oct 6, 2025
5ce2cbd
chore: true random port picking for ledger tests
thlorenz Oct 6, 2025
16a46e8
chore: all non-skipped ledger tests passing in parallel
thlorenz Oct 6, 2025
873e040
chore: allow overriding ephem port while running single test
thlorenz Oct 6, 2025
7b17d39
chore: rename test to proper name
thlorenz Oct 6, 2025
3e345a0
chore: update progress
thlorenz Oct 6, 2025
a50cbaa
fix: for failed txns use meta defaults that are explorer compatible
bmuddha Oct 3, 2025
6f52e37
fix: sync accountsdb slot after ledger replay
bmuddha Oct 3, 2025
7c7d175
fix: disable schedule intent tests
bmuddha Oct 1, 2025
4b7b474
chore: apply c5f2d7c to fix config tests
thlorenz Oct 6, 2025
b3d922e
chore: update progress
thlorenz Oct 6, 2025
7405eb3
fix: correcting resume slot instead of returning error
thlorenz Oct 7, 2025
6fc6071
chore: use svm repo instead of local copy
thlorenz Oct 7, 2025
2507acf
chore: give more context for clone errors
thlorenz Oct 7, 2025
17e6207
chore: log _correctly_ canceled subs on trace to reduce debug noise
thlorenz Oct 7, 2025
1e316c4
chore: log received/scheduled/executed transactions on trace
thlorenz Oct 7, 2025
d96cac9
chore: logs optimized to triage unsub behavior
thlorenz Oct 7, 2025
3f45f40
chore: fix flexi counter ledger restore test
thlorenz Oct 8, 2025
0f40459
chore: minor comment update
thlorenz Oct 8, 2025
aef5e32
fix: slot to reset accounts db from takes reset slot into account
thlorenz Oct 8, 2025
cf87239
chore: fix resume test case
thlorenz Oct 8, 2025
8b0cd87
chore: link issue tracking undelegate between restarts regression
thlorenz Oct 8, 2025
18d26f4
doc: add readme on how to run integration tests
thlorenz Oct 8, 2025
fe0a789
chore: update latest status
thlorenz Oct 8, 2025
057f93d
chore: adapt escrow assertions to 'clone as placeholder' change
thlorenz Oct 9, 2025
cfd45f7
chore: fix API clocks match test
thlorenz Oct 9, 2025
c234448
chore: fix block timestamp stability test
thlorenz Oct 9, 2025
3173865
chore: fix config test + disable auto airdrop test
thlorenz Oct 10, 2025
c6e425d
chore: first try fixing intent test via delegation of payer
thlorenz Oct 10, 2025
530205d
chore: last failed attempt to fix intent tests, preparing them via es…
thlorenz Oct 10, 2025
879cadd
chore: update progress
thlorenz Oct 10, 2025
4d6c53d
fix: program re-clone after re-deploy
thlorenz Oct 13, 2025
66f2309
chore: minor cleanup
thlorenz Oct 13, 2025
0dea41d
chore: fix single test and update status on 9 more failing
thlorenz Oct 13, 2025
61369e8
Merge branch 'master' into thlorenz/chainlink
thlorenz Oct 13, 2025
8ad7de1
chore: fix issues caused by merge
thlorenz Oct 13, 2025
8e85ea9
chore: adapt task scheduler
thlorenz Oct 13, 2025
cf0deb3
chore: fix context initialization
thlorenz Oct 14, 2025
8e18721
chore: fix ix test merge conflicts
thlorenz Oct 14, 2025
38b27f4
chore: fix phony section in Makefile
thlorenz Oct 14, 2025
424d251
chore: fix compile error
thlorenz Oct 14, 2025
b67dd24
chore: add doc about running separate test suites
thlorenz Oct 14, 2025
5039e8f
chore: update current integration test status
thlorenz Oct 14, 2025
342c64e
chore: remove obsolete code step 1
thlorenz Oct 14, 2025
6956b13
chore: remove magicblock-account-dumper
thlorenz Oct 14, 2025
92d36e1
chore: remove magicblock-account-fetcher
thlorenz Oct 14, 2025
84a69e7
chore: remove magicblock-account-updates
thlorenz Oct 14, 2025
74be01b
chore: add moved bpf_loader_v1.rs
thlorenz Oct 14, 2025
20bbc39
chore: remove magicblock-accounts-api
thlorenz Oct 14, 2025
30226c8
chore: remove obsolete parts of magicblock-accounts step 1
thlorenz Oct 14, 2025
12fc8b2
chore: weed out more obsolete code + conjunto use
thlorenz Oct 14, 2025
10543f1
chore: remove obsolete magicblock-mutator
thlorenz Oct 14, 2025
4fc0d58
refactor: clarifying names
Dodecahedr0x Oct 14, 2025
9ae040e
fix: wait for tx to be processed
Dodecahedr0x Oct 14, 2025
168a386
feat: use execution results
Dodecahedr0x Oct 14, 2025
9de3825
feat: do not skip preflight
Dodecahedr0x Oct 14, 2025
46e3436
docs: instructions on how to run task schedulder tests
thlorenz Oct 15, 2025
600400b
chore: remove entry point hack for executables
thlorenz Oct 15, 2025
8f110f4
chore: update progress
thlorenz Oct 15, 2025
88c4a6e
Merge branch 'master' into thlorenz/chainlink
thlorenz Oct 15, 2025
69a3946
Revert "chore: remove entry point hack for executables"
thlorenz Oct 15, 2025
bf40f37
chore: fix task tests running in parallel
thlorenz Oct 15, 2025
44a9990
feat: properly enable/disable executable check via instructions
thlorenz Oct 15, 2025
1d0f537
chore: fmt
thlorenz Oct 16, 2025
7e1980f
chore: fix clippy
thlorenz Oct 16, 2025
2541953
chore: run committor unit tests with preflight to show underlying issue
thlorenz Oct 16, 2025
3d4ef66
chore: add details to failing committor tests
thlorenz Oct 16, 2025
ff870af
chore: add logs around account ensure
thlorenz Oct 16, 2025
39e6eef
chore: disable tests requiring delegate account
thlorenz Oct 16, 2025
39bc75a
chore: remove commented out account commit ticker code
thlorenz Oct 16, 2025
f33f131
chore: disable failing asserts for epoch schedule and supply tests fo…
thlorenz Oct 16, 2025
d49c0f4
chore: logs around fetch multiple accounts
thlorenz Oct 16, 2025
fdacb09
Revert "chore: logs around fetch multiple accounts"
thlorenz Oct 16, 2025
5f90396
chore: ignore one more test failing due to delegate flag
thlorenz Oct 16, 2025
10c0f46
chore: fmt integration tests
thlorenz Oct 16, 2025
149bb3d
chore: test with no fail fast flag
thlorenz Oct 16, 2025
b924032
chore: temporarily disable intent tests assert that fails in CI
thlorenz Oct 16, 2025
3637e10
chore: fix clippy issues in test-integration
thlorenz Oct 16, 2025
74d9a5e
chore: use linux base64 compat flags only
thlorenz Oct 16, 2025
1d457e4
chore: linux friendly way to create account json
thlorenz Oct 16, 2025
eda7c40
chore: remote account provider cleanup, logs, docs
thlorenz Oct 17, 2025
984a1c2
tmp: add log when preparing transaction
thlorenz Oct 17, 2025
0f91b12
tmp: also log on simulate transaction
thlorenz Oct 17, 2025
27709b9
chore: update todos
thlorenz Oct 17, 2025
33985ab
chore: allow more deviation for program size checks
thlorenz Oct 17, 2025
1cacaf8
chore: check compiled program size
thlorenz Oct 17, 2025
c00fa4b
chore: calc prog size deviation via percentage
thlorenz Oct 17, 2025
6b5f196
chore: minor fix
thlorenz Oct 17, 2025
f13fbd9
fix: test macros
thlorenz Oct 17, 2025
6ac66b0
fix: macro issue
thlorenz Oct 17, 2025
7c94e1f
chore: update progress notes
thlorenz Oct 18, 2025
74a505c
chore: using node script to generate miniv2 json from so
thlorenz Oct 18, 2025
15c5faf
chore: upgrade solana version used in CI
thlorenz Oct 18, 2025
b7a4566
chore: fix kill validator process name
thlorenz Oct 18, 2025
d5c03df
chore: wait for more slots after upgrade
thlorenz Oct 18, 2025
6d855f3
chore: wait for a bit less slots
thlorenz Oct 20, 2025
47d18a4
fix: use contains for blockhash check + fix tests
bmuddha Oct 20, 2025
44089e2
fix: outdated assert messages
thlorenz Oct 20, 2025
6d05032
chore: less brittle clone config test assertions
thlorenz Oct 20, 2025
602ec16
chore: include task context in blacklisted accounts
thlorenz Oct 20, 2025
c5b1efb
chore: add details about undelegation race condition
thlorenz Oct 20, 2025
d609e63
chore: link issue about making LRU capacity configurable
thlorenz Oct 20, 2025
eb3cffd
chore: fix out of order sub updates
thlorenz Oct 20, 2025
96c3098
chore: update progress
thlorenz Oct 20, 2025
84b288d
Merge branch 'master' into thlorenz/chainlink
thlorenz Oct 20, 2025
91a11e3
chore: fix invalid tmpdir assignments in ledger restore tests
thlorenz Oct 20, 2025
bb745fc
chore: update progress
thlorenz Oct 20, 2025
79d3df3
fix: readme
thlorenz Oct 20, 2025
9c04c09
chore: fmt
thlorenz Oct 21, 2025
dfe86ee
chore: remove progress tracking doc
thlorenz Oct 21, 2025
d0c8fe9
chore: wait a bit longer for program redeploy in cloning test
thlorenz Oct 21, 2025
5a6a24e
fix: review related nitpick fixes
bmuddha Oct 21, 2025
750e5be
chore: avoid Arc clone when possible
thlorenz Oct 22, 2025
77aed49
chore: update solana-account crate
thlorenz Oct 22, 2025
0826927
chore: remove unit tests that cannot run due to SVM changes
thlorenz Oct 22, 2025
62db6bb
fix: don't allow rent epoch mutations in magic program
bmuddha Oct 22, 2025
2cc4470
fix: intent tests
taco-paco Oct 22, 2025
b09e9c2
chore: remove duplicate log extraction code
thlorenz Oct 22, 2025
f955f74
chore: more resilient program upgrade test
thlorenz Oct 22, 2025
0a9194c
chore: change warn to debug when starting with new ledger
thlorenz Oct 23, 2025
9d604e9
fix: upgrade program test
thlorenz Oct 23, 2025
79b4f97
chore: use proper deploy slot when cloning bpf_loader_v1 program
thlorenz Oct 23, 2025
65628d9
fix: coderabbit post review fixes
bmuddha Oct 23, 2025
ffb5f99
chore: improve warning msg
thlorenz Oct 23, 2025
ba48d31
chore: not depending on joinset order when logging undelegate request…
thlorenz Oct 23, 2025
19a65c4
chore: fmt
thlorenz Oct 23, 2025
29ff17f
chore: improve escrow account cloning check
thlorenz Oct 23, 2025
1a37103
chore: move not found message to debug
thlorenz Oct 24, 2025
6b1a67e
chore: more efficient tuple extraction from vec
thlorenz Oct 24, 2025
248ee2b
chore: wrap fetch cloner in Arc to avoid separate field cloning
thlorenz Oct 24, 2025
23e9867
chore: address clippy issue
thlorenz Oct 24, 2025
7692255
Merge branch 'thlorenz/chainlink' into bmuddha/feat/rpc-metrics
bmuddha Oct 24, 2025
4d28188
Merge branch 'master' into bmuddha/feat/rpc-metrics
bmuddha Oct 24, 2025
72890fb
fix: cargo fmt
bmuddha Oct 24, 2025
5127e86
fix: PR post-review fixes
bmuddha Oct 27, 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
2 changes: 2 additions & 0 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ jsonrpc-pubsub = "18.0.0"
jsonrpc-ws-server = "18.0.0"
lazy_static = "1.4.0"
libc = "0.2.153"
log = "0.4.20"
log = { version = "0.4.20", features = ["release_max_level_info"] }
lru = "0.16.0"
macrotest = "1"
magic-domain-program = { git = "https://github.com/magicblock-labs/magic-domain-program.git", rev = "ea04d46", default-features = false }
Expand Down
1 change: 1 addition & 0 deletions magicblock-aperture/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ magicblock-chainlink = { workspace = true }
magicblock-config = { workspace = true }
magicblock-core = { workspace = true }
magicblock-ledger = { workspace = true }
magicblock-metrics = { workspace = true }
magicblock-version = { workspace = true }

# solana
Expand Down
24 changes: 13 additions & 11 deletions magicblock-aperture/src/requests/http/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use log::*;
use magicblock_core::{
link::transactions::SanitizeableTransaction, traits::AccountsBank,
};
use magicblock_metrics::metrics::ENSURE_ACCOUNTS_TIME;
use prelude::JsonBody;
use solana_account::AccountSharedData;
use solana_pubkey::Pubkey;
Expand Down Expand Up @@ -101,15 +102,17 @@ impl HttpDispatcher {
&self,
pubkey: &Pubkey,
) -> Option<AccountSharedData> {
debug!("Ensuring account {pubkey}");
let _timer = ENSURE_ACCOUNTS_TIME
.with_label_values(&["account"])
.start_timer();
let _ = self
.chainlink
.ensure_accounts(&[*pubkey], None)
.await
.inspect_err(|e| {
// There is nothing we can do if fetching the account fails
// Log the error and return whatever is in the accounts db
error!("Failed to ensure account {pubkey}: {e}");
warn!("Failed to ensure account {pubkey}: {e}");
});
self.accountsdb.get_account(pubkey)
}
Expand All @@ -120,22 +123,18 @@ impl HttpDispatcher {
&self,
pubkeys: &[Pubkey],
) -> Vec<Option<AccountSharedData>> {
if log::log_enabled!(log::Level::Debug) {
let pubkeys = pubkeys
.iter()
.map(ToString::to_string)
.collect::<Vec<_>>()
.join(", ");
debug!("Ensuring accounts {pubkeys}");
}
trace!("Ensuring accounts {pubkeys:?}");
let _timer = ENSURE_ACCOUNTS_TIME
.with_label_values(&["multi-account"])
.start_timer();
let _ = self
.chainlink
.ensure_accounts(pubkeys, None)
.await
.inspect_err(|e| {
// There is nothing we can do if fetching the accounts fails
// Log the error and return whatever is in the accounts db
error!("Failed to ensure accounts: {e}");
warn!("Failed to ensure accounts: {e}");
});
pubkeys
.iter()
Expand Down Expand Up @@ -195,6 +194,9 @@ impl HttpDispatcher {
&self,
transaction: &SanitizedTransaction,
) -> RpcResult<()> {
let _timer = ENSURE_ACCOUNTS_TIME
.with_label_values(&["transaction"])
.start_timer();
match self
.chainlink
.ensure_transaction_accounts(transaction)
Expand Down
13 changes: 9 additions & 4 deletions magicblock-aperture/src/requests/http/send_transaction.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
use log::*;
use log::{trace, warn};
use magicblock_metrics::metrics::{
TRANSACTION_PROCESSING_TIME, TRANSACTION_SKIP_PREFLIGHT,
};
use solana_rpc_client_api::config::RpcSendTransactionConfig;
use solana_transaction_error::TransactionError;
use solana_transaction_status::UiTransactionEncoding;
Expand All @@ -15,8 +18,10 @@ impl HttpDispatcher {
&self,
request: &mut JsonRequest,
) -> HandlerResult {
let _timer = TRANSACTION_PROCESSING_TIME.start_timer();
let (transaction_str, config) =
parse_params!(request.params()?, String, RpcSendTransactionConfig);

let transaction_str: String = some_or_err!(transaction_str);
let config = config.unwrap_or_default();
let encoding = config.encoding.unwrap_or(UiTransactionEncoding::Base58);
Expand All @@ -33,16 +38,16 @@ impl HttpDispatcher {
{
return Err(TransactionError::AlreadyProcessed.into());
}
debug!("Received transaction: {signature}, ensuring accounts");
self.ensure_transaction_accounts(&transaction).await?;

// Based on the preflight flag, either execute and await the result,
// or schedule (fire-and-forget) for background processing.
if config.skip_preflight {
trace!("Scheduling transaction: {signature}");
TRANSACTION_SKIP_PREFLIGHT.inc();
self.transactions_scheduler.schedule(transaction).await?;
trace!("Scheduling transaction {signature}");
} else {
trace!("Executing transaction: {signature}");
trace!("Executing transaction {signature}");
self.transactions_scheduler.execute(transaction).await?;
}

Expand Down
78 changes: 78 additions & 0 deletions magicblock-aperture/src/requests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,84 @@ pub(crate) enum JsonRpcWsMethod {
SlotUnsubscribe,
}

impl JsonRpcHttpMethod {
pub(crate) fn as_str(&self) -> &'static str {
match self {
JsonRpcHttpMethod::GetAccountInfo => "getAccountInfo",
JsonRpcHttpMethod::GetBalance => "getBalance",
JsonRpcHttpMethod::GetBlock => "getBlock",
JsonRpcHttpMethod::GetBlockCommitment => "getBlockCommitment",
JsonRpcHttpMethod::GetBlockHeight => "getBlockHeight",
JsonRpcHttpMethod::GetBlockTime => "getBlockTime",
JsonRpcHttpMethod::GetBlocks => "getBlocks",
JsonRpcHttpMethod::GetBlocksWithLimit => "getBlocksWithLimit",
JsonRpcHttpMethod::GetClusterNodes => "getClusterNodes",
JsonRpcHttpMethod::GetEpochInfo => "getEpochInfo",
JsonRpcHttpMethod::GetEpochSchedule => "getEpochSchedule",
JsonRpcHttpMethod::GetFeeForMessage => "getFeeForMessage",
JsonRpcHttpMethod::GetFirstAvailableBlock => {
"getFirstAvailableBlock"
}
JsonRpcHttpMethod::GetGenesisHash => "getGenesisHash",
JsonRpcHttpMethod::GetHealth => "getHealth",
JsonRpcHttpMethod::GetHighestSnapshotSlot => {
"getHighestSnapshotSlot"
}
JsonRpcHttpMethod::GetIdentity => "getIdentity",
JsonRpcHttpMethod::GetLargestAccounts => "getLargestAccounts",
JsonRpcHttpMethod::GetLatestBlockhash => "getLatestBlockhash",
JsonRpcHttpMethod::GetMultipleAccounts => "getMultipleAccounts",
JsonRpcHttpMethod::GetProgramAccounts => "getProgramAccounts",
JsonRpcHttpMethod::GetSignatureStatuses => "getSignatureStatuses",
JsonRpcHttpMethod::GetSignaturesForAddress => {
"getSignaturesForAddress"
}
JsonRpcHttpMethod::GetSlot => "getSlot",
JsonRpcHttpMethod::GetSlotLeader => "getSlotLeader",
JsonRpcHttpMethod::GetSlotLeaders => "getSlotLeaders",
JsonRpcHttpMethod::GetSupply => "getSupply",
JsonRpcHttpMethod::GetTokenAccountBalance => {
"getTokenAccountBalance"
}
JsonRpcHttpMethod::GetTokenAccountsByDelegate => {
"getTokenAccountsByDelegate"
}
JsonRpcHttpMethod::GetTokenAccountsByOwner => {
"getTokenAccountsByOwner"
}
JsonRpcHttpMethod::GetTokenLargestAccounts => {
"getTokenLargestAccounts"
}
JsonRpcHttpMethod::GetTokenSupply => "getTokenSupply",
JsonRpcHttpMethod::GetTransaction => "getTransaction",
JsonRpcHttpMethod::GetTransactionCount => "getTransactionCount",
JsonRpcHttpMethod::GetVersion => "getVersion",
JsonRpcHttpMethod::IsBlockhashValid => "isBlockhashValid",
JsonRpcHttpMethod::MinimumLedgerSlot => "minimumLedgerSlot",
JsonRpcHttpMethod::RequestAirdrop => "requestAirdrop",
JsonRpcHttpMethod::SendTransaction => "sendTransaction",
JsonRpcHttpMethod::SimulateTransaction => "simulateTransaction",
}
}
}

impl JsonRpcWsMethod {
pub(crate) fn as_str(&self) -> &'static str {
match self {
JsonRpcWsMethod::AccountSubscribe => "accountSubscribe",
JsonRpcWsMethod::AccountUnsubscribe => "accountUnsubscribe",
JsonRpcWsMethod::LogsSubscribe => "logsSubscribe",
JsonRpcWsMethod::LogsUnsubscribe => "logsUnsubscribe",
JsonRpcWsMethod::ProgramSubscribe => "programSubscribe",
JsonRpcWsMethod::ProgramUnsubscribe => "programUnsubscribe",
JsonRpcWsMethod::SignatureSubscribe => "signatureSubscribe",
JsonRpcWsMethod::SignatureUnsubscribe => "signatureUnsubscribe",
JsonRpcWsMethod::SlotSubscribe => "slotSubscribe",
JsonRpcWsMethod::SlotUnsubscribe => "slotUnsubscribe",
}
}
}

/// A helper macro for easily parsing positional parameters from a JSON-RPC request.
///
/// This macro simplifies the process of extracting and deserializing parameters
Expand Down
8 changes: 8 additions & 0 deletions magicblock-aperture/src/server/http/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ use magicblock_core::link::{
transactions::TransactionSchedulerHandle, DispatchEndpoints,
};
use magicblock_ledger::Ledger;
use magicblock_metrics::metrics::{
RPC_REQUESTS_COUNT, RPC_REQUEST_HANDLING_TIME,
};

use crate::{
requests::{
Expand Down Expand Up @@ -111,6 +114,11 @@ impl HttpDispatcher {
async fn process(&self, request: &mut JsonHttpRequest) -> HandlerResult {
// Route the request to the correct handler based on the method name.
use crate::requests::JsonRpcHttpMethod::*;
let method = request.method.as_str();
RPC_REQUESTS_COUNT.with_label_values(&[method]).inc();
let _timer = RPC_REQUEST_HANDLING_TIME
.with_label_values(&[method])
.start_timer();
match request.method {
GetAccountInfo => self.get_account_info(request).await,
GetBalance => self.get_balance(request).await,
Expand Down
4 changes: 4 additions & 0 deletions magicblock-aperture/src/server/websocket/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use std::collections::HashMap;

use hyper::body::Bytes;
use json::{Serialize, Value};
use magicblock_metrics::metrics::RPC_REQUESTS_COUNT;
use tokio::sync::mpsc;

use super::connection::ConnectionID;
Expand Down Expand Up @@ -65,6 +66,9 @@ impl WsDispatcher {
request: &mut JsonWsRequest,
) -> RpcResult<WsDispatchResult> {
use JsonRpcWsMethod::*;
RPC_REQUESTS_COUNT
.with_label_values(&[request.method.as_str()])
.inc();
let result = match request.method {
AccountSubscribe => self.account_subscribe(request).await,
ProgramSubscribe => self.program_subscribe(request).await,
Expand Down
27 changes: 26 additions & 1 deletion magicblock-aperture/src/state/subscriptions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use magicblock_core::{
},
Slot,
};
use magicblock_metrics::metrics::RPC_WS_SUBSCRIPTIONS_COUNT;
use parking_lot::RwLock;
use solana_account::ReadableAccount;
use solana_pubkey::Pubkey;
Expand Down Expand Up @@ -105,7 +106,7 @@ impl SubscriptionsDb {
.await
.or_insert_with(|| UpdateSubscribers(vec![]))
.add_subscriber(chan, encoder.clone());

let metric = SubMetricGuard::new("account-subscribe");
// Create a cleanup future that will be executed when the handle is dropped.
let accounts = self.accounts.clone();
let callback = async move {
Expand All @@ -116,6 +117,7 @@ impl SubscriptionsDb {
if entry.remove_subscriber(conid, &encoder) {
let _ = entry.remove();
}
drop(metric)
};
let cleanup = CleanUp(Some(Box::pin(callback)));
SubscriptionHandle { id, cleanup }
Expand Down Expand Up @@ -146,13 +148,15 @@ impl SubscriptionsDb {
.add_subscriber(chan, encoder.clone());

let programs = self.programs.clone();
let metric = SubMetricGuard::new("program-subscribe");
let callback = async move {
let Some(mut entry) = programs.get_async(&pubkey).await else {
return;
};
if entry.remove_subscriber(conid, &encoder) {
let _ = entry.remove();
}
drop(metric)
};
let cleanup = CleanUp(Some(Box::pin(callback)));
SubscriptionHandle { id, cleanup }
Expand Down Expand Up @@ -212,8 +216,10 @@ impl SubscriptionsDb {
let id = self.logs.write().add_subscriber(chan, encoder.clone());

let logs = self.logs.clone();
let metric = SubMetricGuard::new("logs-subscribe");
let callback = async move {
logs.write().remove_subscriber(conid, &encoder);
drop(metric)
};
let cleanup = CleanUp(Some(Box::pin(callback)));
SubscriptionHandle { id, cleanup }
Expand All @@ -239,8 +245,10 @@ impl SubscriptionsDb {
let id = subscriber.id;

let slot = self.slot.clone();
let metric = SubMetricGuard::new("slot-subscribe");
let callback = async move {
slot.write().txs.remove(&conid);
drop(metric)
};
let cleanup = CleanUp(Some(Box::pin(callback)));
SubscriptionHandle { id, cleanup }
Expand Down Expand Up @@ -391,3 +399,20 @@ impl<E> Drop for UpdateSubscriber<E> {
self.live.store(false, Ordering::Relaxed);
}
}

pub(crate) struct SubMetricGuard(&'static str);

impl SubMetricGuard {
pub(crate) fn new(name: &'static str) -> Self {
RPC_WS_SUBSCRIPTIONS_COUNT.with_label_values(&[name]).inc();
Self(name)
}
}

impl Drop for SubMetricGuard {
fn drop(&mut self) {
RPC_WS_SUBSCRIPTIONS_COUNT
.with_label_values(&[self.0])
.dec();
}
}
Loading
Loading