mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 00:31:02 +00:00
Use Substrate state_getReadProof RPC method to get storage proofs (#893)
* use Substrate state_getReadProof method instead of pallet-bridge-messages-rpc * Fix typo Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>
This commit is contained in:
committed by
Bastian Köcher
parent
aa17c272f1
commit
0d60f42b5e
@@ -19,7 +19,6 @@ bp-messages = { path = "../../../primitives/messages" }
|
||||
bp-runtime = { path = "../../../primitives/runtime" }
|
||||
bp-rialto = { path = "../../../primitives/chain-rialto" }
|
||||
pallet-bridge-messages = { path = "../../../modules/messages" }
|
||||
pallet-bridge-messages-rpc = { path = "../../../modules/messages/rpc" }
|
||||
rialto-runtime = { path = "../runtime" }
|
||||
|
||||
# Substrate Dependencies
|
||||
|
||||
@@ -211,40 +211,8 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
|
||||
let prometheus_registry = config.prometheus_registry().cloned();
|
||||
|
||||
let rpc_extensions_builder = {
|
||||
use bp_messages::{LaneId, MessageNonce};
|
||||
use bp_runtime::{InstanceId, MILLAU_BRIDGE_INSTANCE};
|
||||
use sc_finality_grandpa::FinalityProofProvider as GrandpaFinalityProofProvider;
|
||||
use sp_core::storage::StorageKey;
|
||||
|
||||
// This struct is here to ease update process.
|
||||
|
||||
/// Rialto runtime from messages RPC point of view.
|
||||
struct RialtoMessagesKeys;
|
||||
|
||||
impl pallet_bridge_messages_rpc::Runtime for RialtoMessagesKeys {
|
||||
fn message_key(&self, instance: &InstanceId, lane: &LaneId, nonce: MessageNonce) -> Option<StorageKey> {
|
||||
match *instance {
|
||||
MILLAU_BRIDGE_INSTANCE => Some(rialto_runtime::millau_messages::message_key(lane, nonce)),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
fn outbound_lane_data_key(&self, instance: &InstanceId, lane: &LaneId) -> Option<StorageKey> {
|
||||
match *instance {
|
||||
MILLAU_BRIDGE_INSTANCE => Some(rialto_runtime::millau_messages::outbound_lane_data_key(lane)),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
fn inbound_lane_data_key(&self, instance: &InstanceId, lane: &LaneId) -> Option<StorageKey> {
|
||||
match *instance {
|
||||
MILLAU_BRIDGE_INSTANCE => Some(rialto_runtime::millau_messages::inbound_lane_data_key(lane)),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
use pallet_bridge_messages_rpc::{MessagesApi, MessagesRpcHandler};
|
||||
use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApi};
|
||||
use sc_finality_grandpa_rpc::{GrandpaApi, GrandpaRpcHandler};
|
||||
use sc_rpc::DenyUnsafe;
|
||||
@@ -259,7 +227,7 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
|
||||
let shared_voter_state = sc_finality_grandpa::SharedVoterState::empty();
|
||||
|
||||
let finality_proof_provider =
|
||||
GrandpaFinalityProofProvider::new_for_service(backend.clone(), Some(shared_authority_set.clone()));
|
||||
GrandpaFinalityProofProvider::new_for_service(backend, Some(shared_authority_set.clone()));
|
||||
|
||||
Box::new(move |_, subscription_executor| {
|
||||
let mut io = jsonrpc_core::IoHandler::default();
|
||||
@@ -278,10 +246,6 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
|
||||
subscription_executor,
|
||||
finality_proof_provider.clone(),
|
||||
)));
|
||||
io.extend_with(MessagesApi::to_delegate(MessagesRpcHandler::new(
|
||||
backend.clone(),
|
||||
Arc::new(RialtoMessagesKeys),
|
||||
)));
|
||||
|
||||
io
|
||||
})
|
||||
|
||||
@@ -443,8 +443,10 @@ parameter_types! {
|
||||
pub const RootAccountForPayments: Option<AccountId> = None;
|
||||
}
|
||||
|
||||
pub(crate) type WithMillauMessagesInstance = pallet_bridge_messages::DefaultInstance;
|
||||
impl pallet_bridge_messages::Config for Runtime {
|
||||
/// Instance of the messages pallet used to relay messages to/from Millau chain.
|
||||
pub type WithMillauMessagesInstance = pallet_bridge_messages::DefaultInstance;
|
||||
|
||||
impl pallet_bridge_messages::Config<WithMillauMessagesInstance> for Runtime {
|
||||
type Event = Event;
|
||||
type WeightInfo = pallet_bridge_messages::weights::RialtoWeight<Runtime>;
|
||||
type Parameter = millau_messages::RialtoToMillauMessagesParameter;
|
||||
|
||||
@@ -24,14 +24,13 @@ use bp_messages::{
|
||||
InboundLaneData, LaneId, Message, MessageNonce, Parameter as MessagesParameter,
|
||||
};
|
||||
use bp_runtime::{InstanceId, MILLAU_BRIDGE_INSTANCE};
|
||||
use bridge_runtime_common::messages::{self, ChainWithMessages, MessageBridge, MessageTransaction};
|
||||
use bridge_runtime_common::messages::{self, MessageBridge, MessageTransaction};
|
||||
use codec::{Decode, Encode};
|
||||
use frame_support::{
|
||||
parameter_types,
|
||||
weights::{DispatchClass, Weight},
|
||||
RuntimeDebug,
|
||||
};
|
||||
use sp_core::storage::StorageKey;
|
||||
use sp_runtime::{FixedPointNumber, FixedU128};
|
||||
use sp_std::{convert::TryFrom, ops::RangeInclusive};
|
||||
|
||||
@@ -43,28 +42,6 @@ parameter_types! {
|
||||
pub storage MillauToRialtoConversionRate: FixedU128 = INITIAL_MILLAU_TO_RIALTO_CONVERSION_RATE;
|
||||
}
|
||||
|
||||
/// Storage key of the Rialto -> Millau message in the runtime storage.
|
||||
pub fn message_key(lane: &LaneId, nonce: MessageNonce) -> StorageKey {
|
||||
pallet_bridge_messages::storage_keys::message_key::<Runtime, <Rialto as ChainWithMessages>::MessagesInstance>(
|
||||
lane, nonce,
|
||||
)
|
||||
}
|
||||
|
||||
/// Storage key of the Rialto -> Millau message lane state in the runtime storage.
|
||||
pub fn outbound_lane_data_key(lane: &LaneId) -> StorageKey {
|
||||
pallet_bridge_messages::storage_keys::outbound_lane_data_key::<<Rialto as ChainWithMessages>::MessagesInstance>(
|
||||
lane,
|
||||
)
|
||||
}
|
||||
|
||||
/// Storage key of the Millau -> Rialto message lane state in the runtime storage.
|
||||
pub fn inbound_lane_data_key(lane: &LaneId) -> StorageKey {
|
||||
pallet_bridge_messages::storage_keys::inbound_lane_data_key::<
|
||||
Runtime,
|
||||
<Rialto as ChainWithMessages>::MessagesInstance,
|
||||
>(lane)
|
||||
}
|
||||
|
||||
/// Message payload for Rialto -> Millau messages.
|
||||
pub type ToMillauMessagePayload = messages::source::FromThisChainMessagePayload<WithMillauMessageBridge>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user