Skip to content
This repository has been archived by the owner on Jan 24, 2025. It is now read-only.

Add optional check when starting engine about correctness of last commitment and ledger state #803

Merged
merged 18 commits into from
Mar 14, 2024

Conversation

polinikita
Copy link
Member

This PR is supposed to cover two issues: #707 and #708

Upon starting an engine, and loading data into storage, it optionally triggers the check of the commitment and the ledger state. Once triggered, it then verifies the ledger state against the commitment and recomputes the latest commitment to ensure that the commitment fields correspond to the commitment ID.

It requires accessing the roots of the latest commitment, so when creating a snapshot for a certain slot, we additionally store all the roots of the respective commitment (unless the genesis slot). When loading a snapshot, we additionally import the roots (unless the genesis slot).

One suite test is included to check the correctness of the whole logic.

@polinikita polinikita added the team-consensus Issues for Consensus Team label Mar 4, 2024
@polinikita polinikita requested a review from piotrm50 March 4, 2024 12:32
@polinikita polinikita marked this pull request as ready for review March 5, 2024 14:19
pkg/protocol/protocol.go Outdated Show resolved Hide resolved
pkg/tests/engine_check_ledger_state_commitment_test.go Outdated Show resolved Hide resolved
pkg/protocol/engine/engine.go Show resolved Hide resolved
pkg/protocol/options.go Outdated Show resolved Hide resolved
@piotrm50 piotrm50 enabled auto-merge March 14, 2024 15:36
@piotrm50 piotrm50 merged commit f5b974b into develop Mar 14, 2024
4 checks passed
@piotrm50 piotrm50 deleted the feat/check-last-commitment-upon-startup branch March 14, 2024 15:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add option to validate snapshot after download Add optional ledger state verification on startup
4 participants