Add shared Postgres nonce queue for cross-repo transaction serialization#2876
Merged
sparrowDom merged 9 commits intosparrowDom/automated-actions-litefrom Apr 15, 2026
Conversation
Both origin-dollar and arm-oeth cron containers use the same KMS signer, risking nonce collisions when transactions are sent concurrently. This adds a Postgres-backed nonce lock that wraps the signer transparently via SELECT ... FOR UPDATE, holding the row lock for the full tx lifecycle. - nonceQueue.ts: withNonceLock + wrapWithNonceQueue signer wrapper - action.ts: conditionally wraps signer when DATABASE_URL is set - docker-compose.yml: adds postgres service for local dev - cron-supervisor.ts: pool cleanup on shutdown - Includes integration tests verifying lock serialization
sparrowDom
commented
Apr 13, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## sparrowDom/automated-actions-lite #2876 +/- ##
=====================================================================
+ Coverage 48.21% 49.19% +0.98%
=====================================================================
Files 112 112
Lines 4835 4844 +9
Branches 1338 1343 +5
=====================================================================
+ Hits 2331 2383 +52
+ Misses 2500 2457 -43
Partials 4 4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
sparrowDom
commented
Apr 13, 2026
…mated-actions-lite-nonce # Conflicts: # contracts/cron/cron-supervisor.ts
0f17acc
into
sparrowDom/automated-actions-lite
14 of 16 checks passed
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.
Both
origin-dollarandarm-oethcron containers use the same KMS signer, risking nonce collisions when transactions are sent concurrently.Functionality:
This adds postgres backed nonce lock, so different processes don't have nonce race conditions
Timeout mechanism added and configured via
NONCE_QUEUE_LOCK_TIMEOUT_MS. If process is waiting for longer than this configuration the process exitsadd per chain gas price limit
functionality to repeat failed brodcasts is added
functionality to re-broadcast a transaction with a higher gas price is added
nonceQueue.ts: withNonceLock + wrapWithNonceQueue signer wrapper
action.ts: conditionally wraps signer when DATABASE_URL is set
docker-compose.yml: adds postgres service for local dev
cron-supervisor.ts: pool cleanup on shutdown
Includes integration tests verifying lock serialization