test(python/evm): add unit tests for ExactEvmSchemeV1 facilitator#146
Open
0xAxiom wants to merge 1 commit into
Open
test(python/evm): add unit tests for ExactEvmSchemeV1 facilitator#1460xAxiom wants to merge 1 commit into
0xAxiom wants to merge 1 commit into
Conversation
Add 36 unit tests for python/x402/x402/mechanisms/evm/exact/v1/facilitator.py - the only file in mechanisms/evm/exact/v1/ without a dedicated test module. The existing test_facilitator.py contains a single V1 case (overpayment amount mismatch) inside TestVerifyV1; the V1 facilitator's other paths (legacy network lookup, JSON-domain validation, validity windows, signature classification, settle, smart-wallet deployment) had no coverage. Tests cover: - TestExactEvmSchemeV1Constructor: default and custom config wiring - TestExactEvmSchemeV1Attributes: scheme, caip_family, get_extra, get_signers - TestVerifyV1: scheme/network mismatch (top-level V1 fields), unknown legacy network (get_evm_chain_id failure), missing eip712 domain (full and version-only), recipient mismatch, amount mismatch (under/over), validBefore too close to now, validAfter in future, empty signature, EOA invalid, undeployed smart wallet without deployment info, classify exception path, EOA-valid + simulation success, deployed ERC1271 simulation fallback, undeployed ERC6492 simulation success/failure, diagnostic name mismatch / nonce used / insufficient balance - TestSettleV1: short-circuit on verify failure, success path with default config, simulate_in_settle=True path, transaction failed receipt, write exception with parsed error, undeployed wallet rejected when deploy disabled, deploy-then-write success, deploy-receipt failure (smart wallet deployment failed)
🟡 Heimdall Review Status
|
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 36 unit tests for
python/x402/x402/mechanisms/evm/exact/v1/facilitator.py— the only file inmechanisms/evm/exact/v1/without a dedicated test module.The existing
test_facilitator.pycontains a single V1 case (TestVerifyV1::test_rejects_overpayment_amount_mismatch); every other path throughExactEvmSchemeV1(legacy network lookup, JSON-domain validation, validity windows, signature classification fallbacks, settle, smart-wallet deployment) had no coverage.Coverage
TestExactEvmSchemeV1Constructor(2)ExactEvmSchemeV1ConfigwiringTestExactEvmSchemeV1Attributes(4)scheme,caip_family,get_extra,get_signersTestVerifyV1(21)get_evm_chain_idfailure →ERR_FAILED_TO_GET_NETWORK_CONFIG)validBeforetoo close to now (6-second buffer)validAfterin futureERR_INVALID_SIGNATUREERR_INVALID_SIGNATUREERR_UNDEPLOYED_SMART_WALLETERR_FAILED_TO_VERIFY_SIGNATURETestSettleV1(9)simulate_in_settle=False)simulate_in_settle=TrueERR_TRANSACTION_FAILEDdeploy_erc4337_with_eip6492=FalseERR_SMART_WALLET_DEPLOYMENT_FAILEDTest Plan
uv run pytest tests/unit/mechanisms/evm/test_v1_facilitator.py— 36/36 passuv run pytest tests/unit/mechanisms/evm/— 290/290 pass (no regressions)uvx ruff format— no changesuvx ruff check— no issues