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

Research about EthereumTransactionData.fromBytes #1615

Closed
petreze opened this issue May 29, 2023 · 1 comment · Fixed by #1702
Closed

Research about EthereumTransactionData.fromBytes #1615

petreze opened this issue May 29, 2023 · 1 comment · Fixed by #1702
Assignees
Labels
bug Something isn't working
Milestone

Comments

@petreze
Copy link
Contributor

petreze commented May 29, 2023

Description

EthereumTransactionData cannot be generated fromBytes() from a signed transaction generated previously with the usage of ethers.js (6.4.0)
Signing a transaction with await wallet.signTransaction(tx); from ethers
Error: reason: 'invalid rlp data', code: 'INVALID_ARGUMENT', argument: 'data'
EthereumTransactionData uses "@ethersproject/rlp": "5.7.0" for encoding/decoding ethereum transaction data

Notes: The entire workflow works if using previous ethers.js version - (5.7.2)

Steps to reproduce

const tx = {
    value: ,
    gasPrice:,
    gasLimit: ,
    chainId: ,
    to: ,
    nonce:
};

const wallet = new ethers.Wallet('private_key');
const signed = await wallet.signTransaction(tx);
    
const transactionBuffer = Buffer.from(signed.substring(2), 'hex');

const ethereumTransactionData = EthereumTransactionData.fromBytes(transactionBuffer);

Additional context

Note that while ethers.js has newer stable v6 (6.4.0) version, the @ethersproject/rlp library is still with the most recent stable version v5 (5.7.0). And since everything works properly with ethers v5 (5.7.2), my assumption is that it comes from the difference between those versions

Furthermore, the bytes length generated from await wallet.signTransaction(tx); differs between the versions, hence the newer representation cannot be decoded by the previous decoding approach

Hedera network

other

Version

v25.0.0

Operating system

macOS

@petreze petreze added the bug Something isn't working label May 29, 2023
@ochikov
Copy link
Contributor

ochikov commented May 30, 2023

@petreze What will be the solution here? We are just going to downgrade to Ethers Legacy 5.7?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants