Skip to content

Tree versions, block rules and the sigma-rust fork at a7656774 - #35

Merged
mwaddip merged 46 commits into
mainfrom
fix/sigma-evaluated-values
Nov 11, 2026
Merged

mwaddip merged 46 commits into
mainfrom
fix/sigma-evaluated-values

Conversation

@mwaddip

@mwaddip mwaddip commented Nov 11, 2026

Copy link
Copy Markdown
Owner

The node now pins the sigma-rust fork's master at a7656774, moving off the eni line at 0bd7199f. The fork reads and writes a transaction at an ErgoTree version, so the node names that version wherever the JVM fixes one: a block's transactions at the version their section is written at, a peer's transaction at the activated script version, box bytes at 0. The rule lives once in enr_chain. Among the fork's fixes, a lambda now shares its environment instead of copying it: block 1,379,778, which took the node to 56 GB, now validates in 42 MB.

Block rules 306 and 400–406 are checked. An epoch-boundary block's transactions validate under its boundary parameters, and the parent's extension is kept as deep as the state's rollback. Transaction JSON round-trips: a rendered transaction writes its values at its id's version, a pool entry carries that version, and POST /transactions and /check read the api's own request type, built at the activated version with id required and checked. fastsync asks for 15 ids per headerIds request.

One session now maintains the repo: the per-crate CLAUDE.md files fold into the root one, and SPECIAL.md moves to the root.

Checked:

  • workspace tests 1327/1327, clippy -D warnings, fmt --check; both addons the same
  • testnet from genesis to tip on 920419cb, and mainnet from genesis to tip on 4e1d0f44: no errors, no rejected blocks, peak RSS 6.6 GiB
  • mainnet node at tip on a7656774 since 2026-11-11 21:30

🤖 Generated with Claude Code

mwaddip and others added 30 commits September 30, 2026 01:03
… at 0

The fork at 3b23f47e reads and writes a transaction at a tree version,
and the version decides what parses and what a transaction's id is.
Pin the JVM's rules:

- A block's transactions are read at 3 from block version 4, at 0 below
  (BlockTransactionsSerializer.parse), and written at 3 from block
  version 3 (its serializer). One definition, in enr-chain.
- Pool transactions are read at the activated script version, and the
  ones the node relays are written at it.
- UTXO insert values, fee-box measurement and the indexer's box bytes are
  ErgoBox::bytes(), written at 0, as the JVM's ErgoBox.bytes is.

The JVM's one-block exception for the retired testnet is left out on
purpose: no network the node joins can hold that block.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fork PR #51: context-extension and register values parse as the JVM's
EvaluatedValue (board item #16), plus the parse-conformance fixes since
ae29ba13. The fork's crates move to the 0.30 line; core2 becomes core3.

All nine manifests move together, the two addons included. The node
does not yet read or write at the tree versions the fork now honours;
that lands in the crates next (facts/chain.md § "The tree version a
block's transactions are read at").

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…on encodes

The fork reads a transaction at its reader's tree version and computes
its id there. section_id_from_body read every 102 body at 0, so a v4
block whose transactions read differently at 3 (an Upcast of a constant
in a register or context-extension value) got another transactions root
and failed to bind. The JVM reads a v4 block's transactions at (3, 3)
(BlockTransactionsSerializer.parse).

- block_transactions_read_version, block_transactions_write_version and
  activated_tree_version state the three version rules once, exported
  from the crate root, with tests pinned to the JVM's table.
- section_id_from_body reads each transaction at
  block_transactions_read_version of the section's own block version.
- The section tests build SANTA X15, Tuple(1, Upcast(1, Long)), as a
  context-extension value: a v4 section binds under the root its header
  computes at 3, the same bytes read at 0 do not, and a v3 section with
  the same transaction is read at 0. The tests' body serializer writes
  at the JVM's write version.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The fork reads a transaction at its reader's tree version and computes
the id there; the pool read every peer transaction at 0. The JVM reads
them at the activated script version, 3 since 6.0
(parseAndProcessTransaction, withVersions(activatedScriptVersion, ..)).

parse_pool_transaction reads at enr_chain::activated_tree_version of the
state context's block version. Its test pins the chain crate's X15
vector: the same bytes give the Upcast-kept id at block version 4 and
the Upcast-dropped id at block version 1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ions

The fork writes at a tree version, and sigma_serialize_bytes() writes at
its highest, 3, for everything.

- fastsync writes a block's transactions at the block's write version,
  3 from block version 3 and 0 below, as the JVM's block serializer
  does. It keeps a copy of enr_chain::block_transactions_write_version,
  being outside the workspace.
- The indexer's box-bytes endpoint serves ErgoBox::bytes(), the box as
  the JVM writes it at 0, whose hash is the box id. At 3 a register's
  Upcast of a constant stays, and the hash is not the box id.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The version functions return 3 from block version 4 on. The JVM would
read and write a v5 block at (4, 4); the two part only where a version-4
box tree meets VersionContext's ergoTreeVersion <= activatedVersion
check. No v5 exists; a v5 soft-fork moves the fork and these functions
together. Raised by the chain session.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…version, insert boxes at 0

The fork at 3b23f47e reads and writes a transaction at a tree version and
computes its id at the version it read it at. Three sites here mixed the
defaults, and two of them fork us off a v4 block holding an Upcast of a
constant:

- parse_block_transactions read every block at 0. It reads each
  transaction at enr_chain::block_transactions_read_version of the version
  the section encodes (3 from block version 4), as section_id_from_body
  does, and rejects a block version that does not fit u8 as that does.
- The UTXO insert value was sigma_serialize_bytes(), written at 3. It is
  ErgoBox::bytes(), written at 0 as the JVM's ErgoBox.bytes is, the bytes
  the box id hashes. apply_state, insertions_of_block and
  proofs_for_transactions all reach it through transactions_to_summaries.
- serialize_block_transactions wrote every block at 3. It writes at
  block_transactions_write_version (3 from block version 3), on one writer.

Boxes read back from the state stay at 0, and the fork keeps the slice it
read, so their bytes() are the stored bytes.

The tests pin SANTA X15, Tuple(1, Upcast(1, Long)), in a context extension
and in an output's R4, with every id computed off the wire layout: sections
read at 3 and at 0 (the ids enr-chain pins), the writer at 3 and at 0, the
insert value, a retained box slice, and a v4 block applied end to end under
the state root its output written at 0 gives.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
a623dea made enr-chain a path dependency of ergo-validation, for the
tree-version functions; the lock line came with it but sat outside the
crate session's boundary.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s with chain's

Decisions on the validation session's report (a623dea):

- ParsedBlockTransactions.block_version and serialize_block_transactions'
  block_version are u8. The parser already rejects anything larger, so
  the type states it instead of every caller converting.
- parse_block_transactions rejects a zero count and trailing bytes, as
  section_id_from_body does; the two parsers agree on every input.
- The serializer writes the version sentinel only above block version 1,
  as the JVM does.
- enr-chain joins the dependencies. The Insert Values citation names the
  JVM's first read of ErgoBox.bytes (UtxoState.scala:77), and the known
  gap in ergo-lib's verify_output, which measures outputs at 3.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…h chain's

Main's decisions on a623dea (facts/validation.md, 4133f6b):

- ParsedBlockTransactions.block_version and serialize_block_transactions'
  block_version are u8. The parser already rejected anything larger; the
  type now says so, and the serializer's own range check goes.
- parse_block_transactions rejects a transaction count of zero and any
  bytes left after the last transaction, each a SectionParse error, as
  section_id_from_body does. The two parsers agree on every input.
- The serializer writes the version sentinel only above block version 1,
  as the JVM does: a v1 section is header_id || count || txs.

The zero-count test now asserts the rejection, and the block-version-gate
fixture carries one transaction instead of none.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The JVM's BlockTransactionsSerializer writes the 10_000_000 + version
sentinel only when blockVersion > 1; a v1 section's first field after
the header id is the transaction count. fastsync wrote it for v1 too.
Both parsers read either form, but a resync from genesis stores the
bytes fastsync writes, and those should be the JVM's.

The body writer is split out of block_transactions_to_modifier so its
layout can be tested without a header: v1 has no sentinel, v2 carries
VLQ 10_000_002.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…chain

The api crate reaches the chain only through ChainAccess. The version
rules it needs come the same way:

- ChainAccess::activated_tree_version() gives the version a submitted
  transaction is written at, from the chain's parameters in effect. The
  chain has them from startup, so the size check runs while syncing, as
  step 2a says; the state context exists only after the first block.
- validation-fragments writes each transaction with
  ergo_validation::serialize_block_transaction, the per-transaction half
  of serialize_block_transactions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… block writes it

Per facts/validation.md § Section Parsing (1265c0d): the api crate keeps off
enr-chain, so validation-fragments needs the block writer's version rule
from here, one transaction at a time.

- serialize_block_transaction(tx, block_version) writes the transaction at
  block_transactions_write_version(block_version), exported next to
  serialize_block_transactions.
- serialize_block_transactions writes each transaction through it. A writer
  carries no state from one transaction to the next, so the section bytes
  are unchanged, as its tests show.
- Tested on the X15 fixture: block version 2 writes at 0, 3 at 3.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… box at 0

Per facts/mining.md Step 3.4a and Step 4 (fc95218):

- serialized_size takes the candidate's block version and measures with
  ergo_validation::serialize_block_transaction, the writer
  serialize_block_transactions writes each transaction through: at
  block_transactions_write_version(block_version), not at the fork's
  highest version. The emission and fee transactions are measured so.
- The reward box is measured by ErgoBox::bytes(), the box at version 0
  that txBoxSize reads, not by sigma_serialize_bytes().
- For the transactions the miner builds, no number moves: neither carries
  a register or context-extension value, and those are all the writer's
  version reaches.

Tests: SANTA X15, Tuple(1, Upcast(1, Long)), as a context-extension value
and an R4 measures 64 bytes for a v4 and a v3 candidate and 60 for a v2
one, and agrees with the section serialize_block_transactions writes. No
reward box can tell bytes() from sigma_serialize_bytes(), since it carries
no registers; a test pins that. The integration tests' box and section
measures follow the same versions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ate builds on the fork

Per facts/api.md § Transaction Submission Flow (1265c0d), the api gets the
script version the parameters in effect activate from the chain. The chain
has those parameters from startup, and the crate still doesn't depend on
enr-chain. The trait method lands here without a caller. The main crate's
adapter implements it, and the submission handler writes at it next.

The crate compiles against the fork at 3b23f47e again:
- BlockTransactionsSection.block_version is a u8, the type the parser
  returns now. The JSON carries the same number.
- A mined block's section is written at the candidate's u8 version, with
  no cast.
- The extension-order fixture builds its values from a Constant, since
  context-extension values are EvaluatedValue now.

Every test double answers 3, the version block version 4 activates.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…meters

The api writes a submitted transaction at the activated script version
and sizes it there (facts/api.md § Transaction Submission Flow). The
adapter applies enr_chain::activated_tree_version to the chain's
parameters in effect, which the chain holds from startup, so the api
needs no state context for it and no enr-chain dependency.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… a fragment's as its block does

Per facts/api.md § Transaction Submission Flow and facts/openapi.yaml
ValidationFragmentsTx (fc95218, 1265c0d). Both sites wrote every
transaction with sigma_serialize_bytes(), at the fork's highest tree
version, 3:

- POST /transactions and /transactions/check write tx_bytes at
  ChainAccess::activated_tree_version(): 3 at block version 4, 2 at block
  version 3. The pool stores and relays these bytes, and the size check
  measures them. The chain answers from startup, so an oversized
  transaction still gets 400 while the node is syncing. With no activated
  version, which only a block version outside u8 gives, both routes
  answer 500.
- validation-fragments writes each transaction's bytes with
  ergo_validation::serialize_block_transaction at the section's block
  version: 0 in a v2 block, 3 in a v3 or v4 block. signingMessage stays
  bytes_to_sign() of the transaction as the parser read it.

The tests use SANTA X15, Tuple(1, Upcast(1, Long)), whose Upcast is kept
at 3 and written as 1 below:
- A submission is accepted into the pool at activated 3 and at 2, with
  the pool's bytes pinned for both. At 3 they hash to the id the node
  answers.
- validation-fragments answers for the same section bytes in a v2, a v3
  and a v4 block, bytes and signingMessage pinned, the v3 asymmetry
  included.
- Both routes answer 500 when the chain has no activated version.
Each site's test fails when that site goes back to sigma_serialize_bytes().

Doc comments that called `bytes` sigma_serialize_bytes(), and said the
signing message strips context extensions, now say what the code does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…at the read version

- POST /transactions and /transactions/check answer 500 when the block
  version in effect doesn't fit u8: there is then no activated version
  to write the transaction at.
- validation-fragments' path text named sigma_serialize_bytes for
  `bytes`; it is the block serializer's writing. Re-parsing `bytes`
  recovers the transaction only at the block's read version: a v3
  block's are written at 3 and read at 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e from

ChainAccess::activated_tree_version answers None when the active block
version doesn't fit u8, and the api answers 500 on it. Neither logged,
so the case voting can't produce would leave no trace. The adapter knows
the value; it logs it at error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fork PR #52: the output checks measure an output as ergo's default
context writes it (ErgoBox::bytes, version 0), where they measured the
box written at 3 and counted each Upcast two bytes over (board #27). An
output version 0 can't write now parses and fails the output checks,
as ergo's does. All nine manifests move together; the lock diff is the
rev swap alone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…put checks

At fork 3f8c2633 such an output (a function-typed register, v6-only
data) reads: its id is taken from the box written at 3, its bytes()
fails, and the output checks reject it, as the JVM's do. This crate's
state changes, which insert bytes(), reject it too. verify_output
measures bytes(), so the known-gap paragraph goes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…segment

The JVM tries postBlocksR, which has no path matcher, before the
headerIds route, and akka-http 10.2.4 keeps a request body readable
twice only when it arrives in the same read as the head. A request split
across TCP segments therefore reaches headerIds with its body consumed,
and the peer answers 400 "DecodingFailure at .header" (every JVM from
v5.0.15 through v6.0.7; SANTA 2026-09-30). 32 ids made a 2145-byte body,
over a 1448-byte MSS: the 2026-09-30 resync's block phase failed on its
first request.

15 ids make a 1006-byte body, which with a head under 200 bytes fits
the ~1208-byte MSS of the IPv6 minimum MTU. A test pins that budget.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fork PR #53: update_interlinks returns Err(EmptyInterlinks) for an empty
non-genesis vector and keeps the vector at a level <= 0, where it
panicked on both (the JVM's require sits inside the extension
validator's Try, so rule 402 fails). max_level_of takes log2 as the JVM
does, ln(x) / ln(2) (upstream #917). The lock diff is the rev swap
alone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…saction parameters

Board items #3 and #25.

- apply_state takes the parent's Extension section. It enforces the
  JVM's appendFullBlock rules at every height, before the state changes:
  306 (the BlockTransactions size against the pre-block maxBlockSize),
  400 (extension size), 401/402 (interlinks against the parent's, via
  unpack_interlinks and update_interlinks), 404, 405 and 406. 403 holds
  by construction. A missing parent extension skips 401/402, as the
  JVM's 413 does. Violations are ValidationError::BlockRule { rule, .. }.
- An epoch-boundary block's transactions are validated with the
  boundary parameters it carries (the JVM's newStateContext), not the
  previous epoch's.
- Sync reads the parent's extension from the store, and pruning keeps
  extensions for the state's rollback depth whatever blocks_to_keep says.
  The JVM keeps its copy in the versioned state context; the store is our
  authoritative copy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
keep_versions was 256 at the state open site, a bare 256 at the snapshot
open site, and a hand-mirrored 256u32 in the compaction message. Sync
will keep extensions exactly that deep (facts/sync.md § "Pruning at
flush time"), so the number gets one name, STATE_KEEP_VERSIONS, that
all four sites and the coming SyncConfig.extension_keep_depth share.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
apply_state now enforces the rules JVM ErgoStateContext.appendFullBlock
runs before any state changes:
  306 BlockTransactions section size <= active_params.max_block_size
  400 Extension section size <= 32768
  401 Interlink field value is exactly 33 bytes
  402 Interlinks equal update_interlinks(parent, unpack(parent extension))
  404 No extension value > 64 bytes
  405 No duplicate extension keys
  406 Non-genesis extension has at least one field

Also fixes #25: at an epoch-boundary block the transactions are validated
with the boundary parameters the block carries, not the previous epoch's
active_params. Rule 306 keeps using active_params (pre-block).

Adds parent_extension: Option<&[u8]> to BlockValidator::apply_state - needed
by rules 401/402. None on a non-genesis block skips those two with a warn!
(JVM exIlUnableToValidate).

The block-rules check lives in one place, validate_block_rules, exported
for main's mainnet real-history gate. Fires ValidationError::BlockRule
with the JVM's rule id. Rules run below checkpoint_height too, matching
the JVM's execTransactions-only skip.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
4eae2c6 made the fork's ergo-nipopow a dependency of ergo-validation,
for update_interlinks in the block rules; the lock line sat outside the
crate session's boundary.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The validator's interlink checks (rules 401/402) need the parent block's
extension. The sweep now seeds it from the store at sweep start (by
computing the extension's section id from the parent header) and carries
it forward across successive applications so each extension is read once.
`None` at genesis and when the store doesn't hold the parent's — the
latter must not stop the sweep; the validator skips the interlink rules
with a warn.

Pruning splits into two horizons at each flush pair: 102/104 at the
existing `blocks_to_keep` horizon, 108 at
`min(horizon, flushed − extension_keep_depth)` saturating. Every
extension at or above `flushed − extension_keep_depth` stays, so a fork
point the state can roll back to (within `keep_versions`) still has its
parent's extension available for the interlink checks.

`SyncConfig.extension_keep_depth: u32` (default 256, matching state's
`keep_versions`) is the new dial; main wires it from the same value it
builds the validator with.

Nine `apply_state` test mocks pick up the new `parent_extension: Option<&[u8]>`
argument. Existing pruning tests now assert the two-call split; new tests
pin the extension horizon for `blocks_to_keep = 0` and for a value below
`extension_keep_depth`, and pin the sweep's parent-extension propagation
at `h > 1`, at genesis, and when the store lacks the parent's.

See `facts/sync.md` § "Pruning at flush time" and § "What \`apply_state\`
is called with"; `facts/validation.md` § Traits and § "Block rules taken
from \`appendFullBlock\`".

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ensions as deep as the state

- The Validator wrapper forwards the parent's extension (4eae2c6's new
  apply_state argument) to both validators.
- SyncConfig.extension_keep_depth is STATE_KEEP_VERSIONS, the UTXO
  state's rollback depth: every fork point the state can return to
  keeps the extension its successor's interlinks are checked against
  (facts/sync.md § "Pruning at flush time").

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fork PR #54: storage rent measures bytes(), the wallet builder's
mock-box minimum, and the bytesWithoutRef first-reader rule. Fork PR
#56: a transaction's JSON writes its extension and register values at
the version its id is written at, the one it was read or built at, so
it parses back to the same id; a box's JSON stays at 0. The api tests
that PR #54 alone broke (the X15 fixture's JSON, InvalidTxId) pass
again. The lock diff is the rev swap plus ergotree-ir's new dependency
on once_cell, already in the lock.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mwaddip and others added 16 commits October 1, 2026 00:56
clippy's collapsible_if fails `-D warnings` on it. CI checks only the
addons' formatting, so the lint went unnoticed. Behaviour is unchanged:
&& short-circuits, and v1 headers still skip check_pow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…uilt at the activated one

A rendered transaction writes its extension and register values at the
version its id is written at, so the JSON re-serializes to its id. Each
output's boxId hashes the output at version 0, as ergo computes it.

A JSON submission is the api's own request type (openapi
TransactionSubmission): id, inputs, data inputs, and outputs read as
candidates with an optional boxId. The api builds it with
new_from_vec_at at the activated version, the version the node writes
and relays the bytes at. The id must match what it builds, and so must
each output's boxId where given, or 400. The fork's Transaction JSON is
not the request format: it builds at version 3 and drops the boxIds.

Both name the JVM's behaviour, which SANTA measured on its v6.0.6
oracle. The JVM's JSON routes run at its default version context (1, 1):
a rendered v4-block transaction holding an Upcast of a constant drops
it, so its hex doesn't hash to its id, and a JSON submission's id drops
it, so a v3-signed one is invalid there but valid through
/transactions/bytes. The JVM reads neither id nor boxId. POST
/transactions and /transactions/check become partial.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ilt at the activated version

POST /transactions and POST /transactions/check used to deserialize their body
into ergo-lib's Transaction, which builds at the fork's version 3 and drops
each output's boxId. Below activated version 3, the id the node answered and
the bytes it pooled disagreed for a transaction holding an Upcast of a
constant (facts/api.md § Transaction Submission Flow).

Add TransactionSubmission and OutputSubmission to this crate's types, built
from the fork's public parts (Input, DataInput, ErgoBoxCandidate), with each
output keeping its optional boxId through serde flatten. The handlers now
build with Transaction::new_from_vec_at at the activated version from
ChainAccess, then check the body's id against the built id and each
output's boxId where given, answering 400 with the submitted/built pair in
detail.

Tests pin the X15 submission and the register-X15 submission as literals
and author bodies by hand, covering activated 3 and 2, wrong/missing id,
wrong output boxId, no boxId or transactionId or index on outputs, a wrong
transactionId beside a right boxId, X15 in R4 at the version-0 boxId, and
the no-activated-version 500. 119 tests pass; clippy and fmt clean.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…, and the pool routes render at it

UnconfirmedTx gains id_version: the script version the transaction was
read or built at, where its id and tx_bytes are written. process() takes
it from the caller, with the precondition that tx's id is the id of its
parts built at that version. The P2P intake hands over the version it
parsed at, and the API handler the version it built at.

The pool routes build their JSON from a transaction's parts, and a
part's own Serialize writes at version 0. They render each input's
extension and each output at the entry's id_version, with the fork's
public json_at. At version 0 an X15 pool transaction would render
without its Upcast, and an extension value version 0 can't write would
fail the whole response. The block routes serialize the fork's
Transaction, which already writes at its id version.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ten at

`UnconfirmedTx` gains `id_version: ErgoTreeVersion`, and `process()` takes
it after `tx_bytes` and stores it on the entry. A `debug_assert!` guards
the precondition — `tx.id()` matches the id of its parts rebuilt at
`id_version` via `Transaction::new_from_vec_at` — and costs nothing in
release.

`return_to_pool` keeps each entry's version as given. The pool never
relabels an entry it was handed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ission hands process() the version it built at

The pool entry carries `id_version` (facts/mempool.md § UnconfirmedTx);
`process()` takes it alongside the bytes (bf157cb). Hand it the version
the handler built at.

The pool routes used to render through `UnconfirmedTransaction`'s derived
Serialize, which went through each part's own Serialize — all defaulting
to tree version 0. An input's context extension and an output's register
values therefore came out below the version the id is written at, so the
response contradicted its own id and a value a version-0 write cannot
represent (e.g., a tree-version-3 `UnsignedBigInt` or `Header`) failed
the whole response (facts/api.md § Transaction JSON).

`UnconfirmedTransaction` now carries `id_version` and has a manual
Serialize that writes each input through `ContextExtension::json_at`
and each output through `ErgoBox::json_at` at that version. A resolved
input's spent box renders on its own, at version 0, as the contract
describes.

`TransactionSubmission` now requires `dataInputs` (schema and JVM both
do); the previous `#[serde(default)]` on it was a mistake.

Sweep: `types.rs` holds `UnconfirmedTransaction` as the only part-wise
transaction renderer. Block routes render transactions through the
fork's `Transaction::Serialize`, which writes at `self.id_version`
since fork PR #56. `BlockTransactionsSection.transactions:
Vec<Transaction>` and `ValidationFragmentsTx` (raw hex of
`bytes_to_sign`) both go through that path. `/utxo/byId` and
`/utxo/withPool/byId` render an `ErgoBox` on its own, which stays at
version 0 as the contract has them.

Tests: round-trip at V3; the pool entry renders the input extension at
V3 and at V2; an output's R4 renders at V3 beside the version-0
`boxId`; a resolved input's spent box renders at V0 (the `Upcast`
folded); a version-0-unwritable extension value is pooled at V3 and
rendered by both the by-id and the list route — the test reproduces
that `ContextExtension::serialize` (the old V0 renderer) fails on it;
a submission without `dataInputs` answers 400.

125 tests pass; clippy and fmt clean.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…action at

parse_pool_transaction returns the script version it parsed at with the
transaction, and the mempool task passes it to process() as the entry's
id_version (facts/mempool.md § P2P Transaction Intake). One place applies
enr_chain::activated_tree_version, so the parse and the label can't
drift. The test pins the version beside the ids: 3 at block version 4,
0 at block version 1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fork PRs #57-#65 and the upstream develop merge at d6c8fc71. The block
version now comes from the parameters' BlockVersion entry, not the
pre-header, for the activated script version and the negative-height rule.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fork PR #66: Global.none and Global.some read and write their type
byte as sigmastate does (a v3 tree holding either failed to parse on
920419cb), and a PropertyCall with explicit type arguments no longer
reads its receiver's type.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fork PR #67: a lambda shares its defining environment and body instead
of copying them, so block 1,379,778's spends validate in milliseconds
and about a megabyte where each took seconds and up to 5 GB (board #36).
Comparing a lambda now fails the script, as sigmastate's equalDataValues
does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s parameters

Since fork 920419cb, validation reads the block version from the
parameters' BlockVersion entry, not the pre-header. The fixture passed
Parameters::default(), which says 1, so the negative-height rule was off
and negative_creation_height_is_invalidated_not_declined failed, and the
monotonic-height rule it was written to keep live was off too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fork PRs #68-#77. A tuple of other than two items is a collection of
Any at evaluation (Value::Pair replaces Value::Tup), a parsed tree keeps
its bytes, method tables hold every id the JVM resolves, collections
take the JVM's runtime class, and the 14 node kinds sigmastate parses
but never evaluates are read and fail at eval.

EvaluatedExpr::Tuple now takes TupleItems, so the five X15 test
fixtures build it from an array.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The nine per-crate SPECIAL.md files were symlinks to facts/SPECIAL.md,
there for per-crate sessions. With one session for the whole repo, the
file moves to the root and the symlinks go.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The node is feature complete and gets bugfixes only, so one session
works across the whole repo and nothing is dispatched to per-crate
sessions. The root CLAUDE.md drops the dispatch rule, says a contract
always changes before the code, and takes over what each crate's file
held: its scope, contract and crate-specific facts, and where its
behavior lives in the JVM source.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
One session now edits the whole repo, so the skill drops the per-crate
dispatch section, says a contract is committed before the code, and
points at SPECIAL.md at the repo root. The P2P allocation row no longer
names a 256 KB cap: that guess once dropped valid blocks; match the
JVM's own bounds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
One session maintains the whole repo now. The section points at
CLAUDE.md, SPECIAL.md and the skill, and keeps the multi-session
workflow and claude-dbc as how the node was built.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mwaddip
mwaddip merged commit 9c15411 into main Nov 11, 2026
1 check passed
@mwaddip
mwaddip deleted the fix/sigma-evaluated-values branch November 11, 2026 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant