Open
Conversation
cd5102b to
570266d
Compare
570266d to
85cbc41
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
5.2.1->7.0.10Release Notes
ethereumjs/ethereumjs-util
v7.0.9Compare Source
This release adds support for very high
chainIdnumbers exceedingMAX_SAFE_INTEGER(an example is the chain ID34180983699157880used for the ephemeral Yolov3 testnet preparing for theberlinhardfork, but high chain IDs might be used for things like private test networks and the like as well).Function signatures for methods in
addressandsignatureare therefore expanded to allow for aBNLikeinput type (BN | PrefixedHexString | number | Buffer) for chain ID related parameters.All function signatures are still taking in a
numberinput for backwards-compatibility reasons. If you use one of the following functions to implement generic use cases in your library where the chain ID is not yet known it is recommended to updated to one of the other input types (with plainBufferlikely be the most future-proof). Note that on some functions this changes the return value as well.account:toChecksumAddresss(hexAddress: string, eip1191ChainId?: number): stringtoChecksumAddress = function(hexAddress: string, eip1191ChainId?: BNLike): stringaccount:isValidChecksumAddress(hexAddress: string, eip1191ChainId?: number)isValidChecksumAddress(hexAddress: string, eip1191ChainId?: BNLike)signature:ecsign(msgHash: Buffer, privateKey: Buffer, chainId?: number): ECDSASignatureecsign(msgHash: Buffer, privateKey: Buffer, chainId?: number): ECDSASignature(return value stays the same onnumberinput)ecsign(msgHash: Buffer, privateKey: Buffer, chainId: BNLike): ECDSASignatureBuffer(changed return value for other type inputs)signature:ecrecover(msgHash: Buffer, v: number, r: Buffer, s: Buffer, chainId?: number): Bufferecrecover(msgHash: Buffer, v: BNLike, r: Buffer, s: Buffer, chainId?: BNLike): Buffersignature:toRpcSig(v: number, r: Buffer, s: Buffer, chainId?: number): stringtoRpcSig(v: BNLike, r: Buffer, s: Buffer, chainId?: BNLike): stringsignature:isValidSignature(v: number, r: Buffer, s: Buffer, homesteadOrLater: boolean = true, chainId?: number)isValidSignature(v: BNLike, r: Buffer, s: Buffer, homesteadOrLater: boolean = true, chainId?: BNLike)v7.0.8Compare Source
Address.equals(address: Address)function for easier address equality comparions, PR #285fromRpcSig()in thesignaturemodule not working correctly for chain IDs greater than 110, PR #287v7.0.7Compare Source
stateRootcheck forAccount.isEmpty()to make emptiness checkEIP-161compliant, PR #279AddressLikeand helperbnToHex(), PR #279account.raw()which returns a Buffer Array of the raw Buffers for the account in order, PR #279v7.0.6Compare Source
New
AccountclassThis release adds a new
Accountclass intended as a modern replacement forethereumjs-account. It has a shape ofAccount(nonce?: BN, balance?: BN, stateRoot?: Buffer, codeHash?: Buffer).Instantiation
The static factory methods assist in creating an
Accountobject from varying data types:Object: fromAccountData,RLP: fromRlpSerializedAccount, andArray: fromValuesArray.Methods:
isEmpty(): boolean,isContract(): boolean,serialize(): BufferExample usage:
For more info see the documentation, examples of usage in
test/account.spec.tsorPR #275.
New export: TypeScript types
A new file with helpful TypeScript types has been added to the exports of this project,
see PR #275.
In this release it contains
BNLike,BufferLike, andTransformableToBuffer.Address.toBuffer()
The Address class has as a new method
address.toBuffer()that will give you a copy of the underlyingaddress.buf(PR #277).
toBuffer()now converts TransformableToBufferThe
toBuffer()exported function now additionally converts any object with atoBuffer()method(PR #277).
v7.0.5Compare Source
This release adds a new module
address- see README -with a new
Addressclass and type which can be used for creating and representing Ethereum addresses.Example usage:
In
TypeScriptthe associatedAddresstype can be used to more strictly enforce type checks(e.g. on the length of an address) on function parameters expecting an address input.
So you can declare a function like the following:
myAddressRelatedFunction(Address: address)to get more assurance that the address input is correct.
See PR #186
v7.0.4Compare Source
BN.jsandRLPre-export failures from TypeScript,PR #270
within the
assertIs*helper functions, issue affects most methods of thelibrary,
PR #269
v7.0.3Compare Source
This release replaces the
keccakandsecp256k1dependencies(PR #257)
and instead uses the
ethereum-cryptography
package that uses native JS implementations for cryptographic primitives
and makes use of modern and forward-compatible N-API implementations in Node
wherever possible.
This is part of a larger initiative led by Nomic Labs to improve the developer
experience within the Ethereum developer ecosystem,
see ethereum/js-team-organization#18 for context.
Other Changes:
TypeScriptdefinitions forethjs-utilmethods,PR #248 and
PR #260
v7.0.2Compare Source
This patch release re-establishes the state of
v7.0.0release and upgradesthe
BN.jsre-export version back tov5since quick patches for boththe
v5(v5.1.2) andthe
v4branch (v4.11.9)have been released to fix interoperability issues between the
BN.jsversions.This now makes it possible to move to the latest
BN.jsv5version and profitfrom future upgrades and patches.
An upgrade is highly recommended, the
v7.0.1release will be marked asdeprecated along this release.
See: Issue #250
v7.0.1Compare Source
[DEPRECATED in favour of v7.0.2]
This patch release downgrades the re-exported
BN.jsversion fromv5tov4(so a continuation of what has being used within thev6.xversions).This is due to some unexpected interoperability problems in libraries using
the older
v4BN.jsbranch in their some of their respective dependencies.An upgrade is highly recommended, the
v7.0.0release will be marked asdeprecated along this release.
See: Issue #250
v7.0.0Compare Source
[DEPRECATED in favour of v7.0.1]
This release comes with significant changes to the API, updated versions of
the core crypto libraries and substantial developer improvements in the form
of a refactored test suite and API documentation.
API Changes
Changes to the API have been discussed in Issue
#172 and are
guided by the principles of:
While the implemented changes come with some additional need for manual type
conversions depending on the usage context, they should finally lead to
cleaner usage patterns on the cosuming side and a more predictable, robust and
less error-prone control flow.
Some note: for methods where
Bufferusage is now enforced you can use theBytes.toBuffer()method for conversion.Account Module
Enforced Hex Prefixing for Address Strings
PR: #241
Hex prefixing is now enforced for all address string inputs and functions
will throw if a non-hex string is provided:
Account.isValidAddress()Account.isZeroAddress()Account.toChecksumAddress()Account.isValidChecksumAddress()The
Account.isPrecompile()method was removed from the code base,PR #242
Enforce Buffer Inputs for Account Methods
PR: #245
Implicit
Bufferconversions for the following methods have been removedand
Bufferinputs are now enforced:Account.generateAddress()Account.generateAddress2()Account.pubToAddress()AccountprivateToPublic()AccountimportPublic()Bytes Module
Typestrict Methods and Type-Explicit Method Split-Up
PR: #244
Bufferinput forBytes.setLengthLeft(),Bytes.setLengthRight()Bytes.setLength()has been removed (alias forBytes.setLengthLeft())Bytes.stripZeros()has been removed (alias forBytes.unPad())Bytes.unpadhas been split up into:Bytes.unpadBuffer()Bytes.unpadHexString()Bytes.unpadArray()Hash Module
Typestrict Methods and Type-Explicit Method Split-Up
PR #247
The following methods are now
Buffer-only:Hash.keccak()Hash.keccak256()Hash.sha256()Hash.ripemd160()Hash.keccak()gets the following additional convenience methods:Hash.keccakFromString()Hash.keccakFromHexString()(hex string enforced)Hash.keccakFromArray()Hash.sha256()gets the following additional convenience methods:Hash.sha256FromString()Hash.sha256FromArray()Hash.ripemd160()gets the following additional convenience methods:Hash.ripemd160FromString()Hash.ripemd160FromArray()Other Breaking Changes
PR #249
8alongPR #228
BN.jslibrary re-export from4.xto5.x,PR [#249], New release v7.0.0 ethereumjs/ethereumjs-util#249
secp2561re-export (use methods provided or import directly),PR #228
Cryto Library Updates: Keccak, secp2561
Keccakdependency has been updated from2.1.0to3.0.0. This versioncomes with prebuilds for Linux, MacOS and Windows so most users won't need
to have
node-gyprun on installation.The version update also brings in feature compatibility with newer Node.js
versions.
The
secp2561ECDSA dependency has been updated from3.0.1to4.0.1.Developer Improvements
PR #231
PR #231
TypeDocAPI documentation,PR #232 and
PR #236
PR #235
v6.2.1Compare Source
This release replaces the native
secp256k1andkeccakdependencies with ethereum-cryptopgraphy which doesn't need native compilation.v6.2.0Compare Source
This release comes with a new file structure, related functionality is now broken
down into separate files (like
account.js) allowing for more oversight andmodular integration. All functionality is additionally exposed through an
aggregating
index.jsfile, so this version remains backwards-compatible.Overview on the new structure:
account: Private/public key and address-related functionality(creation, validation, conversion)
byte: Byte-related helper and conversion functionsconstants: Exposed constants (e.g.KECCAK256_NULL_Sfor the stringrepresentation of the Keccak-256 hash of null)
hash: Hash functionsobject: Helper function for creating a binary object (DEPRECATED)signature: Signing, signature validation, conversion, recoverySee associated PRs #182
and #179.
Features
account: AddedEIP-1191address checksum algorithm support fortoChecksumAddress(),PR #204
Bug Fixes
bytes:toBuffer()conversion function now throws if strings aren't0x-prefixed hex values making the behavior oftoBuffer()more predictablerespectively less error-prone (you might generally want to check cases in your
code where you eventually allowed non-
0x-prefixed input before),PR #197
Dependencies / Environment
6, added Node11and12to officially supported Node versions,PR #207
safe-bufferdependency,PR #182
rlpdependency fromv2.0.0tov2.2.3(TypeScriptimprovementsfor RLP hash functionality),
PR #187
@types/bn.jsadependencyinstead of adevDependency,PR #205
keccak256dependency fromv1.4.0tov2.0.0, PR #168v6.1.0Compare Source
First TypeScript based release of the library, now also including a
type declaration file distributed along with the package published,
see PR #170.
Bug Fixes
isValidSignature()not correctly returningfalseif passed an
s-value greater thansecp256k1n/2onhomesteador later.If you use the method signature with more than three arguments (so not just
passing in
v,r,sand use it likeisValidSignature(v, r, s)and omitthe optional args) please read the thread from
PR #171 carefully
and check your code.
Development
@types/nodeto Node11types,PR #175
PR #156
v6.0.0Compare Source
EIP-155replay protection by adding an optionalchainIdparameterto
ecsign(),ecrecover(),toRpcSig()andisValidSignature(), if present thenew signature format relying on the
chainIdis used, see PR #143generateAddress2()forCREATE2opcode (EIP-1014) address creation(Constantinople HF), see PR #146
toRpcSig()changingvfrom 0/1 to 27/28, this changes the resulting signature buffer, see PR #139sha3-named constants and methods (seev5.2.0release),see PR #154
Configuration
📅 Schedule: At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by WhiteSource Renovate. View repository job log here.