Skip to content

Commit 1147033

Browse files
authored
Bigint and Buffer conversion comment cleanups in READMEs (#3962)
* clean up block readme * more cleanup * Blockchain edits * remove all buffer and bigint conversion comments * add correct spelling back
1 parent 7fc1cee commit 1147033

File tree

12 files changed

+22
-171
lines changed

12 files changed

+22
-171
lines changed

packages/block/README.md

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,40 @@
99
| Implements schema and functions related to Ethereum's block. |
1010
| ------------------------------------------------------------ |
1111

12-
Note: this `README` reflects the state of the library from `v3.0.0` onwards. See `README` from the [standalone repository](https://github.com/ethereumjs/ethereumjs-block) for an introduction on the last preceding release.
1312

1413
## Installation
1514

16-
To obtain the latest version, simply require the project using `npm`:
15+
To obtain the latest version, simply install the project using `npm`:
1716

1817
```shell
1918
npm install @ethereumjs/block
2019
```
2120

22-
**Note:** If you want to work with `EIP-4844` related functionality, you will have additional manual installation steps for the **KZG setup**, see related section below.
21+
**Note:** If you want to work with `EIP-4844` related functionality, you will have additional initialization steps for the **KZG setup**, see related section below.
2322

2423
## Usage
2524

2625
### Introduction
2726

28-
There are five standalone functions to instantiate a `Block`:
27+
There are several standalone functions to instantiate a `Block`:
2928

3029
- `createBlock(blockData: BlockData = {}, opts?: BlockOptions)`
31-
- `createBlockFromRLPSerializedBlock(serialized: Uint8Array, opts?: BlockOptions)`
30+
- `createEmptyBlock(headerData: HeaderData, opts?: BlockOptions)`
3231
- `createBlockFromBytesArray(values: BlockBytes, opts?: BlockOptions)`
33-
- `createBlockFromRPC(blockParams: JsonRpcBlock, uncles?: any[], opts?: BlockOptions)`
34-
- `createBlockFromJsonRPCProvider(provider: string | EthersProvider, blockTag: string | bigint, opts: BlockOptions)`
32+
- `createBlockFromRLP(serialized: Uint8Array, opts?: BlockOptions)`
33+
- `createBlockFromRPC(blockParams: JSONRPCBlock, uncles?: any[], opts?: BlockOptions)`
34+
- `createBlockFromJSONRPCProvider(provider: string | EthersProvider, blockTag: string | bigint, opts: BlockOptions)`
35+
- `createBlockFromExecutionPayload(payload: ExecutionPayload, opts?: BlockOptions)`
36+
- `createBlockFromBeaconPayloadJSON(payload: BeaconPayloadJSON, opts?: BlockOptions)`
37+
- `createSealedCliqueBlock(blockData: BlockData = {}, cliqueSigner: Uint8Array, opts?: BlockOptions)`
3538

36-
For `BlockHeader` instantiation standalone functions exists for instantiation, see API docs linked below.
39+
For `BlockHeader` instantiation, there are similar standalone functions:
40+
41+
- `createBlockHeader(headerData: HeaderData = {}, opts?: BlockOptions)`
42+
- `createBlockHeaderFromBytesArray(values: BlockHeaderBytes, opts?: BlockOptions)`
43+
- `createBlockHeaderFromRLP(serializedHeaderData: Uint8Array, opts?: BlockOptions)`
44+
- `createBlockHeaderFromRPC(blockParams: JSONRPCBlock, options?: BlockOptions)`
45+
- `createSealedCliqueBlockHeader(headerData: HeaderData = {}, cliqueSigner: Uint8Array, opts?: BlockOptions)`
3746

3847
Instantiation Example:
3948

@@ -449,7 +458,7 @@ console.log(`Old Clique Proof-of-Authority block created`)
449458
For sealing a block on instantiation you can use the `cliqueSigner` constructor option:
450459

451460
```ts
452-
const cliqueSigner = Buffer.from('PRIVATE_KEY_HEX_STRING', 'hex')
461+
const cliqueSigner = hexToBytes('PRIVATE_KEY_HEX_STRING')
453462
const block = createSealedCliqueBlock(blockData, cliqueSigner)
454463
```
455464

@@ -519,17 +528,6 @@ const { EthereumJSClass } = require('@ethereumjs/[PACKAGE_NAME]')
519528

520529
Using ESM will give you additional advantages over CJS beyond browser usage like static code analysis / Tree Shaking which CJS can not provide.
521530

522-
### Buffer -> Uint8Array
523-
524-
With the breaking releases from Summer 2023 we have removed all Node.js specific `Buffer` usages from our libraries and replace these with [Uint8Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) representations, which are available both in Node.js and the browser (`Buffer` is a subclass of `Uint8Array`).
525-
526-
We have converted existing Buffer conversion methods to Uint8Array conversion methods in the [@ethereumjs/util](https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/util) `bytes` module, see the respective README section for guidance.
527-
528-
### BigInt Support
529-
530-
Starting with v4 the usage of [BN.js](https://github.com/indutny/bn.js/) for big numbers has been removed from the library and replaced with the usage of the native JS [BigInt](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) data type (introduced in `ES2020`).
531-
532-
Please note that number-related API signatures have changed along with this version update and the minimal build target has been updated to `ES2020`.
533531

534532
## Testing
535533

packages/blockchain/README.md

Lines changed: 4 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,15 @@
99
| A module to store and interact with blocks. |
1010
| ------------------------------------------- |
1111

12-
Note: this `README` reflects the state of the library from `v5.0.0` onwards. See `README` from the [standalone repository](https://github.com/ethereumjs/ethereumjs-blockchain) for an introduction on the last preceding release.
13-
1412
## Installation
1513

16-
To obtain the latest version, simply require the project using `npm`:
14+
To obtain the latest version, simply install the project using `npm`:
1715

1816
```shell
1917
npm install @ethereumjs/blockchain
2018
```
2119

22-
**Note:** If you want to work with `EIP-4844` related functionality, you will have additional manual installation steps for the **KZG setup**, see related section below.
20+
**Note:** If you want to work with `EIP-4844` related functionality, you will have additional initialization steps for the **KZG setup**, see related section below.
2321

2422
## Usage
2523

@@ -116,23 +114,10 @@ Note, if you construct a blockchain with a custom consensus implementation, tran
116114

117115
## Custom Genesis State
118116

119-
### Genesis in v7 (removed genesis dependency)
120-
121-
Genesis state was huge and had previously been bundled with the `Blockchain` package with the burden going over to the VM, since `Blockchain` is a dependency.
122-
123-
Starting with the v7 release genesis state has been removed from `blockchain` and moved into its own auxiliary package [@ethereumjs/genesis](https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/genesis), from which it can be included if needed (for most - especially VM - use cases it is not necessary), see PR [#2844](https://github.com/ethereumjs/ethereumjs-monorepo/pull/2844).
124-
125-
This goes along with some changes in Blockchain and VM API:
126-
127-
- Blockchain: There is a new constructor option `genesisStateRoot` beside `genesisBlock` and `genesisState` for an alternative condensed way to provide the genesis state root directly
128-
- Blockchain: `genesisState(): GenesisState` method has been replaced by the async `getGenesisStateRoot(chainId: Chain): Promise<Uint8Array>` method
129-
- VM: `activateGenesisState?: boolean` constructor option has been replaced with a `genesisState?: GenesisState` option
130-
131-
### Genesis in v6
117+
### Genesis State
132118

133-
For the v6 release responsibility for setting up a custom genesis state moved from the [Common](../common/) library to the `Blockchain` package, see PR [#1924](https://github.com/ethereumjs/ethereumjs-monorepo/pull/1924) for some work context.
119+
Genesis state for the 4 supported networks (mainnet, sepolia, hoodi, holesky) is stored in an auxiliary package [@ethereumjs/genesis](https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/genesis), from which it can be included if needed (for most - especially VM - use cases it is not necessary), see PR [#2844](https://github.com/ethereumjs/ethereumjs-monorepo/pull/2844).
134120

135-
A genesis state can be set along `Blockchain` creation by passing in a custom `genesisBlock` and `genesisState`. For `mainnet` and the official test networks like `sepolia` or `goerli` genesis is already provided with the block data coming from `@ethereumjs/common`. The genesis state is being integrated in the `Blockchain` library (see `genesisStates` folder).
136121

137122
### Custom genesis from a Geth genesis config
138123

@@ -220,18 +205,6 @@ const { EthereumJSClass } = require('@ethereumjs/[PACKAGE_NAME]')
220205

221206
Using ESM will give you additional advantages over CJS beyond browser usage like static code analysis / Tree Shaking which CJS can not provide.
222207

223-
### Buffer -> Uint8Array
224-
225-
With the breaking releases from Summer 2023 we have removed all Node.js specific `Buffer` usages from our libraries and replace these with [Uint8Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) representations, which are available both in Node.js and the browser (`Buffer` is a subclass of `Uint8Array`).
226-
227-
We have converted existing Buffer conversion methods to Uint8Array conversion methods in the [@ethereumjs/util](https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/util) `bytes` module, see the respective README section for guidance.
228-
229-
### BigInt Support
230-
231-
Starting with v6 the usage of [BN.js](https://github.com/indutny/bn.js/) for big numbers has been removed from the library and replaced with the usage of the native JS [BigInt](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) data type (introduced in `ES2020`).
232-
233-
Please note that number-related API signatures have changed along with this version update and the minimal build target has been updated to `ES2020`.
234-
235208
## Events
236209

237210
The `Blockchain` class has a public property `events` which contains an `EventEmitter`. Following events are emitted on which you can react within your code:

packages/common/README.md

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -174,18 +174,6 @@ const { EthereumJSClass } = require('@ethereumjs/[PACKAGE_NAME]')
174174

175175
Using ESM will give you additional advantages over CJS beyond browser usage like static code analysis / Tree Shaking which CJS can not provide.
176176

177-
### Buffer -> Uint8Array
178-
179-
With the breaking releases from Summer 2023 we have removed all Node.js specific `Buffer` usages from our libraries and replace these with [Uint8Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) representations, which are available both in Node.js and the browser (`Buffer` is a subclass of `Uint8Array`).
180-
181-
We have converted existing Buffer conversion methods to Uint8Array conversion methods in the [@ethereumjs/util](https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/util) `bytes` module, see the respective README section for guidance.
182-
183-
### BigInt Support
184-
185-
Starting with v4 the usage of [BN.js](https://github.com/indutny/bn.js/) for big numbers has been removed from the library and replaced with the usage of the native JS [BigInt](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) data type (introduced in `ES2020`).
186-
187-
Please note that number-related API signatures have changed along with this version update and the minimal build target has been updated to `ES2020`.
188-
189177
## Events
190178

191179
The `Common` class has a public property `events` which contains an `EventEmitter`. Following events are emitted on which you can react within your code:

packages/devp2p/README.md

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -328,18 +328,6 @@ const { EthereumJSClass } = require('@ethereumjs/[PACKAGE_NAME]')
328328
329329
Using ESM will give you additional advantages over CJS beyond browser usage like static code analysis / Tree Shaking which CJS can not provide.
330330
331-
### Buffer -> Uint8Array
332-
333-
With the breaking releases from Summer 2023 we have removed all Node.js specific `Buffer` usages from our libraries and replace these with [Uint8Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) representations, which are available both in Node.js and the browser (`Buffer` is a subclass of `Uint8Array`).
334-
335-
We have converted existing Buffer conversion methods to Uint8Array conversion methods in the [@ethereumjs/util](https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/util) `bytes` module, see the respective README section for guidance.
336-
337-
### BigInt Support
338-
339-
Starting with v4 the usage of [BN.js](https://github.com/indutny/bn.js/) for big numbers has been removed from the library and replaced with the usage of the native JS [BigInt](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) data type (introduced in `ES2020`).
340-
341-
Please note that number-related API signatures have changed along with this version update and the minimal build target has been updated to `ES2020`.
342-
343331
### Events
344332
345333
Events emitted:

packages/ethash/README.md

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -104,18 +104,6 @@ const { EthereumJSClass } = require('@ethereumjs/[PACKAGE_NAME]')
104104

105105
Using ESM will give you additional advantages over CJS beyond browser usage like static code analysis / Tree Shaking which CJS can not provide.
106106

107-
### Buffer -> Uint8Array
108-
109-
With the breaking releases from Summer 2023 we have removed all Node.js specific `Buffer` usages from our libraries and replace these with [Uint8Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) representations, which are available both in Node.js and the browser (`Buffer` is a subclass of `Uint8Array`).
110-
111-
We have converted existing Buffer conversion methods to Uint8Array conversion methods in the [@ethereumjs/util](https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/util) `bytes` module, see the respective README section for guidance.
112-
113-
### BigInt Support
114-
115-
Starting with v2 the usage of [BN.js](https://github.com/indutny/bn.js/) for big numbers has been removed from the library and replaced with the usage of the native JS [BigInt](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) data type (introduced in `ES2020`).
116-
117-
Please note that number-related API signatures have changed along with this version update and the minimal build target has been updated to `ES2020`.
118-
119107
## EthereumJS
120108

121109
See our organizational [documentation](https://ethereumjs.readthedocs.io) for an introduction to `EthereumJS` as well as information on current standards and best practices. If you want to join for work or carry out improvements on the libraries, please review our [contribution guidelines](https://ethereumjs.readthedocs.io/en/latest/contributing.html) first.

packages/evm/README.md

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -191,18 +191,6 @@ const { EthereumJSClass } = require('@ethereumjs/[PACKAGE_NAME]')
191191

192192
Using ESM will give you additional advantages over CJS beyond browser usage like static code analysis / Tree Shaking which CJS can not provide.
193193

194-
### Buffer -> Uint8Array
195-
196-
With the breaking releases from Summer 2023 we have removed all Node.js specific `Buffer` usages from our libraries and replace these with [Uint8Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) representations, which are available both in Node.js and the browser (`Buffer` is a subclass of `Uint8Array`).
197-
198-
We have converted existing Buffer conversion methods to Uint8Array conversion methods in the [@ethereumjs/util](https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/util) `bytes` module, see the respective README section for guidance.
199-
200-
### BigInt Support
201-
202-
Starting with v1 the usage of [BN.js](https://github.com/indutny/bn.js/) for big numbers has been removed from the library and replaced with the usage of the native JS [BigInt](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) data type (introduced in `ES2020`).
203-
204-
Please note that number-related API signatures have changed along with this version update and the minimal build target has been updated to `ES2020`.
205-
206194
## Architecture
207195

208196
### VM/EVM Relation

packages/mpt/README.md

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -299,18 +299,6 @@ const { EthereumJSClass } = require('@ethereumjs/[PACKAGE_NAME]')
299299
300300
Using ESM will give you additional advantages over CJS beyond browser usage like static code analysis / Tree Shaking which CJS can not provide.
301301
302-
### Buffer -> Uint8Array
303-
304-
With the breaking releases from Summer 2023 we have removed all Node.js specific `Buffer` usages from our libraries and replace these with [Uint8Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) representations, which are available both in Node.js and the browser (`Buffer` is a subclass of `Uint8Array`).
305-
306-
We have converted existing Buffer conversion methods to Uint8Array conversion methods in the [@ethereumjs/util](https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/util) `bytes` module, see the respective README section for guidance.
307-
308-
### BigInt Support
309-
310-
With the 5.0.0 release, [BigInt](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) takes the place of [BN.js](https://github.com/indutny/bn.js/).
311-
312-
BigInt is a primitive that is used to represent and manipulate primitive `bigint` values that the number primitive is incapable of representing as a result of their magnitude. `ES2020` saw the introduction of this particular feature. Note that this version update resulted in the altering of number-related API signatures and that the minimal build target is now set to `ES2020`.
313-
314302
## Benchmarking
315303
316304
You will find two simple **benchmarks** in the `benchmarks` folder:

packages/rlp/README.md

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,6 @@ It is now easily possible to run a browser build of one of the EthereumJS librar
4646

4747
`RLP.decode(encoded, [stream=false])` - Decodes an RLP encoded `Uint8Array`, `Array` or `String` and returns a `Uint8Array` or `NestedUint8Array`. If `stream` is enabled, it will just decode the first rlp sequence in the Uint8Array. By default, it would throw an error if there are more bytes in Uint8Array than used by the rlp sequence.
4848

49-
### Buffer -> Uint8Array
50-
51-
With the breaking releases from Summer 2023 we have removed all Node.js specific `Buffer` usages from our libraries and replace these with [Uint8Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) representations, which are available both in Node.js and the browser (`Buffer` is a subclass of `Uint8Array`).
52-
53-
We have converted existing Buffer conversion methods to Uint8Array conversion methods in the [@ethereumjs/util](https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/util) `bytes` module, see the respective README section for guidance.
54-
55-
### BigInt Support
56-
57-
Starting with v4 the usage of [BN.js](https://github.com/indutny/bn.js/) for big numbers has been removed from the library and replaced with the usage of the native JS [BigInt](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) data type (introduced in `ES2020`).
58-
59-
Please note that number-related API signatures have changed along with this version update and the minimal build target has been updated to `ES2020`.
60-
6149
## CLI
6250

6351
`rlp encode <JSON string>`\

packages/statemanager/README.md

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -284,18 +284,6 @@ const { EthereumJSClass } = require('@ethereumjs/[PACKAGE_NAME]')
284284

285285
Using ESM will give you additional advantages over CJS beyond browser usage like static code analysis / Tree Shaking which CJS can not provide.
286286

287-
### Buffer -> Uint8Array
288-
289-
With the breaking releases from Summer 2023 we have removed all Node.js specific `Buffer` usages from our libraries and replace these with [Uint8Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) representations, which are available both in Node.js and the browser (`Buffer` is a subclass of `Uint8Array`).
290-
291-
We have converted existing Buffer conversion methods to Uint8Array conversion methods in the [@ethereumjs/util](https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/util) `bytes` module, see the respective README section for guidance.
292-
293-
### BigInt Support
294-
295-
Starting with v1 the usage of [BN.js](https://github.com/indutny/bn.js/) for big numbers has been removed from the library and replaced with the usage of the native JS [BigInt](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) data type (introduced in `ES2020`).
296-
297-
Please note that number-related API signatures have changed along with this version update and the minimal build target has been updated to `ES2020`.
298-
299287
## Development
300288

301289
Developer documentation - currently mainly with information on testing and debugging - can be found [here](./DEVELOPER.md).

0 commit comments

Comments
 (0)