From e1f259ca9b359ae03535cd116ba414a20cecd99f Mon Sep 17 00:00:00 2001 From: Santiago Carmuega Date: Fri, 15 Mar 2024 13:01:29 -0300 Subject: [PATCH 1/2] docs: draft ADR for extra ledger queries --- adrs/_draft_001_extra_ledger_queries.md | 72 +++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 adrs/_draft_001_extra_ledger_queries.md diff --git a/adrs/_draft_001_extra_ledger_queries.md b/adrs/_draft_001_extra_ledger_queries.md new file mode 100644 index 00000000..48d62612 --- /dev/null +++ b/adrs/_draft_001_extra_ledger_queries.md @@ -0,0 +1,72 @@ +### Rationale + +There are ledger queries that are strictly required for validation and consensus of the chain, we consider these "core queries". There's another group of queries that are not strictly required for validation (at least in the current state of affairs) but are useful for dApps using Dolos as data-source, we consider these "extra queries". + +### Use cases +These are what we _assume_ as potential use-cases that we want to support: + +- get chain tip (last block) for defining validity periods +- get chain parameters for building txs +- get utxos from a particular address for coin selection algorithms +- get utxo by reference to resolve inputs of past txs +- get tx by hash for traceability purposes +- get block by hash for traceability purposes +- get utxo by beacon (nft) for distributed app tx building + +### Use cases that need refinement: +These are some other use-cases that might be useful but need further discussion. + +- get utxo that hold a particular datum? +- get datum by hash? +- get script by hash? +- get epoch info? + +### Out-of-scope +We won't include queries for the following areas of the ledger since we don't consider them a priority at this stage. + +- Staking +- Rewards / Withdrawals +- Pool info + +```mermaid +erDiagram + Utxo { + bytes hash_index pk + bytes cbor + } + + Tx { + bytes hash pk + bytes cbor + } + + Block { + bytes hash pk + bytes cbor + } + + PParams { + bytes slot pk + bytes cbor + } + + UtxoByAddress { + bytes address pk + } + UtxoByAddress ||--|{ Utxo: hash_index + + UtxoByStake { + bytes hash pk + } + UtxoByStake ||--|{ Utxo: hash_index + + UtxoByBeacon { + bytes hash pk + } + UtxoByBeacon ||--|{ Utxo: hash_index +``` + +### Entities that need refinement + +- Datum +- Scripts From bcf38f64124259ef4d9841978aeb5b3f74103e57 Mon Sep 17 00:00:00 2001 From: Santiago Carmuega Date: Fri, 15 Mar 2024 13:03:37 -0300 Subject: [PATCH 2/2] improve md --- adrs/_draft_001_extra_ledger_queries.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/adrs/_draft_001_extra_ledger_queries.md b/adrs/_draft_001_extra_ledger_queries.md index 48d62612..e56d00b8 100644 --- a/adrs/_draft_001_extra_ledger_queries.md +++ b/adrs/_draft_001_extra_ledger_queries.md @@ -1,8 +1,10 @@ -### Rationale +# ADR 001 (Draft) - Extra Ledger Queries + +## Rationale There are ledger queries that are strictly required for validation and consensus of the chain, we consider these "core queries". There's another group of queries that are not strictly required for validation (at least in the current state of affairs) but are useful for dApps using Dolos as data-source, we consider these "extra queries". -### Use cases +## Use cases These are what we _assume_ as potential use-cases that we want to support: - get chain tip (last block) for defining validity periods @@ -13,7 +15,7 @@ These are what we _assume_ as potential use-cases that we want to support: - get block by hash for traceability purposes - get utxo by beacon (nft) for distributed app tx building -### Use cases that need refinement: +## Use cases that need refinement: These are some other use-cases that might be useful but need further discussion. - get utxo that hold a particular datum? @@ -21,13 +23,15 @@ These are some other use-cases that might be useful but need further discussion. - get script by hash? - get epoch info? -### Out-of-scope +## Out-of-scope We won't include queries for the following areas of the ledger since we don't consider them a priority at this stage. - Staking - Rewards / Withdrawals - Pool info +## Model + ```mermaid erDiagram Utxo {