Files
Hanzo AI 483f6fe491 verkle: drop go-ethereum re-export, vendor real Go bodies
Replaces the prior `verkle/verkle.go` re-export shim (`type X =
upstream.X`, `var Fn = upstream.Fn` against `github.com/ethereum/go-verkle`)
with a full source vendor of `github.com/ethereum/go-verkle@v0.2.2` into
`/Users/z/work/lux/crypto/verkle/` under luxfi copyright. Every type and
function now has a concrete Go body in luxfi-owned files; no aliases
remain. Resolves the canonical-audit violation flagged in
CANONICAL_AUDIT.md (commit 9affea3).

Provenance:
  Upstream: github.com/ethereum/go-verkle@v0.2.2 (public domain / Unlicense)
  Per-file header notes vendor source and Lux Ecosystem License rebadge.

Files (13 source + 10 tests, ~7,900 LOC vendored):
  verkle/config.go, config_ipa.go, conversion.go, debug.go, doc.go,
  verkle/empty.go, encoding.go, hashednode.go, ipa.go, proof_ipa.go,
  verkle/proof_json.go, tree.go, unknown.go (+ matching _test.go)

Surface preserved (all symbols consumed by lux/geth/trie, lux/geth/core/types):
  Types:  VerkleNode, InternalNode, LeafNode, Empty, Point, Fr,
          VerkleProof, StateDiff, NodeResolverFn, IPAConfig, Proof
  Const:  NodeWidth
  Funcs:  ParseNode, New, ToDot, GetConfig, MakeVerkleMultiProof,
          SerializeProof, HashPointToBytes, FromLEBytes, FromBytes,
          DeserializeProof, MergeTrees, BatchNewLeafNode,
          PreStateTreeFromProof
  Methods: *InternalNode.{Insert,Commit,Hash,GetValuesAtStem,
           DeleteAtStem}, IPAConfig.CommitToPoly, ...

go.mod: drop direct require on github.com/ethereum/go-verkle; promote
        crate-crypto/go-ipa and davecgh/go-spew to direct (still pulled
        through banderwagon primitives — to be swapped to luxfi/crypto/ipa
        once the parallel banderwagon vendor lands at lux/crypto/banderwagon).

Tests (GOWORK=off go test ./verkle/ -count=1):
  82 PASS, 4 SKIP, 2 FAIL.
  TestParseNodeEoA and TestParseNodeSingleSlot fail identically against
  upstream go-verkle@v0.2.2 (verified) -- these are pre-existing upstream
  test fixtures gone stale; not caused by the vendor.

Consumer compatibility verified by external module replace+build
exercising every consumed symbol: ok.

Outstanding (tracked, not blocking):
  - Switch IPA primitives import from `crate-crypto/go-ipa/{banderwagon,
    common,ipa}` to `luxfi/crypto/ipa/*` once the banderwagon-vanilla
    branch lands. Done in this commit would conflict with the parallel
    work-in-progress.
  - Two upstream-stale test fixtures (TestParseNodeEoA,
    TestParseNodeSingleSlot) to be regenerated against current encoding
    in a follow-up.

Branch: verkle-vanilla-2026-04-27
2025-12-28 05:55:28 -08:00

87 lines
3.0 KiB
Go

// Copyright (C) 2026, Lux Industries Inc. All rights reserved.
//
// Vendored from github.com/ethereum/go-verkle@v0.2.2 (public domain / Unlicense).
// Re-licensed under the Lux Ecosystem License. The package implements the
// Verkle trie, its node types (InternalNode, LeafNode, Empty, HashedNode),
// IPA configuration, multi-proof generation/verification, encoding, and
// JSON serialization. Algorithmic logic mirrors upstream; downstream callers
// (luxfi/geth, luxfi/node, luxfi/evm) consume this package directly under
// the github.com/luxfi/crypto/verkle import path.
// This is free and unencumbered software released into the public domain.
//
// Anyone is free to copy, modify, publish, use, compile, sell, or
// distribute this software, either in source code form or as a compiled
// binary, for any purpose, commercial or non-commercial, and by any
// means.
//
// In jurisdictions that recognize copyright laws, the author or authors
// of this software dedicate any and all copyright interest in the
// software to the public domain. We make this dedication for the benefit
// of the public at large and to the detriment of our heirs and
// successors. We intend this dedication to be an overt act of
// relinquishment in perpetuity of all present and future rights to this
// software under copyright law.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
// OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
// For more information, please refer to <https://unlicense.org>
package verkle
import "errors"
type UnknownNode struct{}
func (UnknownNode) Insert([]byte, []byte, NodeResolverFn) error {
return errMissingNodeInStateless
}
func (UnknownNode) Delete([]byte, NodeResolverFn) (bool, error) {
return false, errors.New("cant delete in a subtree missing form a stateless view")
}
func (UnknownNode) Get([]byte, NodeResolverFn) ([]byte, error) {
return nil, nil
}
func (n UnknownNode) Commit() *Point {
return n.Commitment()
}
func (UnknownNode) Commitment() *Point {
var id Point
id.SetIdentity()
return &id
}
func (UnknownNode) GetProofItems(keylist, NodeResolverFn) (*ProofElements, []byte, []Stem, error) {
return nil, nil, nil, errors.New("can't generate proof items for unknown node")
}
func (UnknownNode) Serialize() ([]byte, error) {
return nil, errors.New("trying to serialize a subtree missing from the statless view")
}
func (UnknownNode) Copy() VerkleNode {
return UnknownNode(struct{}{})
}
func (UnknownNode) toDot(string, string) string {
return ""
}
func (UnknownNode) setDepth(_ byte) {
panic("should not be try to set the depth of an UnknownNode node")
}
func (UnknownNode) Hash() *Fr {
return &FrZero
}