Skip to content

test(host-function-contract): harden fixture, tests, and harness docs - #761

Merged
mallison031 merged 4 commits into
Tollcraft:mainfrom
aigbagbobila:fix/issues-715-718-host-function-contract
Sep 30, 2026
Merged

mallison031 merged 4 commits into
Tollcraft:mainfrom
aigbagbobila:fix/issues-715-718-host-function-contract

Conversation

@aigbagbobila

Copy link
Copy Markdown

Resolve four maintenance issues in the host-function benchmark fixture:

-Closes #718: extract the duplicated identity-Map seeding loop shared by every map_* entry point into a documented private support submodule, leaving the public contract interface unchanged.
-Closes #716: cover every fixture entry point (ledger reads, crypto, allocation, Map ops) in both native and WASM registration, including the zero/empty edge cases.
-Closes #717: document the shared WASM loader's purpose, control flow, item behaviour, and panics.
-Closes #715: load the WASM artifact once per test through the shared helper and reuse it across sizes instead of re-reading the file for every measurement, removing the fragile hardcoded relative path.

🤖 Generated with Codebuff

Description

Related Issue

Closes #

Motivation and Context

How Has This Been Tested?

  • Added/Updated tests
  • Passed cargo test
  • Passed cargo clippy
  • Formatted with cargo fmt
  • Reviewed or re-measured budget limits in amm-pool-contract/tests/budget_test.rs when contract, build profile, or toolchain changes may affect them

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Resolve four maintenance issues in the host-function benchmark fixture:

- Tollcraft#718: extract the duplicated identity-Map seeding loop shared by every
  map_* entry point into a documented private `support` submodule, leaving
  the public contract interface unchanged.
- Tollcraft#716: cover every fixture entry point (ledger reads, crypto, allocation,
  Map ops) in both native and WASM registration, including the zero/empty
  edge cases.
- Tollcraft#717: document the shared WASM loader's purpose, control flow, item
  behaviour, and panics.
- Tollcraft#715: load the WASM artifact once per test through the shared helper and
  reuse it across sizes instead of re-reading the file for every
  measurement, removing the fragile hardcoded relative path.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
@drips-wave

drips-wave Bot commented Sep 26, 2026

Copy link
Copy Markdown

@aigbagbobila 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

@mergekeeper

mergekeeper Bot commented Sep 26, 2026

Copy link
Copy Markdown

MergeKeeper review unavailable

AI provider failed: gemini-3.5-flash-lite (200)

No approval or merge action was taken.

The expanded entry-point coverage added for Tollcraft#716 creates a bare
Env::default() and asserts only on return values, but Env::default()
installs a finite Budget::default() (100M CPU instructions, 40MB memory)
alongside the mainnet per-invocation resource limits. A correctness
assertion can therefore fail with a budget error rather than a value
mismatch, and the resulting exit code 101 is indistinguishable from a
real assertion failure in CI.

Every measure_* harness in this crate already calls reset_unlimited()
for the same reason. Do it in the two client helpers so all tests in the
file inherit it, including the zero/empty edge cases added by Tollcraft#716.
main is currently red on the Code Quality workflow: \cargo fmt --all --
--check\ reports a diff in amm-pool-contract/src/lib.rs, which fails the
lint gate on every open PR (PR 761 included) because pull_request runs
check the merge with the base tip.

The violation was introduced on main by the pool_logic refactor
(c37e6f9, 831e319, 59aa304): the \/// Internal module for AMM pool
logic\ doc comment was left abutting the preceding item's closing
brace, and a second blank line was left after \mod pool_logic;\.
rustfmt's default blank_lines_upper_bound is 1, so the extra blank
line is the reported diff.

Add the missing blank line before the doc comment and collapse the
duplicate blank line. No behaviour change.
@mallison031
mallison031 merged commit 85fd89a into Tollcraft:main Sep 30, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants