test: add coverage for carbon credits, funding round, bridge, cap, governance, archive (Closes #318, #319, #320, #321, #326, #327) - #361
Open
laurentketterle-hub wants to merge 2 commits into
Conversation
…vernance, archive Adds unit test coverage for six previously-untested code paths and repairs the build breakage from Heliobond#342 that prevented the test suite from compiling. Test coverage added: - Heliobond#318: carbon credit calculate/issue/transfer/balance (success + panic paths) - Heliobond#319: funding-round share-transfer block and re-enable - Heliobond#320: outbound Wormhole bridge payload round-trip + HBS burn + zero-amount panic - Heliobond#321: per-project investment cap enforcement + capacity reporting - Heliobond#326: governance proposal create/vote/execute full-flow + error branches - Heliobond#327: project archive/delete/compact lifecycle + ArchiveSummary Build repairs (required for the suite to compile after Heliobond#342): - Close missing braces in lib.rs, events.rs, and test.rs - Resolve duplicate VaultError discriminants (FundingRoundActive/InvestmentCapExceeded) - Restore sequence-based deposit lock (lock_deposit/check_deposit_lock, Heliobond#36) - Update stale create_project call sites to the current 4-arg signature - Restore the accidentally-removed bodies of test_get_all_project_investments_returns_all and test_claim_queued_is_idempotent_against_double_claim - Remove redundant from.require_auth() before Base::burn in bridge_burn / initiate_bridge_transfer (Base::burn already requires auth) Signed-off-by: laurentketterle-hub <laurentketterle-hub@users.noreply.github.com>
Signed-off-by: laurentketterle-hub <laurentketterle-hub@users.noreply.github.com>
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
Adds unit-test coverage for six previously-untested code paths and repairs the build breakage from #342 that prevented the suite from compiling.
Test coverage added
calculate_carbon_creditscorrectness, zero-green-impact,issue_carbon_credits(success + "no carbon credits" panic),transfer_carbon_credits(success + insufficient-balance + zero-amount panics), balance query.start_funding_round/end_funding_round/is_funding_round_active, share-transfer panic while open, transfer succeeds after close.serialize_bridge_payload/parse_bridge_payloadround-trip (all fields),initiate_bridge_transferburns HBS + publishes via a mock core,amount <= 0panic.set_max_investment_per_project,investment_capacitybefore/after funding, funding at cap succeeds, 1 stroop over cap panics,cap = 0restores the compile-time default.create_proposal(happy +VotingPeriodTooShort),cast_vote(tally,weight <= 0, double-vote,VotingPeriodEnded),execute_proposal(VotingStillOpen, double-execute, pass vs. fail),get_proposal(ProposalNotFound).archive_projectstatus + listing exclusion,delete_projectremoval,compact_archivesummary +ProjectNotArchivedguard.Build repairs (required for the suite to compile after #342)
lib.rs,events.rs, andtest.rs.VaultErrordiscriminants (FundingRoundActive/InvestmentCapExceeded).lock_deposit/check_deposit_lock([Logic] Implement withdrawal sliding window to prevent instant exit #36), matching theWithdrawalWindowLedgerssliding-window semantics the tests exercise.create_projectcall sites to the current 4-arg signature.test_get_all_project_investments_returns_allandtest_claim_queued_is_idempotent_against_double_claim.from.require_auth()beforeBase::burninbridge_burn/initiate_bridge_transfer(consistent withwithdraw, whereBase::burnalready requires auth).Verification
cargo test -p investment-vault— all new + existing tests pass (12 new vault tests, 21 withdraw tests).cargo test -p project-registry— all new + existing tests pass (15 tests).Signed-off-by: laurentketterle-hub laurentketterle-hub@users.noreply.github.com