Skip to content

Commit d8e7066

Browse files
authored
Merge pull request #946 from ethereumjs/beta.2-releases
Beta.2 Releases
2 parents daf1bb7 + 96504cc commit d8e7066

36 files changed

+474
-302
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ This monorepo uses [Lerna](https://lerna.js.org/). It links the local packages t
4343
TLDR: Setup
4444
```sh
4545
npm install
46-
npm build
46+
npm run build
4747
```
4848

4949
TLDR: To update dependencies and (re-)link packages
5050
```sh
5151
npm run bootstrap
52-
npm build
52+
npm run build
5353
```
5454

5555
Above is the quickest way to set you up. Going down the road, there are two sets of commands: *project* and *package-specific* commands. You can find them at `./package.json` and `./packages/*/package.json`, respectively. Here's a breakdown:

packages/block/CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
66
(modification: no type change headlines) and this project adheres to
77
[Semantic Versioning](http://semver.org/spec/v2.0.0.html).
88

9-
## 3.0.0-beta.2 - UNRELEASED
9+
## 3.0.0-beta.2 - 2020-11-12
10+
11+
This is the second beta release towards a final library release, see [beta.1 release notes](https://github.com/ethereumjs/ethereumjs-vm/releases/tag/%40ethereumjs%2Ftx%403.0.0-beta.1) for an overview on the full changes since the last publicly released version.
1012

1113
- Added `freeze` option to allow for block freeze deactivation (e.g. to allow for subclassing block and adding additional parameters), see PR [#941](https://github.com/ethereumjs/ethereumjs-vm/pull/941)
1214
- **Breaking:** Difficulty-depending methods `canonicalDifficulty()` and `validateDifficulty()` in block and header now throw on non-PoW chains, see PR [#937](https://github.com/ethereumjs/ethereumjs-vm/pull/937)

packages/block/README.md

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,45 @@
88

99
Implements schema and functions related to Ethereum's block.
1010

11+
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 preceeding release.
12+
1113
# INSTALL
1214

1315
`npm install @ethereumjs/block`
1416

15-
# BROWSER
17+
# USAGE
18+
19+
There are three static factories to instantiate a `Block` or `BlockHeader`:
20+
21+
- `Block.fromBlockData(blockData: BlockData = {}, opts?: BlockOptions)`
22+
- `Block.fromRLPSerializedBlock(serialized: Buffer, opts?: BlockOptions)`
23+
- `Block.fromValuesArray(values: BlockBuffer, opts?: BlockOptions)`
24+
25+
Instantiation Example:
26+
27+
```typescript
28+
const headerData = {
29+
number: 15,
30+
parentHash: '0x6bfee7294bf44572b7266358e627f3c35105e1c3851f3de09e6d646f955725a7',
31+
difficulty: 131072,
32+
gasLimit: 8000000,
33+
timestamp: 1562422144,
34+
}
35+
const header = BlockHeader.fromHeaderData(headerData)
36+
```
37+
38+
Properties of a `Block` or `BlockHeader` object are frozen with `Object.freeze()` which gives you enhanced security and consistency properties when working with the instantiated object. This behavior can be modified using the `freeze` option in the constructor if needed.
39+
40+
API Usage Example:
1641

17-
This module works with `browserify`.
42+
```typescript
43+
try {
44+
await block.validate(blockchain)
45+
// Block validation has passed
46+
} catch (err) {
47+
// handle errors appropriately
48+
}
49+
```
1850

1951
# API
2052

packages/block/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ethereumjs/block",
3-
"version": "3.0.0-beta.1",
3+
"version": "3.0.0-beta.2",
44
"description": "Provides Block serialization and help functions",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",
@@ -39,8 +39,8 @@
3939
},
4040
"homepage": "https://github.com/ethereumjs/ethereumjs-vm/tree/master/packages/block#synopsis",
4141
"dependencies": {
42-
"@ethereumjs/common": "2.0.0-beta.1",
43-
"@ethereumjs/tx": "3.0.0-beta.1",
42+
"@ethereumjs/common": "2.0.0-beta.2",
43+
"@ethereumjs/tx": "3.0.0-beta.2",
4444
"@types/bn.js": "^4.11.6",
4545
"ethereumjs-util": "^7.0.7",
4646
"merkle-patricia-tree": "^4.0.0"

packages/blockchain/CHANGELOG.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
66
(modification: no type change headlines) and this project adheres to
77
[Semantic Versioning](http://semver.org/spec/v2.0.0.html).
88

9-
## 5.0.0-beta.2 - UNRELEASED
9+
## 5.0.0-beta.2 - 2020-11-12
1010

11-
This is the second beta release towards a final `v5.0.0` `Blockchain` library release, see [v5.0.0-beta.1 release notes](https://github.com/ethereumjs/ethereumjs-vm/releases/tag/%40ethereumjs%2Fblockchain%405.0.0-beta.1) for an overview on the full changes since the last publicly released version.
11+
This is the second beta release towards a final library release, see [beta.1 release notes](https://github.com/ethereumjs/ethereumjs-vm/releases/tag/%40ethereumjs%2Fblockchain%405.0.0-beta.1) for an overview on the full changes since the last publicly released version.
1212

1313
This release introduces **new breaking changes**, so please carefully read the additional release note sections!
1414

@@ -122,8 +122,6 @@ in performance benefits for Node.js consumers, see [here](https://github.com/eth
122122
- Fixed blockchain hanging forever in case code throws between a semaphore `lock`/`unlock`,
123123
Issue [#877](https://github.com/ethereumjs/ethereumjs-vm/issues/877)
124124

125-
[5.0.0]: https://github.com/ethereumjs/ethereumjs-vm/compare/%40ethereumjs%2Fblockchain%404.0.2...%40ethereumjs%2Fblockchain%405.0.0
126-
127125
## 4.0.4 - 2020-07-27
128126

129127
This release replaces the tilde (`~`) dependency from `ethereumjs-util` for a caret (`^`) one, meaning that any update to `ethereumjs-util` v6 will also be available for this library.

packages/blockchain/README.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,13 @@
88

99
A module to store and interact with blocks.
1010

11-
# INSTALL
12-
13-
`npm install ethereumjs-blockchain`
11+
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 preceeding release.
1412

15-
# API
13+
# INSTALL
1614

17-
[Documentation](./docs/README.md)
15+
`npm install @ethereumjs/blockchain`
1816

19-
# EXAMPLE
17+
# USAGE
2018

2119
The following is an example to iterate through an existing Geth DB (needs `level` to be installed separately).
2220

@@ -29,8 +27,10 @@ const level = require('level')
2927

3028
const gethDbPath = './chaindata' // Add your own path here. It will get modified, see remarks.
3129

30+
const common = new Common({ chain: 'ropsten' })
3231
const db = level(gethDbPath)
33-
const blockchain = new Blockchain({ db })
32+
// Use the safe static constructor which awaits the init method
33+
const blockchain = Blockchain.create({ common, db })
3434

3535
blockchain.iterator('i', (block) => {
3636
const blockNumber = block.header.number.toString()
@@ -41,6 +41,10 @@ blockchain.iterator('i', (block) => {
4141

4242
**WARNING**: Since `@ethereumjs/blockchain` is also doing write operations on the DB for safety reasons only run this on a copy of your database, otherwise this might lead to a compromised DB state.
4343

44+
# API
45+
46+
[Documentation](./docs/README.md)
47+
4448
# EthereumJS
4549

4650
See our organizational [documentation](https://ethereumjs.readthedocs.io) for an introduction to `EthereumJS` as well as information on current standards and best practices.

packages/blockchain/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ethereumjs/blockchain",
3-
"version": "5.0.0-beta.1",
3+
"version": "5.0.0-beta.2",
44
"description": "A module to store and interact with blocks",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",
@@ -36,8 +36,8 @@
3636
},
3737
"homepage": "https://github.com/ethereumjs/ethereumjs-vm/tree/master/packages/blockchain#synopsis",
3838
"dependencies": {
39-
"@ethereumjs/block": "3.0.0-beta.1",
40-
"@ethereumjs/common": "2.0.0-beta.1",
39+
"@ethereumjs/block": "3.0.0-beta.2",
40+
"@ethereumjs/common": "2.0.0-beta.2",
4141
"@ethereumjs/ethash": "1.0.0-beta.1",
4242
"ethereumjs-util": "^7.0.7",
4343
"level-mem": "^5.0.1",

packages/common/CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
66
(modification: no type change headlines) and this project adheres to
77
[Semantic Versioning](http://semver.org/spec/v2.0.0.html).
88

9-
## 2.0.0-beta.2 - UNRELEASED
9+
## 2.0.0-beta.2 - 2020-11-12
10+
11+
This is the second beta release towards a final library release, see [beta.1 release notes](https://github.com/ethereumjs/ethereumjs-vm/releases/tag/%40ethereumjs%2Fcommon%402.0.0-beta.1) for an overview on the full changes since the last publicly released version.
1012

1113
- Added consensus information to chains, new functions `Common.consensusType()` for consensus type access ("pow" or "poa") and `Common.consensusAlgorithm()` to get the associated algorithm or protocol (e.g. "ethash" PoW algorithm or "clique" PoA protocol), see PR [#937](https://github.com/ethereumjs/ethereumjs-vm/pull/937)
1214

packages/common/README.md

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
Resources common to all Ethereum implementations.
1010

11-
Succeeds the old [ethereum/common](https://github.com/ethereumjs/common/) library.
11+
Note: this `README` reflects the state of the library from `v2.0.0` onwards. See `README` from the [standalone repository](https://github.com/ethereumjs/ethereumjs-common) for an introduction on the last preceeding release.
1212

1313
# INSTALL
1414

@@ -20,30 +20,36 @@ All parameters can be accessed through the `Common` class which can be required
2020
main package and instantiated either with just the `chain` (e.g. 'mainnet') or the `chain`
2121
together with a specific `hardfork` provided.
2222

23+
If no hardfork is provided the common is initialized with the default hardfork.
24+
25+
Current `DEFAULT_HARDFORK`: `istanbul`
26+
2327
Here are some simple usage examples:
2428

25-
```javascript
26-
const Common = require('@ethereumjs/common')
29+
```typescript
30+
import Common from '@ethereumjs/common'
2731

28-
// Instantiate with only the chain
29-
let c = new Common({ chain: 'ropsten' })
30-
c.param('gasPrices', 'ecAddGas', 'byzantium') // 500
32+
// Instantiate with the chain (and the default hardfork)
33+
const c = new Common({ chain: 'ropsten' })
34+
c.param('gasPrices', 'ecAddGas') // 500
3135

3236
// Chain and hardfork provided
3337
c = new Common({ chain: 'ropsten', hardfork: 'byzantium' })
3438
c.param('pow', 'minerReward') // 3000000000000000000
3539

40+
// Instantiate with an EIP activated
41+
const c = new Common({ chain: 'mainnet', eips: [2537] })
42+
3643
// Access genesis data for Ropsten network
3744
c.genesis().hash // 0x41941023680923e0fe4d74a34bdac8141f2540e3ae90623718e47d66d1ca4a2d
3845

3946
// Get bootstrap nodes for chain/network
4047
c.bootstrapNodes() // Array with current nodes
4148
```
4249

43-
It is encouraged to also explicitly set the `supportedHardforks` if the initializing library
44-
only supports a certain range of `hardforks`:
50+
If the initializing library only supports a certain range of `hardforks` you can use the `supportedHardforks` option to restrict hardfork access on the `Common` instance:
4551

46-
```javascript
52+
```typescript
4753
let c = new Common({
4854
chain: 'ropsten',
4955
supportedHardforks: ['byzantium', 'constantinople', 'petersburg'],
@@ -77,13 +83,16 @@ library supported:
7783
- `byzantium`
7884
- `constantinople`
7985
- `petersburg` (aka `constantinopleFix`, apply together with `constantinople`)
80-
- `istanbul` (`DEFAULT_HARDFORK`)
81-
- `muirGlacier`
86+
- `istanbul` (`DEFAULT_HARDFORK` (`v2.0.0` release series))
87+
- `muirGlacier` (since `v1.5.0`)
8288

8389
## Future Hardforks
8490

85-
The `muirGlacier` HF delaying the difficulty bomb and scheduled for January 2020
86-
is supported by the library since `v1.5.0`.
91+
General support for the `berlin` hardfork has been added along `v2.0.0`, specification of the hardfork regarding EIPs included was not finalized upon release date.
92+
93+
Currently supported `berlin` EIPs:
94+
95+
- `EIP-2315`
8796

8897
## Parameter Access
8998

@@ -102,9 +111,6 @@ hardfork.
102111
The hardfork-specific json files only contain the deltas from `chainstart` and
103112
shouldn't be accessed directly until you have a specific reason for it.
104113

105-
Note: The list of `gasPrices` and gas price changes on hardforks is consistent
106-
but not complete, so there are currently gas price values missing (PRs welcome!).
107-
108114
# Chain Params
109115

110116
Supported chains:
@@ -113,14 +119,16 @@ Supported chains:
113119
- `ropsten`
114120
- `rinkeby`
115121
- `kovan`
116-
- `goerli` (final configuration since `v1.1.0`)
122+
- `goerli`
117123
- Private/custom chain parameters
118124

119125
The following chain-specific parameters are provided:
120126

121127
- `name`
122128
- `chainId`
123129
- `networkId`
130+
- `consensusType` (e.g. `pow` or `poa`)
131+
- `consensusAlgorithm` (e.g. `ethash` or `clique`)
124132
- `genesis` block header values
125133
- `hardforks` block numbers
126134
- `bootstrapNodes` list

packages/common/docs/classes/_index_.common.md

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ Common class to access chain and hardfork parameters
3030
* [bootstrapNodes](_index_.common.md#bootstrapnodes)
3131
* [chainId](_index_.common.md#chainid)
3232
* [chainName](_index_.common.md#chainname)
33+
* [consensusAlgorithm](_index_.common.md#consensusalgorithm)
34+
* [consensusType](_index_.common.md#consensustype)
3335
* [eips](_index_.common.md#eips)
3436
* [forkHash](_index_.common.md#forkhash)
3537
* [genesis](_index_.common.md#genesis)
@@ -269,6 +271,34 @@ chain name (lower case)
269271

270272
___
271273

274+
### consensusAlgorithm
275+
276+
**consensusAlgorithm**(): *string*
277+
278+
*Defined in [index.ts:649](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L649)*
279+
280+
Returns the concrete consensus implementation
281+
algorithm or protocol for the network
282+
e.g. "ethash" for "pow" consensus type or
283+
"clique" for "poa" consensus type
284+
285+
**Returns:** *string*
286+
287+
___
288+
289+
### consensusType
290+
291+
**consensusType**(): *string*
292+
293+
*Defined in [index.ts:639](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L639)*
294+
295+
Returns the consensus type of the network
296+
Possible values: "pow"|"poa"
297+
298+
**Returns:** *string*
299+
300+
___
301+
272302
### eips
273303

274304
**eips**(): *number[]*
@@ -338,13 +368,13 @@ ___
338368

339369
### hardfork
340370

341-
**hardfork**(): *string | null*
371+
**hardfork**(): *string*
342372

343373
*Defined in [index.ts:599](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L599)*
344374

345375
Returns the hardfork set
346376

347-
**Returns:** *string | null*
377+
**Returns:** *string*
348378

349379
Hardfork name
350380

0 commit comments

Comments
 (0)