Skip to content

Move anchoring off the request path + nonce safety #7

Description

@trietlu

Description

Persist anchor-eligible events as PENDING and return the HTTP response immediately (no await tx.wait() in the handler) for createWatch, addEvent, uploadContractDocument. Actual submission moves to the async worker. Serialize submissions per signer to avoid nonce collisions.

Affected areas

backend/src/controllers/watch.controller.ts, backend/src/services/onchain.service.ts.

Dependencies / order

Depends on #6.

Acceptance criteria

  • Event-creation responses no longer block on chain confirmation (measured latency drops).
  • Newly created anchor-eligible events are left PENDING and picked up asynchronously.
  • Two concurrent event creations do not produce a nonce collision / dropped tx.
  • Behavior with BLOCKCHAIN_ENABLED=false unchanged (events NOT_REQUIRED).

Definition of done

  • Implemented on a short-lived feature branch, merged into staging (never main).
  • Verified on the staging preview stack.
  • Docs updated if infra/env/API behavior changes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readyScoped and specified for autonomous agent implementationblockchainOn-chain anchoring / smart-contract work

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions