Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(iota-types): Remove ConsensusTransactionKind::RandomnessStateUpdate #3795

Merged
merged 1 commit into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -2383,10 +2383,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 @@ -3427,13 +3423,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
Loading