Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update governance end-to-end tests to work with changed precompile #1476

Merged
merged 2 commits into from
Oct 25, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions packages/celotool/src/e2e-tests/governance_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,6 @@ describe('governance tests', () => {
await sleep(epoch)
})

// Note that this returns the validator set at the END of `blockNumber`, i.e. the validator set
// that will validate the next block, and NOT necessarily the validator set that validated this
// block.
const getValidatorSetAtBlock = async (blockNumber: number) => {
const validatorSetSize = await election.methods
.numberValidatorsInCurrentSet()
Expand Down Expand Up @@ -212,9 +209,7 @@ describe('governance tests', () => {

it('should only have created blocks whose miner was in the current validator set', async () => {
for (const blockNumber of blockNumbers) {
// The validators responsible for creating `blockNumber` were those in the validator set at
// `blockNumber-1`.
const validatorSet = await getValidatorSetAtBlock(blockNumber - 1)
const validatorSet = await getValidatorSetAtBlock(blockNumber)
const block = await web3.eth.getBlock(blockNumber)
assert.include(validatorSet.map((x) => x.toLowerCase()), block.miner.toLowerCase())
}
Expand Down Expand Up @@ -257,7 +252,7 @@ describe('governance tests', () => {
let expectUnchangedScores: string[]
let expectChangedScores: string[]
if (isLastBlockOfEpoch(blockNumber, epoch)) {
expectChangedScores = await getValidatorSetAtBlock(blockNumber - 1)
expectChangedScores = await getValidatorSetAtBlock(blockNumber)
expectUnchangedScores = allValidators.filter((x) => !expectChangedScores.includes(x))
} else {
expectUnchangedScores = allValidators
Expand Down Expand Up @@ -314,7 +309,7 @@ describe('governance tests', () => {
let expectUnchangedBalances: string[]
let expectChangedBalances: string[]
if (isLastBlockOfEpoch(blockNumber, epoch)) {
expectChangedBalances = await getValidatorSetAtBlock(blockNumber - 1)
expectChangedBalances = await getValidatorSetAtBlock(blockNumber)
expectUnchangedBalances = allValidators.filter((x) => !expectChangedBalances.includes(x))
} else {
expectUnchangedBalances = allValidators
Expand Down