Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use TxnManager for onchain transactions #164

Merged
merged 1 commit into from
Jan 9, 2024

Conversation

ian-shim
Copy link
Contributor

@ian-shim ian-shim commented Jan 8, 2024

Why are these changes needed?

  • make use of TxnManager to wait for transactions in a separate goroutines
  • confirmationInfo is updated in a separate goroutine as transaction receipt is now received asynchronously

TODOs In following PRs:

  • update retry logic
  • add metrics to TxnManager

Checks

  • I've made sure the lint is passing in this PR.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, in that case, please comment that they are not relevant.
  • Testing Strategy
    • Unit tests
    • Integration tests
    • This PR is not tested :(

@ian-shim ian-shim force-pushed the batcher-use-txn-manager branch 2 times, most recently from 5bc6b43 to 0c9760e Compare January 8, 2024 20:14
@ian-shim ian-shim marked this pull request as ready for review January 8, 2024 20:41
if err != nil {
return nil, fmt.Errorf("HandleSingleBatch: error getting batch header hash: %w", err)
}
batchID, err := b.getBatchID(ctx, txnReceipt)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function requests a new receipt if the previous one doesn't contain the logs. Are the logs the only thing that may not be populated? I see that we are using the TxHash on L258. Assuming this will always be populated.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, TxHash will be populated as long as the txn has been published.
I've seen logs missing intermittently in some RPC endpoints when receipt is retrieved too soon

@@ -44,7 +44,7 @@ func (c *BatchConfirmer) ConfirmBatch(ctx context.Context, header *core.BatchHea
ctxWithTimeout, cancel := context.WithTimeout(ctx, c.timeout)
defer cancel()
for i := 0; i < maxRetries; i++ {
txReceipt, err = c.Transactor.ConfirmBatch(ctxWithTimeout, *header, quorums, *sigAgg)
txReceipt, err = c.Transactor.ConfirmBatch(ctxWithTimeout, header, quorums, sigAgg)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like maybe we can remove this object?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I'm planning on removing BatchConfirmer entirely once we've tested and validated TxnManager

Copy link
Collaborator

@mooselumph mooselumph left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Just a few questions.

@ian-shim ian-shim force-pushed the batcher-use-txn-manager branch from 0c9760e to 541dcfc Compare January 9, 2024 04:38
@ian-shim ian-shim merged commit 65f3d54 into Layr-Labs:master Jan 9, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants