Skip to content

Confirm the relayer gets paid rewards in unit tests#1081

Merged
alistair-singh merged 1 commit intomainfrom
alistair/assert-inbound-rewards
Dec 21, 2023
Merged

Confirm the relayer gets paid rewards in unit tests#1081
alistair-singh merged 1 commit intomainfrom
alistair/assert-inbound-rewards

Conversation

@alistair-singh
Copy link
Contributor

@alistair-singh alistair-singh commented Dec 20, 2023

@codecov
Copy link

codecov bot commented Dec 20, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (c481b54) 80.69% compared to head (7f54f39) 80.69%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1081   +/-   ##
=======================================
  Coverage   80.69%   80.69%           
=======================================
  Files          55       55           
  Lines        2274     2274           
  Branches       71       71           
=======================================
  Hits         1835     1835           
  Misses        422      422           
  Partials       17       17           
Flag Coverage Δ
rust 80.71% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@alistair-singh alistair-singh changed the title Confirm the relayer get paid rewards in tests Confirm the relayer gets paid rewards in unit tests Dec 20, 2023
@alistair-singh alistair-singh merged commit 0627a68 into main Dec 21, 2023
@alistair-singh alistair-singh deleted the alistair/assert-inbound-rewards branch December 21, 2023 09:22
Comment on lines +50 to +55
let reward = Parameters::get().rewards.local;
assert!(Balances::balance(&relayer) >= reward, "relayer was rewarded");
assert!(
Balances::balance(&channel_sovereign) <= initial_fund - reward,
"sovereign account paid reward"
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let reward = Parameters::get().rewards.local;
assert!(Balances::balance(&relayer) >= reward, "relayer was rewarded");
assert!(
Balances::balance(&channel_sovereign) <= initial_fund - reward,
"sovereign account paid reward"
);
let delivery_cost = InboundQueue::calculate_delivery_cost(message.encode().len() as u32);
assert!(Parameters::get().rewards.local < delivery_cost, "delivery cost exceeds pure reward");
assert_eq!(Balances::balance(&relayer), delivery_cost, "relayer was reimbursed and rewarded");
assert!(
Balances::balance(&channel_sovereign) <= initial_fund - delivery_cost,
"sovereign account paid reward and delivery fee"
);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in #1086

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants