feat: Add EIP-7702 authorization list support to Transaction#2246
feat: Add EIP-7702 authorization list support to Transaction#2246gtebrean merged 4 commits intoLFDT-web3j:mainfrom
Conversation
Signed-off-by: Roman <4833306+Filter94@users.noreply.github.com>
0a70a0f to
091d83c
Compare
There was a problem hiding this comment.
Pull request overview
This PR adds support for EIP-7702 authorization lists to the Transaction class, enabling Web3j to handle the new transaction type introduced by EIP-7702. The implementation includes a new AuthorizationTuple class to represent authorization list entries and updates to the Transaction class to include an optional authorization list field.
Key changes:
- Introduced
AuthorizationTupleclass with fields for chainId, address, nonce, yParity, r, and s - Added
authorizationListfield toTransactionclass with getter/setter methods - Updated
TransactionandEthBlock.TransactionObjectconstructors to support the new field while maintaining backward compatibility - Added comprehensive test coverage for transactions with authorization lists
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
AuthorizationTuple.java |
New class representing EIP-7702 authorization tuple with proper equality, hashCode, and getter/setter methods |
AuthorizationListTest.java |
Test coverage for AuthorizationTuple equality and getter methods |
TransactionTest.java |
Test coverage for Transaction equality with authorization lists |
Transaction.java |
Added authorizationList field, updated constructors to delegate to the main constructor, and updated equals/hashCode methods |
EthBlock.java |
Added new TransactionObject constructor accepting authorizationList and updated existing constructors to pass null for new fields |
ResponseTest.java |
Added tests for deserializing transactions with authorization lists from JSON responses |
Contract.java |
Minor formatting improvements (line wrapping) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| public TransactionObject( | ||
| String hash, | ||
| String nonce, | ||
| String blockHash, | ||
| String blockNumber, | ||
| String transactionIndex, | ||
| String from, | ||
| String to, | ||
| String value, | ||
| String gas, | ||
| String gasPrice, | ||
| String input, | ||
| String creates, | ||
| String publicKey, | ||
| String raw, | ||
| String r, | ||
| String s, | ||
| long v, | ||
| String type, | ||
| String maxFeePerGas, | ||
| String maxPriorityFeePerGas, | ||
| List<AccessListObject> accessList, | ||
| List<AuthorizationTuple> authorizationList) { | ||
| super( | ||
| hash, | ||
| nonce, | ||
| blockHash, | ||
| blockNumber, | ||
| null, | ||
| transactionIndex, | ||
| from, | ||
| to, | ||
| value, | ||
| gas, | ||
| gasPrice, | ||
| input, | ||
| creates, | ||
| publicKey, | ||
| raw, | ||
| r, | ||
| s, | ||
| v, | ||
| null, | ||
| type, | ||
| maxFeePerGas, | ||
| maxPriorityFeePerGas, | ||
| accessList, | ||
| null, | ||
| null, | ||
| authorizationList); | ||
| } |
There was a problem hiding this comment.
The new TransactionObject constructor that accepts authorizationList (lines 790-840) lacks test coverage. Consider adding a test similar to testEthBlockFullTransactionsWithBlob that includes transactions with authorization lists to ensure proper deserialization from JSON responses.
… transaction specific test Signed-off-by: Roman <4833306+Filter94@users.noreply.github.com>
a557a31 to
215ccfa
Compare
|
@gtebrean So it means that with the current latest version of Web3j I can fetch and deserialize a complete 7702 transaction from the chain, right? And if that's the case, Can you please point me where this field is in the existing codebase? You should be able to easily check this using a 7702 transaction sample and the ResponseTest |
|
@Filter94, now I get it, the 7702 transaction from now can be included in the reponse of those rpcs and that's why Transaction has to be update because else will just increase complexity of the code by managing the custom class there. Please update the pr with the autorization tuple from crypto module (is already referenced in this module) and I will merge it, also update the changelog too. Will be included in the next release |
|
@gtebrean I think what you're asking implies a deeper refactoring. Right now If we use the existing
|
Signed-off-by: gtebrean <99179176+gtebrean@users.noreply.github.com>
What does this PR do?
This PR adds support for 7702 transactions returned from various ETH API methods, like eth_getBlockByX, eth_getTransactionByX
Where should the reviewer start?
ResponseTest.java
Or
EthBlock.java
Why is it needed?
Because otherwise it's impossible to get valid deserialized 7702 transactions from an Ethereum node with Web3j
Checklist