Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use crate::{
#[rstest]
#[test_log::test(tokio::test)]
#[timeout(Duration::from_secs(2))]
async fn from_pending_to_settle() {
async fn from_pending_to_settled() {
let tmp = TempDBDir::new();
let storage = new_storage(&tmp.path);

Expand Down Expand Up @@ -288,7 +288,7 @@ async fn from_proven_to_settled() {
#[rstest]
#[test_log::test(tokio::test)]
#[timeout(Duration::from_secs(2))]
async fn from_candidate_to_settle() {
async fn from_candidate_to_settled() {
let tmp = TempDBDir::new();
let storage = new_storage(&tmp.path);

Expand Down Expand Up @@ -401,7 +401,7 @@ async fn from_candidate_to_settle() {
#[rstest]
#[test_log::test(tokio::test)]
#[timeout(Duration::from_secs(2))]
async fn from_settle_to_settle() {
async fn from_settled_to_settled() {
let tmp = TempDBDir::new();
let storage = new_storage(&tmp.path);

Expand Down
6 changes: 6 additions & 0 deletions crates/agglayer-storage/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ pub enum Error {

#[error(transparent)]
SettlementCompat(#[from] crate::types::settlement::compat::Error),

#[error(
"Invalid pending certificate height for network {0}: attempted to insert height {1}, but \
latest pending height is {2}"
)]
InvalidPendingHeight(NetworkId, Height, Height),
}

impl From<Error> for CertificateStatusError {
Expand Down
11 changes: 4 additions & 7 deletions crates/agglayer-storage/src/stores/pending/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,10 @@ impl PendingCertificateWriter for PendingStore {
self.get_latest_pending_certificate_for_network(&network_id)?
{
if latest_height > height {
// TODO: This is technically not Candidate error,
return Err(Error::CertificateCandidateError(
crate::error::CertificateCandidateError::UnexpectedHeight(
network_id,
height,
latest_height,
),
return Err(Error::InvalidPendingHeight(
network_id,
height,
latest_height,
));
}
}
Expand Down
Loading