Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Commit b202f7a

Browse files
Merge branch '1.x' into wyatt/4058-unsubscribe-fix
2 parents 8fdaa1f + ed10114 commit b202f7a

File tree

4 files changed

+55
-13
lines changed

4 files changed

+55
-13
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -448,3 +448,4 @@ Released with 1.0.0-beta.37 code base.
448448
- Dropped build tests in CI for Node v8 and v10, and added support for Node v14
449449
- Change default value for `maxPriorityFeePerGas` from `1 Gwei` to `2.5 Gwei` (#4284)
450450
- Emit subscription id with connect event when creating a subscription (#4300)
451+
- Fixed bug in signTransaction (#4295)

RELEASE.md

+11-9
Original file line numberDiff line numberDiff line change
@@ -79,25 +79,27 @@ The following describes the steps required to release a new version of `web3.js`
7979
1. Update and commit `CHANGELOG.md`.
8080
1. Move section header `[Unreleased]` to bottom.
8181
1. Add next anticipated release version number to bottom (as a placeholder for new changelog entries).
82-
1. Create release commit and tags e.g. `lerna version 1.2.7-rc.0 --no-push`
82+
1. In the project root, run `npm run build` and commit changes after using a commit message like: `Build for 1.0.0-rc.0`
83+
1. The next step will also build each package, but Lerna makes the tagged commit before building the packages (so they're not included)
84+
3. Create release commit and tags e.g. `lerna version 1.2.7-rc.0 --no-push`
8385
1. (updates package version numbers, builds minified file (for `1.x`), creates release commit and tags.)
84-
1. Push release branch to origin with tags `git push origin release/1.2.7 --follow-tags`.
85-
1. Create release PR as draft ([example](https://github.com/ethereum/web3.js/pull/3351)).
86-
1. Ensure CI is green / passing.
86+
4. Push release branch to origin with tags `git push origin release/1.2.7 --follow-tags`.
87+
5. Create release PR as draft ([example](https://github.com/ethereum/web3.js/pull/3351)).
88+
6. Ensure CI is green / passing.
8789
1. (spend time here inspecting the CI logs to ensure everything looks valid and results were reported correctly)
88-
1. Run `npm run publish from-package -- --dist-tag rc`.
90+
7. Run `npm run publish from-package -- --dist-tag rc`.
8991
1. Lerna can sometimes have difficulty with the number of packages we have. If the above command is unsuccessful, for every unpublished package run: `lerna publish --scope="package-name"` `npm dist-tag add <package-name>@<version> rc`)
90-
1. Publish the GitHub release.
91-
1. A GitHub Webhook should trigger the ReadTheDocs build after the release is published.
92+
8. Publish the GitHub release.
93+
9. A GitHub Webhook should trigger the ReadTheDocs build after the release is published.
9294
1. (The build may sometimes need to be manually triggered in ReadTheDocs admin panel. If the version does not appear, create a build of a previous version to refresh the list.)
9395
1. Activate the new version.
94-
1. Request PR review from key contributors:
96+
10. Request PR review from key contributors:
9597
1. Chris from EthereumJS ([@cgewecke](https://github.com/cgewecke))
9698
1. Patricio from Nomic Labs ([@alcuadrado](https://github.com/alcuadrado))
9799
1. Michael from Embark ([@michaelsbradleyjr](https://github.com/michaelsbradleyjr))
98100
1. Nicholas from Truffle ([@gnidan](https://github.com/gnidan))
99101
1. If touches or affects ENS: Nick Johnson ([@Arachnid](https://github.com/Arachnid))
100-
1. Wait 1 week for community discourse and 2 reviewer approvals.
102+
11. Wait 1 week for community discourse and 2 reviewer approvals.
101103
1. (if release is an emergency patch, time limit may be reduced relative to severity.)
102104

103105
## Formal Release Procedure

packages/web3-eth-accounts/src/index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,9 @@ Accounts.prototype.signTransaction = function signTransaction(tx, privateKey, ca
228228

229229
var result = {
230230
messageHash: '0x' + Buffer.from(signedTx.getMessageToSign(true)).toString('hex'),
231-
v: '0x' + Buffer.from(signedTx.v).toString('hex'),
232-
r: '0x' + Buffer.from(signedTx.r).toString('hex'),
233-
s: '0x' + Buffer.from(signedTx.s).toString('hex'),
231+
v: '0x' + signedTx.v.toString('hex'),
232+
r: '0x' + signedTx.r.toString('hex'),
233+
s: '0x' + signedTx.s.toString('hex'),
234234
rawTransaction: rawTransaction,
235235
transactionHash: transactionHash
236236
};

test/e2e.method.signing.js

+40-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ var assert = require('assert');
22
var Basic = require('./sources/Basic');
33
var utils = require('./helpers/test.utils');
44
var Web3 = utils.getWeb3();
5+
var {TransactionFactory} = require('@ethereumjs/tx');
56

67
describe('transaction and message signing [ @E2E ]', function() {
78
let web3;
@@ -563,5 +564,43 @@ describe('transaction and message signing [ @E2E ]', function() {
563564
done(error)
564565
}
565566
});
566-
});
567567

568+
it('accounts.signTransaction returning valid v r s values', async function(){
569+
570+
const source = wallet[0].address;
571+
const destination = wallet[1].address;
572+
573+
const txCount = await web3.eth.getTransactionCount(source);
574+
const networkId = await web3.eth.net.getId();
575+
const chainId = await web3.eth.getChainId();
576+
577+
578+
const customCommon = {
579+
baseChain: 'mainnet',
580+
customChain: {
581+
name: 'custom-network',
582+
networkId: networkId,
583+
chainId: chainId,
584+
},
585+
hardfork: 'petersburg',
586+
};
587+
588+
const txObject = {
589+
nonce: web3.utils.toHex(txCount),
590+
to: destination,
591+
value: web3.utils.toHex(web3.utils.toWei('0.1', 'ether')),
592+
gasLimit: web3.utils.toHex(21000),
593+
gasPrice: web3.utils.toHex(web3.utils.toWei('10', 'gwei')),
594+
common: customCommon
595+
};
596+
597+
const signed = await web3.eth.accounts.signTransaction(txObject, wallet[0].privateKey);
598+
599+
const data = Buffer.from(signed.rawTransaction.slice(2), "hex")
600+
const tx = TransactionFactory.fromSerializedData(data);
601+
602+
assert(signed.v === ('0x' + tx.v.toString('hex')));
603+
assert(signed.r === ('0x' + tx.r.toString('hex')));
604+
assert(signed.s === ('0x' + tx.s.toString('hex')));
605+
});
606+
});

0 commit comments

Comments
 (0)