fix(store,gui,package): every reader that derives facts reads the committed journal (P15 T1 review)
A failed call's ids are handed out again (nothing it wrote counted), so a reader of the raw journal pins dead lines on whatever takes the id next: a failed books.create_bill for entry 42 then a manual entry 42 showed as a Bill. One accessor, calls::committed (lines outside a call and of calls that closed ok, the frame left out), now feeds the viewer's books (entry events and origin, asset trails, party events), the package feed attention reads, and the adopt preview's settings check. The journal page and journal_history keep every line and say in words of each line of a call that failed, never finished or is still running that it did not count. A call's closing line is now bounded (ANSWER_CAP 4 KiB: above it, the answer's SHA-256 and length), a call that wrote no line leaves no line (its key and answer live in a bounded in-memory table), and the journaled argument digest is an HMAC under the books' own call key, so two requests that differ only in a tax id are two requests and nothing journaled lets a guess of one be tested. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
e542319e63
commit
d4c0036599
11 files changed
+950
-120
No files matched your search
@@ -9,7 +9,7 @@
|
||||
//! INVARIANTS:
|
||||
//! 1. Every method only reads.
|
||||
//! 2. A Store and a Snapshot of the same journal answer every method
|
||||
//! alike: the same ledger, settings, journal, journal seq,
|
||||
//! alike: the same ledger, settings, committed journal, journal seq,
|
||||
//! attachments (withdrawn ones included), bytes, statements, and
|
||||
//! reconciliations, and the same entry links once the filing entry
|
||||
//! is added (a store lists it in `links_of`; a snapshot only lists
|
||||
@@ -39,8 +39,12 @@ pub trait PackageBooks {
|
||||
/// package reflects.
|
||||
fn journal_seq(&self) -> u64;
|
||||
|
||||
/// Every journal line, in order: what an entry's origin and its events
|
||||
/// are read from.
|
||||
/// The committed journal, in order: what an entry's origin and its
|
||||
/// events are read from. Only the lines that are facts of the books
|
||||
/// (ledger_store::calls::committed): the lines of a call that failed or
|
||||
/// never finished are not here, because ids are handed out again after
|
||||
/// a failed call and a reader that took them would pin dead lines on
|
||||
/// whatever takes the id next (WB-format-12).
|
||||
fn journal(&self) -> Result<Vec<JournalLine>, StoreError>;
|
||||
|
||||
/// Every attachment (receipts and documents), withdrawn ones
|
||||
@@ -83,9 +87,10 @@ impl PackageBooks for Store {
|
||||
}
|
||||
|
||||
fn journal(&self) -> Result<Vec<JournalLine>, StoreError> {
|
||||
ledger_store::journal::read_and_verify_journal(
|
||||
let lines = ledger_store::journal::read_and_verify_journal(
|
||||
&Store::data_dir(self).join(ledger_store::JOURNAL_FILE),
|
||||
)
|
||||
)?;
|
||||
ledger_store::calls::committed(&lines)
|
||||
}
|
||||
|
||||
fn all_attachments(&self) -> Result<Vec<Attachment>, StoreError> {
|
||||
@@ -134,7 +139,7 @@ impl PackageBooks for Snapshot {
|
||||
}
|
||||
|
||||
fn journal(&self) -> Result<Vec<JournalLine>, StoreError> {
|
||||
Ok(Snapshot::journal(self).to_vec())
|
||||
Snapshot::committed_journal(self)
|
||||
}
|
||||
|
||||
fn all_attachments(&self) -> Result<Vec<Attachment>, StoreError> {
|
||||
|
||||
Reference in new issue
Block a user