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

Commit

Permalink
Merge pull request #89 from ethereumjs/add-goerli-support
Browse files Browse the repository at this point in the history
Add Goerli Support
  • Loading branch information
holgerd77 committed Feb 11, 2019
2 parents 1905b14 + 6bd7d03 commit 0031434
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 9 deletions.
4 changes: 2 additions & 2 deletions bin/cli.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env node
'use strict'

const Common = require('ethereumjs-common')
const chains = require('ethereumjs-common/chains')
const Common = require('ethereumjs-common').default
const chains = require('ethereumjs-common/dist/chains').chains
const { getLogger } = require('../lib/logging')
const { parse } = require('../lib/util')
const { fromName: serverFromName } = require('../lib/net/server')
Expand Down
2 changes: 1 addition & 1 deletion lib/blockchain/chain.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict'

const EventEmitter = require('events')
const Common = require('ethereumjs-common')
const Common = require('ethereumjs-common').default
const Block = require('ethereumjs-block')
const Blockchain = require('ethereumjs-blockchain')
const { BN } = require('ethereumjs-util')
Expand Down
2 changes: 1 addition & 1 deletion lib/service/ethereumservice.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const Service = require('./service')
const FlowControl = require('../net/protocol/flowcontrol')
const { Chain } = require('../blockchain')
const Common = require('ethereumjs-common')
const Common = require('ethereumjs-common').default

const defaultOptions = {
lightserv: false,
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@
"dependencies": {
"chalk": "^2.4.1",
"ethereumjs-account": "^2.0.5",
"ethereumjs-block": "^2.1.0",
"ethereumjs-blockchain": "^3.3.2",
"ethereumjs-common": "^0.6.1",
"ethereumjs-block": "^2.2.0",
"ethereumjs-blockchain": "^3.4.0",
"ethereumjs-common": "^1.1.0",
"ethereumjs-devp2p": "^2.5.1",
"ethereumjs-util": "^6.0.0",
"fs-extra": "^6.0.1",
Expand Down
2 changes: 1 addition & 1 deletion test/rpc/helpers.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const jayson = require('jayson')
const Common = require('ethereumjs-common')
const Common = require('ethereumjs-common').default

const Manager = require('../../lib/rpc')
const Logger = require('../../lib/logging')
Expand Down
41 changes: 40 additions & 1 deletion test/rpc/net/version.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const test = require('tape')

const request = require('supertest')
const Common = require('ethereumjs-common')
const Common = require('ethereumjs-common').default
const { startRPC, closeRPC, createManager, createNode } = require('../helpers')

test('call net_version on ropsten', t => {
Expand Down Expand Up @@ -153,3 +153,42 @@ test('call net_version on kovan', t => {
t.end(err)
})
})

test('call net_version on goerli', t => {
const manager = createManager(createNode({ opened: true, commonChain: new Common('goerli') }))
const server = startRPC(manager.getMethods())

const req = {
jsonrpc: '2.0',
method: 'net_version',
params: [],
id: 1
}

request(server)
.post('/')
.set('Content-Type', 'application/json')
.send(req)
.expect(200)
.expect(res => {
const { result } = res.body

if (typeof result !== 'string') {
throw new Error('Result should be a string, but is not')
}

if (result.length === 0) {
throw new Error('Empty result string')
}

if (result !== '5') {
throw new Error(
`Incorrect chain ID. Expected: 5, Received: ${result}`
)
}
})
.end((err, res) => {
closeRPC(server)
t.end(err)
})
})

0 comments on commit 0031434

Please sign in to comment.