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

Commit 4373b4b

Browse files
committed
Migrate to TypeScript
1 parent 83fb9c0 commit 4373b4b

20 files changed

+2392
-1963
lines changed

.babelrc

Lines changed: 0 additions & 4 deletions
This file was deleted.

.nycrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "@ethereumjs/config-nyc"
3+
}

.prettierignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules
2+
.vscode
3+
package.json
4+
dist
5+
.nyc_output

CHANGELOG.md

Lines changed: 68 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,78 @@
11
# Changelog
2+
23
All notable changes to this project will be documented in this file.
34

4-
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5-
(modification: no type change headlines) and this project adheres to
5+
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
6+
(modification: no type change headlines) and this project adheres to
67
[Semantic Versioning](http://semver.org/spec/v2.0.0.html).
78

8-
99
## [3.4.0] - 2019-02-06
10-
**Petersburg** (aka `constantinopleFix`) as well as **Goerli**
11-
support/readiness by updating to a supporting `ethereumjs-common` version
12-
[v1.1.0](https://github.com/ethereumjs/ethereumjs-common/releases/tag/v1.1.0),
10+
11+
**Petersburg** (aka `constantinopleFix`) as well as **Goerli**
12+
support/readiness by updating to a supporting `ethereumjs-common` version
13+
[v1.1.0](https://github.com/ethereumjs/ethereumjs-common/releases/tag/v1.1.0),
1314
PR [#86](https://github.com/ethereumjs/ethereumjs-blockchain/pull/86)
1415

1516
[3.4.0]: https://github.com/ethereumjs/ethereumjs-blockchain/compare/v3.3.3...v3.4.0
1617

1718
## [3.3.3] - 2019-01-03
18-
- Fixed a bug causing the ``iterate()`` method to fail when an older version
19-
``levelup`` DB instance is passed, see PR [#83](https://github.com/ethereumjs/ethereumjs-blockchain/pull/83)
19+
20+
- Fixed a bug causing the `iterate()` method to fail when an older version
21+
`levelup` DB instance is passed, see PR [#83](https://github.com/ethereumjs/ethereumjs-blockchain/pull/83)
2022

2123
[3.3.3]: https://github.com/ethereumjs/ethereumjs-blockchain/compare/v3.3.2...v3.3.3
2224

2325
## [3.3.2] - 2018-12-20
24-
- Updated ``levelup`` dependency to ``level-mem`` ``v3.0.1``, PR [#75](https://github.com/ethereumjs/ethereumjs-blockchain/pull/75)
25-
- Fix ``putBlock()`` edge case, PR [#79](https://github.com/ethereumjs/ethereumjs-blockchain/pull/79)
26-
- Replaced uses of deprecated `new Buffer` with `Buffer.from`, PR [#80](https://github.com/ethereumjs/ethereumjs-blockchain/pull/80)
26+
27+
- Updated `levelup` dependency to `level-mem` `v3.0.1`, PR [#75](https://github.com/ethereumjs/ethereumjs-blockchain/pull/75)
28+
- Fix `putBlock()` edge case, PR [#79](https://github.com/ethereumjs/ethereumjs-blockchain/pull/79)
29+
- Replaced uses of deprecated `new Buffer` with `Buffer.from`, PR [#80](https://github.com/ethereumjs/ethereumjs-blockchain/pull/80)
2730

2831
[3.3.2]: https://github.com/ethereumjs/ethereumjs-blockchain/compare/v3.3.1...v3.3.2
2932

3033
## [3.3.1] - 2018-10-26
31-
- Replaced calls to BN.toBuffer() with BN.toArrayLike() so that ``ethereumjs-blockchain`` can run in a browser environment, PR [#73](https://github.com/ethereumjs/ethereumjs-blockchain/pull/73)
34+
35+
- Replaced calls to BN.toBuffer() with BN.toArrayLike() so that `ethereumjs-blockchain` can run in a browser environment, PR [#73](https://github.com/ethereumjs/ethereumjs-blockchain/pull/73)
3236

3337
[3.3.1]: https://github.com/ethereumjs/ethereumjs-blockchain/compare/v3.3.0...v3.3.1
3438

3539
## [3.3.0] - 2018-10-19
36-
- Constantinople support when using block validation (set with ``opts.validate`` in constructor),
37-
update to a Constantinople-ready version of the ``ethereumjs-block`` dependency (>2.1.0), PR [#71](https://github.com/ethereumjs/ethereumjs-blockchain/pull/71)
40+
41+
- Constantinople support when using block validation (set with `opts.validate` in constructor),
42+
update to a Constantinople-ready version of the `ethereumjs-block` dependency (>2.1.0), PR [#71](https://github.com/ethereumjs/ethereumjs-blockchain/pull/71)
3843

3944
[3.3.0]: https://github.com/ethereumjs/ethereumjs-blockchain/compare/v3.2.1...v3.3.0
4045

4146
## [3.2.1] - 2018-08-29
42-
- Fixed an issue with the ``iterator()`` function returning an error on end of block iteration instead of finish gracefully, PR [#64](https://github.com/ethereumjs/ethereumjs-blockchain/pull/64)
43-
- Updated ``ethereumjs-common`` dependency to ``v0.5.0`` (custom chain support), PR [#63](https://github.com/ethereumjs/ethereumjs-blockchain/pull/63)
47+
48+
- Fixed an issue with the `iterator()` function returning an error on end of block iteration instead of finish gracefully, PR [#64](https://github.com/ethereumjs/ethereumjs-blockchain/pull/64)
49+
- Updated `ethereumjs-common` dependency to `v0.5.0` (custom chain support), PR [#63](https://github.com/ethereumjs/ethereumjs-blockchain/pull/63)
4450

4551
[3.2.1]: https://github.com/ethereumjs/ethereumjs-blockchain/compare/v3.2.0...v3.2.1
4652

4753
## [3.2.0] - 2018-08-13
48-
- Added support for setting network and performing hardfork-specific validation by integrating with [ethereumjs-common](https://github.com/ethereumjs/ethereumjs-common), PR [#59](https://github.com/ethereumjs/ethereumjs-blockchain/pull/59)
49-
- Added ``Blockchain.putHeader()`` and ``Blockchain.putHeaders()`` functions to provide header-chain functionality (needed by ethereumjs-client), PR [#59](https://github.com/ethereumjs/ethereumjs-blockchain/pull/59)
50-
- Fixed a bug with caching, PR [#59](https://github.com/ethereumjs/ethereumjs-blockchain/pull/59)
51-
- Fixed error propagation in ``Blockchain.iterator()``, PR [#60](https://github.com/ethereumjs/ethereumjs-blockchain/pull/60)
54+
55+
- Added support for setting network and performing hardfork-specific validation by integrating with [ethereumjs-common](https://github.com/ethereumjs/ethereumjs-common), PR [#59](https://github.com/ethereumjs/ethereumjs-blockchain/pull/59)
56+
- Added `Blockchain.putHeader()` and `Blockchain.putHeaders()` functions to provide header-chain functionality (needed by ethereumjs-client), PR [#59](https://github.com/ethereumjs/ethereumjs-blockchain/pull/59)
57+
- Fixed a bug with caching, PR [#59](https://github.com/ethereumjs/ethereumjs-blockchain/pull/59)
58+
- Fixed error propagation in `Blockchain.iterator()`, PR [#60](https://github.com/ethereumjs/ethereumjs-blockchain/pull/60)
5259

5360
[3.2.0]: https://github.com/ethereumjs/ethereumjs-blockchain/compare/v3.1.0...v3.2.0
5461

5562
## [3.1.0] - 2018-05-24
56-
- New ``getLatestHeader()`` and ``getLatestBlock()`` methods for retrieving the latest header
57-
respectively full block in the canonical chain, PR [#52](https://github.com/ethereumjs/ethereumjs-blockchain/pull/52)
58-
- Fixed ``saveHeads()`` bug not storing the internal ``headHeader``/``headBlock`` header cursors
59-
to the DB, PR [#52](https://github.com/ethereumjs/ethereumjs-blockchain/pull/52)
60-
- Updated API docs
63+
64+
- New `getLatestHeader()` and `getLatestBlock()` methods for retrieving the latest header
65+
respectively full block in the canonical chain, PR [#52](https://github.com/ethereumjs/ethereumjs-blockchain/pull/52)
66+
- Fixed `saveHeads()` bug not storing the internal `headHeader`/`headBlock` header cursors
67+
to the DB, PR [#52](https://github.com/ethereumjs/ethereumjs-blockchain/pull/52)
68+
- Updated API docs
6169

6270
[3.1.0]: https://github.com/ethereumjs/ethereumjs-blockchain/compare/v3.0.0...v3.1.0
6371

6472
## [3.0.0] - 2018-05-18
73+
6574
This release comes with heavy internal changes bringing Geth DB compatibility to the
66-
``ethereumjs-blockchain`` library. For a full list of changes and associated discussion
75+
`ethereumjs-blockchain` library. For a full list of changes and associated discussion
6776
see PR [#47](https://github.com/ethereumjs/ethereumjs-blockchain/pull/47)
6877
(thanks to @vpulim for this amazing work!). To test iterating through your local Geth
6978
chaindata DB you can run the [example](https://github.com/ethereumjs/ethereumjs-blockchain#example)
@@ -76,64 +85,69 @@ instances, so it is not possible to load an old DB with the new library version
7685
problems for you get in touch on GitHub or Gitter!).
7786

7887
Summary of the changes:
79-
- New unified constructor where ``detailsDB`` and ``blockDB`` are replaced by a single ``db`` reference
80-
- Deprecation of the ``getDetails()`` method now returning an empty object
81-
- ``td`` and ``height`` are not stored in the db as meta info but computed as needed
82-
- Block headers and body are stored under two separate keys
83-
- Changes have been made to properly rebuild the chain and number/hash mappings as a result of forks and deletions
84-
- A write-through cache has been added to reduce database reads
85-
- Similar to geth, we now defend against selfish mining vulnerability
86-
- Added many more tests to increase coverage to over 90%
87-
- Updated docs to reflect the API changes
88-
- Updated library dependencies
88+
89+
- New unified constructor where `detailsDB` and `blockDB` are replaced by a single `db` reference
90+
- Deprecation of the `getDetails()` method now returning an empty object
91+
- `td` and `height` are not stored in the db as meta info but computed as needed
92+
- Block headers and body are stored under two separate keys
93+
- Changes have been made to properly rebuild the chain and number/hash mappings as a result of forks and deletions
94+
- A write-through cache has been added to reduce database reads
95+
- Similar to geth, we now defend against selfish mining vulnerability
96+
- Added many more tests to increase coverage to over 90%
97+
- Updated docs to reflect the API changes
98+
- Updated library dependencies
8999

90100
[3.0.0]: https://github.com/ethereumjs/ethereumjs-blockchain/compare/v2.1.0...v3.0.0
91101

92102
## [2.1.0] - 2017-10-11
93-
- ``Metro-Byzantium`` compatible
94-
- Updated ``ethereumjs-block`` dependency (new difficulty formula / difficulty bomb delay)
103+
104+
- `Metro-Byzantium` compatible
105+
- Updated `ethereumjs-block` dependency (new difficulty formula / difficulty bomb delay)
95106

96107
[2.1.0]: https://github.com/ethereumjs/ethereumjs-blockchain/compare/v2.0.2...v2.1.0
97108

98109
## [2.0.2] - 2017-09-19
99-
- Tightened dependencies to prevent the ``2.0.x`` version of the library to break
100-
after ``ethereumjs`` Byzantium library updates
110+
111+
- Tightened dependencies to prevent the `2.0.x` version of the library to break
112+
after `ethereumjs` Byzantium library updates
101113

102114
[2.0.2]: https://github.com/ethereumjs/ethereumjs-blockchain/compare/v2.0.1...v2.0.2
103115

104116
## [2.0.1] - 2017-09-14
105-
- Fixed severe bug adding blocks before blockchain init is complete
117+
118+
- Fixed severe bug adding blocks before blockchain init is complete
106119

107120
[2.0.1]: https://github.com/ethereumjs/ethereumjs-blockchain/compare/v2.0.0...v2.0.1
108121

109122
## [2.0.0] - 2017-01-01
110-
- Split ``db`` into ``blockDB`` and ``detailsDB`` (breaking)
123+
124+
- Split `db` into `blockDB` and `detailsDB` (breaking)
111125

112126
[2.0.0]: https://github.com/ethereumjs/ethereumjs-blockchain/compare/v1.4.2...v2.0.0
113127

114128
## [1.4.2] - 2016-12-29
115-
- New ``getBlocks`` API method
116-
- Testing improvements
129+
130+
- New `getBlocks` API method
131+
- Testing improvements
117132

118133
[1.4.2]: https://github.com/ethereumjs/ethereumjs-blockchain/compare/v1.4.1...v1.4.2
119134

120135
## [1.4.1] - 2016-03-01
121-
- Update dependencies to support Windows
136+
137+
- Update dependencies to support Windows
122138

123139
[1.4.1]: https://github.com/ethereumjs/ethereumjs-blockchain/compare/v1.4.0...v1.4.1
124140

125141
## [1.4.0] - 2016-01-09
126-
- Bump dependencies
127142

128-
[1.4.0]: https://github.com/ethereumjs/ethereumjs-blockchain/compare/v1.3.4...v1.4.0
143+
- Bump dependencies
129144

145+
[1.4.0]: https://github.com/ethereumjs/ethereumjs-blockchain/compare/v1.3.4...v1.4.0
130146

131147
## Older releases:
132148

133-
- [1.3.4](https://github.com/ethereumjs/ethereumjs-blockchain/compare/v1.3.3...v1.3.4) - 2016-01-08
134-
- [1.3.3](https://github.com/ethereumjs/ethereumjs-blockchain/compare/v1.3.2...v1.3.3) - 2015-11-27
135-
- [1.3.2](https://github.com/ethereumjs/ethereumjs-blockchain/compare/v1.3.1...v1.3.2) - 2015-11-27
136-
- [1.3.1](https://github.com/ethereumjs/ethereumjs-blockchain/compare/v1.2.0...v1.3.1) - 2015-10-23
137-
- 1.2.0 - 2015-10-01
138-
139-
149+
- [1.3.4](https://github.com/ethereumjs/ethereumjs-blockchain/compare/v1.3.3...v1.3.4) - 2016-01-08
150+
- [1.3.3](https://github.com/ethereumjs/ethereumjs-blockchain/compare/v1.3.2...v1.3.3) - 2015-11-27
151+
- [1.3.2](https://github.com/ethereumjs/ethereumjs-blockchain/compare/v1.3.1...v1.3.2) - 2015-11-27
152+
- [1.3.1](https://github.com/ethereumjs/ethereumjs-blockchain/compare/v1.2.0...v1.3.1) - 2015-10-23
153+
- 1.2.0 - 2015-10-01

0 commit comments

Comments
 (0)