Skip to content

[BUG] - db-analyser --store-ledger does not store the ledger at the requested slot #1875

@notunrandom

Description

@notunrandom

External

Summary

When a snapshot is produced using db-analyser [...] --store-ledger SLOT_NUMBER, where SLOT_NUMBER contains a block, the resulting snapshot is for an earlier slot.

Steps to reproduce

Steps to reproduce the behavior:

  • install cardano-node 10.5.4 and cardano-cli
  • install db-analyser from corresponding ouroboros-consensus (release-ouroboros-consensus-cardano-0.25.1.1)
  • Download preprod config files from https://book.play.dev.cardano.org/environments/preprod
  • Download mithril snapshot
  • start the node on preprod config files and wait till it is synchronised
  • Use cardano-cli query tip:
{
    "block": 4412526,
    "epoch": 270,
    "era": "Conway",
    "hash": "16f6569272011c12147a7227a6a6a1b1d94df6b6391d3a211b38dd6fbbd882f6",
    "slot": 115135151,
    "slotInEpoch": 136751,
    "slotsToEpochEnd": 295249,
    "syncProgress": "100.00"
}
  • Use that to calculate the last slot of the previous epoch (114998400)
  • Stop the node.
  • Check if there is a block in that last slot with:
db-analyser --db db --analyse-from 108950442 --num-blocks-to-process 1 --count-blocks --v2-in-mem cardano --config conf/config.json`
  • Since there is not, keep trying the previous slot until you found one with a block in it (114998370)
  • Ask db-analyser to produce a snapshot at that slot you found (with a block in it):
db-analyser --db db --v2-in-mem --store-ledger $slot cardano --config conf/config.json`
  • Although the standard output from db-analyser claims to have produced requested snapshot, in fact db/ledger contains 114998312_db-analyser

log.txt

Expected behavior

That the snapshot produced is for the same slot that was requested, if that slot contains at least one block. The db_SLOT_NUMBER/ directory in which the snapshot is placed should correspond.

**System info **

  • OS Name: Ubuntu
  • OS Version: 24.04 aarch64
  • Consensus version: release-ouroboros-consensus-cardano-0.25.1.1

Screenshots and attachments

Cf. attached log

Additional context

In order to produce snapshots from which to bootstrap Amaru we need to be able to snapshot the ledger exactly at the last, non-empty slot of an epoch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    🗓️ Next up

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions