Skip to content

Commit

Permalink
free up assembly coordinator after revert
Browse files Browse the repository at this point in the history
Signed-off-by: John Hosie <[email protected]>
  • Loading branch information
hosie committed Dec 16, 2024
1 parent f4a838b commit 3f5faf9
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
27 changes: 27 additions & 0 deletions core/go/componenttest/component_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,33 @@ func TestPrivateTransactionRevertedAssembleFailed(t *testing.T) {
assert.Regexp(t, domains.SimpleDomainInsufficientFundsError, txFull.Receipt.FailureMessage)
assert.Regexp(t, "SDE0001", txFull.Receipt.FailureMessage)

//Check that the domain is left in a healthy state and we can submit good transactions
// Start a private transaction - Mint to alice
var goodTxID uuid.UUID
err = rpcClient.CallRPC(ctx, &goodTxID, "ptx_sendTransaction", &pldapi.TransactionInput{
ABI: *domains.SimpleTokenTransferABI(),
TransactionBase: pldapi.TransactionBase{
To: contractAddress,
Domain: "domain1",
IdempotencyKey: "goodTx",
Type: pldapi.TransactionTypePrivate.Enum(),
From: "wallets.org1.aaaaaa",
Data: tktypes.RawJSON(`{
"from": "",
"to": "wallets.org1.bbbbbb",
"amount": "123000000000000000000"
}`),
},
})

require.NoError(t, err)
assert.NotEqual(t, uuid.UUID{}, goodTxID)
assert.Eventually(t,
transactionReceiptCondition(t, ctx, goodTxID, rpcClient, false),
transactionLatencyThreshold(t),
100*time.Millisecond,
"Transaction did not receive a receipt",
)
}

func TestDeployOnOneNodeInvokeOnAnother(t *testing.T) {
Expand Down
2 changes: 2 additions & 0 deletions core/go/internal/privatetxnmgr/transaction_flow_mutators.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,15 @@ func (tf *transactionFlow) applyTransactionAssembledEvent(ctx context.Context, e
revertReason = *event.PostAssembly.RevertReason
}
tf.revertTransaction(ctx, i18n.ExpandWithCode(ctx, i18n.MessageKey(msgs.MsgPrivateTxManagerAssembleRevert), revertReason))
tf.assembleCoordinator.Complete(event.AssembleRequestID, nil)
return
}
if tf.transaction.PostAssembly.AssemblyResult == prototk.AssembleTransactionResponse_PARK {

log.L(ctx).Infof("AssemblyResult is AssembleTransactionResponse_PARK")
tf.status = "parked"
tf.assemblePending = false
tf.assembleCoordinator.Complete(event.AssembleRequestID, nil)
return
}
tf.status = "assembled"
Expand Down

0 comments on commit 3f5faf9

Please sign in to comment.