Repository navigation
Commit 8982803
committed
params%feat!: validate chain parameters against RPCs, add the spork address and the LLMQ allowlist (#84)
* [54785cf] params%test: check genesis and deployments against the reference RPCs (pasta)
* [5db4c51] params%fix: give regtest the placeholder DNS seed (pasta)
* [8ed53b4] params%feat!: add the spork address (pasta)
* [3374dc8] params%feat!: add the LLMQs each chain runs (pasta)
Description:
`````
## Motivation
`dash-params` holds the chain parameters of mainnet, testnet and regtest as static tables. Their values match the reference implementation (`dashpay/dash` [`v24.0.0-rc.3`](https://github.com/dashpay/dash/tree/0364ed626ec2eaa518bf1ae4a0566ce638c7fe18)) except that:
- regtest has no DNS seed, where the reference implementation lists a placeholder;
- the spork address of each chain is missing;
- a chain does not say which LLMQ types it runs, so a caller cannot tell which entries of the LLMQ table apply to it.
Nothing compares the tables with the reference implementation either.
This pull request adds the missing parameters, and checks the ones the reference implementation reports over RPC against its output. The corpus holds the output of three RPCs at the genesis block of each chain, each entry under the command that produced it. The node of each chain runs with an empty data directory and no connections:
```
dashd -chain=<chain> -connect=0 -listen=0 -dnsseed=0 -fixedseeds=0 -daemon
dash-cli -chain=<chain> getblockheader "$(dash-cli -chain=<chain> getblockhash 0)"
dash-cli -chain=<chain> getdeploymentinfo
dash-cli -chain=<chain> quorum list
```
`<chain>` is `main`, `test` or `regtest`. The test builds the output it expects from the parameters and compares it with each entry. Values that no RPC reports, such as the DNS seeds, the spork address and the parameters of each LLMQ type, are not in the corpus.
## Additional Information
| Description | Notes | Reference implementation | Corpus |
| ----------- | ----- | ------------------------ | ------ |
| Check the genesis and deployments against the reference implementation's RPCs | The hash, version, time, nonce and bits of each genesis block are compared with `getblockheader`, and the `genesis_valid` test of `dash-primitives` already checks that the block built from the genesis parameters has that hash. The height of every buried deployment, and the start time, timeout, EHF flag and minimum activation height of every BIP9 deployment, are compared with `getdeploymentinfo`. A BIP9 deployment that never activates is not reported, so its start time must say so. | [getblockheader](https://github.com/dashpay/dash/blob/0364ed626ec2eaa518bf1ae4a0566ce638c7fe18/src/rpc/blockchain.cpp#L607-L678), [getdeploymentinfo](https://github.com/dashpay/dash/blob/0364ed626ec2eaa518bf1ae4a0566ce638c7fe18/src/rpc/blockchain.cpp#L1664-L1693), [deployments](https://github.com/dashpay/dash/blob/0364ed626ec2eaa518bf1ae4a0566ce638c7fe18/src/rpc/blockchain.cpp#L1445-L1537), [names](https://github.com/dashpay/dash/blob/0364ed626ec2eaa518bf1ae4a0566ce638c7fe18/src/deploymentinfo.cpp#L9-L60), [reported](https://github.com/dashpay/dash/blob/0364ed626ec2eaa518bf1ae4a0566ce638c7fe18/src/deploymentstatus.h#L53-L63) | `chainparams.json5` `genesis`, `deployments` |
| Give regtest the placeholder DNS seed | `dummySeed.invalid.` never resolves, as `.invalid` is a reserved top-level domain. | [seeds](https://github.com/dashpay/dash/blob/0364ed626ec2eaa518bf1ae4a0566ce638c7fe18/src/chainparams.cpp#L889-L890) | — |
| Add the spork address | `ChainParams::spork_address` is the address of the key that signs sporks. It is kept as the address string, as the reference implementation keeps it. | [mainnet](https://github.com/dashpay/dash/blob/0364ed626ec2eaa518bf1ae4a0566ce638c7fe18/src/chainparams.cpp#L302), [testnet](https://github.com/dashpay/dash/blob/0364ed626ec2eaa518bf1ae4a0566ce638c7fe18/src/chainparams.cpp#L505), [regtest](https://github.com/dashpay/dash/blob/0364ed626ec2eaa518bf1ae4a0566ce638c7fe18/src/chainparams.cpp#L904) | — |
| Add the LLMQs each chain runs | `ConsensusParams::llmqs` lists the types a chain runs, in the reference implementation's order. `ConsensusParams::llmq` returns the parameters of one of them, and `None` for a type the chain does not run, as the reference implementation's lookup does. `quorum list` reports the types enabled at the tip, so at the genesis block it lists some of them, and each must be one the chain runs. | [lookup](https://github.com/dashpay/dash/blob/0364ed626ec2eaa518bf1ae4a0566ce638c7fe18/src/chainparams.cpp#L132-L153), [mainnet](https://github.com/dashpay/dash/blob/0364ed626ec2eaa518bf1ae4a0566ce638c7fe18/src/chainparams.cpp#L281-L285), [testnet](https://github.com/dashpay/dash/blob/0364ed626ec2eaa518bf1ae4a0566ce638c7fe18/src/chainparams.cpp#L483-L488), [regtest](https://github.com/dashpay/dash/blob/0364ed626ec2eaa518bf1ae4a0566ce638c7fe18/src/chainparams.cpp#L949-L953), [quorum list](https://github.com/dashpay/dash/blob/0364ed626ec2eaa518bf1ae4a0566ce638c7fe18/src/rpc/quorums.cpp#L50-L107) | `chainparams.json5` `quorums` |
## Breaking Changes
Changes below for `dash-params`.
- `ChainParams` has the new field `spork_address`.
- `ConsensusParams` has the new field `llmqs`.
## How Has This Been Tested?
```
just comb
```
`just comb` (`just test lint fuzz::test`, CodeQL 2.27.2 included) passed on every commit, on `develop` (3153d6f), on x86_64 Linux.
Each corpus entry is the output of the command above it, run against the reference implementation at the pin.
## Checklist
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] I have added or updated relevant unit/integration/functional tests
- [x] I have made corresponding changes to the documentation
- [ ] I did not use agentic assistance (i.e. LLMs, AI) except as [disclosed](#agent-disclosure) and can answer questions,
comments and concerns without said assistance. I assume authorship of the code submitted.
- [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_
### Agent disclosure
Code, tests, commit messages and this description were generated with Claude Code using Claude Opus 5.5, running autonomously as an agent on behalf of the author. The agent also ran the reference implementation to produce the corpus. The branch was reviewed by a Claude Code agent using Opus 5.5.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
`````10 files changed
Lines changed: 617 additions & 5 deletions
File tree
- pkgs/params
- corpus
- src
- params
- tests
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
34 | 39 | | |
35 | 40 | | |
36 | 41 | | |
| |||
0 commit comments