From ab7f978ccc96f42b33eac9c3748a96fc171671fe Mon Sep 17 00:00:00 2001 From: Uncle Stretch Date: Wed, 21 Oct 2026 17:27:12 +0300 Subject: [PATCH] expose exodus-pallet API in casper runtime Signed-off-by: Uncle Stretch --- runtime/casper/Cargo.toml | 4 +++- runtime/casper/src/lib.rs | 38 +++++++++++++++++++++++++++++++++++++- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/runtime/casper/Cargo.toml b/runtime/casper/Cargo.toml index 8359287..6f8ee6f 100644 --- a/runtime/casper/Cargo.toml +++ b/runtime/casper/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "casper-runtime" -version = "4.0.14" +version = "4.0.15" build = "build.rs" description = "Runtime of the Casper Network" edition.workspace = true @@ -75,6 +75,7 @@ ghost-networks = { workspace = true } ghost-governance = { workspace = true } ghost-weaver = { workspace = true } ghost-exodus = { workspace = true } +ghost-exodus-runtime-api = { workspace = true } ghost-sudo = { workspace = true } ghost-traits = { workspace = true } ghost-helpers = { workspace = true } @@ -188,6 +189,7 @@ std = [ "ghost-governance/std", "ghost-weaver/std", "ghost-exodus/std", + "ghost-exodus-runtime-api/std", "ghost-sudo/std", "casper-runtime-constants/std", "runtime-common/std", diff --git a/runtime/casper/src/lib.rs b/runtime/casper/src/lib.rs index a2177bc..fac8f53 100644 --- a/runtime/casper/src/lib.rs +++ b/runtime/casper/src/lib.rs @@ -69,6 +69,7 @@ pub use frame_system::Call as SystemCall; pub use pallet_balances::Call as BalancesCall; pub use pallet_election_provider_multi_phase::{Call as EPMCall, GeometricDepositBase}; +use ghost_helpers::networks::{NetworkCurve, NetworkType}; use ghost_weaver::sr25519::AuthorityId as GhostWeaverId; use ghost_exodus::sr25519::AuthorityId as GhostExodusId; @@ -123,7 +124,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("casper"), impl_name: create_runtime_str!("casper-svengali"), authoring_version: 0, - spec_version: 7, + spec_version: 8, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1, @@ -906,6 +907,7 @@ parameter_types! { pub ExodusUnsignedPriority: TransactionPriority = Perbill::from_percent(90) * TransactionPriority::MAX; + pub MaxExodusRequestCount: u32 = 32; pub MaxAuthoritiesChunks: u32 = 32; pub WeavingDelay: u64 = 50; pub AttestationDelay: u64 = 25; @@ -949,6 +951,7 @@ impl ghost_exodus::Config for Runtime { type UnsignedPriority = ExodusUnsignedPriority; type MaxAuthorities = MaxActiveValidators; type MaxAuthoritiesChunks = MaxAuthoritiesChunks; + type MaxExodusRequestCount = MaxExodusRequestCount; type DkgRoundPeriod = ExodusDkgRoundPeriod; type RemovalLimit = ExodusRemovalLimit; @@ -1156,6 +1159,39 @@ sp_api::impl_runtime_apis! { } } + impl ghost_exodus_runtime_api::ExodusApi for Runtime { + fn get_evm_rotation_metadata( + dkg_index: u64, + network_type: NetworkType, + ) -> ghost_exodus_runtime_api::PreparedEvmMessage { + GhostExodus::api_get_evm_rotation(dkg_index, network_type) + } + + fn get_evm_bridge_metadata( + dkg_index: u64, + network_id: u64, + session: u64, + ) -> ghost_exodus_runtime_api::PreparedEvmMessage { + GhostExodus::api_get_evm_bridge(dkg_index, network_id, session) + } + + fn get_evm_governance_metadata( + dkg_index: u64, + network_id: u64, + session: u64, + ) -> ghost_exodus_runtime_api::PreparedEvmMessage { + GhostExodus::api_get_evm_governance(dkg_index, network_id, session) + } + + fn pending_exodus_request_count() -> u32 { + GhostExodus::api_pending_exodus_request_count() + } + + fn is_qualification_ongoing(network_curve: NetworkCurve) -> bool { + GhostExodus::api_is_qualification_ongoing(network_curve) + } + } + impl pallet_staking_runtime_api::StakingApi for Runtime { fn nominations_quota(balance: Balance) -> u32 { Staking::api_nominations_quota(balance)