-
Notifications
You must be signed in to change notification settings - Fork 5k
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
Transactions integration tests - failing #6072
Comments
const Web3 = require('../../packages/web3/lib');
(async () => {
const web3 = new Web3('http://127.0.0.1:8545');
const tx = {
to: '0x8f3e9c1Bd65EB267d19B176A73217524DC21A5ca',
nonce: 951,
gasLimit: '0x67b8bf',
maxFeePerGas: '0xacd3ccc06a',
maxPriorityFeePerGas: '0x180c3ca0',
};
const privateKey = '0x0f8592102198f565b00937d2da3cd00475866ebdb18053243355dd6aa0222ab4';
console.log(await web3.eth.accounts.signTransaction(tx, privateKey));
})().catch(console.error); Result: {
messageHash: '0x64d483d6ad77ec3f98883d422e0d437314f26d2ad315dafee43991fdd6fc10d5',
v: '0x0',
r: '0x36fc20be13e2bbd9cadbbc6827fcdf21a2b9d9b17e32e140d62c67b90d5167d',
s: '0x20e0d8a16a30e9d3ddd78374b9469be5179c73dafa9e5a8b82994748cbbb3e93',
rawTransaction: '0x02f8708205398203b784180c3ca085acd3ccc06a8367b8bf948f3e9c1bd65eb267d19b176a73217524dc21a5ca8080c080a0036fc20be13e2bbd9cadbbc6827fcdf21a2b9d9b17e32e140d62c67b90d5167da020e0d8a16a30e9d3ddd78374b9469be5179c73dafa9e5a8b82994748cbbb3e93',
transactionHash: '0x23cdd2c6da508a064d78b490a200d525c15543652c1ff3804cd067e95f394877'
} const {Web3} = require('../../packages/web3/lib/commonjs');
(async () => {
const web3 = new Web3('http://127.0.0.1:8545');
const tx = {
to: '0x8f3e9c1Bd65EB267d19B176A73217524DC21A5ca',
nonce: 951,
gasLimit: '0x67b8bf',
maxFeePerGas: '0xacd3ccc06a',
maxPriorityFeePerGas: '0x180c3ca0',
};
const privateKey = '0x0f8592102198f565b00937d2da3cd00475866ebdb18053243355dd6aa0222ab4';
console.log(await web3.eth.accounts.signTransaction(tx, privateKey));
})().catch(console.error); Result: {
messageHash: '0x64d483d6ad77ec3f98883d422e0d437314f26d2ad315dafee43991fdd6fc10d5',
v: '0x0',
r: '0x36fc20be13e2bbd9cadbbc6827fcdf21a2b9d9b17e32e140d62c67b90d5167d',
s: '0x20e0d8a16a30e9d3ddd78374b9469be5179c73dafa9e5a8b82994748cbbb3e93',
rawTransaction: '0x02f8708205398203b784180c3ca085acd3ccc06a8367b8bf948f3e9c1bd65eb267d19b176a73217524dc21a5ca8080c080a0036fc20be13e2bbd9cadbbc6827fcdf21a2b9d9b17e32e140d62c67b90d5167da020e0d8a16a30e9d3ddd78374b9469be5179c73dafa9e5a8b82994748cbbb3e93',
transactionHash: '0x23cdd2c6da508a064d78b490a200d525c15543652c1ff3804cd067e95f394877'
} @ethereumjs/tx const { Transaction } = require('@ethereumjs/tx');
const { hexToBytes,bytesToHex } = require('ethereum-cryptography/utils');
(async () => {
const tx = Transaction.fromTxData({
to: '0x8f3e9c1Bd65EB267d19B176A73217524DC21A5ca',
nonce: 951,
gasLimit: '0x67b8bf',
maxFeePerGas: '0xacd3ccc06a',
maxPriorityFeePerGas: '0x180c3ca0',
})
const privateKey = hexToBytes('0f8592102198f565b00937d2da3cd00475866ebdb18053243355dd6aa0222ab4')
const signedTx = tx.sign(privateKey)
console.log('signedTx', bytesToHex(signedTx.serialize()));
})().catch(console.error); Result: f8628203b7808367b8bf948f3e9c1bd65eb267d19b176a73217524dc21a5ca808026a091085ae95e31b90ca9f24329b97c534cea38660feb845196d8c90d225d9b2ceea06b050c46eafe839e3bc0606f14129051b4873cde91b10214430aa6b69e453751 |
Update of investigation: if I use this code for 4.x const {Web3,TransactionFactory} = require('../../packages/web3/lib/commonjs');
(async () => {
const web3 = new Web3('http://127.0.0.1:8545');
const tx = {
to: '0x8f3e9c1Bd65EB267d19B176A73217524DC21A5ca',
nonce: 951,
chainId: 1, // ADDED CHAIN ID HERE,
gas: '0x67b8bf',
gasLimit: '0x67b8bf',
maxFeePerGas: '0xacd3ccc06a',
maxPriorityFeePerGas: '0x180c3ca0',
}
const privateKey = '0x0f8592102198f565b00937d2da3cd00475866ebdb18053243355dd6aa0222ab4';
console.log(await web3.eth.accounts.signTransaction(tx, privateKey));
})().catch(console.error);
// RESULT:
'0x02f86e018203b784180c3ca085acd3ccc06a8367b8bf948f3e9c1bd65eb267d19b176a73217524dc21a5ca8080c001a0c529af66fcc1681583db0a4aa26935fd05b827dbf1295d07490b7ec2f194faa1a0275202c63732a528b4a6c91bc241a8641db8195a4339cd6d789bcc4ceb309f17' @ethereumjs/tx code: const { TransactionFactory } = require('@ethereumjs/tx');
const { hexToBytes, bytesToHex } = require('ethereum-cryptography/utils');
(async () => {
const tx = TransactionFactory.fromTxData({
to: '0x8f3e9c1Bd65EB267d19B176A73217524DC21A5ca',
nonce: 951,
gasLimit: '0x67b8bf',
maxFeePerGas: '0xacd3ccc06a',
maxPriorityFeePerGas: '0x180c3ca0',
type: 2, // ADDED TYPE HERE, because automatically set 0
});
const privateKey = hexToBytes('0f8592102198f565b00937d2da3cd00475866ebdb18053243355dd6aa0222ab4');
const signedTx = tx.sign(privateKey);
console.log('signedTx', bytesToHex(signedTx.serialize()));
})().catch(console.error);
// RESULT
'02f86e018203b784180c3ca085acd3ccc06a8367b8bf948f3e9c1bd65eb267d19b176a73217524dc21a5ca8080c001a0c529af66fcc1681583db0a4aa26935fd05b827dbf1295d07490b7ec2f194faa1a0275202c63732a528b4a6c91bc241a8641db8195a4339cd6d789bcc4ceb309f17' So if I set |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Following tests are excluded in this PR as these are not passing, these should be investigated.
The text was updated successfully, but these errors were encountered: