You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: do not queue multiple jobs when same SIWF payload is posted multiple times (#752)
# Problem
If the same authorizationCode was posted to the `/v2/accounts/siwf`
endpoint, multiple queue tasks would be created for (essentially) the
same payload (at least, the same sequence of extrinsics).
# Root Cause
The work queue in BullMQ is intended to be unique on `jobId`. The
`jobId` was being created from a hash of the payload retrieved from SIWF
(Frequency Access). However, when a payload is retrieved from SIWF using
an authorization code, that payload is *SIGNED ON DEMAND*--meaning the
signed extrinsics within the payload differ; different contents =>
different hash, different job ID, hence multiple jobs.
# Solution
If an authorization code is being used to retrieve a payload, use the
authorization code as the job ID instead of the retrieved payload hash
Note, it's still possible that the same operations could be submitted by
an external agent who handles their own signing/payload creation, or
handles fetching the payload from SIWF themselves and submits the actual
payload to Gateway instead of the authorization code. This solution does
not prevent that scenario from causing multiple jobs to be queued for
the same sequence of user creation transactions. (Tracking as #753)
Closes#674
---------
Co-authored-by: Aramik <[email protected]>
0 commit comments