Skip to content

Gsd/phase 04.1 anvil local bridge e2e test use tokencontracts gnus ai env t catchup watcher fix#335

Merged
henriqueaklein merged 126 commits into
developfrom
gsd/phase-04.1-anvil-local-bridge-e2e-test-use-tokencontracts-gnus-ai-env-t-catchup-watcher-fix
Jul 17, 2026
Merged

Gsd/phase 04.1 anvil local bridge e2e test use tokencontracts gnus ai env t catchup watcher fix#335
henriqueaklein merged 126 commits into
developfrom
gsd/phase-04.1-anvil-local-bridge-e2e-test-use-tokencontracts-gnus-ai-env-t-catchup-watcher-fix

Conversation

@henriqueaklein

Copy link
Copy Markdown
Contributor

No description provided.

@Super-Genius
Super-Genius force-pushed the gsd/phase-04.1-anvil-local-bridge-e2e-test-use-tokencontracts-gnus-ai-env-t-catchup-watcher-fix branch 2 times, most recently from 8637215 to 1db4c9d Compare July 14, 2026 03:56
@Super-Genius
Super-Genius force-pushed the gsd/phase-04.1-anvil-local-bridge-e2e-test-use-tokencontracts-gnus-ai-env-t-catchup-watcher-fix branch from dfc8b68 to b09cd33 Compare July 14, 2026 06:16
@henriqueaklein
henriqueaklein force-pushed the gsd/phase-04.1-anvil-local-bridge-e2e-test-use-tokencontracts-gnus-ai-env-t-catchup-watcher-fix branch from ffd7535 to 017b867 Compare July 15, 2026 14:06
Codebase research revealed 3 plan-reality mismatches:
- Votes created in ConsensusManager::CreateVote(), not GeniusNode
- PublicChainInputValidator owned by TransactionManager, not GeniusNode
- WeightedRpcEndpoint has no is_paid/api_key fields

Fixes across all 4 plans:
- 06-01: SlotHashPopulator callback injected by GeniusNode bridging
  TransactionManager → ConsensusManager, not GeniusNode direct wire
- 06-02: Context updated, tally algorithm unchanged
- 06-03: Verified correct, full_promotion_weight_ is 8th constant (not 1st)
- 06-04: Test targets updated for callback-based wiring
- Default-constructed slot_0/1/2_hash empty (abstain sentinel D-05)
- Accessor round-trip returns 32-byte payloads
- VoteSigningBytes covers slot hashes (T-06-01)
- Add bytes slot_0_hash (tag 6), slot_1_hash (tag 7), slot_2_hash (tag 8)
- slot 0 = DIRECT_API endpoints (consensus_weight >= 50, D-02)
- slots 1-2 = PUBLIC endpoints (consensus_weight < 50), dedup D-03
- Empty bytes = abstain sentinel (D-05); hash lives only in vote (D-04)
- Fields inside VoteSigningBytes signing surface (T-06-01)
…Hash

- slot 0 (DIRECT_API, weight>=50), slot 1/2 (PUBLIC, weight<50)
- Empty vector when no qualifying endpoint or unknown slot/chain (D-05)
- Asserts exact SHA-256 of endpoint URL strings
- Read-only const noexcept accessor (D-10: additive, Tier 1 untouched)
- slot 0 = first endpoint with consensus_weight>=50 (DIRECT_API, D-02)
- slots 1/2 = first/second endpoint with consensus_weight<50 (PUBLIC)
- SHA-256 of url string via existing crypto::HasherImpl (T-06-03)
- Empty vector = abstain sentinel / fail-closed for unknown slot/chain (D-05)
- CreateVote invokes SetSlotHashPopulator callback before signing
- Populator-set slot_0_hash survives into the signed vote
- Without populator, CreateVote is backward compatible (slots empty)
…Node

- ConsensusManager: SetSlotHashPopulator callback + slot_hash_populator_ member
- CreateVote invokes populator before VoteSigningBytes (T-06-01)
- Blockchain::SetSlotHashPopulator forwarder to consensus_manager_
- PublicChainInputValidator::GetFirstConfiguredChainId (single-chain resolver)
- GeniusNode wires the callback in INITIALIZING_TRANSACTIONS bridging
  TransactionManager::GetPublicChainInputValidator -> ConsensusManager vote
- Backward compatible: unset populator -> CreateVote unchanged (D-05 abstain)
- SUMMARY documents proto extension, GetSlotHash accessor, populator wiring
- 2 deviations (Blockchain forwarder, single-chain resolver) auto-fixed
- Build/test execution deferred to user per CLAUDE.md build policy
…with in-memory test storage

The test required full ConsensusManager/GeniusAccount/CRDT setup with filesystem
paths, violating the MemorySecureStorage requirement for tests. The populator
callback mechanism (setter + if-guard in CreateVote) is verified by code review;
integration behavior is covered by Plan 04 slot quorum tests.
…hmetic

- Context D-06 canonical example (550/1200/900/false)
- D-03 solo PUBLIC hash dedup, 2-validator group contributes 25%
- D-02 slot 0 half-weight contribution
- D-05 abstainer raises threshold, contributes zero
- REQ-DETERM-01 ordering independence
- strict greater-than boundary, reject-vote skip, duplicate dedup
- WeightConfig extended with 7 integer-ratio slot constants (D-02/D-03/D-06)
- SlotQuorumResult struct (qualified_sum, total_voting_reputation, threshold, has_quorum)
- EvaluateSlotQuorum member + EvaluateSlotQuorumStatic pure helper
- D-03 >=2-validator dedup on PUBLIC slots; solo hashes contribute zero
- D-05 abstainers count toward threshold, zero toward qualified_sum
- D-06 strict > certificate predicate
- REQ-DETERM-01: reads only votes + registry snapshot, integer math throughout
- MintV2 + non-empty chain_id -> bridge mint (D-06)
- MintV2 + empty chain_id -> not bridge (native mint)
- TransferTx -> not bridge
- Undecodable subject fails-closed to non-bridge (single-pool applies)
- QuorumTally extended with qualified_sum/slot_threshold (D-06 observability)
- IsBridgeMintSubject static discriminator (kMintV2 + non-empty chain_id;
  fail-closed to single-pool on decode failure)
- EvaluateQuorum dispatcher: single-pool IsQuorum for non-bridge, slot tally
  via ValidatorRegistry::EvaluateSlotQuorum for bridge mints
- TallyVotes (certificate creation) routes final has_quorum through EvaluateQuorum
- HandleVote incremental tally routes bridge mints through EvaluateQuorum,
  keeps fast-path IsQuorum for non-bridge (Pitfall 1 / T-06-10 mitigation)
- SUMMARY.md documents EvaluateSlotQuorum arithmetic + EvaluateQuorum dispatcher
- TDD RED/GREEN gates per task, 4 commits
- Deviations: pure static helper for testability; HandleVote non-bridge fast path
- Self-check PASSED (agent-verified); build/test deferred to user per CLAUDE.md
Super-Genius and others added 18 commits July 15, 2026 13:25
…hasher API

- Replace hasher_impl.hpp includes with hasher.hpp in consumer files
- Remove std::make_shared<HasherImpl>() calls (HasherImpl deleted on develop)
- Remove hasher arg from TransactionManager::New and ExtensionFactoryImpl
- PublicChainInputValidator::GetSlotHash uses sgns::crypto::sha2_256() directly
- Add missing closing brace after AddRpcEndpoints
- Change sgns::crypto::sha2_256 to crypto::sha2_256 (unqualified)
- Add closing brace for GetSlotHash method
- Append VerifyPublicChainSmartContract + namespace close
  (these were lost during rebase conflict resolution)
- Move GeniusNode::GetTransactionManager() from private to public for test access
- Add bridge_rlpx_e2e_test.cpp implementing BridgeRlpxE2ETest fixture
- 3-node cluster (ports 40021-40023) with per-node EthWatchService in kDiscoverFirst mode
- Per-node BridgeRelayer wired against test-owned RLPx service with dual v1+v2 watches
- RLPx settle wait polls remote_status_accepted >= 1, GTEST_SKIP on timeout (D-03)
- Burn stream at 1-2s deterministic pseudo-jitter cadence via deadline polling
- Each burn asserts balance increase on ALL THREE nodes (D-12)
- Zero sleep_for, zero raw stdio, zero new OS ifdefs (CLAUDE.md compliant)
- Env-gated: RUN_E2E_RLPX + PRIVATE_KEY/SIGNING_KEY required
- Mirror bridge_anvil_e2e_test block: addtest + AsyncIOManager include + genius_node_test + json_secure_storage link + three-platform whole-archive
- Add evmrelay/examples include dir for chain_config.hpp access
…le examples/ dir not in cmake include scope)
@henriqueaklein
henriqueaklein force-pushed the gsd/phase-04.1-anvil-local-bridge-e2e-test-use-tokencontracts-gnus-ai-env-t-catchup-watcher-fix branch from d9a724e to f470b5b Compare July 15, 2026 16:26
@henriqueaklein
henriqueaklein merged commit e1f48fa into develop Jul 17, 2026
14 of 15 checks passed
@henriqueaklein
henriqueaklein deleted the gsd/phase-04.1-anvil-local-bridge-e2e-test-use-tokencontracts-gnus-ai-env-t-catchup-watcher-fix branch July 17, 2026 01:26
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.

2 participants