Skip to content

Commit

Permalink
Make sure CertifiedTranaction always has valid epoch (MystenLabs#2524)
Browse files Browse the repository at this point in the history
  • Loading branch information
lxfind authored Jun 13, 2022
1 parent 74ea62a commit a569987
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
15 changes: 3 additions & 12 deletions crates/sui-types/src/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1150,7 +1150,7 @@ impl<'a> SignatureAggregator<'a> {
committee,
weight: 0,
used_authorities: HashSet::new(),
partial: CertifiedTransaction::new(transaction),
partial: CertifiedTransaction::new(committee.epoch, transaction),
}
}

Expand Down Expand Up @@ -1188,17 +1188,8 @@ impl<'a> SignatureAggregator<'a> {
}

impl CertifiedTransaction {
pub fn new(transaction: Transaction) -> CertifiedTransaction {
CertifiedTransaction {
transaction_digest: transaction.transaction_digest,
is_verified: false,
data: transaction.data,
tx_signature: transaction.tx_signature,
auth_sign_info: AuthorityQuorumSignInfo {
epoch: 0,
signatures: Vec::new(),
},
}
pub fn new(epoch: EpochId, transaction: Transaction) -> CertifiedTransaction {
Self::new_with_signatures(epoch, transaction, vec![])
}

pub fn new_with_signatures(
Expand Down
2 changes: 1 addition & 1 deletion crates/sui/src/benchmark/transaction_creator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ fn create_gas_object(object_id: ObjectID, owner: SuiAddress) -> Object {
/// This builds, signs a cert
fn make_cert(network_config: &NetworkConfig, tx: &Transaction) -> CertifiedTransaction {
// Make certificate
let mut certificate = CertifiedTransaction::new(tx.clone());
let committee = network_config.committee();
let mut certificate = CertifiedTransaction::new(committee.epoch(), tx.clone());
certificate.auth_sign_info.epoch = committee.epoch();
// TODO: Why iterating from 0 to quorum_threshold??
for i in 0..committee.quorum_threshold() {
Expand Down

0 comments on commit a569987

Please sign in to comment.