mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 08:07:58 +00:00
babe: secondary blocks with VRF (#5501)
* babe: secondary blocks with VRF * Fix node runtime compile * Fix test-utils runtime interface * Fix babe tests * typo: v == 2 * babe: support online configuration upgrades * Fix rpc tests * Fix runtime version tests * Switch to use NextConfigDescriptor instead of changing runtime interface * Fix tests * epoch-changes: map function that allows converting with different epoch types * Add migration script for the epoch config change * Fix docs for PrimaryAndSecondaryVRFSlots * Add docs of `SecondaryVRF` in babe crate * babe-primitives: Secondary -> SecondaryPlain * babe-client: Secondary -> SecondaryPlain * Fix migration tests * test-utils-runtime: Secondary -> SecondaryPlain * Fix missing name change in test-utils-runtime * Fix migration: Epoch should be EpochV0 * Update client/consensus/babe/src/lib.rs Co-Authored-By: André Silva <123550+andresilva@users.noreply.github.com> * Fix new epochChanges version * Fix babe-primitives naming changes * Fix merge issues in babe-client Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com> Co-authored-by: André Silva <andre.beat@gmail.com>
This commit is contained in:
@@ -123,9 +123,12 @@ impl<B, C, SC> BabeApi for BabeRPCHandler<B, C, SC>
|
||||
PreDigest::Primary { .. } => {
|
||||
claims.entry(key.public()).or_default().primary.push(slot_number);
|
||||
}
|
||||
PreDigest::Secondary { .. } => {
|
||||
PreDigest::SecondaryPlain { .. } => {
|
||||
claims.entry(key.public()).or_default().secondary.push(slot_number);
|
||||
}
|
||||
PreDigest::SecondaryVRF { .. } => {
|
||||
claims.entry(key.public()).or_default().secondary_vrf.push(slot_number);
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -144,6 +147,8 @@ pub struct EpochAuthorship {
|
||||
primary: Vec<u64>,
|
||||
/// the array of secondary slots that can be claimed
|
||||
secondary: Vec<u64>,
|
||||
/// The array of secondary VRF slots that can be claimed.
|
||||
secondary_vrf: Vec<u64>,
|
||||
}
|
||||
|
||||
/// Errors encountered by the RPC
|
||||
@@ -236,7 +241,7 @@ mod tests {
|
||||
|
||||
io.extend_with(BabeApi::to_delegate(handler));
|
||||
let request = r#"{"jsonrpc":"2.0","method":"babe_epochAuthorship","params": [],"id":1}"#;
|
||||
let response = r#"{"jsonrpc":"2.0","result":{"5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY":{"primary":[0],"secondary":[1,2,4]}},"id":1}"#;
|
||||
let response = r#"{"jsonrpc":"2.0","result":{"5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY":{"primary":[0],"secondary":[1,2,4],"secondary_vrf":[]}},"id":1}"#;
|
||||
|
||||
assert_eq!(Some(response.into()), io.handle_request_sync(request));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user