Real Requant blocks in the lab
A model can drift from the code it describes. Requant Lab closes that gap for Requant in two ways: the model's difficulty rule is checked against Requant's consensus bit for bit, and a protocol mode replaces the model's blocks with real Requant regtest blocks that every simulated node checks with Requant's own code.
The adapter
- Requant's consensus at a pinned commit. The adapter builds
requant-consensusfrom requant-network/requant at a9ce4d0 in a separate workspace with its own lock file; the lab's core engine is built without Requant. Moving the pin is a new adapter version and a new run of all its checks. - A node is a real chain with its own clock. Each simulated node keeps an upstream
Chain. A block reaches it through the fullChain::accept(block, now), wherenowis the virtual time plus that node's clock skew; no shortcut that skips validation is used. - Blocks are built the way the node builds them. A found block is made from the upstream template on the branch it extends, and a real TNet claim is searched with that branch's epoch weights. The nonce search starts at zero, so a run repeats bit for bit.
Who decides what
| Part | Decided by |
|---|---|
| When a block is found, by whom, on which parent | The lab's engine: exponential waiting time by power and target, pool work, delays |
| Delivery, partitions, outages, noise, queues, ancestor requests | The lab's engine, as in the model |
| Block contents, claim, target, reward, development fund, epoch | The adapter, from the upstream template on the real branch |
| Accept or reject a block, and why | The node's real Chain, by its own clock |
| Which block is the node's tip | The node's real Chain; the engine follows its choice |
Coverage
| Area | Protocol mode (regtest) | Lab model |
|---|---|---|
| Difficulty | exact: upstream next_target inside Chain::accept | asert-v1 equals upstream on whole seconds; the model counts microseconds |
| Reward, fund, issuance | exact: reward, fund share, issuance by branch | modeled: a fixed reward, no Requant schedule |
| Proof of work | exact: real TNet claims of the reduced regtest profile | modeled: a probabilistic search |
| Fork choice | exact: each Chain chooses its own branch | modeled: most work |
| Timestamps | exact: median of past and the +7200 s limit by the node's clock | the block's time is the exact time of the find |
| Transactions and mempool | exact: real signed transfers with UTXOs, change and fees through each node's upstream Mempool | modeled: a flow with sizes and fees, no signatures or UTXOs |
| Peer-to-peer and sync | modeled: by the lab's engine | modeled |
| Reorganisation policy | exact: set_max_reorg and min_chain_work | not modeled |
| Epochs | exact: epoch_seed along its own branch, regtest 16/4 | not modeled |
Checks
- ASERT, model against upstream. For the
testandregtestnetworks, seven heights from 0 to 4·10⁹ and more than 500 offsets from the schedule (fractions of a period, the network's limit above, a shift of more than 1024 periods below), the model's next target equals Requant's. Anchor: the genesis target; interval 60 s; half-life 7200 s. - R01, clocks. A block stamped 7300 s ahead is rejected by both nodes; a node with a correct clock accepts it 100 s later, a node three hours behind only when its clock reaches the stamp. A corrupted claim is rejected.
- R02, epochs. Branches that split before the anchor of epoch 1 have different epoch-1 seeds and a common epoch-0 seed; after they join, a node moves to the branch with more work.
- R03, issuance. Each coinbase pays the reward of its own branch's issuance and the fund share by height; after a reorganisation both nodes report the issuance of the new branch.
- R04, reorganisation limit. The same deep fork is rejected by a synchronized node with a limit of 3 and accepted by a node that has not reached the minimum chain work.
Reference scenarios
- R01, partition and recovery: the network splits, both sides mine real blocks, and after healing the nodes converge with real rejections and reorganisations.
- R02, node clocks and the reorganisation limit: a node whose clock runs ahead, and
max_reorgper node. - R03, transactions: real signed transfers that enter through chosen nodes and pass the nodes' mempools.
They open in the lab's TOML editor and run on the server; the browser does not compute protocol mode.
Calibration
The adapter can measure how fast a machine searches TNet tickets the way a real miner does, so a measured rate can be used as the model's power.
| Machine, one core | regtest (n 256, 4 layers), tickets/s | test (TNet v1, n 8192, 8 layers), tickets/s | A test block at genesis difficulty (2^27 tickets) |
|---|---|---|---|
| AMD Ryzen 7 8745HS | 20,530 | 1,218 | about 30.6 h |
| AMD EPYC 9654, one-core service limit, 2 GiB | 12,848 | 967 | about 38.5 h |
That is why real claims are searched for regtest only: a block of the full test profile takes more than a day on one CPU core. The rules of test are checked where it is cheap, as with ASERT above. In the protocol mode one real regtest block takes 13-20 ms.
Boundaries
- The node runtime is not run. In Requant's node, time comes from the operating system and networking and the mempool live in the node's process; in the lab, delivery is the engine's. There is no connection to live peers, wallets or the test network.
- The pin predates later releases. Rules added after commit
a9ce4d0, including node 0.18.0's relative difficulty from testnet height 8020, are not covered until the pin moves. - Regtest, not test. Proof-of-work work in protocol mode is the reduced regtest profile; it shows the rules, not mining costs.