This is a follow-up issue to #8072.
Currently, the epoch randomness for current and next epochs is fetched using runtime calls:
|
async fn current_epoch(&self, hash: RelayHash) -> RelayChainResult<Epoch> { |
|
let res = self |
|
.relay_chain_interface |
|
.call_runtime_api("BabeApi_current_epoch", hash, &[]) |
|
.await?; |
|
Decode::decode(&mut &*res).map_err(Into::into) |
|
} |
|
|
|
async fn next_epoch(&self, hash: RelayHash) -> RelayChainResult<Epoch> { |
|
let res = self |
|
.relay_chain_interface |
|
.call_runtime_api("BabeApi_next_epoch", hash, &[]) |
|
.await?; |
|
Decode::decode(&mut &*res).map_err(Into::into) |
|
} |
This can be optimized by only using runtime calls on startup, and later getting the randomness from the next epoch descriptor at the first block of every epoch.
This is a follow-up issue to #8072.
Currently, the epoch randomness for current and next epochs is fetched using runtime calls:
polkadot-sdk/cumulus/client/bootnodes/src/advertisement.rs
Lines 147 to 161 in a6a7165
This can be optimized by only using runtime calls on startup, and later getting the randomness from the next epoch descriptor at the first block of every epoch.