feat(payments): support selected EVM funding sources - #630
Conversation
* feat(payments): add wallet funding planning * fix(payments): keep wallet funding contract internal
* docs: validate Squid acquisition route * docs: harden acquisition transaction preflight * docs: define Squid acquisition provider
* feat: add bounded token acquisition to payments fund * ci: trigger pull request checks * fix: harden acquisition recovery preflight * fix: normalize squid route addresses * fix: harden funding recovery output * fix: bind acquisition signer and nonces * fix: retry unindexed squid status * fix: reserve remaining acquisition gas * fix: ignore ambient source rpc for direct funding * fix: preserve withdrawal readiness checks * fix: preserve public links in funding errors * fix: clear ready acquisition checkpoints * fix: reject read-only source acquisition * fix: keep direct funding separate from acquisition * fix: confirm resumed acquisition quotes * fix: report invalid fund acquisition inputs * fix: retain incomplete ready checkpoints * fix: cap acquisition status polling * fix: harden acquisition recovery safeguards * fix: refresh wallet before acquisition planning * fix: validate acquisition slippage and URL redaction * fix: preserve fixed-input acquisition refreshes
* test: cover automatic setup acquisition * feat: acquire setup wallet shortfalls * fix: fall back from invalid payment permit * fix: harden automatic setup acquisition * fix: prioritize supported acquisition networks * fix: redact acquisition error causes * fix: avoid duplicate acquisition retries
* test(payments): add release evidence harness * docs(payments): link acquisition glossary terms * refactor(release): split pending evidence record * fix(release): harden evidence artifact sanitization * fix(release): honor custom Filecoin RPC * fix(release): verify custom RPC network * test(release): isolate harness environment
Replace release-evidence terminology and repository-local artifacts with guarded payments smoke-test tooling and operator documentation. Preserve the funded mainnet smoke test as a separate release gate tracked by issue #6.
fix(ci): restore cross-platform payment checks
fix(payments): keep retry commands executable with colors enabled
feat(payments): resolve Squid source assets safely
feat(payments): reuse selected sources in setup --auto
test(payments): cover all selected route policies
fix(payments): enforce acquisition spend bounds
|
The two blocking spend-bound findings have been resolved in the current draft head:
The review follow-ups are also complete: earlier Base and Optimism checkpoints remain recovery-only, recovered routes wait for Filecoin balance propagation, RPC mismatch errors include the actual chain ID, and confirmed approval-only checkpoints can be cleared after direct funding satisfies their saved target. Validation on the fork passed 977 tests with 11 skipped, and the final implementation commit received an exact-head Codex review with no major issues found. This PR remains draft because the funded mainnet checks are still outstanding. |
SgtPooki
left a comment
There was a problem hiding this comment.
this PR is ginormous. I am wondering if this complicated logic belongs in a separate library that we consume and use in filecoin-pin..
| ## Payments Smoke Test | ||
|
|
||
| An explicitly authorized, operator-run verification of the [`filecoin-pin` CLI](#filecoin-pin-cli) funding flows. The tool is dry-run-only unless execution is requested, writes its report outside the repository checkout, and applies additional acknowledgement and spend caps to a live [Squid](#squid) route. It verifies [FIL](#fil) and [USDFC](#usdfc) funding behavior before the existing [Filecoin Pay](#filecoin-pay) path. It is operational verification, not a normal CI task, and its generated report does not belong in the repository. See the [payments smoke-test procedure](payments-smoke-test.md). |
There was a problem hiding this comment.
this feels unnecessary? I don't think we would need to define what a payments smoke test is?
There was a problem hiding this comment.
Separating makes sense.. let me sketch out what that can look like and what can be simplified
There was a problem hiding this comment.
@SgtPooki good idea - I think this plan captures your suggestion:
- i'll build the payments library / move the payments code into a new repo I own here: https://github.com/snissn/squid-evm-funding
- build a new implementation of this PR on top of that repo and close this PR.
- When we get closer to ready to merge the new PR or after we merge it we can move the squid-evm-funding repo to a new owner
There was a problem hiding this comment.
@snissn before we go too far down that path, lets sync up. I think the code should probably belong in the FilOzone/filecoin-project github org, but I'm not wholly convinced all this code is necessary to begin with
|
Superseded by #637. The replacement limits the Filecoin Pin integration to interactive |
Summary
This draft adds optional source funding to
payments fundandpayments setup --autoon Filecoin mainnet.Users choose one source network, one token, and a maximum source amount. New acquisitions support Filecoin, Arbitrum, Ethereum, Polygon, Avalanche, and BNB Chain. The token must resolve unambiguously in the current Squid catalog and return a valid route to the FIL or USDFC required by the command.
The existing Filecoin Pin funding calculations determine the wallet shortfall. The source-funding layer requests only that shortfall, validates the route and spending limits, waits for the assets to reach the Filecoin wallet, and then continues through the existing Filecoin Pay deposit and approval flow.
If the wallet already has enough FIL and USDFC, the direct path remains unchanged and does not request a quote or sign a source transaction. External source funding remains disabled on Calibration and local devnet.
Base and Optimism are not available for new acquisitions. Their total transaction fees include OP Stack fee components that are not bounded by the transaction-level gas fields used by the current hard native-spend ceiling. Earlier Base or Optimism checkpoints with already-broadcast transactions remain recoverable without quoting or signing another source transaction.
Current status
The implementation work tracked by #15, #16, #17, and #18 is complete on the fork.
This includes:
payments fundandpayments setup --auto;Local validation on the merged fork head passed 73 test files: 977 tests passed and 11 were skipped. The final implementation commit also received an exact-head Codex review with no major issues found.
The current upstream head is
a87a8b23370e7062f7682b3499479e45381e0092. The full upstream Actions matrix passed on current and LTS Node.js across Ubuntu, macOS, and Windows, including both browser jobs: Actions run 30340494489.Work remaining before review
This PR remains a draft and is not ready for maintainer review because the funded mainnet checks have not run.
#6 and #19 own that remaining work:
payments fund --daysagainst active mainnet spend and confirm initial mainnet setup reaches ready.No funded mainnet transaction has been completed for this draft, so it does not claim production readiness.
Safety and recovery
The funding path:
This scope does not include wallet balance scanning, source recommendations, automatic source selection, combining multiple source tokens, non-EVM networks, or additional EVM networks.