Skip to content

Commit

Permalink
fix(node): move TimestampMs to iota-core and rename it to `CommitTi…
Browse files Browse the repository at this point in the history
…mestampMs`
  • Loading branch information
muXxer committed Oct 30, 2024
1 parent aee559a commit 73e6167
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion crates/iota-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ num-bigint.workspace = true
pretty_assertions.workspace = true
rstest.workspace = true
serde-reflection.workspace = true
tower.workspace = true
serde_yaml.workspace = true
tower.workspace = true

# internal dependencies
iota-move.workspace = true
Expand Down
10 changes: 5 additions & 5 deletions crates/iota-core/src/authority/authority_per_epoch_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ use iota_types::{
authenticator_state::{ActiveJwk, get_authenticator_state},
base_types::{
AuthorityName, CommitRound, ConciseableName, EpochId, ObjectID, ObjectRef, SequenceNumber,
TimestampMs, TransactionDigest,
TransactionDigest,
},
committee::{Committee, CommitteeTrait},
crypto::{AuthoritySignInfo, AuthorityStrongQuorumSignInfo, RandomnessRound},
Expand Down Expand Up @@ -103,7 +103,7 @@ use crate::{
epoch::{
epoch_metrics::EpochMetrics,
randomness::{
DkgStatus, RandomnessManager, RandomnessReporter, SINGLETON_KEY,
DkgStatus, RandomnessManager, RandomnessReporter, SINGLETON_KEY, CommitTimestampMs,
VersionedProcessedMessage, VersionedUsedProcessedMessages,
},
reconfiguration::ReconfigState,
Expand Down Expand Up @@ -598,7 +598,7 @@ pub struct AuthorityEpochTables {
pub(crate) randomness_highest_completed_round: DBMap<u64, RandomnessRound>,

/// Holds the timestamp of the most recently generated round of randomness.
pub(crate) randomness_last_round_timestamp: DBMap<u64, TimestampMs>,
pub(crate) randomness_last_round_timestamp: DBMap<u64, CommitTimestampMs>,
}

fn signed_transactions_table_default_config() -> DBOptions {
Expand Down Expand Up @@ -3839,7 +3839,7 @@ pub(crate) struct ConsensusCommitOutput {
pending_checkpoints: Vec<PendingCheckpoint>,

// random beacon state
next_randomness_round: Option<(RandomnessRound, TimestampMs)>,
next_randomness_round: Option<(RandomnessRound, CommitTimestampMs)>,

dkg_confirmations: BTreeMap<PartyId, VersionedDkgConfirmation>,
dkg_processed_messages: BTreeMap<PartyId, VersionedProcessedMessage>,
Expand Down Expand Up @@ -3917,7 +3917,7 @@ impl ConsensusCommitOutput {
pub fn reserve_next_randomness_round(
&mut self,
next_randomness_round: RandomnessRound,
commit_timestamp: TimestampMs,
commit_timestamp: CommitTimestampMs,
) {
assert!(self.next_randomness_round.is_none());
self.next_randomness_round = Some((next_randomness_round, commit_timestamp));
Expand Down
7 changes: 5 additions & 2 deletions crates/iota-core/src/epoch/randomness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use futures::{StreamExt, stream::FuturesUnordered};
use iota_macros::fail_point_if;
use iota_network::randomness;
use iota_types::{
base_types::{AuthorityName, CommitRound, TimestampMs},
base_types::{AuthorityName, CommitRound},
committee::{Committee, EpochId, StakeUnit},
crypto::{AuthorityKeyPair, RandomnessRound},
error::{IotaError, IotaResult},
Expand All @@ -46,6 +46,9 @@ use crate::{
consensus_adapter::SubmitToConsensus,
};

/// The epoch UNIX timestamp in milliseconds
pub type CommitTimestampMs = u64;

type PkG = bls12381::G2Element;
type EncG = bls12381::G2Element;

Expand Down Expand Up @@ -689,7 +692,7 @@ impl RandomnessManager {
/// be resumed.
pub(crate) fn reserve_next_randomness(
&mut self,
commit_timestamp: TimestampMs,
commit_timestamp: CommitTimestampMs,
output: &mut ConsensusCommitOutput,
) -> IotaResult<Option<RandomnessRound>> {
let epoch_store = self.epoch_store()?;
Expand Down
3 changes: 0 additions & 3 deletions crates/iota-types/src/base_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,6 @@ pub type VersionNumber = SequenceNumber;
/// The round number.
pub type CommitRound = u64;

/// The epoch UNIX timestamp in milliseconds
pub type TimestampMs = u64;

#[derive(Eq, PartialEq, Ord, PartialOrd, Clone, Hash, Default, Debug, Serialize, Deserialize)]
pub struct UserData(pub Option<[u8; 32]>);

Expand Down

0 comments on commit 73e6167

Please sign in to comment.