Skip to content

test: make the lib test target build and run to completion - #1272

Closed
ASIDISG wants to merge 2 commits into
RevoraOrg:masterfrom
ASIDISG:fix/lib-build-recovery
Closed

ASIDISG wants to merge 2 commits into
RevoraOrg:masterfrom
ASIDISG:fix/lib-build-recovery

Conversation

@ASIDISG

@ASIDISG ASIDISG commented Sep 28, 2026 •

Copy link
Copy Markdown

Summary

On master, cargo test --lib does not compile (23 errors in test modules and the kani harness), and once it does, two gas tests exceed the host's default budget and abort the whole test process (SIGABRT), so no test result is reported at all. This PR makes the lib test target build and run to completion. Test code only; no contract code changes.

This replaces the earlier version of this PR (a 33-file "restore lib build" rewrite that had gone stale against master and conflicted in 15 files). Most of what it restored has since landed on master; what remained was the above. The previous branch is kept at backup/pr1272-fix-lib-build-recovery.

What changed (two commits)

  1. style: cargo fmt --all: the repository's own Format check (cargo fmt) job fails on master today (40 hunks). Formatting only. The same commit is the base of the four issuer-transfer test PRs (test: add adversarial cancel_issuer_transfer coverage (#1060) #1279, test: add adversarial propose_transfer_with_expiry coverage (#1057) #1280, test: add adversarial replace_issuer_transfer coverage (#1058) #1281, test: add adversarial accept_issuer_transfer coverage (#1059) #1282), so it merges identically in any order.
  2. test: make the lib test target build and run to completion:
    • kani harness tests (compute_share.rs, issuer_transfer_cancel.rs): import the std items they use in this no_std crate (format!, Box, String, ToString).
    • API drift in contributed tests (test_audit_summary_getter, test_testnet_mode, test_estimate_transfer, test_deposit_revenue_adversarial, test_offering_count_adversarial): set_min_revenue_threshold takes four arguments; freeze() takes none and the pause call is pause_admin; the clients return () for Result<(), _> so .unwrap() is removed; try_* results are matched on Ok(Ok(..)); a moved env/jurisdiction is cloned or computed first; register_offering is idempotent on (issuer, namespace, token), so a duplicate is Ok, there is no OfferingAlreadyExists.
    • Two aborting gas tests (test_close_period): env.budget().reset_unlimited() before registering 1000 persistent entries / 1000 holders. Their own comments assume an unlimited test budget; cost is still measured as a cpu_instruction_cost() delta.
    • Add decimals-consistency guard rejecting register_offering with mismatched token decimals #612 decimals guard: 48 register_offering calls in eight modules passed display_decimals = 0 for the 7-decimal test token, which the guard rejects with DecimalsMismatch. They now pass 7. This one change took the suite from 163 failures to 102.

Verification

cargo fmt --all -- --check          -> clean
cargo test --lib -- --test-threads=4
test result: FAILED. 585 passed; 102 failed; 1 ignored   (completes, no abort)

Before this PR the same command either does not compile or aborts.

The 102 remaining failures are pre-existing, not introduced here

They are in modules this PR only made buildable, grouped by module so they can be split into follow-ups:

Module Failing
test_estimate_transfer 19
test_faucet_metrics 12
test_event_indexed_v3 9
test_transfer_cooldown, test_epoch_boundary_report 8 each
test_storage_layout_version, test_audit_summary_getter 6 each
test_quorum_check 5
test_tax_year, test_reg_limit_delta, test_close_period 4 each
test_faucet_seed, test_compute_share_invariants 3 each
test_get_payment_token, test_event_indexed_v2, oracle_chain_tests 2 each
vesting, test_offering_count_adversarial, test_multi_token_independence, test_claim_transfer_fail, test_accrual_reconciliation_prop 1 each

Known causes include: test_faucet_metrics/test_faucet_seed expect the fct_mtr1 emission that the Aug-31 merge chain dropped (the constant, counters and docs survive, the emission does not), test_estimate_transfer fails with StaleNonce, and test_audit_summary_getter reads storage outside env.as_contract. The earlier version of this PR contained the fct_mtr1 restoration and the orphaned test_indexer_fixtures module; both are still on the backup branch and I will resubmit them separately rather than fold them in here.

Notes

  • This PR does not close an issue. (The earlier version carried Closes #1059 by mistake.)
  • The upstream Build and test job runs with continue-on-error: true and || true, so its green tick does not reflect any of the above. Removing that is worth a follow-up once the 102 are fixed.

@drips-wave

drips-wave Bot commented Sep 28, 2026

Copy link
Copy Markdown

@ASIDISG Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Brings master in line with the repository's own Format check (cargo fmt --all -- --check), which fails on master today (40 hunks). Formatting only; no code or test changes.
On master 'cargo test --lib' does not compile (23 errors in test modules and the kani harness), and once it does, two gas tests exceed the host's default budget and abort the whole test process, so no test result is reported at all. This commit fixes that, test code only:
- kani harness tests: import the std items they use in this no_std crate
- test_audit_summary_getter, test_testnet_mode, test_estimate_transfer, test_deposit_revenue_adversarial, test_offering_count_adversarial: follow the current client API (freeze() and pause_admin(), set_min_revenue_threshold has four arguments, estimate_transfer / register_offering results, register_offering is idempotent so a duplicate is Ok)
- test_close_period: reset the budget in the two 1000-entry gas tests so they measure cost instead of aborting the process
- 48 register_offering calls in eight modules pass display_decimals = 7 for the 7-decimal test token, as the RevoraOrg#612 decimals guard requires
@ASIDISG
ASIDISG force-pushed the fix/lib-build-recovery branch from dc904be to 18b624c Compare October 16, 2026 01:41
@ASIDISG ASIDISG changed the title fix: restore lib build and recover test suite lost in the Aug-31 merge chain test: make the lib test target build and run to completion Oct 16, 2026
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