A header says who mined a block, not what they were paid: the amount is remaining supply over an emission divisor plus fees, quantized with dust carried forward, so only the `MinerRewarded` event knows it. Reading it means decoding SCALE against the registry of the runtime that produced the block, and this chain's shapes differ from vanilla Substrate because of the post-quantum signatures. So the chain describes itself. `state_getMetadata` at a block hash executes `Metadata_metadata` against the runtime WASM in that block's state; the v14 registry that comes back drives a decoder that knows nothing about mining, rewards or transfers. `INDEXED_EVENTS` is the only place a name appears — adding transfers or anything the chain grows next is one line and a query, not a migration, a struct and a decoder. Metadata is cached per spec_version, because a node that starts pruning would otherwise make history undecodable. Blocks are tried against the tip's runtime first, which costs no extra call; `decode_events` refuses a partial read, so a block from before an upgrade fails loudly rather than decoding into plausible nonsense, and that failure is what asks which runtime actually produced it. `backfill` walks outward from the tip — to the tip first, then toward genesis — because live indexing alone leaves holes an account page would show: a restart, an RPC blip, a gap fill that ran before the metadata was cached. Progress is a cursor rather than `max(height)`, since a block with no indexed event and a block never read are otherwise the same answer. Verified on mainnet: block 13160's preimage derives, through the same Poseidon2 the chain runs, to exactly the `miner` field of its own reward event — so the header author and the payee join with no lookup table. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Jp6a8EDar9ueEhAxzep4V5
64 lines
2.8 KiB
TOML
64 lines
2.8 KiB
TOML
[workspace]
|
|
resolver = "3"
|
|
members = ["crates/*"]
|
|
|
|
[workspace.package]
|
|
version = "0.1.0"
|
|
edition = "2024"
|
|
rust-version = "1.85"
|
|
license = "GPL-3.0-or-later"
|
|
authors = ["Rob Thijssen <rob@lair.cafe>"]
|
|
repository = "https://git.lair.cafe/Quantus-Network/blackbeard.observer"
|
|
|
|
[workspace.dependencies]
|
|
blackbeard-entities = { path = "crates/blackbeard-entities", version = "=0.1.0" }
|
|
blackbeard-core = { path = "crates/blackbeard-core", version = "=0.1.0" }
|
|
blackbeard-data = { path = "crates/blackbeard-data", version = "=0.1.0" }
|
|
|
|
anyhow = "1"
|
|
axum = { version = "0.8", features = ["ws", "macros"] }
|
|
chrono = { version = "0.4", default-features = false, features = ["clock", "serde", "std"] }
|
|
clap = { version = "4", features = ["derive", "env"] }
|
|
figment = { version = "0.10", features = ["toml", "env"] }
|
|
futures-util = { version = "0.3", default-features = false, features = ["sink", "std"] }
|
|
hex = "0.4"
|
|
# The chain's own description of itself, and a decoder driven by it. This is the
|
|
# alternative to hand-written SCALE readers that rot on every runtime upgrade,
|
|
# and to pulling in subxt or the runtime crate to avoid writing them.
|
|
frame-metadata = { version = "23", default-features = false, features = ["current", "decode"] }
|
|
parity-scale-codec = { version = "3", default-features = false, features = ["derive"] }
|
|
scale-info = { version = "2", default-features = false }
|
|
scale-value = { version = "0.18", default-features = false }
|
|
# The chain's own reward-address derivation, so the observer computes the same
|
|
# account `pallets/mining-rewards` pays rather than guessing or asking.
|
|
qp-poseidon-core = { version = "3.1.0", default-features = false }
|
|
# SS58 checksums only. Base58 is hand-rolled; this is not.
|
|
blake2 = { version = "0.10", default-features = false }
|
|
reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls-native-roots"] }
|
|
rustls = { version = "0.23", default-features = false, features = ["ring", "std", "tls12"] }
|
|
serde = { version = "1", features = ["derive"] }
|
|
serde_json = "1"
|
|
sqlx = { version = "0.8", default-features = false, features = [
|
|
"postgres",
|
|
"runtime-tokio-rustls",
|
|
"macros", "json",
|
|
"migrate",
|
|
"chrono",
|
|
"bigdecimal",
|
|
] }
|
|
bigdecimal = "0.4"
|
|
primitive-types = { version = "0.13", default-features = false }
|
|
thiserror = "2"
|
|
tokio = { version = "1", features = ["full"] }
|
|
tokio-tungstenite = { version = "0.24", default-features = false, features = ["connect", "rustls-tls-native-roots"] }
|
|
tower-http = { version = "0.6", features = ["cors", "trace", "compression-gzip"] }
|
|
tracing = "0.1"
|
|
tracing-subscriber = { version = "0.3", features = ["env-filter", "json"] }
|
|
ts-rs = { version = "10", features = ["serde-compat", "chrono-impl", "no-serde-warnings"] }
|
|
url = "2"
|
|
|
|
[profile.release]
|
|
lto = "thin"
|
|
codegen-units = 1
|
|
strip = "debuginfo"
|