Skip to content

Commit 29d7c8d

Browse files
authored
Merge pull request #505 from AmbireTech/reject-state-timestamp
RejectState timestamp is always present
2 parents de09b85 + 7ead500 commit 29d7c8d

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

primitives/src/validator.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,15 +330,16 @@ pub mod messages {
330330
}
331331
}
332332

333-
#[derive(Default, Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
333+
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
334334
#[serde(rename_all = "camelCase")]
335335
pub struct RejectState<S: BalancesState> {
336336
pub reason: String,
337337
pub state_root: String,
338338
pub signature: String,
339339
#[serde(flatten, bound = "S: BalancesState")]
340340
pub balances: Option<Balances<S>>,
341-
pub timestamp: Option<DateTime<Utc>>,
341+
/// The timestamp when the [`NewState`] was rejected.
342+
pub timestamp: DateTime<Utc>,
342343
}
343344

344345
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]

validator_worker/src/follower.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,8 @@ async fn on_error<'a, C: Unlocked + 'static>(
321321
state_root: new_state.state_root.clone(),
322322
signature: new_state.signature.clone(),
323323
balances: Some(new_state.balances.clone()),
324-
/// The timestamp when the NewState is being rejected
325-
timestamp: Some(Utc::now()),
324+
// The timestamp when the NewState is being rejected
325+
timestamp: Utc::now(),
326326
})],
327327
)
328328
.await?;
@@ -363,7 +363,7 @@ mod test {
363363
Mock, MockGuard, MockServer, ResponseTemplate,
364364
};
365365

366-
// Initialies a SentryApi instance
366+
// Initializes a SentryApi instance
367367
async fn setup_sentry(server: &MockServer, config: &Config) -> SentryApi<Dummy> {
368368
let sentry_url =
369369
ApiUrl::from_str(&format!("{}/follower", &server.uri())).expect("Should parse");
@@ -978,7 +978,7 @@ mod test {
978978
let reject_state = RejectState {
979979
state_root,
980980
signature: IDS[&*FOLLOWER].to_checksum(),
981-
timestamp: Some(received),
981+
timestamp: received,
982982
reason: "rejected".to_string(),
983983
balances: None,
984984
};

0 commit comments

Comments
 (0)