Skip to content
This repository has been archived by the owner on Apr 6, 2020. It is now read-only.

Commit

Permalink
Merge pull request #14 from ethereumjs/new-release-v030
Browse files Browse the repository at this point in the history
New release v0.3.0
  • Loading branch information
holgerd77 committed May 25, 2018
2 parents b88c235 + 7d5b6ad commit 4620975
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 80 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
[Semantic Versioning](http://semver.org/spec/v2.0.0.html).


## [0.3.0] - 2018-05-25
- Allow functions like ``hardforkIsActiveOnBlock()`` - where hardfork is provided as param - also to be run on hardfork set for greater flexibility/comfort, PR [#13](https://github.com/ethereumjs/ethereumjs-common/pull/13)
- New ``hardforkGteHardfork()`` method for HF order comparisons, PR [#13](https://github.com/ethereumjs/ethereumjs-common/pull/13)

[0.3.0]: https://github.com/ethereumjs/ethereumjs-common/compare/v0.2.0...v0.3.0

## [0.2.0] - 2018-05-14
- New optional initialization parameter ``allowedHardforks``, this allows for cleaner client
library implementations by preventing undefined behaviour, PR [#10](https://github.com/ethereumjs/ethereumjs-common/pull/10)
Expand Down
176 changes: 97 additions & 79 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,64 +11,66 @@
- [param][7]
- [paramByBlock][8]
- [hardforkIsActiveOnBlock][9]
- [hardforkIsActiveOnChain][10]
- [activeHardforks][11]
- [activeHardfork][12]
- [hardforkBlock][13]
- [isHardforkBlock][14]
- [consensus][15]
- [finality][16]
- [genesis][17]
- [hardforks][18]
- [bootstrapNodes][19]
- [hardfork][20]
- [chainId][21]
- [chainName][22]
- [networkId][23]
- [hardforkGteHardfork][10]
- [hardforkIsActiveOnChain][11]
- [activeHardforks][12]
- [activeHardfork][13]
- [hardforkBlock][14]
- [isHardforkBlock][15]
- [consensus][16]
- [finality][17]
- [genesis][18]
- [hardforks][19]
- [bootstrapNodes][20]
- [hardfork][21]
- [chainId][22]
- [chainName][23]
- [networkId][24]

## Common

Common class to access chain and hardfork parameters

**Parameters**

- `chain` **([String][24] \| [Number][25])** String ('mainnet') or Number (1) chain representation
- `hardfork` **[String][24]** String identifier ('byzantium') for hardfork (optional)
- `supportedHardforks` **[Array][26]** Limit parameter returns to the given hardforks (optional)
- `chain` **([String][25] \| [Number][26])** String ('mainnet') or Number (1) chain representation
- `hardfork` **[String][25]** String identifier ('byzantium') for hardfork (optional)
- `supportedHardforks` **[Array][27]** Limit parameter returns to the given hardforks (optional)

### setChain

Sets the chain

**Parameters**

- `chain` **([String][24] \| [Number][25])** String ('mainnet') or Number (1) chain representation
- `chain` **([String][25] \| [Number][26])** String ('mainnet') or Number (1) chain representation

### setHardfork

Sets the hardfork to get params for

**Parameters**

- `hardfork` **[String][24]** String identifier ('byzantium')
- `hardfork` **[String][25]** String identifier ('byzantium')

### \_chooseHardfork

Internal helper function to choose between hardfork set and hardfork provided as param

**Parameters**

- `hardfork` **[String][24]** Hardfork given to function as a parameter
- `hardfork` **[String][25]** Hardfork given to function as a parameter
- `onlySupported`

Returns **[String][24]** Hardfork chosen to be used
Returns **[String][25]** Hardfork chosen to be used

### \_getHardfork

Internal helper function, returns the params for the given hardfork for the chain set

**Parameters**

- `hardfork` **[String][24]** Hardfork name
- `hardfork` **[String][25]** Hardfork name

Returns **Dictionary**

Expand All @@ -78,119 +80,133 @@ Internal helper function to check if a hardfork is set to be supported by the li

**Parameters**

- `hardfork` **[String][24]** Hardfork name
- `hardfork` **[String][25]** Hardfork name

Returns **[Boolean][27]** True if hardfork is supported
Returns **[Boolean][28]** True if hardfork is supported

### param

Returns the parameter corresponding to a hardfork

**Parameters**

- `topic` **[String][24]** Parameter topic ('gasConfig', 'gasPrices', 'vm', 'pow', 'casper', 'sharding')
- `name` **[String][24]** Parameter name (e.g. 'minGasLimit' for 'gasConfig' topic)
- `hardfork` **[String][24]** Hardfork name, optional if hardfork set
- `topic` **[String][25]** Parameter topic ('gasConfig', 'gasPrices', 'vm', 'pow', 'casper', 'sharding')
- `name` **[String][25]** Parameter name (e.g. 'minGasLimit' for 'gasConfig' topic)
- `hardfork` **[String][25]** Hardfork name, optional if hardfork set

### paramByBlock

Returns a parameter for the hardfork active on block number

**Parameters**

- `topic` **[String][24]** Parameter topic
- `name` **[String][24]** Parameter name
- `blockNumber` **[Number][25]** Block number
- `topic` **[String][25]** Parameter topic
- `name` **[String][25]** Parameter name
- `blockNumber` **[Number][26]** Block number

### hardforkIsActiveOnBlock

Checks if a hardfork is active for a given block number
Checks if set or provided hardfork is active on block number

**Parameters**

- `hardfork` **[String][24]** Hardfork name
- `blockNumber` **[Number][25]**
- `opts` **[Array][26]**
- `hardfork` **[String][25]** Hardfork name or null (for HF set)
- `blockNumber` **[Number][26]**
- `opts` **[Array][27]**
- `opts.onlySupported` **Array.Boolean** optional, only allow supported HFs (default: false)

Returns **[Boolean][27]**
Returns **[Boolean][28]**

### hardforkGteHardfork

Sequence based check if given or set HF1 is greater than or equal HF2

**Parameters**

- `hardfork1` **[Number][26]** Hardfork name or null (if set)
- `hardfork2` **[String][25]** Hardfork name
- `opts` **[Array][27]**
- `opts.onlyActive` **Array.Boolean** optional, only active HFs (default: false)
- `opts.onlySupported` **Array.Boolean** optional, only allow supported HFs (default: false)

Returns **[Boolean][28]**

### hardforkIsActiveOnChain

Checks if the hardfork provided is active on the chain
Checks if given or set hardfork is active on the chain

**Parameters**

- `hardfork` **[String][24]**
- `opts` **[Array][26]**
- `hardfork` **[String][25]** Hardfork name, optional if HF set
- `opts` **[Array][27]**
- `opts.onlySupported` **Array.Boolean** optional, only allow supported HFs (default: false)

Returns **[Boolean][27]**
Returns **[Boolean][28]**

### activeHardforks

Returns the active hardfork switches for the current chain

**Parameters**

- `blockNumber` **[Number][25]** up to block if provided, otherwise for the whole chain
- `opts` **[Array][26]**
- `blockNumber` **[Number][26]** up to block if provided, otherwise for the whole chain
- `opts` **[Array][27]**
- `opts.onlySupported` **Array.Boolean** optional, limit results to supported HFs (default: false)

Returns **[Array][26]** Array with hardfork arrays
Returns **[Array][27]** Array with hardfork arrays

### activeHardfork

Returns the latest active hardfork name for chain or block or throws if unavailable

**Parameters**

- `blockNumber` **[Number][25]** up to block if provided, otherwise for the whole chain
- `opts` **[Array][26]**
- `blockNumber` **[Number][26]** up to block if provided, otherwise for the whole chain
- `opts` **[Array][27]**
- `opts.onlySupported` **Array.Boolean** optional, limit results to supported HFs (default: false)

Returns **[String][24]** Hardfork name
Returns **[String][25]** Hardfork name

### hardforkBlock

Returns the hardfork change block for the given hardfork
Returns the hardfork change block for hardfork provided or set

**Parameters**

- `hardfork` **[String][24]** Hardfork name
- `hardfork` **[String][25]** Hardfork name, optional if HF set

Returns **[Number][25]** Block number
Returns **[Number][26]** Block number

### isHardforkBlock

True if block number provided is the hardfork change block of the current chain
True if block number provided is the hardfork (given or set) change block of the current chain

**Parameters**

- `hardfork` **[String][24]** Hardfork name
- `blockNumber` **[Number][25]** Number of the block to check
- `blockNumber` **[Number][26]** Number of the block to check
- `hardfork` **[String][25]** Hardfork name, optional if HF set

Returns **[Boolean][27]**
Returns **[Boolean][28]**

### consensus

Provide the consensus type for the hardfork set or provided as param

**Parameters**

- `hardfork` **[String][24]** Hardfork name, optional if hardfork set
- `hardfork` **[String][25]** Hardfork name, optional if hardfork set

Returns **[String][24]** Consensus type (e.g. 'pow', 'poa')
Returns **[String][25]** Consensus type (e.g. 'pow', 'poa')

### finality

Provide the finality type for the hardfork set or provided as param

**Parameters**

- `hardfork` **[String][24]** Hardfork name, optional if hardfork set
- `hardfork` **[String][25]** Hardfork name, optional if hardfork set

Returns **[String][24]** Finality type (e.g. 'pos', null of no finality)
Returns **[String][25]** Finality type (e.g. 'pos', null of no finality)

### genesis

Expand All @@ -202,7 +218,7 @@ Returns **Dictionary** Genesis dict

Returns the hardforks for current chain

Returns **[Array][26]** Array with arrays of hardforks
Returns **[Array][27]** Array with arrays of hardforks

### bootstrapNodes

Expand All @@ -214,25 +230,25 @@ Returns **Dictionary** Dict with bootstrap nodes

Returns the hardfork set

Returns **[String][24]** Hardfork name
Returns **[String][25]** Hardfork name

### chainId

Returns the Id of current chain

Returns **[Number][25]** chain Id
Returns **[Number][26]** chain Id

### chainName

Returns the name of current chain

Returns **[String][24]** chain name (lower case)
Returns **[String][25]** chain name (lower case)

### networkId

Returns the Id of current network

Returns **[Number][25]** network Id
Returns **[Number][26]** network Id

[1]: #common

Expand All @@ -252,38 +268,40 @@ Returns **[Number][25]** network Id

[9]: #hardforkisactiveonblock

[10]: #hardforkisactiveonchain
[10]: #hardforkgtehardfork

[11]: #hardforkisactiveonchain

[11]: #activehardforks
[12]: #activehardforks

[12]: #activehardfork
[13]: #activehardfork

[13]: #hardforkblock
[14]: #hardforkblock

[14]: #ishardforkblock
[15]: #ishardforkblock

[15]: #consensus
[16]: #consensus

[16]: #finality
[17]: #finality

[17]: #genesis
[18]: #genesis

[18]: #hardforks
[19]: #hardforks

[19]: #bootstrapnodes
[20]: #bootstrapnodes

[20]: #hardfork
[21]: #hardfork

[21]: #chainid
[22]: #chainid

[22]: #chainname
[23]: #chainname

[23]: #networkid
[24]: #networkid

[24]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
[25]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String

[25]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
[26]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number

[26]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
[27]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array

[27]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
[28]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ethereumjs-common",
"version": "0.2.0",
"version": "0.3.0",
"description": "Resources common to all Ethereum implementations",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 4620975

Please sign in to comment.