Skip to content

Port gean to devnet-4 #208

Description

@dimka90

Description

Migrate gean from devnet-3 to devnet-4 covering XMSS crypto migration, dual-key validators, block envelope simplification, recursive aggregation, and fork choice convergence.

Work is structured in phases matching the leanSpec devnet-4 changes.


Spec Reference

  • leanSpec pinned at 16e50a5fcc8be837f09aabf30c92e653bc36dad4

Branch

  • devnet-4

Phases

Phase 1: Crypto Migration

Migrate XMSS from Dim64Base8 (3112-byte signatures) to Dim46Base8 (2536-byte signatures).

  • Update hashsig-glue to leansig devnet4 Dim46Base8
  • Update SignatureSize in types/constants.go (3112 → 2536)
  • Update SSZ offsets:
    • attestation_encoding.go
    • block_encoding.go
  • Add prover twiddle precomputation (sumcheck backend)
  • Enable AVX2 SIMD build flag (x86_64) with ARM fallback

Phase 2: Dual-Key Validator Model

  • Update Validator struct:
    • AttestationPubkey
    • ProposalPubkey
  • Implement KeyManager:
    • SignAttestation
    • SignBlock
  • Update genesis config:
    • GenesisValidatorEntry with dual keys
  • Implement key generation:
    • annotated_validators.yaml

Phase 3: Block Envelope Simplification

  • Introduce SignedBlock:
    • Block + BlockSignatures
  • Remove BlockWithAttestation
  • Remove ProposerAttestation
  • Update proposer signing:
    • hash_tree_root(block) with proposal key

Phase 4: CGo Safety

  • Add runtime.Pinner in:
    • AggregateWithChildren
    • VerifyAggregatedSignature

Phase 5: Recursive Aggregation

  • Implement Select → Fill → Aggregate

Select

  • Greedy selection of existing child proofs

Fill

  • Collect raw gossip signatures

Aggregate

  • Recursive aggregation via AggregateWithChildren

  • Enforce minimum 2 inputs


Phase 6: Fork Choice Convergence

  • Fix vote index remapping:
    • AppliedIndex, LatestKnown, LatestNew
  • Drain pending blocks before attestation production
  • Call updateHead before proposal
  • Add PromoteNewToKnown + updateHead in maybePropose
  • Use unbounded payload buffers (prune on finalization)

Phase 7: Networking

  • Drop raw gossip attestations on non-aggregators
  • Implement per-validator subnet subscription
  • Parse --aggregate-subnet-ids CLI flag
  • Aggregator fallback to subnet 0

Phase 8: Source Alignment

  • Use store justified for:
    • Attestation source
    • Builder filtering
  • Enforce strict slot-only comparison
  • Drain pending attestations before aggregation

Phase 9: Spec Tests

  • Update fixture parser:
    • camelCase (attestationPubkey, proposalPubkey)
  • Update signature tests for SignedBlock
  • Remove ProposerAttestation from forkchoice tests
  • Pin LEAN_SPEC_COMMIT_HASH

How to Run

make run-setup    # first time: build + generate keys
make run          # terminal 1: aggregator
make run-node1    # terminal 2
make run-node2    # terminal 3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions