Skip to content

Commit b0477d6

Browse files
authored
Block, Blockchain: bugfix releases (client preparation) fixing London HF at block 0 or 1 handling (#1495)
1 parent 02d9330 commit b0477d6

File tree

10 files changed

+55
-29
lines changed

10 files changed

+55
-29
lines changed

packages/block/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ 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.5.1 - 2021-09-28
10+
11+
- Fixed a bug not initializing the HF correctly when run on a custom chain with the `london` HF happening on block 0 or 1, PR [#1492](https://github.com/ethereumjs/ethereumjs-monorepo/pull/1492)
12+
913
## 3.5.0 - 2021-09-24
1014

1115
### Experimental Merge/PoS Support

packages/block/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ethereumjs/block",
3-
"version": "3.5.0",
3+
"version": "3.5.1",
44
"description": "Provides Block serialization and help functions",
55
"license": "MPL-2.0",
66
"author": "mjbecze ([email protected])",

packages/blockchain/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ 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.4.2 - 2021-09-28
10+
11+
- Fixed a bug not initializing the HF correctly when run on a custom chain with the `london` HF happening on block 0 or 1, PR [#1492](https://github.com/ethereumjs/ethereumjs-monorepo/pull/1492)
12+
913
## 5.4.1 - 2021-09-24
1014

1115
### Experimental Casper/PoS and Merge Support

packages/blockchain/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ethereumjs/blockchain",
3-
"version": "5.4.1",
3+
"version": "5.4.2",
44
"description": "A module to store and interact with blocks",
55
"license": "MPL-2.0",
66
"keywords": [
@@ -35,7 +35,7 @@
3535
},
3636
"author": "mjbecze <[email protected]>",
3737
"dependencies": {
38-
"@ethereumjs/block": "^3.5.0",
38+
"@ethereumjs/block": "^3.5.1",
3939
"@ethereumjs/common": "^2.5.0",
4040
"@ethereumjs/ethash": "^1.1.0",
4141
"debug": "^2.2.0",

packages/client/README.md

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Here are some use cases:
2121
- Set up your own local development networks (PoA Clique)
2222
- Run a network with your own custom [EthereumJS VM](../vm)
2323
- Analyze what's in the Ethereum `mainnet` [transaction pool](./lib/sync/txpool.ts)
24-
- Run experiments on Ethereum browser sync (see [example](./examples/light-browser-sync.md))
24+
- Run experiments with Ethereum browser sync (see [example](./examples/light-browser-sync.md))
2525

2626
The client has an extremely modular design by building upon central other libraries in the EthereumJS monorepo ([VM](../vm), [Merkle Patricia Tree](../trie), [Blockchain](../blockchain), [Block](../block), [tx](../tx), [devp2p](../devp2p) and [Common](../common)) and is therefore extremely well suited for a deep dive into Ethereum protocol development.
2727

@@ -32,13 +32,7 @@ We invite you to explore and would be delighted if you give us feedback on your
3232
## INSTALL
3333

3434
```shell
35-
npm install @ethereumjs/client // Release during Fall 2021
36-
```
37-
38-
For the `ethereumjs` CLI command to work run:
39-
40-
```shell
41-
npm link
35+
npm install -g @ethereumjs/client // Release during Fall 2021
4236
```
4337

4438
As long as there is no up-to-date client release on npm and for development purposes the client can be used like this:

packages/client/bin/cli.ts

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env client
1+
#!/usr/bin/env node
22

33
import { homedir } from 'os'
44
import path from 'path'
@@ -33,7 +33,7 @@ const args = require('yargs')
3333
default: undefined,
3434
},
3535
syncmode: {
36-
describe: 'Blockchain sync mode',
36+
describe: 'Blockchain sync mode (light sync experimental)',
3737
choices: ['light', 'full'],
3838
default: Config.SYNCMODE_DEFAULT,
3939
},
@@ -47,11 +47,11 @@ const args = require('yargs')
4747
default: `${homedir()}/Library/Ethereum/ethereumjs`,
4848
},
4949
customChain: {
50-
describe: 'Path to custom chain parameters json file from Common',
50+
describe: 'Path to custom chain parameters json file (@ethereumjs/common format)',
5151
coerce: path.resolve,
5252
},
5353
customGenesisState: {
54-
describe: 'Path to custom genesis state json file from Common',
54+
describe: 'Path to custom genesis state json file (@ethereumjs/common format)',
5555
coerce: path.resolve,
5656
},
5757
gethGenesis: {
@@ -213,6 +213,22 @@ async function run() {
213213
input: process.stdin,
214214
output: process.stdout,
215215
})
216+
217+
// Hide key input
218+
;(rl as any).input.on('keypress', function () {
219+
// get the number of characters entered so far:
220+
const len = (rl as any).line.length
221+
// move cursor back to the beginning of the input:
222+
readline.moveCursor((rl as any).output, -len, 0)
223+
// clear everything to the right of the cursor:
224+
readline.clearLine((rl as any).output, 1)
225+
// replace the original input with asterisks:
226+
for (let i = 0; i < len; i++) {
227+
// eslint-disable-next-line no-extra-semi
228+
;(rl as any).output.write('*')
229+
}
230+
})
231+
216232
const question = (text: string) => {
217233
return new Promise<string>((resolve) => {
218234
rl.question(text, resolve)
@@ -225,18 +241,21 @@ async function run() {
225241
const inputKey = await question(
226242
`Please enter the 0x-prefixed private key to unlock ${address}:\n`
227243
)
244+
;(rl as any).history = (rl as any).history.slice(1)
228245
const privKey = toBuffer(inputKey)
229246
const derivedAddress = Address.fromPrivateKey(privKey)
230247
if (address.equals(derivedAddress)) {
231248
accounts.push([address, privKey])
232249
} else {
233-
throw new Error(
250+
console.error(
234251
`Private key does not match for ${address} (address derived: ${derivedAddress})`
235252
)
253+
process.exit()
236254
}
237255
}
238-
} catch (error) {
239-
console.error(`Encountered error unlocking account:\n${error}`)
256+
} catch (e: any) {
257+
console.error(`Encountered error unlocking account:\n${e.message}`)
258+
process.exit()
240259
}
241260
rl.close()
242261
}
@@ -310,12 +329,14 @@ async function run() {
310329
(args.customChainParams || args.customGenesisState || args.gethGenesis) &&
311330
(!(args.network === 'mainnet') || args.networkId)
312331
) {
313-
throw new Error('cannot specify both custom chain parameters and preset network ID')
332+
console.error('cannot specify both custom chain parameters and preset network ID')
333+
process.exit()
314334
}
315335
// Use custom chain parameters file if specified
316336
if (args.customChain) {
317337
if (!args.customGenesisState) {
318-
throw new Error('cannot have custom chain parameters without genesis state')
338+
console.error('cannot have custom chain parameters without genesis state')
339+
process.exit()
319340
}
320341
try {
321342
const customChainParams = JSON.parse(readFileSync(args.customChain, 'utf-8'))
@@ -325,7 +346,8 @@ async function run() {
325346
customChains: [[customChainParams, genesisState]],
326347
})
327348
} catch (err: any) {
328-
throw new Error(`invalid chain parameters: ${err.message}`)
349+
console.error(`invalid chain parameters: ${err.message}`)
350+
process.exit()
329351
}
330352
} else if (args.gethGenesis) {
331353
// Use geth genesis parameters file if specified
@@ -346,10 +368,12 @@ async function run() {
346368

347369
if (args.mine) {
348370
if (common.consensusType() !== ConsensusType.ProofOfAuthority) {
349-
throw new Error('Currently mining is only supported for PoA consensus')
371+
console.error('Currently mining is only supported for PoA consensus')
372+
process.exit()
350373
}
351374
if (!args.unlock) {
352-
throw new Error('Please provide an account to sign sealed blocks with `--unlock [address]` ')
375+
console.error('Please provide an account to sign sealed blocks with `--unlock [address]` ')
376+
process.exit()
353377
}
354378
}
355379

packages/client/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@
4949
"tsc": "../../config/cli/ts-compile.sh"
5050
},
5151
"dependencies": {
52-
"@ethereumjs/block": "^3.5.0",
53-
"@ethereumjs/blockchain": "^5.4.1",
52+
"@ethereumjs/block": "^3.5.1",
53+
"@ethereumjs/blockchain": "^5.4.2",
5454
"@ethereumjs/common": "^2.5.0",
5555
"@ethereumjs/devp2p": "^4.2.0",
5656
"@ethereumjs/tx": "^3.3.1",

packages/devp2p/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
"snappyjs": "^0.6.1"
6666
},
6767
"devDependencies": {
68-
"@ethereumjs/block": "^3.5.0",
68+
"@ethereumjs/block": "^3.5.1",
6969
"@ethereumjs/tx": "^3.3.1",
7070
"@types/async": "^2.4.1",
7171
"@types/chalk": "^2.2.0",

packages/ethash/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"docs:build": "typedoc --options typedoc.js"
3232
},
3333
"dependencies": {
34-
"@ethereumjs/block": "^3.5.0",
34+
"@ethereumjs/block": "^3.5.1",
3535
"@types/levelup": "^4.3.0",
3636
"buffer-xor": "^2.0.1",
3737
"ethereumjs-util": "^7.1.1",

packages/vm/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@
4848
"tsc": "../../config/cli/ts-compile.sh"
4949
},
5050
"dependencies": {
51-
"@ethereumjs/block": "^3.5.0",
52-
"@ethereumjs/blockchain": "^5.4.1",
51+
"@ethereumjs/block": "^3.5.1",
52+
"@ethereumjs/blockchain": "^5.4.2",
5353
"@ethereumjs/common": "^2.5.0",
5454
"@ethereumjs/tx": "^3.3.1",
5555
"merkle-patricia-tree": "^4.2.1",

0 commit comments

Comments
 (0)