Skip to content

Commit

Permalink
Update genesis block after adding parent signatures to block header (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Asa Oines committed Nov 14, 2019
1 parent 88608f8 commit f11571d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
16 changes: 8 additions & 8 deletions packages/celotool/src/e2e-tests/governance_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,28 +266,28 @@ describe('governance tests', () => {

const assertScoreUnchanged = async (validator: string, blockNumber: number) => {
const score = new BigNumber(
(await validators.methods.getValidator(validator).call({}, blockNumber))[3]
(await validators.methods.getValidator(validator).call({}, blockNumber))[2]
)
const previousScore = new BigNumber(
(await validators.methods.getValidator(validator).call({}, blockNumber - 1))[3]
(await validators.methods.getValidator(validator).call({}, blockNumber - 1))[2]
)
assert.isNotNaN(score)
assert.isNotNaN(previousScore)
assert.isFalse(score.isNaN())
assert.isFalse(previousScore.isNaN())
assert.equal(score.toFixed(), previousScore.toFixed())
}

const assertScoreChanged = async (validator: string, blockNumber: number) => {
const score = new BigNumber(
(await validators.methods.getValidator(validator).call({}, blockNumber))[3]
(await validators.methods.getValidator(validator).call({}, blockNumber))[2]
)
const previousScore = new BigNumber(
(await validators.methods.getValidator(validator).call({}, blockNumber - 1))[3]
(await validators.methods.getValidator(validator).call({}, blockNumber - 1))[2]
)
assert.isFalse(score.isNaN())
assert.isFalse(previousScore.isNaN())
const expectedScore = adjustmentSpeed
.times(uptime)
.plus(new BigNumber(1).minus(adjustmentSpeed).times(fromFixed(previousScore)))
assert.isNotNaN(score)
assert.isNotNaN(previousScore)
assert.equal(score.toFixed(), toFixed(expectedScore).toFixed())
}

Expand Down
2 changes: 2 additions & 0 deletions packages/celotool/src/lib/generate_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ const generateIstanbulExtraData = (validators: Validator[]) => {
new Buffer(0),
Buffer.from(repeat('0', blsSignatureVanity * 2), 'hex'),
new Buffer(0),
new Buffer(0),
Buffer.from(repeat('0', blsSignatureVanity * 2), 'hex'),
])
.toString('hex')
)
Expand Down

0 comments on commit f11571d

Please sign in to comment.