fix: Header.stateRoot is an AvlTree; v2 powOnetimePk is the group generator#887
Open
mwaddip wants to merge 2 commits into
Open
fix: Header.stateRoot is an AvlTree; v2 powOnetimePk is the group generator#887mwaddip wants to merge 2 commits into
mwaddip wants to merge 2 commits into
Conversation
… Coll[Byte] The method is typed SAvlTree (and our descriptor already declares it so): the reference impl wraps the header digest in an AvlTree with all operations enabled, keyLength 32 and no value length (CHeader.stateRoot via AvlTreeData.avlTreeFromDigest). The eval impl returned the raw 33 digest bytes as Coll[Byte] — same bytes, wrong type surface (downstream AvlTree method calls vs collection ops). Pinned by the JVM-blessed byte vector (santa-eval Header.property_accessors, h.stateRoot#nominal). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The reference impl has no absent state for the one-time pk: v2 header parsing fills it with the group generator (ErgoHeader.scala: wForV2 = CryptoConstants.dlogGroup.generator), and Header.powOnetimePk surfaces that in scripts. sigma-rust parsed it as None and the eval fn defaulted to EcPoint::default() — the identity, 33 zero bytes. Wire parsing now fills the generator for v2 (the v2 serializer ignores the field, so header ids and roundtrip bytes are unchanged; the arbitrary generator produces the same post-parse shape), and the eval fallback for headers built without it (e.g. JSON with no `w`) is the generator as well. Pinned by the JVM-blessed byte vector (santa-eval Header.property_accessors, h.powOnetimePk#nominal). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two
Headeraccessor surfaces diverged from the reference impl (both caught by JVM-blessed byte vectors):stateRootis typedSAvlTree— and our method descriptor already declares it so — but the eval impl returned the raw 33 digest bytes asColl[Byte]. It now returns the AvlTree wrapping the digest with all operations enabled, keyLength 32, no value length (CHeader.stateRootviaAvlTreeData.avlTreeFromDigest).powOnetimePkon autolykos-v2 headers surfaced 33 zero bytes (Noneat parse →EcPoint::default()at eval). The reference impl fills the group generator at parse (ErgoHeader.scala:wForV2); we now do the same (v2 serializer ignores the field — header ids and roundtrip bytes unchanged), with the eval fallback also the generator.