-
Notifications
You must be signed in to change notification settings - Fork 107
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
Confirm the relayer gets paid rewards in unit tests #1081
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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" | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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" | |
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in #1086
Resolves: SNO-807
paritytech/polkadot-sdk#2522 (comment)