As explained in the related issue, the current APK (aggregated public key) is constructed by pulling in validator data from the validators who were selected for the current epoch, taking their public keys, then aggregating them.
Instead, the APK should be constructed by fetching all validators from the pool of validators for the epoch and then applying the bitmap included in the Istanbul extra data stored within the block header against this validator list. Once this filtering is done, then can the APK be constructed to appropriately represent the block that was verified.
This resulting list of validators will be only the validators who signed the block, rather than the entire pool of validators who were selected for the epoch.
Note:
chain/listener/listener.go has code added for debugging purposes
validatorsync/syncerstorr.go also has some logs added for debugging purposes
validatorsync/syncerstorr_test.go needed an additional argument because of the change to GetAPKForBlock
validatorsync/sync_test.go needed an additional argument because of the change to GetAPKForBlock
_The additions to the syncerstorr_test and sync_test did not themselves break the tests; the tests were found to be failing prior to the change. This is being investigated_
Related Issue Or Context
Closes: #116
How Has This Been Tested? Testing details.
Unit tests were written.
Types of changes
[x] Bug fix (non-breaking change which fixes an issue)
[ ] New feature (non-breaking change which adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to change)
[ ] Documentation
Checklist:
[x] I have commented my code, particularly in hard-to-understand areas.
[x] I have ensured that all acceptance criteria (or expected behavior) from issue are met
[ ] I have updated the documentation locally and in chainbridge-docs.
[x] I have added tests to cover my changes.
[ ] I have ensured that all the checks are passing and green, I've signed the CLA bot
Description
As explained in the related issue, the current APK (aggregated public key) is constructed by pulling in validator data from the validators who were selected for the current epoch, taking their public keys, then aggregating them.
Instead, the APK should be constructed by fetching all validators from the pool of validators for the epoch and then applying the bitmap included in the Istanbul extra data stored within the block header against this validator list. Once this filtering is done, then can the APK be constructed to appropriately represent the block that was verified.
This resulting list of validators will be only the validators who signed the block, rather than the entire pool of validators who were selected for the epoch.
Note:
chain/listener/listener.go
has code added for debugging purposesvalidatorsync/syncerstorr.go
also has some logs added for debugging purposesvalidatorsync/syncerstorr_test.go
needed an additional argument because of the change toGetAPKForBlock
validatorsync/sync_test.go
needed an additional argument because of the change toGetAPKForBlock
_The additions to the
syncerstorr_test
andsync_test
did not themselves break the tests; the tests were found to be failing prior to the change. This is being investigated_Related Issue Or Context
Closes: #116
How Has This Been Tested? Testing details.
Unit tests were written.
Types of changes
Checklist: