feat(tests): add integration test suite — wallet roundtrip, address vectors, attestation determinism, error paths - #46
Open
CHY9213 wants to merge 6 commits into
Open
Conversation
Coverage includes: - Wallet roundtrip: generate → serialize → deserialize → same address & pubkey; sign → verify; verify fails on tampered message / sig / key - Address derivation vectors: 4 fixed keypairs with expected RTC addresses - Attestation payload determinism: same inputs → same output; malformed/missing fields → error/not-panic - Error paths: every public Result-returning API exercised with a failing input - NodeClient mock-server error paths for health, balance, miners, challenge, attest, enroll - CpuArch determinism and edge cases across all 8 variants - Derive Debug on Wallet (needed for error assertions) Closes: Scottcjn/rustchain-bounties#16256
Owner
|
This is a real, thorough suite and I'd like to take it. One thing before it can land: it also commits three stray files that shouldn't be here, .github/hello.txt, .github/test.txt, and test-api-file.txt, all just containing "hello"/"test". They look like leftover scratch files. Debris in .github/ especially shouldn't go in. Could you drop those three (and the one-line src/lib.rs touch if it was only there to trigger CI) and force-push? Once it's just the test files, tests/integration.rs and tests/address_vectors.rs, I'm happy to move it forward. Nice work on the coverage. |
This was referenced Jul 28, 2026
Author
|
Done — cleaned up as requested:
Thanks for the detailed review! 🙏 |
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.
Summary
Closes Scottcjn/rustchain-bounties#16256
Adds
tests/integration.rswith 46 integration tests covering all required areas:✅ Wallet Roundtrip (8 tests)
✅ Address Derivation Vectors (4 tests)
"RTC" + SHA-256(pubkey)[:40]✅ Attestation Payload Determinism (8 tests)
Challengedeserialization: valid, missing nonce (error), extra fields (silent ignore), wrong nonce type (error)AttestResponse,EnrollResponsedeserialization✅ Error Paths (18 tests)
Wallet::from_hex: invalid hex chars, wrong length, empty, odd-lengthWallet::verify: bad pubkey hex, wrong pubkey length, bad sig hex, wrong sig length, invalid curve point, empty pubkey, empty message (valid)NodeClient::health: malformed JSON → errorNodeClient::balance: missing field → default 0.0NodeClient::miners: invalid JSON → errorNodeClient::challenge: empty response → errorNodeClient::attest: node failure, missing ok field, invalid JSON bodyNodeClient::enroll: node failure✅ CpuArch Edge Cases (3 tests)
✅ Plus (6 tests)
Challengeround-trips through JSONMinersResponseedge cases (empty list, wrapped)🧪 Test Results
🔧 Source Changes
src/lib.rs: DerivedDebugonWallet(needed for error assertions in tests)tests/integration.rs: New file (46 tests).github/workflows/ci.yml: New CI workflow needs to be created manually (see note below)ℹ️ CI Workflow Note
A CI workflow file
.github/workflows/ci.ymlis needed to run tests automatically on PRs. The workflow contents are:This file is prepared in the local branch but could not be pushed via this OAuth token due to GitHub's
workflowscope requirement for.github/workflows/files. Please create this file manually on thefeat/integration-test-suitebranch, or I can add it if the repo maintainer enables workflow-write permissions on the fork.RTC Wallet Address
RTCEd1b5c9d3a8f2e7b6c4a1d9f8e7b6c4a1d9f8e7b6