mirror of
https://github.com/logos-blockchain/logos-execution-zone.git
synced 2026-07-15 10:20:01 +00:00
fix(sequencer): fix copilot reviews
This commit is contained in:
parent
7c3043119b
commit
26750f6d9b
@ -66,13 +66,19 @@ Shared types moved into the crate: `AcceptOutcome`, `BlockIngestError`,
|
||||
`StallReason`, and `Tip`.
|
||||
|
||||
```rust
|
||||
struct Tip { block_id: u64, hash: HashType, l1_slot: Slot }
|
||||
struct Tip { block_id: u64, hash: HashType }
|
||||
|
||||
enum AcceptOutcome { Applied, AlreadyApplied, Parked(BlockIngestError) }
|
||||
enum AcceptOutcome {
|
||||
Applied,
|
||||
AlreadyApplied,
|
||||
Parked(BlockIngestError),
|
||||
RetryableFailure(BlockIngestError),
|
||||
}
|
||||
```
|
||||
|
||||
`Tip` carries `l1_slot` (recorded atomically with the tip) because the anchor /
|
||||
chain-consistency logic keys on the inscription slot, not just `(id, hash)`.
|
||||
`Tip` will additionally carry `l1_slot` once the anchor layer lands (recorded
|
||||
atomically with the tip), because the anchor / chain-consistency logic keys on
|
||||
the inscription slot, not just `(id, hash)`.
|
||||
|
||||
## 4. The two-tier `ChainState`
|
||||
|
||||
|
||||
@ -487,7 +487,9 @@ impl RocksDBIO {
|
||||
if !first {
|
||||
let last_curr_block = self.get_meta_last_block_in_db()?;
|
||||
|
||||
if block.header.block_id > last_curr_block {
|
||||
// `>=` so a same-height overwrite (a reorg replacing the tip block)
|
||||
// also refreshes the tip hash in `latest_block_meta`.
|
||||
if block.header.block_id >= last_curr_block {
|
||||
self.put_meta_last_block_in_db_batch(block.header.block_id, batch)?;
|
||||
self.put_meta_latest_block_meta_batch(
|
||||
&BlockMeta {
|
||||
|
||||
@ -105,4 +105,10 @@ fn store_followed_block_overwrites_competing_block_at_same_id() {
|
||||
assert_eq!(stored.header.hash, block2b.header.hash);
|
||||
assert!(matches!(stored.bedrock_status, BedrockStatus::Pending));
|
||||
assert_eq!(stored_balance(&dbio), 300);
|
||||
|
||||
// The tip meta must follow the reorg winner, or a restart seeds the chain
|
||||
// from the orphaned block's hash.
|
||||
let meta = dbio.latest_block_meta().unwrap();
|
||||
assert_eq!(meta.id, 2);
|
||||
assert_eq!(meta.hash, block2b.header.hash);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user