mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-15 11:31:05 +00:00
Serialisable genesis config (#229)
* Genesis serialization * Custom type for AuthorityId * Merge w master * Fixed a few minor issues * Fixed unmerged file * Renamed tag * Deferred genesis loading * Upated wasm runtime * Minor issues
This commit is contained in:
committed by
Gav Wood
parent
276c464b50
commit
9b885ba092
@@ -261,7 +261,7 @@ impl<C, N, P> bft::ProposerFactory<Block> for ProposerFactory<C, N, P>
|
||||
let (group_info, local_duty) = make_group_info(
|
||||
duty_roster,
|
||||
authorities,
|
||||
sign_with.public().0,
|
||||
sign_with.public().into(),
|
||||
)?;
|
||||
|
||||
let active_parachains = self.client.active_parachains(&checked_id)?;
|
||||
@@ -490,7 +490,7 @@ impl<C, R, P> bft::Proposer<Block> for Proposer<C, R, P>
|
||||
let offset = offset.low_u64() as usize + round_number;
|
||||
|
||||
let proposer = authorities[offset % authorities.len()].clone();
|
||||
trace!(target: "bft", "proposer for round {} is {}", round_number, Hash::from(proposer));
|
||||
trace!(target: "bft", "proposer for round {} is {}", round_number, proposer);
|
||||
|
||||
proposer
|
||||
}
|
||||
|
||||
@@ -92,16 +92,16 @@ fn process_message(msg: net::LocalizedBftMessage<Block>, local_id: &AuthorityId,
|
||||
sender: proposal.sender,
|
||||
digest_signature: ed25519::LocalizedSignature {
|
||||
signature: proposal.digest_signature,
|
||||
signer: ed25519::Public(proposal.sender),
|
||||
signer: proposal.sender.into(),
|
||||
},
|
||||
full_signature: ed25519::LocalizedSignature {
|
||||
signature: proposal.full_signature,
|
||||
signer: ed25519::Public(proposal.sender),
|
||||
signer: proposal.sender.into(),
|
||||
}
|
||||
};
|
||||
bft::check_proposal(authorities, &msg.parent_hash, &proposal)?;
|
||||
|
||||
trace!(target: "bft", "importing proposal message for round {} from {}", proposal.round_number, Hash::from(proposal.sender));
|
||||
trace!(target: "bft", "importing proposal message for round {} from {}", proposal.round_number, proposal.sender);
|
||||
proposal
|
||||
}),
|
||||
net::generic_message::SignedConsensusMessage::Vote(vote) => bft::generic::LocalizedMessage::Vote({
|
||||
@@ -110,7 +110,7 @@ fn process_message(msg: net::LocalizedBftMessage<Block>, local_id: &AuthorityId,
|
||||
sender: vote.sender,
|
||||
signature: ed25519::LocalizedSignature {
|
||||
signature: vote.signature,
|
||||
signer: ed25519::Public(vote.sender),
|
||||
signer: vote.sender.into(),
|
||||
},
|
||||
vote: match vote.vote {
|
||||
net::generic_message::ConsensusVote::Prepare(r, h) => bft::generic::Vote::Prepare(r as usize, h),
|
||||
@@ -120,7 +120,7 @@ fn process_message(msg: net::LocalizedBftMessage<Block>, local_id: &AuthorityId,
|
||||
};
|
||||
bft::check_vote::<Block>(authorities, &msg.parent_hash, &vote)?;
|
||||
|
||||
trace!(target: "bft", "importing vote {:?} from {}", vote.vote, Hash::from(vote.sender));
|
||||
trace!(target: "bft", "importing vote {:?} from {}", vote.vote, vote.sender);
|
||||
vote
|
||||
}),
|
||||
}),
|
||||
|
||||
@@ -62,17 +62,16 @@ impl table::Context for TableContext {
|
||||
|
||||
impl TableContext {
|
||||
fn local_id(&self) -> AuthorityId {
|
||||
self.key.public().0
|
||||
self.key.public().into()
|
||||
}
|
||||
|
||||
fn sign_statement(&self, statement: table::Statement) -> table::SignedStatement {
|
||||
let signature = ::sign_table_statement(&statement, &self.key, &self.parent_hash).into();
|
||||
let local_id = self.key.public().0;
|
||||
|
||||
table::SignedStatement {
|
||||
statement,
|
||||
signature,
|
||||
sender: local_id,
|
||||
sender: self.local_id(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -468,10 +467,10 @@ mod tests {
|
||||
let mut groups = HashMap::new();
|
||||
|
||||
let para_id = ParaId::from(1);
|
||||
let local_id = Keyring::Alice.to_raw_public();
|
||||
let local_id = Keyring::Alice.to_raw_public().into();
|
||||
let local_key = Arc::new(Keyring::Alice.pair());
|
||||
|
||||
let validity_other = Keyring::Bob.to_raw_public();
|
||||
let validity_other = Keyring::Bob.to_raw_public().into();
|
||||
let validity_other_key = Keyring::Bob.pair();
|
||||
let parent_hash = Default::default();
|
||||
|
||||
@@ -518,10 +517,10 @@ mod tests {
|
||||
let mut groups = HashMap::new();
|
||||
|
||||
let para_id = ParaId::from(1);
|
||||
let local_id = Keyring::Alice.to_raw_public();
|
||||
let local_id = Keyring::Alice.to_raw_public().into();
|
||||
let local_key = Arc::new(Keyring::Alice.pair());
|
||||
|
||||
let validity_other = Keyring::Bob.to_raw_public();
|
||||
let validity_other = Keyring::Bob.to_raw_public().into();
|
||||
let validity_other_key = Keyring::Bob.pair();
|
||||
let parent_hash = Default::default();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user