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

Test that events that are emitted during block finalization are included in the blocks #1798

Merged
merged 23 commits into from
Dec 6, 2019
Merged
Changes from 4 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
45b9073
added a simple test
mrsmkl Nov 20, 2019
2568873
fixing lint
mrsmkl Nov 20, 2019
5de8a8f
Merge branch 'master' into extra-receipt-test
mrsmkl Nov 20, 2019
e082fb5
Merge branch 'master' into extra-receipt-test
Nov 20, 2019
b08928c
Merge branch 'master' of github.com:celo-org/celo-monorepo into extra…
mrsmkl Nov 25, 2019
4e9b30b
improved test
mrsmkl Nov 25, 2019
e963123
Merge branch 'master' of github.com:celo-org/celo-monorepo into extra…
mrsmkl Nov 25, 2019
d14436c
Merge branch 'extra-receipt-test' of github.com:mrsmkl/celo-monorepo …
mrsmkl Nov 25, 2019
9d7c89d
Merge branch 'master' into extra-receipt-test
mrsmkl Dec 2, 2019
356a225
adding events
mrsmkl Dec 2, 2019
1e754f0
Merge branch 'extra-receipt-test' of github.com:mrsmkl/celo-monorepo …
mrsmkl Dec 2, 2019
057c212
added test for events
mrsmkl Dec 2, 2019
039b70d
Merge branch 'master' into extra-receipt-test
Dec 2, 2019
20b9ad0
Merge branch 'master' into extra-receipt-test
timmoreton Dec 2, 2019
cd420cd
Merge branch 'master' into extra-receipt-test
mrsmkl Dec 3, 2019
a39fb3d
Merge branch 'master' into extra-receipt-test
jcortejoso Dec 3, 2019
c36dfa8
Merge branch 'master' into extra-receipt-test
mrsmkl Dec 3, 2019
5e3459f
Merge branch 'master' into extra-receipt-test
Dec 3, 2019
010a0e8
Merge branch 'master' into extra-receipt-test
mrsmkl Dec 4, 2019
efc2058
Merge branch 'master' into extra-receipt-test
Dec 5, 2019
f59fbdc
Merge branch 'master' into extra-receipt-test
Dec 5, 2019
0513d48
Merge branch 'master' into extra-receipt-test
Dec 5, 2019
cd1b946
Merge branch 'master' into extra-receipt-test
Dec 6, 2019
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
9 changes: 9 additions & 0 deletions packages/celotool/src/e2e-tests/governance_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,15 @@ describe('governance tests', () => {
}
}
})

it('should have emitted transfer events when paying epoch rewards', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we test that the correct events are emitted, and also that the events are only emitted during epoch blocks?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, adding more checks.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, didn't realize that we don't actually emit the main events that we'd want to record.

More specifically, can we check that the following events are emitted in finalizing the last block of the epoch, and that no events are emitted in finalizing any other block?

TargetVotingYieldUpdated (needs to be added to EpochRewards.updateTargetVotingYield)
ValidatorEpochPaymentDistributed (needs to be added to Validators.distributeEpochPayementsFromSigner)
EpochRewardsDistributedToVoters (needs to be added to Election.distributeEpochRewards)

And can you please add unit tests that check for these events as well?

Thanks!

const currentBlock = await web3.eth.getBlockNumber()
const lst = await web3.eth.getPastLogs({
fromBlock: currentBlock - 10,
toBlock: currentBlock,
})
assert(lst.some((a: any) => a.transactionHash === a.blockHash))
})
})

describe('after the gold token smart contract is registered', () => {
Expand Down