feat: batch settlement go sdk#2212
Closed
CarsonRoscoe wants to merge 4 commits intox402-foundation:mainfrom
Closed
feat: batch settlement go sdk#2212CarsonRoscoe wants to merge 4 commits intox402-foundation:mainfrom
CarsonRoscoe wants to merge 4 commits intox402-foundation:mainfrom
Conversation
|
@CarsonRoscoe is attempting to deploy a commit to the Coinbase Team on Vercel. A member of the Team first needs to authorize it. |
073b8b3 to
f2d2dcc
Compare
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.
Follow up of PR #2164, which was automatically closed when the Typescript SDK merged to main
Description
Adds the batch-settlement EVM scheme to the Go SDK at parity with the TypeScript reference implementation, plus the
resource-server architectural changes from #2109 that batch-settlement depends on.
New: batch-settlement scheme (
go/mechanisms/evm/batch-settlement/)BatchSettlementEvmSchemewith deposit (ERC-3009 + Permit2 transports), voucher signing, channel-state recovery, corrective402 resync, cooperative refund (
scheme.Refund(url)).voucher verification.
UpdateChannelstorage +PendingRequestreservations; voucher local-commit short-circuit (no on-chainsettle for vouchers); local voucher verification when on-chain state is fresh (
OnchainStateTtlMs); InMemory + File channel storagebackends;
BatchSettlementChannelManagerclaim/settle/refund tick loop.extra.channelState,chargedAmount, etc.); error codes consolidated under theinvalid_batch_settlement_evm_*prefix.Resource-server hook architecture (
go/server.go,go/server_hooks.go,go/server_hook_policy.go) — port of TS PR #2109:(network, scheme)hook isolation: scheme-provided hooks no longer leak into the global hook list and only fire for the matchedscheme.
getLabeledHooks).ResourceServerExtensionHooks{...}; each hook is gated onctx.DeclaredExtensions[key]being set on the route.EnrichSettlementPayload/EnrichSettlementResponseproviders, called around facilitator settle.AssertAcceptsAllowlistedAfterExtensionEnrich,AssertAdditivePayloadEnrichment,AssertAdditiveSettlementExtra,MergeAdditiveSettlementExtra, etc.) — full port of TShookPolicy.ts. Replaces TS's compile-timeDeepReadonlyenforcement with runtime additive-policy enforcement.VerifyPaymentWithExtensions/SettlePaymentWithExtensions/ProcessSettlementWithExtensions/CreatePaymentCancellationDispatcherWithExtensionsmethods thread declared extensions through verify → settle → cancellation.Existing API methods delegate with
nilfor backward compat.nethttp,gin,echo) all forwardresult.DeclaredExtensionsand honor theSkipHandlerdirective(previously only
nethttpdid).Examples (
examples/go/{clients,servers,facilitator}/batch-settlement/): drop-in client, server, and facilitator examples with.env-examplefiles mirroring the TS examples.E2E (
e2e/clients/go-http,e2e/facilitators/go,e2e/servers/{gin,nethttp}): batch-settlement scenarios wired into the cross-SDK harness, exercising deposit + voucher + cooperative-refund phases across go-http × {gin, nethttp} × go-facilitator on Base Sepolia.Tests
make testandmake test-integrationfrom/goboth pass:Cross-SDK e2e testing between Typescript and Go for batch-settlement
Checklist