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

Commit 51f9513

Browse files
authored
Merge pull request #181 from ethereumjs/fix-ci-and-improvements
Upgrade to monorepo beta.2 libraries, other improvements
2 parents f3985b8 + 7833882 commit 51f9513

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+123
-87
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ jobs:
2121
- uses: actions/checkout@v2
2222
- run: npm install
2323
- run: npm run lint
24-
- run: npm run build
2524
- run: npm run coverage
2625
- uses: codecov/codecov-action@v1
26+
if: matrix.node-version == 12
2727
with:
2828
file: ./coverage/lcov.info
2929
test-browser:

karma.conf.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@ module.exports = function (config) {
22
config.set({
33
frameworks: ['karma-typescript', 'tap'],
44

5-
files: ['test/**/*.ts', 'lib/**/*.ts'],
5+
files: ['lib/**/*.ts', 'test/blockchain/chain.spec.ts'],
66

77
preprocessors: {
8-
'**/*.ts': ['karma-typescript']
8+
'**/*.ts': ['karma-typescript'],
99
},
1010

1111
reporters: ['progress'],
1212

1313
karmaTypescriptConfig: {
1414
bundlerOptions: {
15-
entrypoints: /\.spec\.ts$/
15+
entrypoints: /\.spec\.ts$/,
1616
},
17-
tsconfig: "./tsconfig.karma.json",
17+
tsconfig: './tsconfig.karma.json',
1818
},
1919

2020
browsers: ['FirefoxHeadless', 'ChromeHeadless'],
@@ -31,6 +31,6 @@ module.exports = function (config) {
3131

3232
// Fail after timeout
3333
browserDisconnectTimeout: 100000,
34-
browserNoActivityTimeout: 100000
34+
browserNoActivityTimeout: 100000,
3535
})
3636
}

lib/blockchain/chain.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export interface ChainOptions {
1212
/**
1313
* Client configuration instance
1414
*/
15-
config?: Config
15+
config: Config
1616

1717
/**
1818
* Database to store blocks and metadata. Should be an abstract-leveldown compliant store.
@@ -99,18 +99,18 @@ export class Chain extends EventEmitter {
9999
* Create new chain
100100
* @param {ChainOptions} options
101101
*/
102-
constructor(options: ChainOptions = {}) {
102+
constructor(options: ChainOptions) {
103103
super()
104104

105-
this.config = options.config ?? new Config()
105+
this.config = options.config
106106

107107
this.blockchain =
108108
options.blockchain ??
109109
new Blockchain({
110110
db: options.db,
111111
common: this.config.common,
112112
validateBlocks: false,
113-
validatePow: false,
113+
validateConsensus: false,
114114
})
115115

116116
this.db = this.blockchain.db
@@ -324,6 +324,6 @@ export class Chain extends EventEmitter {
324324
*/
325325
async getTd(hash: Buffer, num: BN): Promise<BN> {
326326
await this.open()
327-
return this.blockchain._getTd(hash, num)
327+
return (this.blockchain as any)._getTd(hash, num)
328328
}
329329
}

lib/logging.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
import chalk from 'chalk'
22
import { createLogger, format, transports, Logger as WinstonLogger } from 'winston'
3-
const { combine, timestamp, label, printf } = format
43

54
export type Logger = WinstonLogger
65

7-
const levelColors: any = {
6+
const levelColors = {
87
error: 'red',
98
warn: 'yellow',
109
info: 'green',
1110
debug: 'white',
1211
}
1312

13+
const { combine, timestamp, label, printf } = format
14+
1415
const errorFormat = format((info: any) => {
1516
if (info.message instanceof Error && info.message.stack) {
1617
info.message = info.message.stack

lib/net/peer/libp2pnode.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ export class Libp2pNode extends LibP2p {
4141
dht: {
4242
kBucketSize: 20,
4343
},
44-
// @ts-ignore: 'EXPERIMENTAL' does not exist in type 'OptionsConfig'
4544
EXPERIMENTAL: {
4645
dht: false,
4746
pubsub: false,

lib/net/peer/libp2ppeer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export class Libp2pPeer extends Peer {
3939
* Create new libp2p peer
4040
* @param {Libp2pPeerOptions}
4141
*/
42-
constructor(options: Libp2pPeerOptions = {}) {
42+
constructor(options: Libp2pPeerOptions) {
4343
options.multiaddrs = options.multiaddrs
4444
? parseMultiaddrs(options.multiaddrs)
4545
: ['/ip4/0.0.0.0/tcp/0']

lib/net/peer/peer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Config } from '../../config'
55

66
export interface PeerOptions {
77
/* Config */
8-
config?: Config
8+
config: Config
99

1010
/* Peer id */
1111
id?: string
@@ -52,7 +52,7 @@ export class Peer extends events.EventEmitter {
5252
constructor(options: PeerOptions) {
5353
super()
5454

55-
this.config = options.config ?? new Config()
55+
this.config = options.config
5656

5757
this.id = options.id ?? ''
5858
this.address = options.address

lib/net/server/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
export { Server } from './server'
2-
export { RlpxServer } from './rlpxserver'
3-
export { Libp2pServer } from './libp2pserver'
1+
export * from './server'
2+
export * from './rlpxserver'
3+
export * from './libp2pserver'
44

55
/**
66
* @module net/server

lib/net/server/server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { Protocol } from '../protocol/protocol'
66

77
export interface ServerOptions {
88
/* Config */
9-
config?: Config
9+
config: Config
1010

1111
/* How often (in ms) to discover new peers (default: 30000) */
1212
refreshInterval?: number
@@ -39,7 +39,7 @@ export class Server extends EventEmitter {
3939
constructor(options: ServerOptions) {
4040
super()
4141

42-
this.config = options.config ?? new Config()
42+
this.config = options.config
4343
this.key = options.key ? parseKey(options.key) : undefined
4444
this.bootnodes = options.bootnodes ? parseBootnodes(options.bootnodes) : []
4545
this.refreshInterval = options.refreshInterval ?? 30000

lib/service/service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { Protocol } from '../net/protocol'
66

77
export interface ServiceOptions {
88
/* Config */
9-
config?: Config
9+
config: Config
1010
}
1111

1212
/**
@@ -26,7 +26,7 @@ export class Service extends events.EventEmitter {
2626
constructor(options: ServiceOptions) {
2727
super()
2828

29-
this.config = options.config ?? new Config()
29+
this.config = options.config
3030

3131
this.opened = false
3232
this.running = false

0 commit comments

Comments
 (0)