Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[xcm-emulator] Make a generic constructor method for genesis Storage #2613

Open
0xmovses opened this issue Dec 4, 2023 · 0 comments
Open
Labels
I4-refactor Code needs refactoring. T10-tests This PR/Issue is related to tests.

Comments

@0xmovses
Copy link
Contributor

0xmovses commented Dec 4, 2023

Currently we write a separate genesis function for each Parachain when creating the emulated test environments cumulus/parachains/integration-tests/emulated/chains/parachains/bridges/bridge-hub-rococo/src/genesis.rs.
Much of this logic is repeated, but some is chain / environment specific. We can make a generic function, reducing code repetition and making this code more expressive and configurable.

There will likely be more situations in the future where we want to configure genesis state for XCM testing.

We could do something like

trait RuntimeGenesisConfig {
    fn configure_storage(storage: &mut Storage);
}

Then we could do a impl RuntimeGenesisConfig for BridgeHubRococoRuntime, for example.

And finally:

impl Storage {
    pub fn new_genesis<R: RuntimeGenesisConfig>() -> Self {
        let mut storage = Storage::default();
        R::configure_storage(&mut storage);
        storage
    }
}

Originally suggested here by @liamaharon

@0xmovses 0xmovses added I4-refactor Code needs refactoring. T10-tests This PR/Issue is related to tests. labels Dec 4, 2023
@0xmovses 0xmovses changed the title [xcm-emulator] Make a generic genesis constructor method [xcm-emulator] Make a generic constructor method for genesis Storage Dec 4, 2023
bkontur pushed a commit that referenced this issue Jun 5, 2024
* report expected reward from target to source chain in confirmation transaction

* added tests for new code

* fix benchmarks compilation

* clippy + spelling

* remove extra requirements

* RewardAtSource -> RelayerRewardAtSource, delivery_reward_per_message -> relayer_reward_per_message
bkontur pushed a commit that referenced this issue Jun 7, 2024
* report expected reward from target to source chain in confirmation transaction

* added tests for new code

* fix benchmarks compilation

* clippy + spelling

* remove extra requirements

* RewardAtSource -> RelayerRewardAtSource, delivery_reward_per_message -> relayer_reward_per_message
bkontur pushed a commit that referenced this issue Jun 7, 2024
* report expected reward from target to source chain in confirmation transaction

* added tests for new code

* fix benchmarks compilation

* clippy + spelling

* remove extra requirements

* RewardAtSource -> RelayerRewardAtSource, delivery_reward_per_message -> relayer_reward_per_message
bkontur pushed a commit that referenced this issue Jun 12, 2024
* report expected reward from target to source chain in confirmation transaction

* added tests for new code

* fix benchmarks compilation

* clippy + spelling

* remove extra requirements

* RewardAtSource -> RelayerRewardAtSource, delivery_reward_per_message -> relayer_reward_per_message
bkontur pushed a commit that referenced this issue Jun 13, 2024
* report expected reward from target to source chain in confirmation transaction

* added tests for new code

* fix benchmarks compilation

* clippy + spelling

* remove extra requirements

* RewardAtSource -> RelayerRewardAtSource, delivery_reward_per_message -> relayer_reward_per_message
bkontur pushed a commit that referenced this issue Jun 14, 2024
* report expected reward from target to source chain in confirmation transaction

* added tests for new code

* fix benchmarks compilation

* clippy + spelling

* remove extra requirements

* RewardAtSource -> RelayerRewardAtSource, delivery_reward_per_message -> relayer_reward_per_message
bkontur pushed a commit that referenced this issue Jun 14, 2024
* report expected reward from target to source chain in confirmation transaction

* added tests for new code

* fix benchmarks compilation

* clippy + spelling

* remove extra requirements

* RewardAtSource -> RelayerRewardAtSource, delivery_reward_per_message -> relayer_reward_per_message
bkontur pushed a commit that referenced this issue Jun 14, 2024
* report expected reward from target to source chain in confirmation transaction

* added tests for new code

* fix benchmarks compilation

* clippy + spelling

* remove extra requirements

* RewardAtSource -> RelayerRewardAtSource, delivery_reward_per_message -> relayer_reward_per_message
bkontur pushed a commit that referenced this issue Jun 14, 2024
* report expected reward from target to source chain in confirmation transaction

* added tests for new code

* fix benchmarks compilation

* clippy + spelling

* remove extra requirements

* RewardAtSource -> RelayerRewardAtSource, delivery_reward_per_message -> relayer_reward_per_message
bkontur pushed a commit that referenced this issue Jun 20, 2024
* report expected reward from target to source chain in confirmation transaction

* added tests for new code

* fix benchmarks compilation

* clippy + spelling

* remove extra requirements

* RewardAtSource -> RelayerRewardAtSource, delivery_reward_per_message -> relayer_reward_per_message
bkontur pushed a commit that referenced this issue Jun 20, 2024
* report expected reward from target to source chain in confirmation transaction

* added tests for new code

* fix benchmarks compilation

* clippy + spelling

* remove extra requirements

* RewardAtSource -> RelayerRewardAtSource, delivery_reward_per_message -> relayer_reward_per_message
bkontur pushed a commit that referenced this issue Jun 26, 2024
* report expected reward from target to source chain in confirmation transaction

* added tests for new code

* fix benchmarks compilation

* clippy + spelling

* remove extra requirements

* RewardAtSource -> RelayerRewardAtSource, delivery_reward_per_message -> relayer_reward_per_message
bkontur pushed a commit that referenced this issue Jun 26, 2024
* report expected reward from target to source chain in confirmation transaction

* added tests for new code

* fix benchmarks compilation

* clippy + spelling

* remove extra requirements

* RewardAtSource -> RelayerRewardAtSource, delivery_reward_per_message -> relayer_reward_per_message
bkontur pushed a commit that referenced this issue Jun 28, 2024
* report expected reward from target to source chain in confirmation transaction

* added tests for new code

* fix benchmarks compilation

* clippy + spelling

* remove extra requirements

* RewardAtSource -> RelayerRewardAtSource, delivery_reward_per_message -> relayer_reward_per_message
bkontur pushed a commit that referenced this issue Jul 1, 2024
* report expected reward from target to source chain in confirmation transaction

* added tests for new code

* fix benchmarks compilation

* clippy + spelling

* remove extra requirements

* RewardAtSource -> RelayerRewardAtSource, delivery_reward_per_message -> relayer_reward_per_message
bkontur pushed a commit that referenced this issue Jul 4, 2024
* report expected reward from target to source chain in confirmation transaction

* added tests for new code

* fix benchmarks compilation

* clippy + spelling

* remove extra requirements

* RewardAtSource -> RelayerRewardAtSource, delivery_reward_per_message -> relayer_reward_per_message
bkontur pushed a commit that referenced this issue Jul 16, 2024
* report expected reward from target to source chain in confirmation transaction

* added tests for new code

* fix benchmarks compilation

* clippy + spelling

* remove extra requirements

* RewardAtSource -> RelayerRewardAtSource, delivery_reward_per_message -> relayer_reward_per_message
bkontur pushed a commit that referenced this issue Jul 17, 2024
* report expected reward from target to source chain in confirmation transaction

* added tests for new code

* fix benchmarks compilation

* clippy + spelling

* remove extra requirements

* RewardAtSource -> RelayerRewardAtSource, delivery_reward_per_message -> relayer_reward_per_message
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I4-refactor Code needs refactoring. T10-tests This PR/Issue is related to tests.
Projects
None yet
Development

No branches or pull requests

1 participant