-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Support EIP-2718 transaction types, EIP-2930 and EIP-1559 support #11288
Conversation
9876df0
to
2a2d6ea
Compare
Builds ready [2a2d6ea]
Page Load Metrics (573 ± 53 ms)
|
2a2d6ea
to
c7fea9b
Compare
Builds ready [c7fea9b]
Page Load Metrics (635 ± 77 ms)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks proper to me!
|
||
const customChainParams = { | ||
name: nickname, | ||
chainId: parseInt(chainId, 16), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor but can we use parseInt
when we first create the variable, since it's not used as a string in this function? Would be cool to know its type right away. Not a blocker, just a suggestion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@darkwing done in latest. Also renamed nickname -> name during destructuring
return Common.forCustomChain('mainnet', customChainParams, HARDFORK); | ||
} | ||
|
||
return new Common({ chain: type, hardfork: HARDFORK }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also minor, (and our linter may not like this, I forget) Can we check for type !== 'rpc'
at the top of the function and return new Common({ chain: type, hardfork: HARDFORK });
immediately, then we don't have to have the rpc type logic in a conditional? Totally minor and probably too picky :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! Good call. I also changed 'rpc' -> NETWORK_TYPE_RPC
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
other than my nit, lgtm!
63e43c5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
beautiful!
Builds ready [b876ed5]
Page Load Metrics (544 ± 48 ms)
|
Builds ready [b5e806b]
Page Load Metrics (624 ± 45 ms)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code makes sense and all my manual testing worked great! Thank you @brad-decker !
EIP-2718 Support via @ethereumjs/tx
Up until this PR we have used a locked version of ethereumjs-tx, which has been deprecated in favor of the namespace @ethereumjs/tx. The following work was done as a prerequisite for this PR to be able to be merged:
This PR gets us onto the newest version of @etheruemjs/tx which includes support for EIP-2718, EIP-2930, and EIP-1559. No UI modification is included in this PR, sending transactions in MetaMask will still use legacy (type 0) transactions.
@ethereumjs/common
This PR also implements the Common library from ethereumjs which helps to instantiate the different types of chain parameters that can affect which types of transactions work on which chains. In this version of @ethereumjs/tx you must use
TransactionFactory.fromTxData
to create a transaction. This factory method references which chain, hardfork and EIPs are currently supported then analyzes the txParams to build the appropriate type of transaction.Updates were necessary in our
signTransaction
method, as well as in a few test files.