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

chore(rpc-types): Preferred Type #375

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

chore(rpc-types): Preferred Type #375

wants to merge 1 commit into from

Conversation

refcell
Copy link
Collaborator

@refcell refcell commented Jan 9, 2025

Description

Fixes #28.

Implements the preferred_type method on the OpTransactionRequest.

@refcell refcell added the A-rpc-types Area: op alloy rpc types label Jan 9, 2025
@refcell refcell requested a review from mattsse as a code owner January 9, 2025 17:37
@refcell refcell added the C-chore Category: general cleanup label Jan 9, 2025
@refcell refcell requested review from emhane and clabby as code owners January 9, 2025 17:37
@refcell refcell self-assigned this Jan 9, 2025
@refcell
Copy link
Collaborator Author

refcell commented Jan 9, 2025

📚 $\text{Stack Overview}$

Pulls submitted in this stack:

This comment was automatically generated by st.

@refcell refcell added the D-do-not-merge Desc: Do not merge label Jan 9, 2025
@refcell
Copy link
Collaborator Author

refcell commented Jan 9, 2025

Needs review from @emhane

Copy link
Collaborator

@emhane emhane left a comment

Choose a reason for hiding this comment

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

nice

/// Types are preferred as follows:
/// - Deposit Transactions if `chain_id` is not set
/// - EIP-7702 if authorization_list is set
/// - EIP-4844 if sidecar or max_blob_fee_per_gas is set
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
/// - EIP-4844 if sidecar or max_blob_fee_per_gas is set

Comment on lines +97 to +101
/// - EIP-7702 if authorization_list is set
/// - EIP-4844 if sidecar or max_blob_fee_per_gas is set
/// - EIP-2930 if access_list is set
/// - Legacy if gas_price is set and access_list is unset
/// - EIP-1559 in all other cases
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
/// - EIP-7702 if authorization_list is set
/// - EIP-4844 if sidecar or max_blob_fee_per_gas is set
/// - EIP-2930 if access_list is set
/// - Legacy if gas_price is set and access_list is unset
/// - EIP-1559 in all other cases
/// - See [`TransactionRequest::preferred_type`].

I just delegate docs when I delegate a call, that way I know I don't create doc bugs in future

TxType::Eip1559 => OpTxType::Eip1559,
TxType::Eip2930 => OpTxType::Eip2930,
// EIP-4844 transactions are not supported by Optimism.
TxType::Eip4844 => OpTxType::Eip1559,
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe add a debug log here as well

Comment on lines +103 to +105
if self.0.chain_id.is_none() {
return OpTxType::Deposit;
}
Copy link
Member

Choose a reason for hiding this comment

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

this function is intended for clients sending txs, should we return deposit here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Does it make sense if the chain_id is none that deposit is returned and the client should reject the tx?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Alternatively we remove this and just fall-through to the TransactionReceipt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rpc-types Area: op alloy rpc types C-chore Category: general cleanup D-do-not-merge Desc: Do not merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] Impl TransactionRequest::preferred_type for new type OpTransactionRequest
3 participants