test(fulfill): cover validateAndSanitizeFromOrderStatus and isOrderFulfillable - #1001
Open
devorun wants to merge 1 commit into
Open
test(fulfill): cover validateAndSanitizeFromOrderStatus and isOrderFulfillable#1001devorun wants to merge 1 commit into
devorun wants to merge 1 commit into
Conversation
…lfillable Extend fulfill-utils.spec.ts to the two order-status helpers that gate a fulfill on an order's onchain status. validateAndSanitizeFromOrderStatus throws on a filled or cancelled order and wipes the signature of an already-validated one; isOrderFulfillable mirrors those rejections without throwing so a batch fulfill can drop stale orders and settle the rest. Covers the filled/cancelled/validated paths, the filled-before-cancelled ordering, partial fills, and the zero-totalSize guard.
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
Extends
test/fulfill-utils.spec.tsto the two order-status helpers inutils/fulfill.tsthat gate a fulfill on an order's onchain status. Both were previously only exercised indirectly through the hardhat-backed fulfill specs.validateAndSanitizeFromOrderStatus— throws on a fully filled order, throws on a cancelled order, and wipes the signature of an already-validated one (to save the gas of re-supplying it), otherwise returns the order untouched. Tests cover each path, that the filled check is reported before the cancelled one, that a partial fill is not treated as filled, and that the returned object for a validated order is a fresh copy (the caller's order is left intact).isOrderFulfillable— the non-throwing mirror used by batch fulfill to drop stale orders and settle the rest. Tests cover open / partially filled (true), fully filled / cancelled (false), and the zero-totalSizeguard (a never-filled order stays fulfillable rather than dividing by zero).Testing
hardhat test—fulfill-utils.spec.tspasses (19 tests, 11 new)