Skip to content
This repository has been archived by the owner on Nov 10, 2023. It is now read-only.

Commit

Permalink
Merge branch 'main' into dami/release-polkadot-v1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Wizdave97 authored Sep 15, 2023
2 parents 5210e8a + d9b78e4 commit 840ba66
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 27 deletions.
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

18 changes: 10 additions & 8 deletions ismp-demo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,8 @@ pub mod pallet {
/// Dispatch request to a connected EVM chain.
#[pallet::weight(Weight::from_parts(1_000_000, 0))]
#[pallet::call_index(2)]
pub fn disptach_to_evm(origin: OriginFor<T>, params: EvmParams) -> DispatchResult {
pub fn dispatch_to_evm(origin: OriginFor<T>, params: EvmParams) -> DispatchResult {
ensure_signed(origin)?;

let post = DispatchPost {
dest: StateMachine::Ethereum(params.destination),
from: PALLET_ID.to_bytes(),
Expand All @@ -217,13 +216,13 @@ pub mod pallet {
data: b"Hello from polkadot".to_vec(),
gas_limit: 10_000_000,
};

// dispatch the request
let dispatcher = T::IsmpDispatcher::default();
dispatcher
.dispatch_request(DispatchRequest::Post(post))
.map_err(|_| Error::<T>::TransferFailed)?;

for _ in 0..params.count {
// dispatch the request
dispatcher
.dispatch_request(DispatchRequest::Post(post.clone()))
.map_err(|_| Error::<T>::TransferFailed)?;
}
Ok(())
}
}
Expand Down Expand Up @@ -288,6 +287,9 @@ pub mod pallet {

/// Timeout timestamp on destination chain in seconds
pub timeout: u64,

/// Request count
pub count: u64,
}
}

Expand Down
13 changes: 0 additions & 13 deletions pallet-ismp/rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,6 @@ where
#[method(name = "ismp_queryChallengePeriod")]
fn query_challenge_period(&self, client_id: ConsensusClientId) -> Result<u64>;

/// Query the latest timestamp for chain
#[method(name = "ismp_queryTimestamp")]
fn query_timestamp(&self) -> Result<u64>;

/// Query the latest height for a state machine
#[method(name = "ismp_queryStateMachineLatestHeight")]
fn query_state_machine_latest_height(&self, id: StateMachineId) -> Result<u64>;
Expand Down Expand Up @@ -273,15 +269,6 @@ where
.ok_or_else(|| runtime_error_into_rpc_error("Error fetching Challenge period"))
}

fn query_timestamp(&self) -> Result<u64> {
let api = self.client.runtime_api();
let at = self.client.info().best_hash;
api.timestamp(at)
.ok()
.flatten()
.ok_or_else(|| runtime_error_into_rpc_error("Error fetching latest timestamp"))
}

fn query_state_machine_latest_height(&self, id: StateMachineId) -> Result<u64> {
let api = self.client.runtime_api();
let at = self.client.info().best_hash;
Expand Down
3 changes: 0 additions & 3 deletions pallet-ismp/runtime-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ sp_api::decl_runtime_apis! {
/// Return the timestamp this client was last updated in seconds
fn consensus_update_time(id: ConsensusClientId) -> Option<u64>;

/// Return the latest timestamp for the chain
fn timestamp() -> Option<u64>;

/// Return the challenge period timestamp
fn challenge_period(id: ConsensusClientId) -> Option<u64>;

Expand Down

0 comments on commit 840ba66

Please sign in to comment.