Page MenuHomePhabricator

[Chronik] Add `TokenWriter` and `TokenReader`
ClosedPublic

Authored by tobias_ruck on Dec 28 2023, 20:04.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC79026e75747f: [Chronik] Add `TokenWriter` and `TokenReader`
Summary

Parses, colors, verifies and indexes ALP/SLP tokens in a batch (i.e. block).

This doesn't change the behavior of Chronik yet, which will come in a future diff.

Details about the indexing strategy and tradeoffs can be found in the doc comment of TokenWriter.

Depends on D15046 and D15047.

Test Plan

cargo test -p chronik-db

Diff Detail

Repository
rABC Bitcoin ABC
Branch
chronik-slp-token-writer
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 26156
Build 51885: Build Diffchronik-client-integration-tests · build-chronik
Build 51884: arc lint + arc unit

Event Timeline

I forgot to handle unknown tokens (they are simply ignored which is not good)

  • redesign the DB to include unknown tokens
  • split tests into multiple files
Fabien requested changes to this revision.Jan 2 2024, 19:36

You're missing tests for explicit BURN on both SLP and ALP

chronik/chronik-db/src/io/token/batch.rs
102 ↗(On Diff #43800)

that's neat !

110 ↗(On Diff #43800)

Please comment that GENESIS is guaranteed to be at first position and this is checked during the coloring step

346 ↗(On Diff #43800)

nit: you can avoid the flag variable

chronik/chronik-db/src/io/token/io.rs
118 ↗(On Diff #43800)

that's unusual

chronik/chronik-db/src/io/token/tests/mock.rs
1 ↗(On Diff #43800)

missing copyright

This revision now requires changes to proceed.Jan 2 2024, 19:36

update copyrights to 2024, add BURN tests and add a comment about GENESIS for has_any_genesis

Put this on hold while we resolve the mint vault spec…

Discussion with Cyprian concluded, and the spec will match our implementation here.

This revision is now accepted and ready to land.Jan 5 2024, 09:19