Skip to content

misc improvements and fixes#5

Merged
hhl42 merged 2 commits into
mainfrom
improvements
May 2, 2026
Merged

misc improvements and fixes#5
hhl42 merged 2 commits into
mainfrom
improvements

Conversation

@hhl42
Copy link
Copy Markdown
Contributor

@hhl42 hhl42 commented May 2, 2026

harden router refresh, fix pay-resolve / boolean-outcome edge cases, raise WebAPI default pay timeout, drop legacy SDK condition helpers

hhl42 added 2 commits May 2, 2026 08:46
- route: stamp RouterUpdated events with block.timestamp (not time.Now)
  so startup replay doesn't revive stale routers
- route: skip periodic refresh when registeredAt==0 to respect explicit
  deregistration
- route: derive event-monitor backtrack from sampled chain block time so
  the 7-day live-router window is covered on fast chains
- server/webapi: rename ospWebapiDefaultPayTimeout -> ...Sec, bump 50 ->
  600s (post-blocktime the unit silently shrank from blocks to seconds)
- sdk: ResolveCondPayOnChain auto-deploys locally-registered
  VIRTUAL_CONTRACT conditions before submitting; removes the implicit
  'call OnChainGetBooleanOutcome first' prerequisite
- docs: drop stale regenerate-legacy-app-bindings.sh reference
- app: GetBooleanOutcome short-circuits to (false,false,nil) when
  isFinalized is false, matching PayResolver
- celersdk: drop legacy BooleanCondition / SendTokenWithCondition /
  SendETHWithCondition / bc2c (no callers; SendConditionalPayment covers)
- webapi: document block_duration as seconds in web_api.proto; inline
  the no-op paymentInfoFromClientPayment wrapper
- cleanup comments and docs
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR tightens time/timeout semantics and dispute-resolution behavior across the WebAPI, router controller, and SDK, with a focus on making on-chain interactions more robust (router refresh correctness; virtual-condition auto-deploy before on-chain resolve) and removing legacy SDK helpers.

Changes:

  • Harden router refresh/event replay by deriving timestamps from the event’s block header and computing a chain-specific event backtrack window.
  • Make on-chain conditional-pay resolution self-sufficient by auto-deploying locally-registered VIRTUAL_CONTRACT conditions before submitting the resolve tx; update E2E coverage accordingly.
  • Raise the OSP WebAPI SendToken default pay timeout and remove legacy SDK BooleanCondition helpers.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
webapi/proto/web_api.proto Clarifies block_duration semantics as unix-seconds (kept name for wire compatibility).
webapi/api_server_test.go Updates regression test commentary for unknown session ID handling.
webapi/api_server.go Drops legacy payment-info wrapper and routes directly to shared mapping.
tools/scripts/README.md Simplifies generated-file header convention documentation.
test/e2e/pay_dispute.go Updates dispute scenarios to validate SDK auto-deploy behavior for virtual conditions.
server/osp_webapi_backend.go Increases default SendToken resolve-deadline window to 600s and clarifies naming/units.
route/controller.go Adds ethclient dependency, uses canonical block timestamps for RouterUpdated events, and computes dynamic replay backtrack by sampled block time.
cnode/cnode.go Wires ethclient into route controller construction.
client/api.go Auto-deploys locally-registered virtual conditions before ResolveCondPayOnChain.
celersdk/utils.go Removes legacy BooleanCondition conversion helper.
celersdk/types.go Removes legacy BooleanCondition type.
celersdk/pay.go Removes SendTokenWithCondition APIs and updates on-chain resolve docs for auto-deploy behavior.
celersdk/appsession.go Updates SDK app-session module header comment to match trimmed surface area.
app/appclient.go Adds EnsureAppChannelDeployed and short-circuits GetOutcome when IsFinalized is false.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread route/controller.go
Comment thread route/controller.go
@hhl42 hhl42 merged commit 091da6d into main May 2, 2026
6 checks passed
@hhl42 hhl42 deleted the improvements branch May 2, 2026 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants