Skip to content

Commit eaa9cc4

Browse files
committed
mtc_worker: Put landmark checkpoint in object storage
The landmark checkpoint is also part of the landmark bundle, but the landmark bundle is not a standard API and is only intended to be consumed by our internal infrastructure. Relying parties consume the landmark checkpoint as a TLOG note.
1 parent 5fead70 commit eaa9cc4

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

crates/mtc_api/src/landmark.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,13 @@ pub struct LandmarkSequence {
99
pub landmarks: VecDeque<u64>,
1010
}
1111

12-
/// The location in object storage for the landmark sequence
12+
/// The location in object storage for the landmark sequence.
1313
pub const LANDMARK_KEY: &str = "landmark";
1414

15-
/// The location in object storage for the landmark bundle. Its serialized form is JSON
15+
/// The location in object storage for the landmark checkpoint.
16+
pub const LANDMARK_CHECKPOINT_KEY: &str = "landmark-checkpoint";
17+
18+
/// The location in object storage for the landmark bundle. Its serialized form is JSON.
1619
pub const LANDMARK_BUNDLE_KEY: &str = "landmark-bundle";
1720

1821
impl LandmarkSequence {

crates/mtc_worker/src/sequencer_do.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ use generic_log_worker::{
1212
CachedRoObjectBucket, CheckpointCallbacker, GenericSequencer, ObjectBucket, SequencerConfig,
1313
SEQUENCER_BINDING,
1414
};
15-
use mtc_api::{BootstrapMtcLogEntry, LandmarkSequence, LANDMARK_BUNDLE_KEY, LANDMARK_KEY};
15+
use mtc_api::{
16+
BootstrapMtcLogEntry, LandmarkSequence, LANDMARK_BUNDLE_KEY, LANDMARK_CHECKPOINT_KEY,
17+
LANDMARK_KEY,
18+
};
1619
use serde::{Deserialize, Serialize};
1720
use serde_with::{base64::Base64, serde_as};
1821
use signed_note::Note;
@@ -139,6 +142,12 @@ fn checkpoint_callback(env: &Env, name: &str) -> CheckpointCallbacker {
139142
.await?;
140143
}
141144

145+
// Update the landmark checkpoint.
146+
bucket_clone
147+
.put(LANDMARK_CHECKPOINT_KEY, new_checkpoint_str.clone())
148+
.execute()
149+
.await?;
150+
142151
// Compute the landmark bundle and save it
143152
let subtrees =
144153
get_landmark_subtrees(&seq, root_hash, tree_size, bucket_clone.clone())

0 commit comments

Comments
 (0)