Skip to content

Bridge phase5#309

Open
Super-Genius wants to merge 326 commits into
developfrom
bridge_phase5
Open

Bridge phase5#309
Super-Genius wants to merge 326 commits into
developfrom
bridge_phase5

Conversation

@Super-Genius

Copy link
Copy Markdown
Contributor

This fixes quite a lot, including removal of tons of warnings and fixing the installation of evmrelay

Super-Genius and others added 30 commits May 31, 2026 14:52
…hainSmartContract

D-05/D-06: After confirming receipt status success, verify that at least
one receipt log matches the configured bridge contract address and event
topic0. If bridge_contract_address is empty (not configured), log check
is skipped for backward compatibility.

WeightedRpcEndpoint extended with bridge_contract_address and event_topic0
string fields.

Addresses Codex review finding P1 #2 from PR #298.

Note: Unit test for log verification deferred — VerifyPublicChainSmartContract
is private and requires RPC transport mocking.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Create test/src/bridge_e2e/ directory with CMakeLists.txt
- BridgeE2ETest fixture: 3 GeniusNode instances bootstrapped via PubSub
- BurnToMintPipeline test: cast send burn on Sepolia -> MintTokens -> UTXO poll
- Guards: RUN_E2E_BRIDGE, PRIVATE_KEY, cast binary presence
- Wire into test/src/CMakeLists.txt
- BridgeE2ETest fixture with 3-node PubSub bootstrap
- BurnToMintPipeline positive E2E test against Sepolia
- Build passes, test skips cleanly without env vars
- Verify Phase 3 GetSlotKey collision-resistance fix end-to-end
- Two mints with identical chain/token/amount/dest but different burn hashes both succeed
- Proves burn tx hash makes MintV2 slot keys distinct
- Build passes, test registered in bridge_e2e_test binary
- SUMMARY.md with task commit c13f3df
- ROADMAP.md updated with phase 04 progress
…alid receipts

- ReplayRejection: verifies dedup cache rejects duplicate burn tx hash
- MissingEndpointsFailClosed: verifies unknown chain ID fails closed
- InvalidReceiptLogsRejected: verifies verify_receipt_log rejects mismatched contract/topic0
- SUMMARY.md with 3 test cases: ReplayRejection, MissingEndpointsFailClosed, InvalidReceiptLogsRejected
- Self-check: PASSED
- Phase 4 Plan 02 marked complete in roadmap
- Add GeniusNode::ConfigureRpcEndpoint(chain_id, endpoints) for runtime
  RPC endpoint configuration via the public chain input validator
- Update bridge E2E test with additional test cases
- Update Track B Phase 2 UAT and verification docs
Usage: ninja test-unlocked

Unlocks the macOS login keychain for 1 hour before running ctest,
preventing repeated password prompts when test binaries access
crypto keys (signing, key generation, certificate access).
Create a temporary test keychain with no ACL restrictions instead of
unlocking the login keychain. Each test executable has its own macOS
ACL entry, so unlocking login keychain alone doesn't prevent prompts.

The test keychain is created before tests, set as default, then
cleaned up after tests complete.
Use security set-key-partition-list -S apple-tool:,apple: to allow
all Apple crypto framework consumers (test binaries) to access the
login keychain without per-executable ACL prompts.

Previous approach (separate test keychain) failed because the actual
keys live in the login keychain, not the test keychain.
Add SGNS_USE_MEMORY_SECURE_STORAGE compile flag that selects
MemorySecureStorage (in-memory map) instead of AppleSecureStorage
(macOS keychain) for all test builds.

- New: src/local_secure_storage/impl/MemorySecureStorage.hpp
- Updated: SecureStorage.hpp respects SGNS_USE_MEMORY_SECURE_STORAGE
- Updated: CommonBuildParameters.cmake adds flag when BUILD_TESTING=ON
- Updated: secure_storage_test.cpp uses MemorySecureStorage on macOS

This eliminates the ~20 keychain password prompts per test run.
The flag was applied after add_subdirectory(src), so the library
didn't get it. Moving it before ensures both library and tests
use MemorySecureStorage.
Addresses Codex review P1: keep memory storage out of non-test targets.

- genius_node: production library, uses OS keychain (Apple/Windows/Linux)
- genius_node_test: test library, uses MemorySecureStorage (in-memory)
- All test targets now link against genius_node_test
- Removed global SGNS_USE_MEMORY_SECURE_STORAGE cmake option
- Removed target_compile_definitions from addtest function
Adds .planning/scripts/codex-review.sh that sends diffs to OpenAI API
for automated code review. Requires OPENAI_API_KEY environment variable.

Config updated: workflow.code_review_command points to the script.
- code_review_depth: thorough (was standard)
- code_review_auto_fix: true
- ship.review_before_pr: true
- ship.auto_fix_review_issues: true

Code review now runs before PR creation and auto-fixes issues.
Split genius_node into two libraries:
- genius_node: production, uses OS keychain (Apple/Windows/Linux)
- genius_node_test: tests, uses MemorySecureStorage (in-memory)

All test targets link against genius_node_test. No global cmake flags.

Also adds MemorySecureStorage implementation and updates secure_storage_test
to use it on macOS.

Addresses Codex review P1: keep memory storage out of non-test targets.
…rompts

Replace compile-time SGNS_USE_MEMORY_SECURE_STORAGE approach with a runtime
DI factory in GeniusAccount. Tests call SetSecureStorageFactory() to inject
MemorySecureStorage, eliminating macOS keychain prompts without relying on
platform-specific compile flags.

Changes:
- Add SecureStorageFactory type and Set/GetSecureStorageFactory() to GeniusAccount
- CreateSecureStorage() uses injected factory when set, falls back to default
- Existing tests inject MemorySecureStorage via factory in SetUp/fixture
- Remove stale test CMakeLists entries from other branches
- Keep genius_node_test library split from previous commit

All 60 tests pass with zero keychain prompts.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…oint

Three fixes that get BurnToMintPipeline passing against live Sepolia:

1. Use ERC-1155 safeTransferFrom instead of ERC-20 transfer for burn tx.
   The bridge expects TransferSingle event (topic0=0xc3d58168...).

2. Configure bridge_contract_address in lowercase to match hex_array_string output.

3. Configure 6 Sepolia RPC endpoints (weight 25 each). Requires >= 75 consensus weight.

4. Use node SuperGenius address as mint destination instead of Ethereum address.

5. Remove processor node propagation checks - non-full nodes cannot query other addresses.

BurnToMintPipeline, MissingEndpointsFailClosed, and InvalidReceiptLogsRejected pass.
ReplayRejection and SlotKeyCollisionResistance need test-only RPC bypass for offline tests.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
henriqueaklein and others added 30 commits June 22, 2026 18:21
…f EXPECT_TRUE with static assert due to clang format stripping extra parens making it not build. Also formatted
Reverts the config-rpc-array approach (46d5e2e). Keeps the case-normalization
fix (ascii_lower on the configured bridge address) and the v1/v2 topic0 wiring.
The config-rpc wiring is replaced by runtime chainlist.org fetch in a follow-up.
Phase 05.1: Refactor RPC endpoint init to ChainRpcEndpointProvider + 6-param bridge event fix
…to a CID, meaning an unconnectable peer that sent a pubsub message that made it to us via mesh pubsub forwarding could become the only place to try to get a CID. We now track multiple peers per CID and start prioritizing peers that reliably work.
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.

3 participants