Skip to content

Commit 156be17

Browse files
taco-pacobmuddhathlorenz
authored
Validator integration with Domain registry contract (#321)
# Summary Introduced `DomainRegistryManager` for interacting with "Domain" program. ## Details We submit or update information on start of validator, only in ER mode. I also added as an example how we can leverage `harness = false` mode to introduce setup/teardown logic for integration tests. That would allow us to get rid from test-runner or to split it on E2E + real integration tests. <!-- greptile_comment --> ## Greptile Summary This PR integrates DomainRegistryManager for validator lifecycle management with the Domain registry contract, adding RPC-based registration, sync, and unregistration while refactoring related validator and accounts database components. • Added new DomainRegistryManager in magicblock-api/src/domain_registry_manager.rs that performs registration, sync, and unregistration via async RPC calls. • Integrated DomainRegistryManager into magic_validator.rs for Ephemeral-mode registration and async unregistration using a temporary Tokio runtime. • Updated configuration files and Cargo.toml dependencies to support new storage preallocation and Domain features. • Expanded integration tests and adjusted CI workflows to cover all branches and newly introduced functionalities. <sub>💡 (2/5) Greptile learns from your feedback when you react with 👍/👎!</sub> <!-- /greptile_comment --> --------- Co-authored-by: Babur Makhmudov <[email protected]> Co-authored-by: Thorsten Lorenz <[email protected]>
1 parent 8b9934f commit 156be17

File tree

33 files changed

+5897
-449
lines changed

33 files changed

+5897
-449
lines changed

.github/actions/setup-build-env/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ runs:
3333
repository: magicblock-labs/delegation-program
3434
token: ${{ inputs.github_access_token }}
3535
path: delegation-program
36-
ref: main
36+
ref: main
3737

3838
- name: Checkout magicblock-labs/ephemeral-rollups-sdk
3939
uses: actions/checkout@v2

.github/workflows/ci-fmt.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ on:
22
push:
33
branches: [master]
44
pull_request:
5-
branches: [master, dev]
5+
branches: ["*"]
66
types: [opened, reopened, synchronize, ready_for_review]
77

88
name: Run CI - Format

.github/workflows/ci-lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ on:
22
push:
33
branches: [master]
44
pull_request:
5-
branches: [master, dev]
5+
branches: ["*"]
66
types: [opened, reopened, synchronize, ready_for_review]
77

88
name: Run CI - Lint

.github/workflows/ci-test-integration.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ on:
22
push:
33
branches: [master]
44
pull_request:
5-
branches: [master, dev]
5+
branches: ["*"]
66
types: [opened, reopened, synchronize, ready_for_review]
77

88
name: Run CI - Integration Tests

.github/workflows/ci-test-unit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ on:
22
push:
33
branches: [master]
44
pull_request:
5-
branches: [master, dev]
5+
branches: ["*"]
66
types: [opened, reopened, synchronize, ready_for_review]
77

88
name: Run CI - Unit Tests

Cargo.lock

Lines changed: 26 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,11 @@ cargo-lock = "10.0.0"
6161
expiring-hashmap = { path = "./utils/expiring-hashmap" }
6262
conjunto-transwise = { path = "../conjunto/transwise" }
6363
console-subscriber = "0.2.0"
64+
isocountry = "0.3.2"
6465
crossbeam-channel = "0.5.11"
6566
enum-iterator = "1.5.0"
6667
env_logger = "0.11.2"
68+
magic-domain-program = { git = "https://github.com/magicblock-labs/magic-domain-program.git", rev = "eba7644", default-features = false}
6769
magicblock-delegation-program = { path = "../delegation-program" }
6870
fd-lock = "4.0.2"
6971
fs_extra = "1.3.0"
@@ -124,7 +126,7 @@ magicblock-tokens = { path = "./magicblock-tokens" }
124126
magicblock-transaction-status = { path = "./magicblock-transaction-status" }
125127
magicblock-version = { path = "./magicblock-version" }
126128
protobuf-src = "1.1"
127-
solana-account = { git = "https://github.com/magicblock-labs/solana-account.git", rev = "e4a8cc8" }
129+
solana-account = { git = "https://github.com/magicblock-labs/solana-account.git", rev = "7bdfefc" }
128130
solana-accounts-db = { version = "2.2" }
129131
solana-account-decoder = { version = "2.2" }
130132
solana-address-lookup-table-program = { version = "2.2" }
@@ -176,5 +178,8 @@ url = "2.5.0"
176178
vergen = "8.3.1"
177179

178180
[patch.crates-io]
181+
# some solana dependencies have solana-storage-proto as dependency
182+
# we need to patch them with our version, because they use protobuf-src v1.1.0
183+
# and we use protobuf-src v2.1.1. Otherwise compilation fails
179184
solana-storage-proto = { path = "./storage-proto" }
180-
solana-account = { git = "https://github.com/magicblock-labs/solana-account.git", rev = "e4a8cc8" }
185+
solana-account = { git = "https://github.com/magicblock-labs/solana-account.git", rev = "7bdfefc" }

magicblock-account-updates/tests/remote_account_updates.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ async fn test_devnet_monitoring_clock_sysvar_changes_over_time() {
6060
let first_slot_detected =
6161
client.get_last_known_update_slot(&sysvar_clock).unwrap();
6262
// Wait for a few more slots to happen on-chain (some of the connections should be refreshed now)
63-
sleep(Duration::from_millis(2_000)).await;
63+
sleep(Duration::from_millis(3_000)).await;
6464
// We should still detect the updates correctly even when the connections are refreshed
6565
let second_slot_detected =
6666
client.get_last_known_update_slot(&sysvar_clock).unwrap();

magicblock-accounts-db/src/index/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ fn test_recycle_allocation_after_realloc() {
233233
let index_value =
234234
bytes!(#pack, new_allocation.offset, u32, new_allocation.blocks, u32);
235235
tenv.reallocate_account(&pubkey, &mut txn, &index_value)
236-
.expect("faield to reallocate account");
236+
.expect("failed to reallocate account");
237237
txn.commit().expect("failed to commit transaction");
238238
let result = tenv.try_recycle_allocation(new_allocation.blocks);
239239
assert_eq!(

magicblock-api/Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ license.workspace = true
88
edition.workspace = true
99

1010
[dependencies]
11+
anyhow = { workspace = true }
1112
conjunto-transwise = { workspace = true }
1213
crossbeam-channel = { workspace = true }
1314
fd-lock = { workspace = true }
@@ -33,7 +34,9 @@ magicblock-program = { workspace = true }
3334
magicblock-pubsub = { workspace = true }
3435
magicblock-rpc = { workspace = true }
3536
magicblock-transaction-status = { workspace = true }
37+
magic-domain-program = { workspace = true }
3638
solana-geyser-plugin-interface = { workspace = true }
39+
solana-rpc-client = { workspace = true }
3740
solana-geyser-plugin-manager = { workspace = true }
3841
solana-rpc = { workspace = true }
3942
solana-sdk = { workspace = true }
@@ -42,4 +45,6 @@ tempfile = { workspace = true }
4245
thiserror = { workspace = true }
4346
tokio = { workspace = true }
4447
tokio-util = { workspace = true }
48+
4549
libloading = "0.7.4"
50+
borsh = "1.5.3"

magicblock-api/src/accounts.rs

Whitespace-only changes.

0 commit comments

Comments
 (0)