Increase Smart Contract Test Coverage - #769
Open
CollinsC1O wants to merge 3 commits into
Open
Conversation
… coverage (Core-Foundry#403) The contract crate no longer compiled: botched merge-conflict resolutions left duplicate definitions across errors.rs, events.rs, autoshare_logic.rs and reputation.rs, and lib.rs had duplicate / mis-pathed test modules with ~25 suites disabled. - errors.rs: dedupe the Error enum (unique discriminants 1..40) - events.rs: remove duplicate event structs and a doubled #[contractevent] - autoshare_logic.rs: drop the duplicated emit_batch_completed signature, the duplicated import block and a duplicate struct field - lib.rs: collapse the three conflicting test-module blocks into one, re-expose the channel-subscription methods on #[contractimpl] - re-enable every test suite and update stale call sites for the current API (schedule_notification / batch_schedule_notifications take a priority), TryFromVal imports, removed a benchmark using the deleted Budget::get_cpu_instruction_cost, fixed a wrong event-topic index and bad "name too long" test data; access_control_test stays excluded Contract behaviour changes: - record_delivery_attempt / _failure / _acknowledgment now reject unknown, revoked or expired notifications - reduce_usage takes an explicit caller: Address - calculate_reputation_score uses integer math spanning the full 0..100 New tests: edge_case_coverage_test.rs adds 34 failure-scenario / boundary tests. Full suite: 445 passing, 0 failing. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…ear warnings - add tests/reputation_test.rs (12 contract-level reputation tests) that previously lived only on the stale remote branch; ported to the current client API (record_delivery_success) - revocation_test: add the missing #[test] on test_revoke_notification_while_contract_paused_fails so it actually runs - clear compiler warnings across the re-enabled suites: drop unused imports, remove dead helper fns (topics_of / data_of), replace deprecated String::from_slice with String::from_str in metadata_validation, elide lifetimes in access_log_test / schema_version_test setup helpers - scope the test-only Env import inside base::reputation::tests Full suite: 458 passing, 0 failing, 0 warnings. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.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.
Closes #403