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

[HotWallet] Add txsender #124

Merged
merged 3 commits into from
Feb 27, 2024
Merged

[HotWallet] Add txsender #124

merged 3 commits into from
Feb 27, 2024

Conversation

ian-shim
Copy link
Contributor

@ian-shim ian-shim commented Feb 22, 2024

This PR introduces a new interface txsender, which supports a few methods:

  • SendTransaction: signs a raw transaction and broadcasts it to the network
  • GetTransactionReceipt : retrieves the receipt if available
  • SenderAddress: address of the transaction sender

It also refactors the TxManager to use txsender instead of signing/sending the transaction itself.

This interface will be used to implement remote MPC txsender that uses Fireblocks API.

@ian-shim ian-shim force-pushed the tx-sender branch 2 times, most recently from b4b0252 to fd95f52 Compare February 22, 2024 20:20
Copy link
Collaborator

@samlaf samlaf left a comment

Choose a reason for hiding this comment

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

So we're left with these 2 interfaces

type TxSender interface {
	SendTransaction(ctx context.Context, tx *types.Transaction) (TxID, error)
	WaitForTransactionReceipt(ctx context.Context, txID TxID) (*types.Receipt, error)
	SenderAddress() common.Address
}

type TxManager interface {
	Send(ctx context.Context, tx *types.Transaction) (*types.Receipt, error)
	GetNoSendTxOpts() (*bind.TransactOpts, error)
}

which look very very similar to me. Do we still need the txmgr? Unclear to me that they don't serve the same purpose?

chainio/txmgr/txmgr.go Show resolved Hide resolved
chainio/clients/txsender/privateKeyTxSender.go Outdated Show resolved Hide resolved
chainio/clients/txsender/privateKeyTxSender.go Outdated Show resolved Hide resolved
chainio/clients/txsender/privateKeyTxSender.go Outdated Show resolved Hide resolved
Copy link
Contributor Author

@ian-shim ian-shim left a comment

Choose a reason for hiding this comment

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

which look very very similar to me. Do we still need the txmgr? Unclear to me that they don't serve the same purpose?

I agree that they look very similar from the interface/naming. Maybe we can clarify the naming of the two interfaces, but my understanding is the two have different purposes. txmgr "manages" transactions in that it would manage the nonces, regas logic in case tx is stalled, etc. while txsender supports more primitive functionalities like sending a raw transaction. So txmgr would use txsender to achieve the high level functionalities

chainio/txmgr/txmgr.go Show resolved Hide resolved
chainio/clients/txsender/privateKeyTxSender.go Outdated Show resolved Hide resolved
chainio/clients/txsender/privateKeyTxSender.go Outdated Show resolved Hide resolved
@ian-shim ian-shim force-pushed the tx-sender branch 2 times, most recently from afa395f to c73fa2e Compare February 26, 2024 19:34
@ian-shim ian-shim requested a review from samlaf February 26, 2024 23:24
* add txsender

* more methods in fireblocks client

* [HotWallet] Implement Fireblocks TxSender (#131)

* more methods in fireblocks client

* add fireblocks txsender
Copy link
Collaborator

@samlaf samlaf left a comment

Choose a reason for hiding this comment

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

LGTM!

@ian-shim ian-shim merged commit 65cc80e into master Feb 27, 2024
3 checks passed
@ian-shim ian-shim deleted the tx-sender branch February 27, 2024 22:25
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.

3 participants