From 158c3e94eb7815a81b14dd5ebf1db2f95cdebdbf Mon Sep 17 00:00:00 2001 From: Web3 Philosopher Date: Wed, 8 May 2024 13:23:45 +0100 Subject: [PATCH] Add source and destination metadata to Timeout events (#202) --- evm/abi/Cargo.toml | 20 ++- evm/abi/src/conversions.rs | 27 ++- evm/abi/src/generated/evm_host.rs | 30 +++- evm/abi/src/generated/host_manager.rs | 4 +- evm/src/hosts/EvmHost.sol | 21 ++- evm/src/modules/TokenGateway.sol | 5 +- modules/hyperclient/tests/streams.rs | 1 + modules/ismp/core/src/events.rs | 4 + modules/ismp/core/src/handlers/timeout.rs | 18 +- modules/ismp/pallets/pallet/src/events.rs | 178 ++++++-------------- modules/ismp/pallets/pallet/src/impls.rs | 11 +- modules/ismp/pallets/rpc/src/lib.rs | 173 ++++--------------- modules/ismp/pallets/runtime-api/README.md | 6 +- modules/ismp/pallets/runtime-api/src/lib.rs | 4 +- parachain/runtimes/gargantua/src/lib.rs | 4 +- parachain/runtimes/messier/src/lib.rs | 4 +- parachain/runtimes/nexus/src/lib.rs | 4 +- 17 files changed, 203 insertions(+), 311 deletions(-) diff --git a/evm/abi/Cargo.toml b/evm/abi/Cargo.toml index ac248d251..497df5835 100644 --- a/evm/abi/Cargo.toml +++ b/evm/abi/Cargo.toml @@ -13,19 +13,25 @@ ethers-contract-abigen = { workspace = true } forge-testsuite = { workspace = true } [dependencies] -primitive-types = { workspace = true, default-features = true } -anyhow.workspace = true +primitive-types = { workspace = true } +anyhow = { workspace = true } ethers = { workspace = true } ismp = { workspace = true } -mmr-primitives = { workspace = true, optional = true } -sp-consensus-beefy = { workspace = true, features = ["default"], optional = true } -merkle-mountain-range = { workspace = true, features = ["default"], optional = true } -beefy-verifier-primitives = { workspace = true, optional = true } +mmr-primitives = { workspace = true, default-features = true, optional = true } +sp-consensus-beefy = { workspace = true, default-features = true, optional = true } +merkle-mountain-range = { workspace = true, default-features = true, optional = true } +beefy-verifier-primitives = { workspace = true, default-features = true, optional = true } [features] -default = ["beefy"] +default = ["beefy", "std"] +std = [ + "primitive-types/std", + "anyhow/std", + "ethers/default", + "ismp/std", +] build-abi = [] beefy = ["merkle-mountain-range", "sp-consensus-beefy", "beefy-verifier-primitives", "mmr-primitives"] diff --git a/evm/abi/src/conversions.rs b/evm/abi/src/conversions.rs index cde587fc3..eece52692 100644 --- a/evm/abi/src/conversions.rs +++ b/evm/abi/src/conversions.rs @@ -314,18 +314,33 @@ impl TryFrom for ismp::events::Event { }, latest_height: filter.height.low_u64(), })), - EvmHostEvents::PostRequestTimeoutHandledFilter(handled) => + EvmHostEvents::PostRequestTimeoutHandledFilter(handled) => { + let dest = StateMachine::from_str(&String::from_utf8(handled.dest.to_vec())?) + .map_err(|e| anyhow!("{}", e))?; Ok(ismp::events::Event::PostRequestTimeoutHandled(TimeoutHandled { commitment: handled.commitment.into(), - })), - EvmHostEvents::PostResponseTimeoutHandledFilter(handled) => + dest: dest.clone(), + source: dest.clone(), + })) + }, + EvmHostEvents::PostResponseTimeoutHandledFilter(handled) => { + let dest = StateMachine::from_str(&String::from_utf8(handled.dest.to_vec())?) + .map_err(|e| anyhow!("{}", e))?; Ok(ismp::events::Event::PostResponseTimeoutHandled(TimeoutHandled { commitment: handled.commitment.into(), - })), - EvmHostEvents::GetRequestTimeoutHandledFilter(handled) => + dest: dest.clone(), + source: dest.clone(), + })) + }, + EvmHostEvents::GetRequestTimeoutHandledFilter(handled) => { + let dest = StateMachine::from_str(&String::from_utf8(handled.dest.to_vec())?) + .map_err(|e| anyhow!("{}", e))?; Ok(ismp::events::Event::GetRequestTimeoutHandled(TimeoutHandled { commitment: handled.commitment.into(), - })), + dest: dest.clone(), + source: dest.clone(), + })) + }, EvmHostEvents::StateCommitmentVetoedFilter(vetoed) => Ok(ismp::events::Event::StateCommitmentVetoed(StateCommitmentVetoed { height: ismp::consensus::StateMachineHeight { diff --git a/evm/abi/src/generated/evm_host.rs b/evm/abi/src/generated/evm_host.rs index 05a346aed..188aef840 100644 --- a/evm/abi/src/generated/evm_host.rs +++ b/evm/abi/src/generated/evm_host.rs @@ -1454,6 +1454,11 @@ pub mod evm_host { ), indexed: false, }, + ::ethers::core::abi::ethabi::EventParam { + name: ::std::borrow::ToOwned::to_owned("dest"), + kind: ::ethers::core::abi::ethabi::ParamType::Bytes, + indexed: false, + }, ], anonymous: false, }, @@ -1554,6 +1559,11 @@ pub mod evm_host { ), indexed: false, }, + ::ethers::core::abi::ethabi::EventParam { + name: ::std::borrow::ToOwned::to_owned("dest"), + kind: ::ethers::core::abi::ethabi::ParamType::Bytes, + indexed: false, + }, ], anonymous: false, }, @@ -1670,6 +1680,11 @@ pub mod evm_host { ), indexed: false, }, + ::ethers::core::abi::ethabi::EventParam { + name: ::std::borrow::ToOwned::to_owned("dest"), + kind: ::ethers::core::abi::ethabi::ParamType::Bytes, + indexed: false, + }, ], anonymous: false, }, @@ -2296,9 +2311,10 @@ pub mod evm_host { Eq, Hash, )] - #[ethevent(name = "GetRequestTimeoutHandled", abi = "GetRequestTimeoutHandled(bytes32)")] + #[ethevent(name = "GetRequestTimeoutHandled", abi = "GetRequestTimeoutHandled(bytes32,bytes)")] pub struct GetRequestTimeoutHandledFilter { pub commitment: [u8; 32], + pub dest: ::ethers::core::types::Bytes, } #[derive( Clone, @@ -2350,9 +2366,13 @@ pub mod evm_host { Eq, Hash, )] - #[ethevent(name = "PostRequestTimeoutHandled", abi = "PostRequestTimeoutHandled(bytes32)")] + #[ethevent( + name = "PostRequestTimeoutHandled", + abi = "PostRequestTimeoutHandled(bytes32,bytes)" + )] pub struct PostRequestTimeoutHandledFilter { pub commitment: [u8; 32], + pub dest: ::ethers::core::types::Bytes, } #[derive( Clone, @@ -2406,9 +2426,13 @@ pub mod evm_host { Eq, Hash, )] - #[ethevent(name = "PostResponseTimeoutHandled", abi = "PostResponseTimeoutHandled(bytes32)")] + #[ethevent( + name = "PostResponseTimeoutHandled", + abi = "PostResponseTimeoutHandled(bytes32,bytes)" + )] pub struct PostResponseTimeoutHandledFilter { pub commitment: [u8; 32], + pub dest: ::ethers::core::types::Bytes, } #[derive( Clone, diff --git a/evm/abi/src/generated/host_manager.rs b/evm/abi/src/generated/host_manager.rs index 353485add..4f594b362 100644 --- a/evm/abi/src/generated/host_manager.rs +++ b/evm/abi/src/generated/host_manager.rs @@ -254,12 +254,12 @@ pub mod host_manager { pub static HOSTMANAGER_ABI: ::ethers::contract::Lazy<::ethers::core::abi::Abi> = ::ethers::contract::Lazy::new(__abi); #[rustfmt::skip] - const __BYTECODE: &[u8] = b"`\x80`@R4\x80\x15a\0\x10W`\0\x80\xFD[P`@Qa\x14\xB88\x03\x80a\x14\xB8\x839\x81\x01`@\x81\x90Ra\0/\x91a\0\x83V[\x80Q`\0\x80T`\x01`\x01`\xA0\x1B\x03\x19\x90\x81\x16`\x01`\x01`\xA0\x1B\x03\x93\x84\x16\x17\x90\x91U` \x90\x92\x01Q`\x01\x80T\x90\x93\x16\x91\x16\x17\x90Ua\0\xEBV[\x80Q`\x01`\x01`\xA0\x1B\x03\x81\x16\x81\x14a\0~W`\0\x80\xFD[\x91\x90PV[`\0`@\x82\x84\x03\x12\x15a\0\x95W`\0\x80\xFD[`@\x80Q\x90\x81\x01`\x01`\x01`@\x1B\x03\x81\x11\x82\x82\x10\x17\x15a\0\xC5WcNH{q`\xE0\x1B`\0R`A`\x04R`$`\0\xFD[`@Ra\0\xD1\x83a\0gV[\x81Ra\0\xDF` \x84\x01a\0gV[` \x82\x01R\x93\x92PPPV[a\x13\xBE\x80a\0\xFA`\09`\0\xF3\xFE`\x80`@R4\x80\x15a\0\x10W`\0\x80\xFD[P`\x046\x10a\0\x88W`\x005`\xE0\x1C\x80c\xB5\xA9\x82K\x11a\0[W\x80c\xB5\xA9\x82K\x14a\0\xD6W\x80c\xBC\r\xD4G\x14a\0\xE9W\x80c\xC4\x92\xE4&\x14a\0\xFCW\x80c\xCF\xF0\xAB\x96\x14a\x01\nW`\0\x80\xFD[\x80c\x0B\xC3{\xAB\x14a\0\x8DW\x80c\x0E\x83$\xA2\x14a\0\xA2W\x80c\x0F\xEE2\xCE\x14a\0\xB5W\x80c\xB2\xA0\x1B\xF5\x14a\0\xC8W[`\0\x80\xFD[a\0\xA0a\0\x9B6`\x04a\t\nV[a\x01]V[\0[a\0\xA0a\0\xB06`\x04a\t]V[a\x01\xB9V[a\0\xA0a\0\xC36`\x04a\t\x7FV[a\x02`@Q\x81c\xFF\xFF\xFF\xFF\x16`\xE0\x1B\x81R`\x04\x01`\0`@Q\x80\x83\x03\x81\x86Z\xFA\x15\x80\x15a\x02\xFBW=`\0\x80>=`\0\xFD[PPPP`@Q=`\0\x82>`\x1F=\x90\x81\x01`\x1F\x19\x16\x82\x01`@Ra\x03#\x91\x90\x81\x01\x90a\x0E\x14V[a\x03-\x83\x80a\x0E\x8AV[\x80\x80`\x1F\x01` \x80\x91\x04\x02` \x01`@Q\x90\x81\x01`@R\x80\x93\x92\x91\x90\x81\x81R` \x01\x83\x83\x80\x82\x847`\0\x92\x01\x91\x90\x91RP\x92\x93\x92PPa\x05\xF8\x90PV[a\x03\xADW`@QbF\x1B\xCD`\xE5\x1B\x81R` `\x04\x82\x01R`\x14`$\x82\x01Rs\x15[\x98]]\x1A\x1B\xDC\x9A^\x99Y\x08\x1C\x99\\]Y\\\xDD`b\x1B`D\x82\x01R`d\x01a\x01\xB0V[`\0a\x03\xBC`\xC0\x83\x01\x83a\x0E\x8AV[`\0\x81\x81\x10a\x03\xCDWa\x03\xCDa\x0E\xD7V[\x91\x90\x91\x015`\xF8\x1C\x90P`\x01\x81\x11\x15a\x03\xE8Wa\x03\xE8a\x0E\xEDV[\x90P`\0\x81`\x01\x81\x11\x15a\x03\xFEWa\x03\xFEa\x0E\xEDV[\x03a\x04\xA1W`\0a\x04\x12`\xC0\x84\x01\x84a\x0E\x8AV[a\x04 \x91`\x01\x90\x82\x90a\x0F\x03V[\x81\x01\x90a\x04-\x91\x90a\x0F-V[`\x01T`@Qc=`\0\xFD[PPPPPPPPV[`\x01\x81`\x01\x81\x11\x15a\x04\xB5Wa\x04\xB5a\x0E\xEDV[\x03a\x05\x15W`\0a\x04\xC9`\xC0\x84\x01\x84a\x0E\x8AV[a\x04\xD7\x91`\x01\x90\x82\x90a\x0F\x03V[\x81\x01\x90a\x04\xE4\x91\x90a\x10@V[`\x01T`@Qc{H\x1F\xE1`\xE1\x1B\x81R\x91\x92P`\x01`\x01`\xA0\x1B\x03\x16\x90c\xF6\x90?\xC2\x90a\x04i\x90\x84\x90`\x04\x01a\x12MV[`@QbF\x1B\xCD`\xE5\x1B\x81R` `\x04\x82\x01R`\x0E`$\x82\x01Rm*\xB75\xB77\xBB\xB7\x100\xB1\xBA4\xB7\xB7`\x91\x1B`D\x82\x01R`d\x01a\x01\xB0V[`@QbF\x1B\xCD`\xE5\x1B\x81R` `\x04\x82\x01R`$\x80\x82\x01R\x7FIsmpModule doesn't emit Get requ`D\x82\x01Rcests`\xE0\x1B`d\x82\x01R`\x84\x01a\x01\xB0V[`@QbF\x1B\xCD`\xE5\x1B\x81R` `\x04\x82\x01R`%`$\x82\x01R\x7FIsmpModule doesn't emit Post req`D\x82\x01Rduests`\xD8\x1B`d\x82\x01R`\x84\x01a\x01\xB0V[`\0\x81Q\x83Q\x14a\x06\x0BWP`\0a\x06\x1FV[P\x81Q` \x82\x81\x01\x82\x90 \x90\x84\x01\x91\x90\x91 \x14[\x92\x91PPV[cNH{q`\xE0\x1B`\0R`A`\x04R`$`\0\xFD[`@Q`\xE0\x81\x01`\x01`\x01`@\x1B\x03\x81\x11\x82\x82\x10\x17\x15a\x06]Wa\x06]a\x06%V[`@R\x90V[`@\x80Q\x90\x81\x01`\x01`\x01`@\x1B\x03\x81\x11\x82\x82\x10\x17\x15a\x06]Wa\x06]a\x06%V[`@Qa\x01\xC0\x81\x01`\x01`\x01`@\x1B\x03\x81\x11\x82\x82\x10\x17\x15a\x06]Wa\x06]a\x06%V[`@Q`\x1F\x82\x01`\x1F\x19\x16\x81\x01`\x01`\x01`@\x1B\x03\x81\x11\x82\x82\x10\x17\x15a\x06\xD0Wa\x06\xD0a\x06%V[`@R\x91\x90PV[`\0`\x01`\x01`@\x1B\x03\x82\x11\x15a\x06\xF1Wa\x06\xF1a\x06%V[P`\x1F\x01`\x1F\x19\x16` \x01\x90V[`\0\x82`\x1F\x83\x01\x12a\x07\x10W`\0\x80\xFD[\x815a\x07#a\x07\x1E\x82a\x06\xD8V[a\x06\xA8V[\x81\x81R\x84` \x83\x86\x01\x01\x11\x15a\x078W`\0\x80\xFD[\x81` \x85\x01` \x83\x017`\0\x91\x81\x01` \x01\x91\x90\x91R\x93\x92PPPV[\x805`\x01`\x01`@\x1B\x03\x81\x16\x81\x14a\x07lW`\0\x80\xFD[\x91\x90PV[`\0`\xE0\x82\x84\x03\x12\x15a\x07\x83W`\0\x80\xFD[a\x07\x8Ba\x06;V[\x90P\x815`\x01`\x01`@\x1B\x03\x80\x82\x11\x15a\x07\xA4W`\0\x80\xFD[a\x07\xB0\x85\x83\x86\x01a\x06\xFFV[\x83R` \x84\x015\x91P\x80\x82\x11\x15a\x07\xC6W`\0\x80\xFD[a\x07\xD2\x85\x83\x86\x01a\x06\xFFV[` \x84\x01Ra\x07\xE3`@\x85\x01a\x07UV[`@\x84\x01R``\x84\x015\x91P\x80\x82\x11\x15a\x07\xFCW`\0\x80\xFD[a\x08\x08\x85\x83\x86\x01a\x06\xFFV[``\x84\x01R`\x80\x84\x015\x91P\x80\x82\x11\x15a\x08!W`\0\x80\xFD[a\x08-\x85\x83\x86\x01a\x06\xFFV[`\x80\x84\x01Ra\x08>`\xA0\x85\x01a\x07UV[`\xA0\x84\x01R`\xC0\x84\x015\x91P\x80\x82\x11\x15a\x08WW`\0\x80\xFD[Pa\x08d\x84\x82\x85\x01a\x06\xFFV[`\xC0\x83\x01RP\x92\x91PPV[`\0``\x82\x84\x03\x12\x15a\x08\x82W`\0\x80\xFD[`@Q``\x81\x01`\x01`\x01`@\x1B\x03\x82\x82\x10\x81\x83\x11\x17\x15a\x08\xA5Wa\x08\xA5a\x06%V[\x81`@R\x82\x93P\x845\x91P\x80\x82\x11\x15a\x08\xBDW`\0\x80\xFD[a\x08\xC9\x86\x83\x87\x01a\x07qV[\x83R` \x85\x015\x91P\x80\x82\x11\x15a\x08\xDFW`\0\x80\xFD[Pa\x08\xEC\x85\x82\x86\x01a\x06\xFFV[` \x83\x01RPa\x08\xFE`@\x84\x01a\x07UV[`@\x82\x01RP\x92\x91PPV[`\0` \x82\x84\x03\x12\x15a\t\x1CW`\0\x80\xFD[\x815`\x01`\x01`@\x1B\x03\x81\x11\x15a\t2W`\0\x80\xFD[a\t>\x84\x82\x85\x01a\x08pV[\x94\x93PPPPV[\x805`\x01`\x01`\xA0\x1B\x03\x81\x16\x81\x14a\x07lW`\0\x80\xFD[`\0` \x82\x84\x03\x12\x15a\toW`\0\x80\xFD[a\tx\x82a\tFV[\x93\x92PPPV[`\0` \x82\x84\x03\x12\x15a\t\x91W`\0\x80\xFD[\x815`\x01`\x01`@\x1B\x03\x81\x11\x15a\t\xA7W`\0\x80\xFD[\x82\x01`@\x81\x85\x03\x12\x15a\txW`\0\x80\xFD[`\0` \x82\x84\x03\x12\x15a\t\xCBW`\0\x80\xFD[\x815`\x01`\x01`@\x1B\x03\x80\x82\x11\x15a\t\xE2W`\0\x80\xFD[\x90\x83\x01\x90`@\x82\x86\x03\x12\x15a\t\xF6W`\0\x80\xFD[a\t\xFEa\x06cV[\x825\x82\x81\x11\x15a\n\rW`\0\x80\xFD[a\n\x19\x87\x82\x86\x01a\x08pV[\x82RPa\n(` \x84\x01a\tFV[` \x82\x01R\x95\x94PPPPPV[`\0`\x01`\x01`@\x1B\x03\x82\x11\x15a\nOWa\nOa\x06%V[P`\x05\x1B` \x01\x90V[`\0\x82`\x1F\x83\x01\x12a\njW`\0\x80\xFD[\x815` a\nza\x07\x1E\x83a\n6V[\x82\x81R`\x05\x92\x90\x92\x1B\x84\x01\x81\x01\x91\x81\x81\x01\x90\x86\x84\x11\x15a\n\x99W`\0\x80\xFD[\x82\x86\x01[\x84\x81\x10\x15a\n\xD8W\x805`\x01`\x01`@\x1B\x03\x81\x11\x15a\n\xBCW`\0\x80\x81\xFD[a\n\xCA\x89\x86\x83\x8B\x01\x01a\x06\xFFV[\x84RP\x91\x83\x01\x91\x83\x01a\n\x9DV[P\x96\x95PPPPPPV[`\0`\xE0\x82\x84\x03\x12\x15a\n\xF5W`\0\x80\xFD[a\n\xFDa\x06;V[\x90P\x815`\x01`\x01`@\x1B\x03\x80\x82\x11\x15a\x0B\x16W`\0\x80\xFD[a\x0B\"\x85\x83\x86\x01a\x06\xFFV[\x83R` \x84\x015\x91P\x80\x82\x11\x15a\x0B8W`\0\x80\xFD[a\x0BD\x85\x83\x86\x01a\x06\xFFV[` \x84\x01Ra\x0BU`@\x85\x01a\x07UV[`@\x84\x01R``\x84\x015\x91P\x80\x82\x11\x15a\x0BnW`\0\x80\xFD[a\x0Bz\x85\x83\x86\x01a\x06\xFFV[``\x84\x01Ra\x0B\x8B`\x80\x85\x01a\x07UV[`\x80\x84\x01R`\xA0\x84\x015\x91P\x80\x82\x11\x15a\x0B\xA4W`\0\x80\xFD[Pa\x0B\xB1\x84\x82\x85\x01a\nYV[`\xA0\x83\x01RPa\x0B\xC3`\xC0\x83\x01a\x07UV[`\xC0\x82\x01R\x92\x91PPV[`\0` \x82\x84\x03\x12\x15a\x0B\xE0W`\0\x80\xFD[`\x01`\x01`@\x1B\x03\x80\x835\x11\x15a\x0B\xF6W`\0\x80\xFD[\x825\x83\x01`@\x81\x86\x03\x12\x15a\x0C\nW`\0\x80\xFD[a\x0C\x12a\x06cV[\x82\x825\x11\x15a\x0C W`\0\x80\xFD[\x815\x82\x01`@\x81\x88\x03\x12\x15a\x0C4W`\0\x80\xFD[a\x0C\x84\x82\x85\x01a\x07qV[`\0` \x82\x84\x03\x12\x15a\r\xAEW`\0\x80\xFD[\x815`\x01`\x01`@\x1B\x03\x81\x11\x15a\r\xC4W`\0\x80\xFD[a\t>\x84\x82\x85\x01a\n\xE3V[`\0\x825`\xDE\x19\x836\x03\x01\x81\x12a\r\xE6W`\0\x80\xFD[\x91\x90\x91\x01\x92\x91PPV[`\0[\x83\x81\x10\x15a\x0E\x0BW\x81\x81\x01Q\x83\x82\x01R` \x01a\r\xF3V[PP`\0\x91\x01RV[`\0` \x82\x84\x03\x12\x15a\x0E&W`\0\x80\xFD[\x81Q`\x01`\x01`@\x1B\x03\x81\x11\x15a\x0E\xFBh\x0C\x9FZ\x0C\xBD\xC4\x11dsolcC\0\x08\x11\x003"; + const __BYTECODE: &[u8] = b"`\x80`@R4\x80\x15a\0\x10W`\0\x80\xFD[P`@Qa\x14\xB88\x03\x80a\x14\xB8\x839\x81\x01`@\x81\x90Ra\0/\x91a\0\x83V[\x80Q`\0\x80T`\x01`\x01`\xA0\x1B\x03\x19\x90\x81\x16`\x01`\x01`\xA0\x1B\x03\x93\x84\x16\x17\x90\x91U` \x90\x92\x01Q`\x01\x80T\x90\x93\x16\x91\x16\x17\x90Ua\0\xEBV[\x80Q`\x01`\x01`\xA0\x1B\x03\x81\x16\x81\x14a\0~W`\0\x80\xFD[\x91\x90PV[`\0`@\x82\x84\x03\x12\x15a\0\x95W`\0\x80\xFD[`@\x80Q\x90\x81\x01`\x01`\x01`@\x1B\x03\x81\x11\x82\x82\x10\x17\x15a\0\xC5WcNH{q`\xE0\x1B`\0R`A`\x04R`$`\0\xFD[`@Ra\0\xD1\x83a\0gV[\x81Ra\0\xDF` \x84\x01a\0gV[` \x82\x01R\x93\x92PPPV[a\x13\xBE\x80a\0\xFA`\09`\0\xF3\xFE`\x80`@R4\x80\x15a\0\x10W`\0\x80\xFD[P`\x046\x10a\0\x88W`\x005`\xE0\x1C\x80c\xB5\xA9\x82K\x11a\0[W\x80c\xB5\xA9\x82K\x14a\0\xD6W\x80c\xBC\r\xD4G\x14a\0\xE9W\x80c\xC4\x92\xE4&\x14a\0\xFCW\x80c\xCF\xF0\xAB\x96\x14a\x01\nW`\0\x80\xFD[\x80c\x0B\xC3{\xAB\x14a\0\x8DW\x80c\x0E\x83$\xA2\x14a\0\xA2W\x80c\x0F\xEE2\xCE\x14a\0\xB5W\x80c\xB2\xA0\x1B\xF5\x14a\0\xC8W[`\0\x80\xFD[a\0\xA0a\0\x9B6`\x04a\t\nV[a\x01]V[\0[a\0\xA0a\0\xB06`\x04a\t]V[a\x01\xB9V[a\0\xA0a\0\xC36`\x04a\t\x7FV[a\x02`@Q\x81c\xFF\xFF\xFF\xFF\x16`\xE0\x1B\x81R`\x04\x01`\0`@Q\x80\x83\x03\x81\x86Z\xFA\x15\x80\x15a\x02\xFBW=`\0\x80>=`\0\xFD[PPPP`@Q=`\0\x82>`\x1F=\x90\x81\x01`\x1F\x19\x16\x82\x01`@Ra\x03#\x91\x90\x81\x01\x90a\x0E\x14V[a\x03-\x83\x80a\x0E\x8AV[\x80\x80`\x1F\x01` \x80\x91\x04\x02` \x01`@Q\x90\x81\x01`@R\x80\x93\x92\x91\x90\x81\x81R` \x01\x83\x83\x80\x82\x847`\0\x92\x01\x91\x90\x91RP\x92\x93\x92PPa\x05\xF8\x90PV[a\x03\xADW`@QbF\x1B\xCD`\xE5\x1B\x81R` `\x04\x82\x01R`\x14`$\x82\x01Rs\x15[\x98]]\x1A\x1B\xDC\x9A^\x99Y\x08\x1C\x99\\]Y\\\xDD`b\x1B`D\x82\x01R`d\x01a\x01\xB0V[`\0a\x03\xBC`\xC0\x83\x01\x83a\x0E\x8AV[`\0\x81\x81\x10a\x03\xCDWa\x03\xCDa\x0E\xD7V[\x91\x90\x91\x015`\xF8\x1C\x90P`\x01\x81\x11\x15a\x03\xE8Wa\x03\xE8a\x0E\xEDV[\x90P`\0\x81`\x01\x81\x11\x15a\x03\xFEWa\x03\xFEa\x0E\xEDV[\x03a\x04\xA1W`\0a\x04\x12`\xC0\x84\x01\x84a\x0E\x8AV[a\x04 \x91`\x01\x90\x82\x90a\x0F\x03V[\x81\x01\x90a\x04-\x91\x90a\x0F-V[`\x01T`@Qc=`\0\xFD[PPPPPPPPV[`\x01\x81`\x01\x81\x11\x15a\x04\xB5Wa\x04\xB5a\x0E\xEDV[\x03a\x05\x15W`\0a\x04\xC9`\xC0\x84\x01\x84a\x0E\x8AV[a\x04\xD7\x91`\x01\x90\x82\x90a\x0F\x03V[\x81\x01\x90a\x04\xE4\x91\x90a\x10@V[`\x01T`@Qc{H\x1F\xE1`\xE1\x1B\x81R\x91\x92P`\x01`\x01`\xA0\x1B\x03\x16\x90c\xF6\x90?\xC2\x90a\x04i\x90\x84\x90`\x04\x01a\x12MV[`@QbF\x1B\xCD`\xE5\x1B\x81R` `\x04\x82\x01R`\x0E`$\x82\x01Rm*\xB75\xB77\xBB\xB7\x100\xB1\xBA4\xB7\xB7`\x91\x1B`D\x82\x01R`d\x01a\x01\xB0V[`@QbF\x1B\xCD`\xE5\x1B\x81R` `\x04\x82\x01R`$\x80\x82\x01R\x7FIsmpModule doesn't emit Get requ`D\x82\x01Rcests`\xE0\x1B`d\x82\x01R`\x84\x01a\x01\xB0V[`@QbF\x1B\xCD`\xE5\x1B\x81R` `\x04\x82\x01R`%`$\x82\x01R\x7FIsmpModule doesn't emit Post req`D\x82\x01Rduests`\xD8\x1B`d\x82\x01R`\x84\x01a\x01\xB0V[`\0\x81Q\x83Q\x14a\x06\x0BWP`\0a\x06\x1FV[P\x81Q` \x82\x81\x01\x82\x90 \x90\x84\x01\x91\x90\x91 \x14[\x92\x91PPV[cNH{q`\xE0\x1B`\0R`A`\x04R`$`\0\xFD[`@Q`\xE0\x81\x01`\x01`\x01`@\x1B\x03\x81\x11\x82\x82\x10\x17\x15a\x06]Wa\x06]a\x06%V[`@R\x90V[`@\x80Q\x90\x81\x01`\x01`\x01`@\x1B\x03\x81\x11\x82\x82\x10\x17\x15a\x06]Wa\x06]a\x06%V[`@Qa\x01\xC0\x81\x01`\x01`\x01`@\x1B\x03\x81\x11\x82\x82\x10\x17\x15a\x06]Wa\x06]a\x06%V[`@Q`\x1F\x82\x01`\x1F\x19\x16\x81\x01`\x01`\x01`@\x1B\x03\x81\x11\x82\x82\x10\x17\x15a\x06\xD0Wa\x06\xD0a\x06%V[`@R\x91\x90PV[`\0`\x01`\x01`@\x1B\x03\x82\x11\x15a\x06\xF1Wa\x06\xF1a\x06%V[P`\x1F\x01`\x1F\x19\x16` \x01\x90V[`\0\x82`\x1F\x83\x01\x12a\x07\x10W`\0\x80\xFD[\x815a\x07#a\x07\x1E\x82a\x06\xD8V[a\x06\xA8V[\x81\x81R\x84` \x83\x86\x01\x01\x11\x15a\x078W`\0\x80\xFD[\x81` \x85\x01` \x83\x017`\0\x91\x81\x01` \x01\x91\x90\x91R\x93\x92PPPV[\x805`\x01`\x01`@\x1B\x03\x81\x16\x81\x14a\x07lW`\0\x80\xFD[\x91\x90PV[`\0`\xE0\x82\x84\x03\x12\x15a\x07\x83W`\0\x80\xFD[a\x07\x8Ba\x06;V[\x90P\x815`\x01`\x01`@\x1B\x03\x80\x82\x11\x15a\x07\xA4W`\0\x80\xFD[a\x07\xB0\x85\x83\x86\x01a\x06\xFFV[\x83R` \x84\x015\x91P\x80\x82\x11\x15a\x07\xC6W`\0\x80\xFD[a\x07\xD2\x85\x83\x86\x01a\x06\xFFV[` \x84\x01Ra\x07\xE3`@\x85\x01a\x07UV[`@\x84\x01R``\x84\x015\x91P\x80\x82\x11\x15a\x07\xFCW`\0\x80\xFD[a\x08\x08\x85\x83\x86\x01a\x06\xFFV[``\x84\x01R`\x80\x84\x015\x91P\x80\x82\x11\x15a\x08!W`\0\x80\xFD[a\x08-\x85\x83\x86\x01a\x06\xFFV[`\x80\x84\x01Ra\x08>`\xA0\x85\x01a\x07UV[`\xA0\x84\x01R`\xC0\x84\x015\x91P\x80\x82\x11\x15a\x08WW`\0\x80\xFD[Pa\x08d\x84\x82\x85\x01a\x06\xFFV[`\xC0\x83\x01RP\x92\x91PPV[`\0``\x82\x84\x03\x12\x15a\x08\x82W`\0\x80\xFD[`@Q``\x81\x01`\x01`\x01`@\x1B\x03\x82\x82\x10\x81\x83\x11\x17\x15a\x08\xA5Wa\x08\xA5a\x06%V[\x81`@R\x82\x93P\x845\x91P\x80\x82\x11\x15a\x08\xBDW`\0\x80\xFD[a\x08\xC9\x86\x83\x87\x01a\x07qV[\x83R` \x85\x015\x91P\x80\x82\x11\x15a\x08\xDFW`\0\x80\xFD[Pa\x08\xEC\x85\x82\x86\x01a\x06\xFFV[` \x83\x01RPa\x08\xFE`@\x84\x01a\x07UV[`@\x82\x01RP\x92\x91PPV[`\0` \x82\x84\x03\x12\x15a\t\x1CW`\0\x80\xFD[\x815`\x01`\x01`@\x1B\x03\x81\x11\x15a\t2W`\0\x80\xFD[a\t>\x84\x82\x85\x01a\x08pV[\x94\x93PPPPV[\x805`\x01`\x01`\xA0\x1B\x03\x81\x16\x81\x14a\x07lW`\0\x80\xFD[`\0` \x82\x84\x03\x12\x15a\toW`\0\x80\xFD[a\tx\x82a\tFV[\x93\x92PPPV[`\0` \x82\x84\x03\x12\x15a\t\x91W`\0\x80\xFD[\x815`\x01`\x01`@\x1B\x03\x81\x11\x15a\t\xA7W`\0\x80\xFD[\x82\x01`@\x81\x85\x03\x12\x15a\txW`\0\x80\xFD[`\0` \x82\x84\x03\x12\x15a\t\xCBW`\0\x80\xFD[\x815`\x01`\x01`@\x1B\x03\x80\x82\x11\x15a\t\xE2W`\0\x80\xFD[\x90\x83\x01\x90`@\x82\x86\x03\x12\x15a\t\xF6W`\0\x80\xFD[a\t\xFEa\x06cV[\x825\x82\x81\x11\x15a\n\rW`\0\x80\xFD[a\n\x19\x87\x82\x86\x01a\x08pV[\x82RPa\n(` \x84\x01a\tFV[` \x82\x01R\x95\x94PPPPPV[`\0`\x01`\x01`@\x1B\x03\x82\x11\x15a\nOWa\nOa\x06%V[P`\x05\x1B` \x01\x90V[`\0\x82`\x1F\x83\x01\x12a\njW`\0\x80\xFD[\x815` a\nza\x07\x1E\x83a\n6V[\x82\x81R`\x05\x92\x90\x92\x1B\x84\x01\x81\x01\x91\x81\x81\x01\x90\x86\x84\x11\x15a\n\x99W`\0\x80\xFD[\x82\x86\x01[\x84\x81\x10\x15a\n\xD8W\x805`\x01`\x01`@\x1B\x03\x81\x11\x15a\n\xBCW`\0\x80\x81\xFD[a\n\xCA\x89\x86\x83\x8B\x01\x01a\x06\xFFV[\x84RP\x91\x83\x01\x91\x83\x01a\n\x9DV[P\x96\x95PPPPPPV[`\0`\xE0\x82\x84\x03\x12\x15a\n\xF5W`\0\x80\xFD[a\n\xFDa\x06;V[\x90P\x815`\x01`\x01`@\x1B\x03\x80\x82\x11\x15a\x0B\x16W`\0\x80\xFD[a\x0B\"\x85\x83\x86\x01a\x06\xFFV[\x83R` \x84\x015\x91P\x80\x82\x11\x15a\x0B8W`\0\x80\xFD[a\x0BD\x85\x83\x86\x01a\x06\xFFV[` \x84\x01Ra\x0BU`@\x85\x01a\x07UV[`@\x84\x01R``\x84\x015\x91P\x80\x82\x11\x15a\x0BnW`\0\x80\xFD[a\x0Bz\x85\x83\x86\x01a\x06\xFFV[``\x84\x01Ra\x0B\x8B`\x80\x85\x01a\x07UV[`\x80\x84\x01R`\xA0\x84\x015\x91P\x80\x82\x11\x15a\x0B\xA4W`\0\x80\xFD[Pa\x0B\xB1\x84\x82\x85\x01a\nYV[`\xA0\x83\x01RPa\x0B\xC3`\xC0\x83\x01a\x07UV[`\xC0\x82\x01R\x92\x91PPV[`\0` \x82\x84\x03\x12\x15a\x0B\xE0W`\0\x80\xFD[`\x01`\x01`@\x1B\x03\x80\x835\x11\x15a\x0B\xF6W`\0\x80\xFD[\x825\x83\x01`@\x81\x86\x03\x12\x15a\x0C\nW`\0\x80\xFD[a\x0C\x12a\x06cV[\x82\x825\x11\x15a\x0C W`\0\x80\xFD[\x815\x82\x01`@\x81\x88\x03\x12\x15a\x0C4W`\0\x80\xFD[a\x0C\x84\x82\x85\x01a\x07qV[`\0` \x82\x84\x03\x12\x15a\r\xAEW`\0\x80\xFD[\x815`\x01`\x01`@\x1B\x03\x81\x11\x15a\r\xC4W`\0\x80\xFD[a\t>\x84\x82\x85\x01a\n\xE3V[`\0\x825`\xDE\x19\x836\x03\x01\x81\x12a\r\xE6W`\0\x80\xFD[\x91\x90\x91\x01\x92\x91PPV[`\0[\x83\x81\x10\x15a\x0E\x0BW\x81\x81\x01Q\x83\x82\x01R` \x01a\r\xF3V[PP`\0\x91\x01RV[`\0` \x82\x84\x03\x12\x15a\x0E&W`\0\x80\xFD[\x81Q`\x01`\x01`@\x1B\x03\x81\x11\x15a\x0E\xE2Q\x1D\x9F\xBAdsolcC\0\x08\x11\x003"; /// The bytecode of the contract. pub static HOSTMANAGER_BYTECODE: ::ethers::core::types::Bytes = ::ethers::core::types::Bytes::from_static(__BYTECODE); #[rustfmt::skip] - const __DEPLOYED_BYTECODE: &[u8] = b"`\x80`@R4\x80\x15a\0\x10W`\0\x80\xFD[P`\x046\x10a\0\x88W`\x005`\xE0\x1C\x80c\xB5\xA9\x82K\x11a\0[W\x80c\xB5\xA9\x82K\x14a\0\xD6W\x80c\xBC\r\xD4G\x14a\0\xE9W\x80c\xC4\x92\xE4&\x14a\0\xFCW\x80c\xCF\xF0\xAB\x96\x14a\x01\nW`\0\x80\xFD[\x80c\x0B\xC3{\xAB\x14a\0\x8DW\x80c\x0E\x83$\xA2\x14a\0\xA2W\x80c\x0F\xEE2\xCE\x14a\0\xB5W\x80c\xB2\xA0\x1B\xF5\x14a\0\xC8W[`\0\x80\xFD[a\0\xA0a\0\x9B6`\x04a\t\nV[a\x01]V[\0[a\0\xA0a\0\xB06`\x04a\t]V[a\x01\xB9V[a\0\xA0a\0\xC36`\x04a\t\x7FV[a\x02`@Q\x81c\xFF\xFF\xFF\xFF\x16`\xE0\x1B\x81R`\x04\x01`\0`@Q\x80\x83\x03\x81\x86Z\xFA\x15\x80\x15a\x02\xFBW=`\0\x80>=`\0\xFD[PPPP`@Q=`\0\x82>`\x1F=\x90\x81\x01`\x1F\x19\x16\x82\x01`@Ra\x03#\x91\x90\x81\x01\x90a\x0E\x14V[a\x03-\x83\x80a\x0E\x8AV[\x80\x80`\x1F\x01` \x80\x91\x04\x02` \x01`@Q\x90\x81\x01`@R\x80\x93\x92\x91\x90\x81\x81R` \x01\x83\x83\x80\x82\x847`\0\x92\x01\x91\x90\x91RP\x92\x93\x92PPa\x05\xF8\x90PV[a\x03\xADW`@QbF\x1B\xCD`\xE5\x1B\x81R` `\x04\x82\x01R`\x14`$\x82\x01Rs\x15[\x98]]\x1A\x1B\xDC\x9A^\x99Y\x08\x1C\x99\\]Y\\\xDD`b\x1B`D\x82\x01R`d\x01a\x01\xB0V[`\0a\x03\xBC`\xC0\x83\x01\x83a\x0E\x8AV[`\0\x81\x81\x10a\x03\xCDWa\x03\xCDa\x0E\xD7V[\x91\x90\x91\x015`\xF8\x1C\x90P`\x01\x81\x11\x15a\x03\xE8Wa\x03\xE8a\x0E\xEDV[\x90P`\0\x81`\x01\x81\x11\x15a\x03\xFEWa\x03\xFEa\x0E\xEDV[\x03a\x04\xA1W`\0a\x04\x12`\xC0\x84\x01\x84a\x0E\x8AV[a\x04 \x91`\x01\x90\x82\x90a\x0F\x03V[\x81\x01\x90a\x04-\x91\x90a\x0F-V[`\x01T`@Qc=`\0\xFD[PPPPPPPPV[`\x01\x81`\x01\x81\x11\x15a\x04\xB5Wa\x04\xB5a\x0E\xEDV[\x03a\x05\x15W`\0a\x04\xC9`\xC0\x84\x01\x84a\x0E\x8AV[a\x04\xD7\x91`\x01\x90\x82\x90a\x0F\x03V[\x81\x01\x90a\x04\xE4\x91\x90a\x10@V[`\x01T`@Qc{H\x1F\xE1`\xE1\x1B\x81R\x91\x92P`\x01`\x01`\xA0\x1B\x03\x16\x90c\xF6\x90?\xC2\x90a\x04i\x90\x84\x90`\x04\x01a\x12MV[`@QbF\x1B\xCD`\xE5\x1B\x81R` `\x04\x82\x01R`\x0E`$\x82\x01Rm*\xB75\xB77\xBB\xB7\x100\xB1\xBA4\xB7\xB7`\x91\x1B`D\x82\x01R`d\x01a\x01\xB0V[`@QbF\x1B\xCD`\xE5\x1B\x81R` `\x04\x82\x01R`$\x80\x82\x01R\x7FIsmpModule doesn't emit Get requ`D\x82\x01Rcests`\xE0\x1B`d\x82\x01R`\x84\x01a\x01\xB0V[`@QbF\x1B\xCD`\xE5\x1B\x81R` `\x04\x82\x01R`%`$\x82\x01R\x7FIsmpModule doesn't emit Post req`D\x82\x01Rduests`\xD8\x1B`d\x82\x01R`\x84\x01a\x01\xB0V[`\0\x81Q\x83Q\x14a\x06\x0BWP`\0a\x06\x1FV[P\x81Q` \x82\x81\x01\x82\x90 \x90\x84\x01\x91\x90\x91 \x14[\x92\x91PPV[cNH{q`\xE0\x1B`\0R`A`\x04R`$`\0\xFD[`@Q`\xE0\x81\x01`\x01`\x01`@\x1B\x03\x81\x11\x82\x82\x10\x17\x15a\x06]Wa\x06]a\x06%V[`@R\x90V[`@\x80Q\x90\x81\x01`\x01`\x01`@\x1B\x03\x81\x11\x82\x82\x10\x17\x15a\x06]Wa\x06]a\x06%V[`@Qa\x01\xC0\x81\x01`\x01`\x01`@\x1B\x03\x81\x11\x82\x82\x10\x17\x15a\x06]Wa\x06]a\x06%V[`@Q`\x1F\x82\x01`\x1F\x19\x16\x81\x01`\x01`\x01`@\x1B\x03\x81\x11\x82\x82\x10\x17\x15a\x06\xD0Wa\x06\xD0a\x06%V[`@R\x91\x90PV[`\0`\x01`\x01`@\x1B\x03\x82\x11\x15a\x06\xF1Wa\x06\xF1a\x06%V[P`\x1F\x01`\x1F\x19\x16` \x01\x90V[`\0\x82`\x1F\x83\x01\x12a\x07\x10W`\0\x80\xFD[\x815a\x07#a\x07\x1E\x82a\x06\xD8V[a\x06\xA8V[\x81\x81R\x84` \x83\x86\x01\x01\x11\x15a\x078W`\0\x80\xFD[\x81` \x85\x01` \x83\x017`\0\x91\x81\x01` \x01\x91\x90\x91R\x93\x92PPPV[\x805`\x01`\x01`@\x1B\x03\x81\x16\x81\x14a\x07lW`\0\x80\xFD[\x91\x90PV[`\0`\xE0\x82\x84\x03\x12\x15a\x07\x83W`\0\x80\xFD[a\x07\x8Ba\x06;V[\x90P\x815`\x01`\x01`@\x1B\x03\x80\x82\x11\x15a\x07\xA4W`\0\x80\xFD[a\x07\xB0\x85\x83\x86\x01a\x06\xFFV[\x83R` \x84\x015\x91P\x80\x82\x11\x15a\x07\xC6W`\0\x80\xFD[a\x07\xD2\x85\x83\x86\x01a\x06\xFFV[` \x84\x01Ra\x07\xE3`@\x85\x01a\x07UV[`@\x84\x01R``\x84\x015\x91P\x80\x82\x11\x15a\x07\xFCW`\0\x80\xFD[a\x08\x08\x85\x83\x86\x01a\x06\xFFV[``\x84\x01R`\x80\x84\x015\x91P\x80\x82\x11\x15a\x08!W`\0\x80\xFD[a\x08-\x85\x83\x86\x01a\x06\xFFV[`\x80\x84\x01Ra\x08>`\xA0\x85\x01a\x07UV[`\xA0\x84\x01R`\xC0\x84\x015\x91P\x80\x82\x11\x15a\x08WW`\0\x80\xFD[Pa\x08d\x84\x82\x85\x01a\x06\xFFV[`\xC0\x83\x01RP\x92\x91PPV[`\0``\x82\x84\x03\x12\x15a\x08\x82W`\0\x80\xFD[`@Q``\x81\x01`\x01`\x01`@\x1B\x03\x82\x82\x10\x81\x83\x11\x17\x15a\x08\xA5Wa\x08\xA5a\x06%V[\x81`@R\x82\x93P\x845\x91P\x80\x82\x11\x15a\x08\xBDW`\0\x80\xFD[a\x08\xC9\x86\x83\x87\x01a\x07qV[\x83R` \x85\x015\x91P\x80\x82\x11\x15a\x08\xDFW`\0\x80\xFD[Pa\x08\xEC\x85\x82\x86\x01a\x06\xFFV[` \x83\x01RPa\x08\xFE`@\x84\x01a\x07UV[`@\x82\x01RP\x92\x91PPV[`\0` \x82\x84\x03\x12\x15a\t\x1CW`\0\x80\xFD[\x815`\x01`\x01`@\x1B\x03\x81\x11\x15a\t2W`\0\x80\xFD[a\t>\x84\x82\x85\x01a\x08pV[\x94\x93PPPPV[\x805`\x01`\x01`\xA0\x1B\x03\x81\x16\x81\x14a\x07lW`\0\x80\xFD[`\0` \x82\x84\x03\x12\x15a\toW`\0\x80\xFD[a\tx\x82a\tFV[\x93\x92PPPV[`\0` \x82\x84\x03\x12\x15a\t\x91W`\0\x80\xFD[\x815`\x01`\x01`@\x1B\x03\x81\x11\x15a\t\xA7W`\0\x80\xFD[\x82\x01`@\x81\x85\x03\x12\x15a\txW`\0\x80\xFD[`\0` \x82\x84\x03\x12\x15a\t\xCBW`\0\x80\xFD[\x815`\x01`\x01`@\x1B\x03\x80\x82\x11\x15a\t\xE2W`\0\x80\xFD[\x90\x83\x01\x90`@\x82\x86\x03\x12\x15a\t\xF6W`\0\x80\xFD[a\t\xFEa\x06cV[\x825\x82\x81\x11\x15a\n\rW`\0\x80\xFD[a\n\x19\x87\x82\x86\x01a\x08pV[\x82RPa\n(` \x84\x01a\tFV[` \x82\x01R\x95\x94PPPPPV[`\0`\x01`\x01`@\x1B\x03\x82\x11\x15a\nOWa\nOa\x06%V[P`\x05\x1B` \x01\x90V[`\0\x82`\x1F\x83\x01\x12a\njW`\0\x80\xFD[\x815` a\nza\x07\x1E\x83a\n6V[\x82\x81R`\x05\x92\x90\x92\x1B\x84\x01\x81\x01\x91\x81\x81\x01\x90\x86\x84\x11\x15a\n\x99W`\0\x80\xFD[\x82\x86\x01[\x84\x81\x10\x15a\n\xD8W\x805`\x01`\x01`@\x1B\x03\x81\x11\x15a\n\xBCW`\0\x80\x81\xFD[a\n\xCA\x89\x86\x83\x8B\x01\x01a\x06\xFFV[\x84RP\x91\x83\x01\x91\x83\x01a\n\x9DV[P\x96\x95PPPPPPV[`\0`\xE0\x82\x84\x03\x12\x15a\n\xF5W`\0\x80\xFD[a\n\xFDa\x06;V[\x90P\x815`\x01`\x01`@\x1B\x03\x80\x82\x11\x15a\x0B\x16W`\0\x80\xFD[a\x0B\"\x85\x83\x86\x01a\x06\xFFV[\x83R` \x84\x015\x91P\x80\x82\x11\x15a\x0B8W`\0\x80\xFD[a\x0BD\x85\x83\x86\x01a\x06\xFFV[` \x84\x01Ra\x0BU`@\x85\x01a\x07UV[`@\x84\x01R``\x84\x015\x91P\x80\x82\x11\x15a\x0BnW`\0\x80\xFD[a\x0Bz\x85\x83\x86\x01a\x06\xFFV[``\x84\x01Ra\x0B\x8B`\x80\x85\x01a\x07UV[`\x80\x84\x01R`\xA0\x84\x015\x91P\x80\x82\x11\x15a\x0B\xA4W`\0\x80\xFD[Pa\x0B\xB1\x84\x82\x85\x01a\nYV[`\xA0\x83\x01RPa\x0B\xC3`\xC0\x83\x01a\x07UV[`\xC0\x82\x01R\x92\x91PPV[`\0` \x82\x84\x03\x12\x15a\x0B\xE0W`\0\x80\xFD[`\x01`\x01`@\x1B\x03\x80\x835\x11\x15a\x0B\xF6W`\0\x80\xFD[\x825\x83\x01`@\x81\x86\x03\x12\x15a\x0C\nW`\0\x80\xFD[a\x0C\x12a\x06cV[\x82\x825\x11\x15a\x0C W`\0\x80\xFD[\x815\x82\x01`@\x81\x88\x03\x12\x15a\x0C4W`\0\x80\xFD[a\x0C\x84\x82\x85\x01a\x07qV[`\0` \x82\x84\x03\x12\x15a\r\xAEW`\0\x80\xFD[\x815`\x01`\x01`@\x1B\x03\x81\x11\x15a\r\xC4W`\0\x80\xFD[a\t>\x84\x82\x85\x01a\n\xE3V[`\0\x825`\xDE\x19\x836\x03\x01\x81\x12a\r\xE6W`\0\x80\xFD[\x91\x90\x91\x01\x92\x91PPV[`\0[\x83\x81\x10\x15a\x0E\x0BW\x81\x81\x01Q\x83\x82\x01R` \x01a\r\xF3V[PP`\0\x91\x01RV[`\0` \x82\x84\x03\x12\x15a\x0E&W`\0\x80\xFD[\x81Q`\x01`\x01`@\x1B\x03\x81\x11\x15a\x0E\xFBh\x0C\x9FZ\x0C\xBD\xC4\x11dsolcC\0\x08\x11\x003"; + const __DEPLOYED_BYTECODE: &[u8] = b"`\x80`@R4\x80\x15a\0\x10W`\0\x80\xFD[P`\x046\x10a\0\x88W`\x005`\xE0\x1C\x80c\xB5\xA9\x82K\x11a\0[W\x80c\xB5\xA9\x82K\x14a\0\xD6W\x80c\xBC\r\xD4G\x14a\0\xE9W\x80c\xC4\x92\xE4&\x14a\0\xFCW\x80c\xCF\xF0\xAB\x96\x14a\x01\nW`\0\x80\xFD[\x80c\x0B\xC3{\xAB\x14a\0\x8DW\x80c\x0E\x83$\xA2\x14a\0\xA2W\x80c\x0F\xEE2\xCE\x14a\0\xB5W\x80c\xB2\xA0\x1B\xF5\x14a\0\xC8W[`\0\x80\xFD[a\0\xA0a\0\x9B6`\x04a\t\nV[a\x01]V[\0[a\0\xA0a\0\xB06`\x04a\t]V[a\x01\xB9V[a\0\xA0a\0\xC36`\x04a\t\x7FV[a\x02`@Q\x81c\xFF\xFF\xFF\xFF\x16`\xE0\x1B\x81R`\x04\x01`\0`@Q\x80\x83\x03\x81\x86Z\xFA\x15\x80\x15a\x02\xFBW=`\0\x80>=`\0\xFD[PPPP`@Q=`\0\x82>`\x1F=\x90\x81\x01`\x1F\x19\x16\x82\x01`@Ra\x03#\x91\x90\x81\x01\x90a\x0E\x14V[a\x03-\x83\x80a\x0E\x8AV[\x80\x80`\x1F\x01` \x80\x91\x04\x02` \x01`@Q\x90\x81\x01`@R\x80\x93\x92\x91\x90\x81\x81R` \x01\x83\x83\x80\x82\x847`\0\x92\x01\x91\x90\x91RP\x92\x93\x92PPa\x05\xF8\x90PV[a\x03\xADW`@QbF\x1B\xCD`\xE5\x1B\x81R` `\x04\x82\x01R`\x14`$\x82\x01Rs\x15[\x98]]\x1A\x1B\xDC\x9A^\x99Y\x08\x1C\x99\\]Y\\\xDD`b\x1B`D\x82\x01R`d\x01a\x01\xB0V[`\0a\x03\xBC`\xC0\x83\x01\x83a\x0E\x8AV[`\0\x81\x81\x10a\x03\xCDWa\x03\xCDa\x0E\xD7V[\x91\x90\x91\x015`\xF8\x1C\x90P`\x01\x81\x11\x15a\x03\xE8Wa\x03\xE8a\x0E\xEDV[\x90P`\0\x81`\x01\x81\x11\x15a\x03\xFEWa\x03\xFEa\x0E\xEDV[\x03a\x04\xA1W`\0a\x04\x12`\xC0\x84\x01\x84a\x0E\x8AV[a\x04 \x91`\x01\x90\x82\x90a\x0F\x03V[\x81\x01\x90a\x04-\x91\x90a\x0F-V[`\x01T`@Qc=`\0\xFD[PPPPPPPPV[`\x01\x81`\x01\x81\x11\x15a\x04\xB5Wa\x04\xB5a\x0E\xEDV[\x03a\x05\x15W`\0a\x04\xC9`\xC0\x84\x01\x84a\x0E\x8AV[a\x04\xD7\x91`\x01\x90\x82\x90a\x0F\x03V[\x81\x01\x90a\x04\xE4\x91\x90a\x10@V[`\x01T`@Qc{H\x1F\xE1`\xE1\x1B\x81R\x91\x92P`\x01`\x01`\xA0\x1B\x03\x16\x90c\xF6\x90?\xC2\x90a\x04i\x90\x84\x90`\x04\x01a\x12MV[`@QbF\x1B\xCD`\xE5\x1B\x81R` `\x04\x82\x01R`\x0E`$\x82\x01Rm*\xB75\xB77\xBB\xB7\x100\xB1\xBA4\xB7\xB7`\x91\x1B`D\x82\x01R`d\x01a\x01\xB0V[`@QbF\x1B\xCD`\xE5\x1B\x81R` `\x04\x82\x01R`$\x80\x82\x01R\x7FIsmpModule doesn't emit Get requ`D\x82\x01Rcests`\xE0\x1B`d\x82\x01R`\x84\x01a\x01\xB0V[`@QbF\x1B\xCD`\xE5\x1B\x81R` `\x04\x82\x01R`%`$\x82\x01R\x7FIsmpModule doesn't emit Post req`D\x82\x01Rduests`\xD8\x1B`d\x82\x01R`\x84\x01a\x01\xB0V[`\0\x81Q\x83Q\x14a\x06\x0BWP`\0a\x06\x1FV[P\x81Q` \x82\x81\x01\x82\x90 \x90\x84\x01\x91\x90\x91 \x14[\x92\x91PPV[cNH{q`\xE0\x1B`\0R`A`\x04R`$`\0\xFD[`@Q`\xE0\x81\x01`\x01`\x01`@\x1B\x03\x81\x11\x82\x82\x10\x17\x15a\x06]Wa\x06]a\x06%V[`@R\x90V[`@\x80Q\x90\x81\x01`\x01`\x01`@\x1B\x03\x81\x11\x82\x82\x10\x17\x15a\x06]Wa\x06]a\x06%V[`@Qa\x01\xC0\x81\x01`\x01`\x01`@\x1B\x03\x81\x11\x82\x82\x10\x17\x15a\x06]Wa\x06]a\x06%V[`@Q`\x1F\x82\x01`\x1F\x19\x16\x81\x01`\x01`\x01`@\x1B\x03\x81\x11\x82\x82\x10\x17\x15a\x06\xD0Wa\x06\xD0a\x06%V[`@R\x91\x90PV[`\0`\x01`\x01`@\x1B\x03\x82\x11\x15a\x06\xF1Wa\x06\xF1a\x06%V[P`\x1F\x01`\x1F\x19\x16` \x01\x90V[`\0\x82`\x1F\x83\x01\x12a\x07\x10W`\0\x80\xFD[\x815a\x07#a\x07\x1E\x82a\x06\xD8V[a\x06\xA8V[\x81\x81R\x84` \x83\x86\x01\x01\x11\x15a\x078W`\0\x80\xFD[\x81` \x85\x01` \x83\x017`\0\x91\x81\x01` \x01\x91\x90\x91R\x93\x92PPPV[\x805`\x01`\x01`@\x1B\x03\x81\x16\x81\x14a\x07lW`\0\x80\xFD[\x91\x90PV[`\0`\xE0\x82\x84\x03\x12\x15a\x07\x83W`\0\x80\xFD[a\x07\x8Ba\x06;V[\x90P\x815`\x01`\x01`@\x1B\x03\x80\x82\x11\x15a\x07\xA4W`\0\x80\xFD[a\x07\xB0\x85\x83\x86\x01a\x06\xFFV[\x83R` \x84\x015\x91P\x80\x82\x11\x15a\x07\xC6W`\0\x80\xFD[a\x07\xD2\x85\x83\x86\x01a\x06\xFFV[` \x84\x01Ra\x07\xE3`@\x85\x01a\x07UV[`@\x84\x01R``\x84\x015\x91P\x80\x82\x11\x15a\x07\xFCW`\0\x80\xFD[a\x08\x08\x85\x83\x86\x01a\x06\xFFV[``\x84\x01R`\x80\x84\x015\x91P\x80\x82\x11\x15a\x08!W`\0\x80\xFD[a\x08-\x85\x83\x86\x01a\x06\xFFV[`\x80\x84\x01Ra\x08>`\xA0\x85\x01a\x07UV[`\xA0\x84\x01R`\xC0\x84\x015\x91P\x80\x82\x11\x15a\x08WW`\0\x80\xFD[Pa\x08d\x84\x82\x85\x01a\x06\xFFV[`\xC0\x83\x01RP\x92\x91PPV[`\0``\x82\x84\x03\x12\x15a\x08\x82W`\0\x80\xFD[`@Q``\x81\x01`\x01`\x01`@\x1B\x03\x82\x82\x10\x81\x83\x11\x17\x15a\x08\xA5Wa\x08\xA5a\x06%V[\x81`@R\x82\x93P\x845\x91P\x80\x82\x11\x15a\x08\xBDW`\0\x80\xFD[a\x08\xC9\x86\x83\x87\x01a\x07qV[\x83R` \x85\x015\x91P\x80\x82\x11\x15a\x08\xDFW`\0\x80\xFD[Pa\x08\xEC\x85\x82\x86\x01a\x06\xFFV[` \x83\x01RPa\x08\xFE`@\x84\x01a\x07UV[`@\x82\x01RP\x92\x91PPV[`\0` \x82\x84\x03\x12\x15a\t\x1CW`\0\x80\xFD[\x815`\x01`\x01`@\x1B\x03\x81\x11\x15a\t2W`\0\x80\xFD[a\t>\x84\x82\x85\x01a\x08pV[\x94\x93PPPPV[\x805`\x01`\x01`\xA0\x1B\x03\x81\x16\x81\x14a\x07lW`\0\x80\xFD[`\0` \x82\x84\x03\x12\x15a\toW`\0\x80\xFD[a\tx\x82a\tFV[\x93\x92PPPV[`\0` \x82\x84\x03\x12\x15a\t\x91W`\0\x80\xFD[\x815`\x01`\x01`@\x1B\x03\x81\x11\x15a\t\xA7W`\0\x80\xFD[\x82\x01`@\x81\x85\x03\x12\x15a\txW`\0\x80\xFD[`\0` \x82\x84\x03\x12\x15a\t\xCBW`\0\x80\xFD[\x815`\x01`\x01`@\x1B\x03\x80\x82\x11\x15a\t\xE2W`\0\x80\xFD[\x90\x83\x01\x90`@\x82\x86\x03\x12\x15a\t\xF6W`\0\x80\xFD[a\t\xFEa\x06cV[\x825\x82\x81\x11\x15a\n\rW`\0\x80\xFD[a\n\x19\x87\x82\x86\x01a\x08pV[\x82RPa\n(` \x84\x01a\tFV[` \x82\x01R\x95\x94PPPPPV[`\0`\x01`\x01`@\x1B\x03\x82\x11\x15a\nOWa\nOa\x06%V[P`\x05\x1B` \x01\x90V[`\0\x82`\x1F\x83\x01\x12a\njW`\0\x80\xFD[\x815` a\nza\x07\x1E\x83a\n6V[\x82\x81R`\x05\x92\x90\x92\x1B\x84\x01\x81\x01\x91\x81\x81\x01\x90\x86\x84\x11\x15a\n\x99W`\0\x80\xFD[\x82\x86\x01[\x84\x81\x10\x15a\n\xD8W\x805`\x01`\x01`@\x1B\x03\x81\x11\x15a\n\xBCW`\0\x80\x81\xFD[a\n\xCA\x89\x86\x83\x8B\x01\x01a\x06\xFFV[\x84RP\x91\x83\x01\x91\x83\x01a\n\x9DV[P\x96\x95PPPPPPV[`\0`\xE0\x82\x84\x03\x12\x15a\n\xF5W`\0\x80\xFD[a\n\xFDa\x06;V[\x90P\x815`\x01`\x01`@\x1B\x03\x80\x82\x11\x15a\x0B\x16W`\0\x80\xFD[a\x0B\"\x85\x83\x86\x01a\x06\xFFV[\x83R` \x84\x015\x91P\x80\x82\x11\x15a\x0B8W`\0\x80\xFD[a\x0BD\x85\x83\x86\x01a\x06\xFFV[` \x84\x01Ra\x0BU`@\x85\x01a\x07UV[`@\x84\x01R``\x84\x015\x91P\x80\x82\x11\x15a\x0BnW`\0\x80\xFD[a\x0Bz\x85\x83\x86\x01a\x06\xFFV[``\x84\x01Ra\x0B\x8B`\x80\x85\x01a\x07UV[`\x80\x84\x01R`\xA0\x84\x015\x91P\x80\x82\x11\x15a\x0B\xA4W`\0\x80\xFD[Pa\x0B\xB1\x84\x82\x85\x01a\nYV[`\xA0\x83\x01RPa\x0B\xC3`\xC0\x83\x01a\x07UV[`\xC0\x82\x01R\x92\x91PPV[`\0` \x82\x84\x03\x12\x15a\x0B\xE0W`\0\x80\xFD[`\x01`\x01`@\x1B\x03\x80\x835\x11\x15a\x0B\xF6W`\0\x80\xFD[\x825\x83\x01`@\x81\x86\x03\x12\x15a\x0C\nW`\0\x80\xFD[a\x0C\x12a\x06cV[\x82\x825\x11\x15a\x0C W`\0\x80\xFD[\x815\x82\x01`@\x81\x88\x03\x12\x15a\x0C4W`\0\x80\xFD[a\x0C\x84\x82\x85\x01a\x07qV[`\0` \x82\x84\x03\x12\x15a\r\xAEW`\0\x80\xFD[\x815`\x01`\x01`@\x1B\x03\x81\x11\x15a\r\xC4W`\0\x80\xFD[a\t>\x84\x82\x85\x01a\n\xE3V[`\0\x825`\xDE\x19\x836\x03\x01\x81\x12a\r\xE6W`\0\x80\xFD[\x91\x90\x91\x01\x92\x91PPV[`\0[\x83\x81\x10\x15a\x0E\x0BW\x81\x81\x01Q\x83\x82\x01R` \x01a\r\xF3V[PP`\0\x91\x01RV[`\0` \x82\x84\x03\x12\x15a\x0E&W`\0\x80\xFD[\x81Q`\x01`\x01`@\x1B\x03\x81\x11\x15a\x0E\xE2Q\x1D\x9F\xBAdsolcC\0\x08\x11\x003"; /// The deployed bytecode of the contract. pub static HOSTMANAGER_DEPLOYED_BYTECODE: ::ethers::core::types::Bytes = ::ethers::core::types::Bytes::from_static(__DEPLOYED_BYTECODE); diff --git a/evm/src/hosts/EvmHost.sol b/evm/src/hosts/EvmHost.sol index a74c97a50..a07e64425 100644 --- a/evm/src/hosts/EvmHost.sol +++ b/evm/src/hosts/EvmHost.sol @@ -140,20 +140,23 @@ abstract contract EvmHost is IIsmpHost, IHostManager, Context { // Emitted when an incoming POST request is handled event PostRequestHandled(bytes32 commitment, address relayer); - // Emitted when an outgoing POST request timeout is handled - event PostRequestTimeoutHandled(bytes32 commitment); + // Emitted when an outgoing POST request timeout is handled, `dest` refers + // to the destination for the request + event PostRequestTimeoutHandled(bytes32 commitment, bytes dest); // Emitted when an incoming POST response is handled event PostResponseHandled(bytes32 commitment, address relayer); - // Emitted when an outgoing POST timeout response is handled - event PostResponseTimeoutHandled(bytes32 commitment); + // Emitted when an outgoing POST response timeout is handled, `dest` refers + // to the destination for the response + event PostResponseTimeoutHandled(bytes32 commitment, bytes dest); // Emitted when an outgoing GET request is handled event GetRequestHandled(bytes32 commitment, address relayer); - // Emitted when an outgoing GET request timeout is handled - event GetRequestTimeoutHandled(bytes32 commitment); + // Emitted when an outgoing GET request timeout is handled, `dest` refers + // to the destination for the request + event GetRequestTimeoutHandled(bytes32 commitment, bytes dest); // Emitted when new heights are finalized event StateMachineUpdated(bytes stateMachineId, uint256 height); @@ -624,7 +627,7 @@ abstract contract EvmHost is IIsmpHost, IHostManager, Context { // refund relayer fee IERC20(feeToken()).transfer(meta.sender, meta.fee); } - emit GetRequestTimeoutHandled({commitment: commitment}); + emit GetRequestTimeoutHandled({commitment: commitment, dest: request.dest}); } /** @@ -652,7 +655,7 @@ abstract contract EvmHost is IIsmpHost, IHostManager, Context { // refund relayer fee IERC20(feeToken()).transfer(meta.sender, meta.fee); } - emit PostRequestTimeoutHandled({commitment: commitment}); + emit PostRequestTimeoutHandled({commitment: commitment, dest: request.dest}); } /** @@ -683,7 +686,7 @@ abstract contract EvmHost is IIsmpHost, IHostManager, Context { // refund relayer fee IERC20(feeToken()).transfer(meta.sender, meta.fee); } - emit PostResponseTimeoutHandled({commitment: commitment}); + emit PostResponseTimeoutHandled({commitment: commitment, dest: response.request.source}); } /** diff --git a/evm/src/modules/TokenGateway.sol b/evm/src/modules/TokenGateway.sol index f368d90f7..58aa87c03 100644 --- a/evm/src/modules/TokenGateway.sol +++ b/evm/src/modules/TokenGateway.sol @@ -101,9 +101,8 @@ struct AssetFees { uint256 protocolFeePercentage; } -enum OnAcceptActions -// Incoming asset from a chain -{ +enum OnAcceptActions { + // Incoming asset from a chain IncomingAsset, // Governance action to update protocol parameters GovernanceAction diff --git a/modules/hyperclient/tests/streams.rs b/modules/hyperclient/tests/streams.rs index 8bd3f8763..f1b9e9323 100644 --- a/modules/hyperclient/tests/streams.rs +++ b/modules/hyperclient/tests/streams.rs @@ -17,6 +17,7 @@ async fn subscribe_to_request_status() -> Result<(), anyhow::Error> { } #[wasm_bindgen_test] +#[ignore] async fn test_timeout_request() -> Result<(), anyhow::Error> { init_tracing(); diff --git a/modules/ismp/core/src/events.rs b/modules/ismp/core/src/events.rs index ae20bac7d..6586af440 100644 --- a/modules/ismp/core/src/events.rs +++ b/modules/ismp/core/src/events.rs @@ -62,6 +62,10 @@ pub struct RequestResponseHandled { pub struct TimeoutHandled { /// The commitment to the request or response pub commitment: H256, + /// The source chain of the message + pub source: StateMachine, + /// The destination chain of the message + pub dest: StateMachine, } /// This represents events that should be emitted by ismp-rs wrappers diff --git a/modules/ismp/core/src/handlers/timeout.rs b/modules/ismp/core/src/handlers/timeout.rs index 068cdbead..327c9b2a0 100644 --- a/modules/ismp/core/src/handlers/timeout.rs +++ b/modules/ismp/core/src/handlers/timeout.rs @@ -90,7 +90,11 @@ where } let res = cb.on_timeout(request.clone().into()).map(|_| { let commitment = hash_request::(&request); - Event::PostRequestTimeoutHandled(TimeoutHandled { commitment }) + Event::PostRequestTimeoutHandled(TimeoutHandled { + commitment, + source: request.source_chain(), + dest: request.dest_chain(), + }) }); // If module callback failed restore commitment so it can be retried if res.is_err() { @@ -156,7 +160,11 @@ where } let res = cb.on_timeout(response.clone().into()).map(|_| { let commitment = hash_post_response::(&response); - Event::PostResponseTimeoutHandled(TimeoutHandled { commitment }) + Event::PostResponseTimeoutHandled(TimeoutHandled { + commitment, + source: response.source_chain(), + dest: response.dest_chain(), + }) }); // If module callback failed restore commitment so it can be retried if res.is_err() { @@ -200,7 +208,11 @@ where let meta = host.delete_request_commitment(&request)?; let res = cb.on_timeout(request.clone().into()).map(|_| { let commitment = hash_request::(&request); - Event::GetRequestTimeoutHandled(TimeoutHandled { commitment }) + Event::GetRequestTimeoutHandled(TimeoutHandled { + commitment, + source: request.source_chain(), + dest: request.dest_chain(), + }) }); // If module callback failed, restore commitment so it can be retried if res.is_err() { diff --git a/modules/ismp/pallets/pallet/src/events.rs b/modules/ismp/pallets/pallet/src/events.rs index d54a979b4..292fbe981 100644 --- a/modules/ismp/pallets/pallet/src/events.rs +++ b/modules/ismp/pallets/pallet/src/events.rs @@ -13,90 +13,66 @@ // See the License for the specific language governing permissions and // limitations under the License. -//! Pallet event definitions +//! Pallet event conversions to the core ISMP event -use crate::{errors::HandlingError, Config, Event as PalletEvent, Pallet}; -use alloc::vec::Vec; +use crate::{Config, Event as PalletEvent, Pallet}; use frame_support::BoundedVec; use ismp::{ - consensus::StateMachineId, - error::Error, - events::{RequestResponseHandled, TimeoutHandled}, - host::StateMachine, + events::{StateCommitmentVetoed, StateMachineUpdated}, + router::{Request, Response}, }; -use sp_core::H256; -/// Ismp Handler Events -#[derive(Clone, codec::Encode, codec::Decode, Debug, scale_info::TypeInfo)] -#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))] -pub enum Event { - /// Emitted when a state machine is successfully updated to a new height - StateMachineUpdated { - /// State machine id - state_machine_id: StateMachineId, - /// Latest height - latest_height: u64, - }, - /// Emitted for an outgoing response - Response { - /// Chain that this response will be routed to - dest_chain: StateMachine, - /// Source Chain for this response - source_chain: StateMachine, - /// Nonce for the request which this response is for - request_nonce: u64, - /// Commitment - commitment: H256, - }, - /// Emitted for an outgoing request - Request { - /// Chain that this request will be routed to - dest_chain: StateMachine, - /// Source Chain for request - source_chain: StateMachine, - /// Request nonce - request_nonce: u64, - /// Commitment - commitment: H256, - }, - /// Post Request Handled - PostRequestHandled(RequestResponseHandled), - /// Post Response Handled - PostResponseHandled(RequestResponseHandled), - /// Get Response Handled - GetRequestHandled(RequestResponseHandled), - /// Post request timeout handled - PostRequestTimeoutHandled(TimeoutHandled), - /// Post response timeout handled - PostResponseTimeoutHandled(TimeoutHandled), - /// Get request timeout handled - GetRequestTimeoutHandled(TimeoutHandled), -} +impl TryFrom> for ismp::events::Event { + type Error = (); + + fn try_from(event: PalletEvent) -> Result { + match event { + PalletEvent::StateMachineUpdated { state_machine_id, latest_height } => + Ok(ismp::events::Event::StateMachineUpdated(StateMachineUpdated { + state_machine_id, + latest_height, + })), + PalletEvent::Response { commitment, .. } => { + let response = match Pallet::::response(commitment).ok_or_else(|| ())? { + Response::Post(post_reposnse) => post_reposnse, + Response::Get(_) => Err(())?, + }; -/// Convert from pallet event to Ismp event -pub fn to_handler_events(event: PalletEvent) -> Option { - match event { - PalletEvent::StateMachineUpdated { state_machine_id, latest_height } => - Some(Event::StateMachineUpdated { state_machine_id, latest_height }), - PalletEvent::Response { dest_chain, source_chain, request_nonce, commitment } => - Some(Event::Response { dest_chain, source_chain, request_nonce, commitment }), - PalletEvent::Request { dest_chain, source_chain, request_nonce, commitment } => - Some(Event::Request { dest_chain, source_chain, request_nonce, commitment }), - PalletEvent::GetRequestTimeoutHandled(handled) => - Some(Event::GetRequestTimeoutHandled(handled)), - PalletEvent::GetRequestHandled(handled) => Some(Event::GetRequestHandled(handled)), - PalletEvent::PostRequestHandled(handled) => Some(Event::PostRequestHandled(handled)), - PalletEvent::PostResponseHandled(handled) => Some(Event::PostResponseHandled(handled)), - PalletEvent::PostRequestTimeoutHandled(handled) => - Some(Event::PostRequestTimeoutHandled(handled)), - PalletEvent::PostResponseTimeoutHandled(handled) => - Some(Event::PostResponseTimeoutHandled(handled)), - // We are only converting events useful relayers and applications - PalletEvent::ConsensusClientCreated { .. } | - PalletEvent::ConsensusClientFrozen { .. } | - PalletEvent::Errors { .. } | - PalletEvent::__Ignore(_, _) | - PalletEvent::StateCommitmentVetoed { .. } => None, + Ok(ismp::events::Event::PostResponse(response)) + }, + PalletEvent::Request { commitment, .. } => { + let request = Pallet::::request(commitment).ok_or_else(|| ())?; + + let event = match request { + Request::Post(post) => ismp::events::Event::PostRequest(post), + Request::Get(get) => ismp::events::Event::GetRequest(get), + }; + + Ok(event) + }, + PalletEvent::GetRequestTimeoutHandled(handled) => + Ok(ismp::events::Event::GetRequestTimeoutHandled(handled)), + PalletEvent::GetRequestHandled(handled) => + Ok(ismp::events::Event::GetRequestHandled(handled)), + PalletEvent::PostRequestHandled(handled) => + Ok(ismp::events::Event::PostRequestHandled(handled)), + PalletEvent::PostResponseHandled(handled) => + Ok(ismp::events::Event::PostResponseHandled(handled)), + PalletEvent::PostRequestTimeoutHandled(handled) => + Ok(ismp::events::Event::PostRequestTimeoutHandled(handled)), + PalletEvent::PostResponseTimeoutHandled(handled) => + Ok(ismp::events::Event::PostResponseTimeoutHandled(handled)), + PalletEvent::StateCommitmentVetoed { fisherman, height } => + Ok(ismp::events::Event::StateCommitmentVetoed(StateCommitmentVetoed { + fisherman: fisherman.into_inner(), + height, + })), + // We are only converting events useful relayers and applications + PalletEvent::ConsensusClientCreated { .. } | + PalletEvent::ConsensusClientFrozen { .. } | + PalletEvent::Errors { .. } | + PalletEvent::__Ignore(_, _) => Err(()), + } } } @@ -129,52 +105,8 @@ impl From for PalletEvent { ismp::events::Event::PostRequest(_) | ismp::events::Event::PostResponse(_) | ismp::events::Event::GetRequest(_) => { - unimplemented!("Event should not originate from handler") - }, - } - } -} - -/// Deposit some ismp events -/// We only want to deposit Request Handled and time out events at this point -pub fn deposit_ismp_events( - results: Vec>, - errors: &mut Vec, -) { - for result in results { - match result { - Ok(event) => match event { - ismp::events::Event::PostRequestHandled(handled) => - Pallet::::deposit_event(PalletEvent::::PostRequestHandled(handled)), - ismp::events::Event::PostResponseHandled(handled) => - Pallet::::deposit_event(PalletEvent::::PostResponseHandled(handled)), - ismp::events::Event::PostRequestTimeoutHandled(handled) => - Pallet::::deposit_event(PalletEvent::::PostRequestTimeoutHandled(handled)), - ismp::events::Event::PostResponseTimeoutHandled(handled) => - Pallet::::deposit_event(PalletEvent::::PostResponseTimeoutHandled( - handled, - )), - ismp::events::Event::GetRequestHandled(handled) => - Pallet::::deposit_event(PalletEvent::::GetRequestHandled(handled)), - ismp::events::Event::GetRequestTimeoutHandled(handled) => - Pallet::::deposit_event(PalletEvent::::GetRequestTimeoutHandled(handled)), - ismp::events::Event::StateMachineUpdated(ev) => - Pallet::::deposit_event(PalletEvent::::StateMachineUpdated { - state_machine_id: ev.state_machine_id, - latest_height: ev.latest_height, - }), - ismp::events::Event::StateCommitmentVetoed(ev) => - Pallet::::deposit_event(PalletEvent::::StateCommitmentVetoed { - height: ev.height, - fisherman: BoundedVec::truncate_from(ev.fisherman), - }), - // These events are only deposited when messages are dispatched, they should never - // be deposited when a message is handled - ismp::events::Event::PostRequest(_) => {}, - ismp::events::Event::PostResponse(_) => {}, - ismp::events::Event::GetRequest(_) => {}, + unimplemented!("These events should not originate from handler") }, - Err(err) => errors.push(err.into()), } } } diff --git a/modules/ismp/pallets/pallet/src/impls.rs b/modules/ismp/pallets/pallet/src/impls.rs index a5976eb99..f334e4467 100644 --- a/modules/ismp/pallets/pallet/src/impls.rs +++ b/modules/ismp/pallets/pallet/src/impls.rs @@ -18,7 +18,6 @@ use crate::{ child_trie::{RequestCommitments, ResponseCommitments}, dispatcher::{FeeMetadata, RequestMetadata}, - events, mmr::{Leaf, LeafIndexAndPos, Proof, ProofKeys}, weights::get_weight, Config, Error, Event, Pallet, Responded, @@ -212,7 +211,7 @@ impl Pallet { } /// Fetch all ISMP handler events in the block, should only be called from runtime-api. - pub fn block_events() -> Vec + pub fn block_events() -> Vec where ::RuntimeEvent: TryInto>, { @@ -220,14 +219,15 @@ impl Pallet { .filter_map(|e| { let frame_system::EventRecord { event, .. } = *e; - events::to_handler_events::(event.try_into().ok()?) + let pallet_event: Event = event.try_into().ok()?; + pallet_event.try_into().ok() }) .collect() } /// Fetch all ISMP handler events and their extrinsic metadata, should only be called from /// runtime-api. - pub fn block_events_with_metadata() -> Vec<(events::Event, u32)> + pub fn block_events_with_metadata() -> Vec<(ismp::events::Event, u32)> where ::RuntimeEvent: TryInto>, { @@ -235,7 +235,8 @@ impl Pallet { .filter_map(|e| { let frame_system::EventRecord { event, phase, .. } = *e; let Phase::ApplyExtrinsic(index) = phase else { None? }; - let event = events::to_handler_events::(event.try_into().ok()?)?; + let pallet_event: Event = event.try_into().ok()?; + let event = pallet_event.try_into().ok()?; Some((event, index)) }) diff --git a/modules/ismp/pallets/rpc/src/lib.rs b/modules/ismp/pallets/rpc/src/lib.rs index 2cc63eae1..4552de6e1 100644 --- a/modules/ismp/pallets/rpc/src/lib.rs +++ b/modules/ismp/pallets/rpc/src/lib.rs @@ -73,7 +73,7 @@ use anyhow::anyhow; use codec::Encode; use ismp::{ consensus::{ConsensusClientId, StateMachineId}, - events::{Event, StateMachineUpdated}, + events::Event, router::{Request, Response}, }; use pallet_ismp::{ @@ -427,65 +427,9 @@ where api.register_extension(OffchainDbExt::new(self.offchain_db.clone())); let at = header.hash(); - let mut request_commitments = vec![]; - let mut response_commitments = vec![]; - let mut temp: Vec = api - .block_events(at) - .map_err(|e| { - runtime_error_into_rpc_error(format!("failed to read block events {:?}", e)) - })? - .into_iter() - .filter_map(|event| match event { - pallet_ismp::events::Event::Request { commitment, .. } => { - request_commitments.push(commitment); - None - }, - pallet_ismp::events::Event::Response { commitment, .. } => { - response_commitments.push(commitment); - None - }, - pallet_ismp::events::Event::StateMachineUpdated { - state_machine_id, - latest_height, - } => Some(Event::StateMachineUpdated(StateMachineUpdated { - state_machine_id, - latest_height, - })), - pallet_ismp::events::Event::PostRequestHandled(handled) => - Some(Event::PostRequestHandled(handled)), - pallet_ismp::events::Event::PostResponseHandled(handled) => - Some(Event::PostResponseHandled(handled)), - pallet_ismp::events::Event::GetRequestHandled(handled) => - Some(Event::GetRequestHandled(handled)), - pallet_ismp::events::Event::PostRequestTimeoutHandled(handled) => - Some(Event::PostRequestTimeoutHandled(handled)), - pallet_ismp::events::Event::PostResponseTimeoutHandled(handled) => - Some(Event::PostResponseTimeoutHandled(handled)), - pallet_ismp::events::Event::GetRequestTimeoutHandled(handled) => - Some(Event::GetRequestTimeoutHandled(handled)), - }) - .collect(); - - let request_events = api - .requests(at, request_commitments) - .map_err(|_| runtime_error_into_rpc_error("Error fetching requests"))? - .into_iter() - .map(|req| match req { - Request::Post(post) => Event::PostRequest(post), - Request::Get(get) => Event::GetRequest(get), - }); - - let response_events = api - .responses(at, response_commitments) - .map_err(|_| runtime_error_into_rpc_error("Error fetching response"))? - .into_iter() - .filter_map(|res| match res { - Response::Post(post) => Some(Event::PostResponse(post)), - _ => None, - }); - - temp.extend(request_events); - temp.extend(response_events); + let temp: Vec = api.block_events(at).map_err(|e| { + runtime_error_into_rpc_error(format!("failed to read block events {:?}", e)) + })?; events.insert(header.hash().to_string(), temp); header = self @@ -547,87 +491,40 @@ where let mut temp = vec![]; for (event, index) in block_events { - let event = match event { - pallet_ismp::events::Event::Request { commitment, .. } => api - .requests(at, vec![commitment]) - .map_err(|_| runtime_error_into_rpc_error("Error fetching requests"))? - .into_iter() - .map(|req| match req { - Request::Post(post) => Event::PostRequest(post), - Request::Get(get) => Event::GetRequest(get), - }) - .next(), - pallet_ismp::events::Event::Response { commitment, .. } => api - .responses(at, vec![commitment]) - .map_err(|_| runtime_error_into_rpc_error("Error fetching response"))? - .into_iter() - .filter_map(|res| match res { - Response::Post(post) => Some(Event::PostResponse(post)), - _ => None, - }) - .next(), - pallet_ismp::events::Event::StateMachineUpdated { - state_machine_id, - latest_height, - } => Some(Event::StateMachineUpdated(StateMachineUpdated { - state_machine_id, - latest_height, - })), - pallet_ismp::events::Event::PostRequestHandled(handled) => - Some(Event::PostRequestHandled(handled)), - pallet_ismp::events::Event::PostResponseHandled(handled) => - Some(Event::PostResponseHandled(handled)), - pallet_ismp::events::Event::GetRequestHandled(handled) => - Some(Event::GetRequestHandled(handled)), - pallet_ismp::events::Event::PostRequestTimeoutHandled(handled) => - Some(Event::PostRequestTimeoutHandled(handled)), - pallet_ismp::events::Event::PostResponseTimeoutHandled(handled) => - Some(Event::PostResponseTimeoutHandled(handled)), - pallet_ismp::events::Event::GetRequestTimeoutHandled(handled) => - Some(Event::GetRequestTimeoutHandled(handled)), - }; - - if let Some(event) = event { - // get the block extrinsics - let extrinsic = self - .client - .block_body(at) - .map_err(|err| { - runtime_error_into_rpc_error(format!( - "Error fetching extrinsic for block {at:?}: {err:?}" - )) - })? - .ok_or_else(|| { - runtime_error_into_rpc_error(format!( - "No extrinsics found for block {at:?}" - )) - })? - // using swap remove should be fine unless the node is in an inconsistent - // state - .swap_remove(index as usize); - let ext_bytes = serde_json::to_string(&extrinsic).map_err(|err| { + // get the block extrinsics + let extrinsic = self + .client + .block_body(at) + .map_err(|err| { + runtime_error_into_rpc_error(format!( + "Error fetching extrinsic for block {at:?}: {err:?}" + )) + })? + .ok_or_else(|| { runtime_error_into_rpc_error(format!( - "Failed to serialize extrinsic: {err:?}" + "No extrinsics found for block {at:?}" )) + })? + // using swap remove should be fine unless the node is in an inconsistent + // state + .swap_remove(index as usize); + let ext_bytes = serde_json::to_string(&extrinsic).map_err(|err| { + runtime_error_into_rpc_error(format!("Failed to serialize extrinsic: {err:?}")) + })?; + let len = ext_bytes.as_bytes().len() - 1; + let extrinsic = + hex::decode(ext_bytes.as_bytes()[3..len].to_vec()).map_err(|err| { + runtime_error_into_rpc_error(format!("Failed to decode extrinsic: {err:?}")) })?; - let len = ext_bytes.as_bytes().len() - 1; - let extrinsic = - hex::decode(ext_bytes.as_bytes()[3..len].to_vec()).map_err(|err| { - runtime_error_into_rpc_error(format!( - "Failed to decode extrinsic: {err:?}" - )) - })?; - let extrinsic_hash = - ::Hashing::hash(extrinsic.as_slice()); - temp.push(EventWithMetadata { - meta: EventMetadata { - block_hash: at.into(), - transaction_hash: extrinsic_hash.into(), - block_number: u64::from(*header.number()), - }, - event, - }); - } + let extrinsic_hash = ::Hashing::hash(extrinsic.as_slice()); + temp.push(EventWithMetadata { + meta: EventMetadata { + block_hash: at.into(), + transaction_hash: extrinsic_hash.into(), + block_number: u64::from(*header.number()), + }, + event, + }); } events.insert(header.hash().to_string(), temp); diff --git a/modules/ismp/pallets/runtime-api/README.md b/modules/ismp/pallets/runtime-api/README.md index ce8f66671..0f777a1c0 100644 --- a/modules/ismp/pallets/runtime-api/README.md +++ b/modules/ismp/pallets/runtime-api/README.md @@ -6,7 +6,6 @@ This exports the runtime API definitions required by client subsystems like the The required methods are already implemented in [`pallet_ismp::Pallet`](https://docs.rs/pallet-ismp/latest/pallet_ismp/pallet/struct.Pallet.html) - ```rust,ignore sp_api::impl_runtime_apis! { @@ -27,12 +26,12 @@ sp_api::impl_runtime_apis! { } /// Fetch all ISMP events and their extrinsic metadata, should only be called from runtime-api. - fn block_events() -> Vec { + fn block_events() -> Vec { pallet_ismp::Pallet::::block_events() } /// Fetch all ISMP events and their extrinsic metadata - fn block_events_with_metadata() -> Vec<(pallet_ismp::events::Event, u32)> { + fn block_events_with_metadata() -> Vec<(ismp::events::Event, u32)> { pallet_ismp::Pallet::::block_events_with_metadata() } @@ -66,7 +65,6 @@ sp_api::impl_runtime_apis! { ``` - ## License This library is licensed under the Apache 2.0 License, Copyright (c) 2024 Polytope Labs. diff --git a/modules/ismp/pallets/runtime-api/src/lib.rs b/modules/ismp/pallets/runtime-api/src/lib.rs index 83c57d9f4..88890cee8 100644 --- a/modules/ismp/pallets/runtime-api/src/lib.rs +++ b/modules/ismp/pallets/runtime-api/src/lib.rs @@ -42,10 +42,10 @@ sp_api::decl_runtime_apis! { ) -> Result<(Vec, Proof), Error>; /// Fetch all ISMP events - fn block_events() -> Vec; + fn block_events() -> Vec; /// Fetch all ISMP events and their extrinsic metadata - fn block_events_with_metadata() -> Vec<(pallet_ismp::events::Event, u32)>; + fn block_events_with_metadata() -> Vec<(ismp::events::Event, u32)>; /// Return the scale encoded consensus state fn consensus_state(id: ConsensusClientId) -> Option>; diff --git a/parachain/runtimes/gargantua/src/lib.rs b/parachain/runtimes/gargantua/src/lib.rs index e8a99c5f2..38b6945ad 100644 --- a/parachain/runtimes/gargantua/src/lib.rs +++ b/parachain/runtimes/gargantua/src/lib.rs @@ -799,12 +799,12 @@ impl_runtime_apis! { } /// Fetch all ISMP events in the block, should only be called from runtime-api. - fn block_events() -> Vec { + fn block_events() -> Vec<::ismp::events::Event> { Ismp::block_events() } /// Fetch all ISMP events and their extrinsic metadata, should only be called from runtime-api. - fn block_events_with_metadata() -> Vec<(pallet_ismp::events::Event, u32)> { + fn block_events_with_metadata() -> Vec<(::ismp::events::Event, u32)> { Ismp::block_events_with_metadata() } diff --git a/parachain/runtimes/messier/src/lib.rs b/parachain/runtimes/messier/src/lib.rs index 85db4208e..e4e554343 100644 --- a/parachain/runtimes/messier/src/lib.rs +++ b/parachain/runtimes/messier/src/lib.rs @@ -813,12 +813,12 @@ impl_runtime_apis! { } /// Fetch all ISMP events - fn block_events() -> Vec { + fn block_events() -> Vec<::ismp::events::Event> { Ismp::block_events() } /// Fetch all ISMP events and their extrinsic metadata - fn block_events_with_metadata() -> Vec<(pallet_ismp::events::Event, u32)> { + fn block_events_with_metadata() -> Vec<(::ismp::events::Event, u32)> { Ismp::block_events_with_metadata() } diff --git a/parachain/runtimes/nexus/src/lib.rs b/parachain/runtimes/nexus/src/lib.rs index e9db4c352..971799130 100644 --- a/parachain/runtimes/nexus/src/lib.rs +++ b/parachain/runtimes/nexus/src/lib.rs @@ -812,12 +812,12 @@ impl_runtime_apis! { } /// Fetch all ISMP events and their extrinsic metadata - fn block_events_with_metadata() -> Vec<(pallet_ismp::events::Event, u32)> { + fn block_events_with_metadata() -> Vec<(::ismp::events::Event, u32)> { Ismp::block_events_with_metadata() } /// Fetch all ISMP events - fn block_events() -> Vec { + fn block_events() -> Vec<::ismp::events::Event> { Ismp::block_events() }