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

Add reward field to unrewarded relayers #2613

Merged
merged 6 commits into from
Oct 16, 2023

Conversation

svyatonik
Copy link
Contributor

related to #2486

First reviewable part of the #2605. This PR:

  • adds RewardAtSource type, which is used to order relayer bids at the target chain (this part will be added later - for now reference to Finishing "Additional priority boost for relayers that have explicitly registered at lane" #2605). Since we are using single instance of relayers pallet to bridge with all Substrate-based chains (and it actually makes sense to do that), it is difficult to make the code generic over the actual type. So it u64. At the same time, the "core" code does not impose any additional meaning onto this type. So e.g. it may mean milliDOTs and the payment will be made in DOTs or MultiAssets, containing DOTs;
  • adds reward_per_message: RewardAtSource field to the unrewarded relayers vector. It is eventually reported to the source chain, where this reward is actually mapped onto real reward type (see calc_relayers_rewards_at_source function);
  • adds method DeliveryPayments::delivery_reward_per_message, which shall return this reward_per_message field value, that is later proved to the source chain.

The most controversial stuff here is the RewardAtSource type, which is fixed to u64. Do not think we can easily get rid of that hardcoded type. We can change it to u128 (Polkadot-like chains are using it as a native token balance type), but I do not think we expect such large rewards.

modules/relayers/src/payment_adapter.rs Outdated Show resolved Hide resolved
primitives/messages/src/lib.rs Show resolved Hide resolved
primitives/messages/src/lib.rs Outdated Show resolved Hide resolved
primitives/messages/src/lib.rs Outdated Show resolved Hide resolved
@svyatonik svyatonik merged commit 50928a6 into master Oct 16, 2023
@svyatonik svyatonik deleted the add-reward-field-to-unrewarded-relayers branch October 16, 2023 10:57
bkontur pushed a commit that referenced this pull request May 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants