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

Core domain bundle solution verification #923

Merged
merged 7 commits into from
Nov 17, 2022

Conversation

liuchengxu
Copy link
Contributor

@liuchengxu liuchengxu commented Nov 15, 2022

This PR solves a missing piece from #918 which is to verify the ProofOfElection of core domain bundles, which is done in the pre_dispatch hook. The other checks of the core domain bundle have been performed on the primary chain, only the checks on the state of receipts involved need to be done on the system chain:

  • Verify the state root of core domain
  • Verify the bundle election solution threshold

I have tested it locally on top of #918.

Close #906

Code contributor checklist:

Also removed the redundant TODO.
All kinds of bundles share the same logic of verifying the threshold,
this API will be used later for the core domain bundle verification.
`core_block_hash` and `core_state_root` are added to the struct
`ProofOfElection` as we need to the block hash and the corresponding
state root of a core domain. They are optional for the sytem domain
bundle.

Also added a TODO to rename `secondary_hash` to `domain_hash` in
the Receipt struct since now the core domain is possible as well.
@liuchengxu liuchengxu force-pushed the core-domain-bundle-solution-verification branch from 4cb2373 to 70a10d8 Compare November 16, 2022 08:36
Base automatically changed from core-payments-domain to main November 16, 2022 15:05
Comment on lines +164 to +165
// TODO: override the core block info, see if there is a nicer way
// later.
Copy link
Member

Choose a reason for hiding this comment

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

Maybe have an enum instead of a struct so you don't need to have optional fields?

@liuchengxu liuchengxu merged commit 132b820 into main Nov 17, 2022
@liuchengxu liuchengxu deleted the core-domain-bundle-solution-verification branch November 17, 2022 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants