Skip to content

Commit

Permalink
updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MrishoLukamba committed Jul 30, 2024
1 parent a5a5df4 commit 4892441
Show file tree
Hide file tree
Showing 11 changed files with 535 additions and 390 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions evm/abi/src/generated/erc20.rs

Large diffs are not rendered by default.

15 changes: 5 additions & 10 deletions evm/abi/src/generated/evm_host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2705,8 +2705,7 @@ pub mod evm_host {
///Gets the contract's `GetRequestHandled` event
pub fn get_request_handled_filter(
&self,
) -> ::ethers::contract::builders::Event<::std::sync::Arc<M>, M, GetRequestHandledFilter>
{
) -> ::ethers::contract::builders::Event<::std::sync::Arc<M>, M, GetRequestHandledFilter> {
self.0.event()
}
///Gets the contract's `GetRequestTimeoutHandled` event
Expand All @@ -2728,8 +2727,7 @@ pub mod evm_host {
///Gets the contract's `HostParamsUpdated` event
pub fn host_params_updated_filter(
&self,
) -> ::ethers::contract::builders::Event<::std::sync::Arc<M>, M, HostParamsUpdatedFilter>
{
) -> ::ethers::contract::builders::Event<::std::sync::Arc<M>, M, HostParamsUpdatedFilter> {
self.0.event()
}
///Gets the contract's `HostWithdrawal` event
Expand All @@ -2747,8 +2745,7 @@ pub mod evm_host {
///Gets the contract's `PostRequestHandled` event
pub fn post_request_handled_filter(
&self,
) -> ::ethers::contract::builders::Event<::std::sync::Arc<M>, M, PostRequestHandledFilter>
{
) -> ::ethers::contract::builders::Event<::std::sync::Arc<M>, M, PostRequestHandledFilter> {
self.0.event()
}
///Gets the contract's `PostRequestTimeoutHandled` event
Expand All @@ -2764,15 +2761,13 @@ pub mod evm_host {
///Gets the contract's `PostResponseEvent` event
pub fn post_response_event_filter(
&self,
) -> ::ethers::contract::builders::Event<::std::sync::Arc<M>, M, PostResponseEventFilter>
{
) -> ::ethers::contract::builders::Event<::std::sync::Arc<M>, M, PostResponseEventFilter> {
self.0.event()
}
///Gets the contract's `PostResponseFunded` event
pub fn post_response_funded_filter(
&self,
) -> ::ethers::contract::builders::Event<::std::sync::Arc<M>, M, PostResponseFundedFilter>
{
) -> ::ethers::contract::builders::Event<::std::sync::Arc<M>, M, PostResponseFundedFilter> {
self.0.event()
}
///Gets the contract's `PostResponseHandled` event
Expand Down
8 changes: 4 additions & 4 deletions evm/abi/src/generated/host_manager.rs

Large diffs are not rendered by default.

14 changes: 6 additions & 8 deletions evm/abi/src/generated/ping_module.rs

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions evm/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

"@polytope-labs/erc6160@^0.3.0":
version "0.3.0"
resolved "https://registry.yarnpkg.com/@polytope-labs/erc6160/-/erc6160-0.3.0.tgz#d6718fd55fd9babfbfa414db29401019c2ee2d64"
resolved "https://registry.npmjs.org/@polytope-labs/erc6160/-/erc6160-0.3.0.tgz"
integrity sha512-8eW+xetYveMcDcdNa6L7M/vYxZ6wm1f3rF2No1ltfo7FuAp2qbjzjOYguIXkn041S4sp+SM9HC8BlOoopnr4Iw==
dependencies:
openzeppelin-solidity "^4.8.1"
Expand All @@ -13,7 +13,7 @@

"@polytope-labs/ismp-solidity@^0.3.1":
version "0.3.1"
resolved "https://registry.yarnpkg.com/@polytope-labs/ismp-solidity/-/ismp-solidity-0.3.1.tgz#80dd652eaacfb9c1764adc21dc31312c297ecd65"
resolved "https://registry.npmjs.org/@polytope-labs/ismp-solidity/-/ismp-solidity-0.3.1.tgz"
integrity sha512-/ZWT6W/egfHfUdQ22kjLlOHsIsMJAWDBp0x2Zru9fdWZ2DKdw7qHRcqZSHECo6JPvF40YA31wvdXbiU6KRAUzQ==
dependencies:
"@polytope-labs/solidity-merkle-trees" "^0.2.3"
Expand All @@ -23,59 +23,59 @@

"@polytope-labs/solidity-merkle-trees@^0.2.3":
version "0.2.3"
resolved "https://registry.yarnpkg.com/@polytope-labs/solidity-merkle-trees/-/solidity-merkle-trees-0.2.3.tgz#d8346c14190cf41574c20a34b333e26465932622"
resolved "https://registry.npmjs.org/@polytope-labs/solidity-merkle-trees/-/solidity-merkle-trees-0.2.3.tgz"
integrity sha512-aUcUjVNX0CXJNk7pS0jpqbfhi3w9VUI21/3IyTOblw0iAmctkUGq5TDwQBR7zXZnuTxpXbBPPEuXW1uhI2BHDA==
dependencies:
openzeppelin-solidity "^4.8.1"

"@solidity-parser/parser@^0.17.0":
version "0.17.0"
resolved "https://registry.yarnpkg.com/@solidity-parser/parser/-/parser-0.17.0.tgz#52a2fcc97ff609f72011014e4c5b485ec52243ef"
resolved "https://registry.npmjs.org/@solidity-parser/parser/-/parser-0.17.0.tgz"
integrity sha512-Nko8R0/kUo391jsEHHxrGM07QFdnPGvlmox4rmH0kNiNAashItAilhy4Mv4pK5gQmW5f4sXAF58fwJbmlkGcVw==

"@uniswap/lib@1.1.1":
version "1.1.1"
resolved "https://registry.yarnpkg.com/@uniswap/lib/-/lib-1.1.1.tgz#0afd29601846c16e5d082866cbb24a9e0758e6bc"
resolved "https://registry.npmjs.org/@uniswap/lib/-/lib-1.1.1.tgz"
integrity sha512-2yK7sLpKIT91TiS5sewHtOa7YuM8IuBXVl4GZv2jZFys4D2sY7K5vZh6MqD25TPA95Od+0YzCVq6cTF2IKrOmg==

"@uniswap/v2-core@1.0.0":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@uniswap/v2-core/-/v2-core-1.0.0.tgz#e0fab91a7d53e8cafb5326ae4ca18351116b0844"
resolved "https://registry.npmjs.org/@uniswap/v2-core/-/v2-core-1.0.0.tgz"
integrity sha512-BJiXrBGnN8mti7saW49MXwxDBRFiWemGetE58q8zgfnPPzQKq55ADltEILqOt6VFZ22kVeVKbF8gVd8aY3l7pA==

"@uniswap/v2-periphery@^1.1.0-beta.0":
version "1.1.0-beta.0"
resolved "https://registry.yarnpkg.com/@uniswap/v2-periphery/-/v2-periphery-1.1.0-beta.0.tgz#20a4ccfca22f1a45402303aedb5717b6918ebe6d"
resolved "https://registry.npmjs.org/@uniswap/v2-periphery/-/v2-periphery-1.1.0-beta.0.tgz"
integrity sha512-6dkwAMKza8nzqYiXEr2D86dgW3TTavUvCR0w2Tu33bAbM8Ah43LKAzH7oKKPRT5VJQaMi1jtkGs1E8JPor1n5g==
dependencies:
"@uniswap/lib" "1.1.1"
"@uniswap/v2-core" "1.0.0"

openzeppelin-solidity@4.8.1, openzeppelin-solidity@^4.8.1:
openzeppelin-solidity@^4.8.1, openzeppelin-solidity@4.8.1:
version "4.8.1"
resolved "https://registry.yarnpkg.com/openzeppelin-solidity/-/openzeppelin-solidity-4.8.1.tgz#2ab492a5a53a5520401e94df36e43807de7a3b50"
resolved "https://registry.npmjs.org/openzeppelin-solidity/-/openzeppelin-solidity-4.8.1.tgz"
integrity sha512-KM0pVpfrCBdifqN2ZeJZFvFuoGz3GmI4Ty/ceKNkcaf7VVWo/rLOfc5EiLh+Ukb5NadNmYo8WMeGhFA8hVWDpg==

prettier-plugin-solidity@^1.3.1:
version "1.3.1"
resolved "https://registry.yarnpkg.com/prettier-plugin-solidity/-/prettier-plugin-solidity-1.3.1.tgz#59944d3155b249f7f234dee29f433524b9a4abcf"
resolved "https://registry.npmjs.org/prettier-plugin-solidity/-/prettier-plugin-solidity-1.3.1.tgz"
integrity sha512-MN4OP5I2gHAzHZG1wcuJl0FsLS3c4Cc5494bbg+6oQWBPuEamjwDvmGfFMZ6NFzsh3Efd9UUxeT7ImgjNH4ozA==
dependencies:
"@solidity-parser/parser" "^0.17.0"
semver "^7.5.4"
solidity-comments-extractor "^0.0.8"

prettier@^3.3.3:
prettier@^3.3.3, prettier@>=2.3.0:
version "3.3.3"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.3.3.tgz#30c54fe0be0d8d12e6ae61dbb10109ea00d53105"
resolved "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz"
integrity sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==

semver@^7.5.4:
version "7.6.3"
resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.3.tgz#980f7b5550bc175fb4dc09403085627f9eb33143"
resolved "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz"
integrity sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==

solidity-comments-extractor@^0.0.8:
version "0.0.8"
resolved "https://registry.yarnpkg.com/solidity-comments-extractor/-/solidity-comments-extractor-0.0.8.tgz#f6e148ab0c49f30c1abcbecb8b8df01ed8e879f8"
resolved "https://registry.npmjs.org/solidity-comments-extractor/-/solidity-comments-extractor-0.0.8.tgz"
integrity sha512-htM7Vn6LhHreR+EglVMd2s+sZhcXAirB1Zlyrv5zBuTxieCvjfnRpd7iZk75m/u6NOlEyQ94C6TWbBn2cY7w8g==
21 changes: 7 additions & 14 deletions modules/consensus/beefy/prover/src/runtime/paseo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -526,8 +526,7 @@ pub mod api {
pub fn pending_rewards(
&self,
who: ::subxt::utils::AccountId32,
) -> ::subxt::runtime_api::Payload<types::PendingRewards, ::core::primitive::u128>
{
) -> ::subxt::runtime_api::Payload<types::PendingRewards, ::core::primitive::u128> {
::subxt::runtime_api::Payload::new_static(
"NominationPoolsApi",
"pending_rewards",
Expand Down Expand Up @@ -2247,8 +2246,7 @@ pub mod api {
#[doc = " Get current GRANDPA authority set id."]
pub fn current_set_id(
&self,
) -> ::subxt::runtime_api::Payload<types::CurrentSetId, ::core::primitive::u64>
{
) -> ::subxt::runtime_api::Payload<types::CurrentSetId, ::core::primitive::u64> {
::subxt::runtime_api::Payload::new_static(
"GrandpaApi",
"current_set_id",
Expand Down Expand Up @@ -2685,8 +2683,7 @@ pub mod api {
pub fn account_nonce(
&self,
account: ::subxt::utils::AccountId32,
) -> ::subxt::runtime_api::Payload<types::AccountNonce, ::core::primitive::u32>
{
) -> ::subxt::runtime_api::Payload<types::AccountNonce, ::core::primitive::u32> {
::subxt::runtime_api::Payload::new_static(
"AccountNonceApi",
"account_nonce",
Expand Down Expand Up @@ -4398,8 +4395,7 @@ pub mod api {
#[doc = " The maximum length of a block (in bytes)."]
pub fn block_length(
&self,
) -> ::subxt::constants::Address<runtime_types::frame_system::limits::BlockLength>
{
) -> ::subxt::constants::Address<runtime_types::frame_system::limits::BlockLength> {
::subxt::constants::Address::new_static(
"System",
"BlockLength",
Expand Down Expand Up @@ -12689,8 +12685,7 @@ pub mod api {
#[doc = " Maximum amount of funds that should be placed in a deposit for making a proposal."]
pub fn proposal_bond_maximum(
&self,
) -> ::subxt::constants::Address<::core::option::Option<::core::primitive::u128>>
{
) -> ::subxt::constants::Address<::core::option::Option<::core::primitive::u128>> {
::subxt::constants::Address::new_static(
"Treasury",
"ProposalBondMaximum",
Expand Down Expand Up @@ -18654,8 +18649,7 @@ pub mod api {
#[doc = " Maximum amount of funds that should be placed in a deposit for making a proposal."]
pub fn curator_deposit_max(
&self,
) -> ::subxt::constants::Address<::core::option::Option<::core::primitive::u128>>
{
) -> ::subxt::constants::Address<::core::option::Option<::core::primitive::u128>> {
::subxt::constants::Address::new_static(
"Bounties",
"CuratorDepositMax",
Expand All @@ -18670,8 +18664,7 @@ pub mod api {
#[doc = " Minimum amount of funds that should be placed in a deposit for making a proposal."]
pub fn curator_deposit_min(
&self,
) -> ::subxt::constants::Address<::core::option::Option<::core::primitive::u128>>
{
) -> ::subxt::constants::Address<::core::option::Option<::core::primitive::u128>> {
::subxt::constants::Address::new_static(
"Bounties",
"CuratorDepositMin",
Expand Down
24 changes: 20 additions & 4 deletions modules/ismp/pallets/demo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use alloc::{
format,
string::{String, ToString},
};
use frame_support::{traits::fungible::Mutate, PalletId};
use frame_support::{traits::fungible::Mutate, PalletId, StorageHasher, Twox128};
use ismp::{
error::Error as IsmpError,
host::StateMachine,
Expand Down Expand Up @@ -57,6 +57,7 @@ pub mod pallet {
};

#[pallet::pallet]
#[pallet::without_storage_info]
pub struct Pallet<T>(_);

/// Pallet Configuration
Expand Down Expand Up @@ -114,6 +115,12 @@ pub mod pallet {
GetResponse(Vec<Option<Vec<u8>>>),
}

/// Storing values requested from other chains along with their requesting keys
/// hash of the key
#[pallet::storage]
pub type GetResponses<T: Config> =
StorageMap<_, Twox128, [u8; 16], Option<Vec<u8>>, ValueQuery>;

/// Pallet Errors
#[pallet::error]
pub enum Error<T> {
Expand Down Expand Up @@ -350,9 +357,18 @@ impl<T: Config> IsmpModule for IsmpModuleCallback<T> {
Response::Post(_) => Err(IsmpError::Custom(
"Balance transfer protocol does not accept post responses".to_string(),
))?,
Response::Get(res) => Pallet::<T>::deposit_event(Event::<T>::GetResponse(
res.values.into_values().collect(),
)),
Response::Get(res) => {
res.values.iter().for_each(|(k, v)| {
if v.is_some() {
let hash_key = Twox128::hash(k.as_ref());
GetResponses::<T>::insert(hash_key, v)
}
});

Pallet::<T>::deposit_event(Event::<T>::GetResponse(
res.values.into_values().collect(),
))
},
};

Ok(())
Expand Down
Loading

0 comments on commit 4892441

Please sign in to comment.