Update dependency ethereumjs-util to v7 #18
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.10
Release Notes
ethereumjs/ethereumjs-util
v7.0.9
Compare Source
This release adds support for very high
chainId
numbers exceedingMAX_SAFE_INTEGER
(an example is the chain ID34180983699157880
used for the ephemeral Yolov3 testnet preparing for theberlin
hardfork, but high chain IDs might be used for things like private test networks and the like as well).Function signatures for methods in
address
andsignature
are therefore expanded to allow for aBNLike
input type (BN | PrefixedHexString | number | Buffer
) for chain ID related parameters.All function signatures are still taking in a
number
input 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 plainBuffer
likely be the most future-proof). Note that on some functions this changes the return value as well.account
:toChecksumAddresss(hexAddress: string, eip1191ChainId?: number): string
toChecksumAddress = function(hexAddress: string, eip1191ChainId?: BNLike): string
account
:isValidChecksumAddress(hexAddress: string, eip1191ChainId?: number)
isValidChecksumAddress(hexAddress: string, eip1191ChainId?: BNLike)
signature
:ecsign(msgHash: Buffer, privateKey: Buffer, chainId?: number): ECDSASignature
ecsign(msgHash: Buffer, privateKey: Buffer, chainId?: number): ECDSASignature
(return value stays the same onnumber
input)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): Buffer
ecrecover(msgHash: Buffer, v: BNLike, r: Buffer, s: Buffer, chainId?: BNLike): Buffer
signature
:toRpcSig(v: number, r: Buffer, s: Buffer, chainId?: number): string
toRpcSig(v: BNLike, r: Buffer, s: Buffer, chainId?: BNLike): string
signature
: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.8
Compare Source
Address.equals(address: Address)
function for easier address equality comparions, PR #285fromRpcSig()
in thesignature
module not working correctly for chain IDs greater than 110, PR #287v7.0.7
Compare Source
stateRoot
check forAccount.isEmpty()
to make emptiness checkEIP-161
compliant, PR #279AddressLike
and helperbnToHex()
, PR #279account.raw()
which returns a Buffer Array of the raw Buffers for the account in order, PR #279v7.0.6
Compare Source
New
Account
classThis release adds a new
Account
class 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
Account
object from varying data types:Object: fromAccountData
,RLP: fromRlpSerializedAccount
, andArray: fromValuesArray
.Methods:
isEmpty(): boolean
,isContract(): boolean
,serialize(): Buffer
Example usage:
For more info see the documentation, examples of usage in
test/account.spec.ts
orPR #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.5
Compare Source
This release adds a new module
address
- see README -with a new
Address
class and type which can be used for creating and representing Ethereum addresses.Example usage:
In
TypeScript
the associatedAddress
type 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.4
Compare Source
BN.js
andRLP
re-export failures from TypeScript,PR #270
within the
assertIs*
helper functions, issue affects most methods of thelibrary,
PR #269
v7.0.3
Compare Source
This release replaces the
keccak
andsecp256k1
dependencies(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:
TypeScript
definitions forethjs-util
methods,PR #248 and
PR #260
v7.0.2
Compare Source
This patch release re-establishes the state of
v7.0.0
release and upgradesthe
BN.js
re-export version back tov5
since quick patches for boththe
v5
(v5.1.2) andthe
v4
branch (v4.11.9)have been released to fix interoperability issues between the
BN.js
versions.This now makes it possible to move to the latest
BN.js
v5
version and profitfrom future upgrades and patches.
An upgrade is highly recommended, the
v7.0.1
release will be marked asdeprecated along this release.
See: Issue #250
v7.0.1
Compare Source
[DEPRECATED in favour of v7.0.2]
This patch release downgrades the re-exported
BN.js
version fromv5
tov4
(so a continuation of what has being used within thev6.x
versions).This is due to some unexpected interoperability problems in libraries using
the older
v4
BN.js
branch in their some of their respective dependencies.An upgrade is highly recommended, the
v7.0.0
release will be marked asdeprecated along this release.
See: Issue #250
v7.0.0
Compare 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
Buffer
usage 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
Buffer
conversions for the following methods have been removedand
Buffer
inputs are now enforced:Account.generateAddress()
Account.generateAddress2()
Account.pubToAddress()
AccountprivateToPublic()
AccountimportPublic()
Bytes Module
Typestrict Methods and Type-Explicit Method Split-Up
PR: #244
Buffer
input forBytes.setLengthLeft()
,Bytes.setLengthRight()
Bytes.setLength()
has been removed (alias forBytes.setLengthLeft()
)Bytes.stripZeros()
has been removed (alias forBytes.unPad()
)Bytes.unpad
has 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
8
alongPR #228
BN.js
library re-export from4.x
to5.x
,PR [#249], New release v7.0.0 ethereumjs/ethereumjs-util#249
secp2561
re-export (use methods provided or import directly),PR #228
Cryto Library Updates: Keccak, secp2561
Keccak
dependency has been updated from2.1.0
to3.0.0
. This versioncomes with prebuilds for Linux, MacOS and Windows so most users won't need
to have
node-gyp
run on installation.The version update also brings in feature compatibility with newer Node.js
versions.
The
secp2561
ECDSA dependency has been updated from3.0.1
to4.0.1
.Developer Improvements
PR #231
PR #231
TypeDoc
API documentation,PR #232 and
PR #236
PR #235
v6.2.1
Compare Source
This release replaces the native
secp256k1
andkeccak
dependencies with ethereum-cryptopgraphy which doesn't need native compilation.v6.2.0
Compare 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.js
file, 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_S
for 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-1191
address 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 Node11
and12
to officially supported Node versions,PR #207
safe-buffer
dependency,PR #182
rlp
dependency fromv2.0.0
tov2.2.3
(TypeScript
improvementsfor RLP hash functionality),
PR #187
@types/bn.js
adependency
instead of adevDependency
,PR #205
keccak256
dependency fromv1.4.0
tov2.0.0
, PR #168v6.1.0
Compare 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 returningfalse
if passed an
s
-value greater thansecp256k1n/2
onhomestead
or later.If you use the method signature with more than three arguments (so not just
passing in
v
,r
,s
and use it likeisValidSignature(v, r, s)
and omitthe optional args) please read the thread from
PR #171 carefully
and check your code.
Development
@types/node
to Node11
types,PR #175
PR #156
v6.0.0
Compare Source
EIP-155
replay protection by adding an optionalchainId
parameterto
ecsign()
,ecrecover()
,toRpcSig()
andisValidSignature()
, if present thenew signature format relying on the
chainId
is used, see PR #143generateAddress2()
forCREATE2
opcode (EIP-1014
) address creation(Constantinople HF), see PR #146
toRpcSig()
changingv
from 0/1 to 27/28, this changes the resulting signature buffer, see PR #139sha3
-named constants and methods (seev5.2.0
release),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.