Skip to content

Commit

Permalink
Re-enable request_revenue_info_at in CoretimeInterface (#393)
Browse files Browse the repository at this point in the history
In the update to [sdk
1.14](#381) the
`request_revenue_info` is now implemented but this call had been
switched off when it was added in
#212.

This PR just enables this again in the coretime interface.

cc @ggwpez @s0me0ne-unkn0wn
  • Loading branch information
seadanda authored Jul 18, 2024
1 parent 30d1345 commit e3fca1e
Showing 1 changed file with 34 additions and 6 deletions.
40 changes: 34 additions & 6 deletions system-parachains/coretime/coretime-kusama/src/coretime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,41 @@ impl CoretimeInterface for CoretimeAllocator {

fn request_revenue_info_at(when: RCBlockNumberOf<Self>) {
use crate::coretime::CoretimeProviderCalls::RequestRevenueInfoAt;
let _request_revenue_info_at_call =
let request_revenue_info_at_call =
RelayRuntimePallets::Coretime(RequestRevenueInfoAt(when));

log::debug!(
target: "runtime::coretime",
"`request_revenue` is unmiplemented on the relay."
);
// Weight for `request_revenue_at` from Kusama runtime benchmarks:
// `ref_time` = 37_637_000 + (3 * 25000000) + (6 * 100000000) = 712637000
// `proof_size` = 6428
// Add 5% to each component and round to 2 significant figures.
//
// This benchmark has been transplanted from a testnet and not rerun, so adding a healthy
// buffer. TODO refine when benchmarks are run.
let call_weight = Weight::from_parts(1_000_000_000, 20_000);

let message = Xcm(vec![
Instruction::UnpaidExecution {
weight_limit: WeightLimit::Unlimited,
check_origin: None,
},
Instruction::Transact {
origin_kind: OriginKind::Native,
require_weight_at_most: call_weight,
call: request_revenue_info_at_call.encode().into(),
},
]);

match PolkadotXcm::send_xcm(Here, Location::parent(), message) {
Ok(_) => log::debug!(
target: "runtime::coretime",
"Revenue info request sent successfully."
),
Err(e) => log::error!(
target: "runtime::coretime",
"Request for revenue info failed to send: {:?}",
e
),
}
}

fn credit_account(who: Self::AccountId, amount: Self::Balance) {
Expand All @@ -182,7 +210,7 @@ impl CoretimeInterface for CoretimeAllocator {

log::debug!(
target: "runtime::coretime",
"`credit_account` is unmiplemented on the relay."
"`credit_account` is unimplemented on the relay."
);
}

Expand Down

0 comments on commit e3fca1e

Please sign in to comment.