Skip to content

Commit

Permalink
refactor(iota-types): Remove ConsensusTransactionKind::RandomnessStat…
Browse files Browse the repository at this point in the history
…eUpdate (#3795)
  • Loading branch information
jkrvivian authored Oct 30, 2024
1 parent d7a1872 commit 97d85e3
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 33 deletions.
11 changes: 0 additions & 11 deletions crates/iota-core/src/authority/authority_per_epoch_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2382,10 +2382,6 @@ impl AuthorityPerEpochStore {
return None;
}
}
SequencedConsensusTransactionKind::External(ConsensusTransaction {
kind: ConsensusTransactionKind::RandomnessStateUpdate(_round, _bytes),
..
}) => {}
SequencedConsensusTransactionKind::External(ConsensusTransaction {
kind: ConsensusTransactionKind::RandomnessDkgMessage(authority, _bytes),
..
Expand Down Expand Up @@ -3426,13 +3422,6 @@ impl AuthorityPerEpochStore {
}
Ok(ConsensusCertificateResult::ConsensusMessage)
}
SequencedConsensusTransactionKind::External(ConsensusTransaction {
kind: ConsensusTransactionKind::RandomnessStateUpdate(_, _),
..
}) => {
// These are always generated as System transactions (handled below).
panic!("process_consensus_transaction called with external RandomnessStateUpdate");
}
SequencedConsensusTransactionKind::External(ConsensusTransaction {
kind: ConsensusTransactionKind::RandomnessDkgMessage(authority, bytes),
..
Expand Down
18 changes: 4 additions & 14 deletions crates/iota-core/src/consensus_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use iota_types::{
};
use lru::LruCache;
use serde::{Deserialize, Serialize};
use tracing::{debug, error, info, instrument, trace_span, warn};
use tracing::{debug, info, instrument, trace_span, warn};

use crate::{
authority::{
Expand Down Expand Up @@ -314,18 +314,9 @@ impl<C: CheckpointServiceNotify + Send + Sync> ConsensusHandler<C> {
.stats
.inc_num_user_transactions(authority_index as usize);
}
if let ConsensusTransactionKind::RandomnessStateUpdate(randomness_round, _) =
&transaction.kind
{
// These are deprecated and we should never see them. Log an error and eat
// the tx if one appears.
error!(
"BUG: saw deprecated RandomnessStateUpdate tx for commit round {round:?}, randomness round {randomness_round:?}"
)
} else {
let transaction = SequencedConsensusTransactionKind::External(transaction);
transactions.push((serialized_transaction, transaction, authority_index));
}

let transaction = SequencedConsensusTransactionKind::External(transaction);
transactions.push((serialized_transaction, transaction, authority_index));
}
}
}
Expand Down Expand Up @@ -541,7 +532,6 @@ pub(crate) fn classify(transaction: &ConsensusTransaction) -> &'static str {
ConsensusTransactionKind::EndOfPublish(_) => "end_of_publish",
ConsensusTransactionKind::CapabilityNotificationV1(_) => "capability_notification_v1",
ConsensusTransactionKind::NewJWKFetched(_, _, _) => "new_jwk_fetched",
ConsensusTransactionKind::RandomnessStateUpdate(_, _) => "randomness_state_update",
ConsensusTransactionKind::RandomnessDkgMessage(_, _) => "randomness_dkg_message",
ConsensusTransactionKind::RandomnessDkgConfirmation(_, _) => "randomness_dkg_confirmation",
}
Expand Down
3 changes: 1 addition & 2 deletions crates/iota-core/src/consensus_validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@ impl IotaTxValidator {

ConsensusTransactionKind::EndOfPublish(_)
| ConsensusTransactionKind::NewJWKFetched(_, _, _)
| ConsensusTransactionKind::CapabilityNotificationV1(_)
| ConsensusTransactionKind::RandomnessStateUpdate(_, _) => {}
| ConsensusTransactionKind::CapabilityNotificationV1(_) => {}
}
}

Expand Down
6 changes: 0 additions & 6 deletions crates/iota-types/src/messages_consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ pub enum ConsensusTransactionKind {
CapabilityNotificationV1(AuthorityCapabilitiesV1),

NewJWKFetched(AuthorityName, JwkId, JWK),
RandomnessStateUpdate(u64, Vec<u8>), // deprecated
// DKG is used to generate keys for use in the random beacon protocol.
// `RandomnessDkgMessage` is sent out at start-of-epoch to initiate the process.
// Contents are a serialized `fastcrypto_tbls::dkg::Message`.
Expand Down Expand Up @@ -425,11 +424,6 @@ impl ConsensusTransaction {
key.clone(),
)))
}
ConsensusTransactionKind::RandomnessStateUpdate(_, _) => {
unreachable!(
"there should never be a RandomnessStateUpdate with SequencedConsensusTransactionKind::External"
)
}
ConsensusTransactionKind::RandomnessDkgMessage(authority, _) => {
ConsensusTransactionKey::RandomnessDkgMessage(*authority)
}
Expand Down

0 comments on commit 97d85e3

Please sign in to comment.