Expand description
External integration traits: CoinLookup and BlockSigner.
§Requirements trace
- STR-004 — trait definitions, method signatures, object safety.
- NORMATIVE § STR-004 —
CoinLookupuseschia-protocol::CoinStatedirectly;BlockSignerreturnschia-bls::Signature. - SPEC §7.2 — validation context traits.
§Design decisions
-
CoinLookupreturnsOption<CoinState>, notResult: A missing coin is a normal validation condition (Tier 3 checks for ephemeral coins — STV-002), not an I/O error. Implementors that wrap a database should map DB errors toNoneor propagate them through a higher-level API. -
CoinStatefromchia-protocol: Reuses the same type Chia’s peer protocol returns forregister_for_coin_updatesresponses (chia_protocol::CoinState). This meansdig-coinstorecan implementCoinLookupwithout type conversion. Reference:chia-blockchain/chia/protocols/wallet_protocol.py. -
BlockSigneris object-safe: Both traits can be used asdyn CoinLookup/dyn BlockSignerso validation and builder code can be generic over the signing backend (HSM, in-memory key, remote signer). -
SignerError: Kept minimal (one variant) because the signing failure reason is opaque to block validation — it only matters for logging.crate::BlockBuilder::buildmaps failures toBuilderError::SigningFailedusing [SignerError::to_string] (BLD-006 / ERR-004 — theBuilderErrorvariant carries aString, not a nestedSignerError, so integration tests assert diagnostic text rather than type equality).
§Downstream implementors
dig-coinstore ──► implements CoinLookup (returns chia-protocol::CoinState)
proposer ──► implements BlockSigner (returns chia-bls::Signature)
tests/common ──► MockCoinLookup, MockBlockSigner (STR-005)Enums§
- Signer
Error - Signing failure from a
BlockSignerimplementation.
Traits§
- Block
Signer - Block header signing hook for [
crate::builder::BlockBuilder::build] (SPEC §7.2, BLD-006). - Coin
Lookup - Coin state lookup for Tier 3 (state) validation (SPEC §7.2, STV-001).