Skip to content

ethereumjs-util v7.1.4

Compare
Choose a tag to compare
@holgerd77 holgerd77 released this 01 Feb 09:05
· 1570 commits to master since this release
06bdad5

Buffer <-> Uint8Array Conversion Helpers (RLP v3)

The new RLP v3 release is accepting and returning Uint8Array objects instead of Buffer for improved browser compatibility and usage.

There are two new helper functions in the bytes module from the Util library introduced in PR #1648 to help with associated Buffer conversions (while this is our main reason for introducing these functions the functionality can of course be used for other things as well):

  • arrToBufArr(): Converts a Uint8Array or NestedUint8Array to Buffer or NestedBufferArray
  • bufArrToArr(): Converts a Buffer or NestedBufferArray to Uint8Array or NestedUint8Array

Note: the RLP version exposed by this package as a re-export is still RLP v2. This won't change along additional v7 Util releases and other current monorepo libraries (VM, Tx,...) are also still using the v2 RLP version.

Features

  • New validateNoLeadingZeroes() function in bytes module for validating Buffers to have no leading zeros (mainly within an RLP context), PR #1568
  • New MAX_UINT64 constant which can be used to check if a BN instance exceeds the max. possible 64-bit integer value, PR #1568

Maintenance

  • toBuffer (bytes module) now throws when a negative BN is provided as input, PR #1606
  • Dependencies: deduplicated RLP import, PR #1549