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

feat: Re-sign failed CCMs #4277

Merged
merged 17 commits into from Nov 30, 2023
Merged

feat: Re-sign failed CCMs #4277

merged 17 commits into from Nov 30, 2023

Conversation

syan095
Copy link
Contributor

@syan095 syan095 commented Nov 27, 2023

Pull Request

Closes: PRO-263

Checklist

Please conduct a thorough self-review before opening the PR.

  • I am confident that the code works.
  • I have updated documentation where appropriate.

Summary

When CCM failed to broadcast, information regarding the called call is stored on-chain. This is so that the user can get the information about the call and broadcast it manually. When the chain moves to the next epoch, the call is then resigned, so the user can broadcast it in the new epoch. After the second epoch expires, the call is cleaned up from memory.

Workflow:

  • Added a callback which is called when CCM message fails to be broadcasted. Egress ID, broadcast ID and other relevant information are stored.

    • IngressEgress::ccm_broadcast_failed()
  • on_finalize: get failed CCM deposited during the previous epoch. For each call:

    • If the call failed during the previous epoch, schedule Re-signing:
      T::Broadcaster::threshold_resign(ccm.broadcast_id)
    • else: clean up broadcast storage for this call (expire the failed CCM)
      T::Broadcaster::clean_up_broadcast_storage(ccm.broadcast_id);
  • After the threshold signing ceremony is completed, signature data is updated in the Broadcaster pallet.

  • User can query failed ccm data to manually broadcast the call:

    • cf_failed_ccm_call(broadcast_id: BroadcastId): -> Option

Copy link
Collaborator

@dandanlen dandanlen left a comment

Choose a reason for hiding this comment

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

I made some edits too because it was easier than commenting.

state-chain/pallets/cf-ingress-egress/src/lib.rs Outdated Show resolved Hide resolved
state-chain/chains/src/evm.rs Outdated Show resolved Hide resolved
state-chain/pallets/cf-broadcast/src/lib.rs Outdated Show resolved Hide resolved
state-chain/pallets/cf-ingress-egress/src/lib.rs Outdated Show resolved Hide resolved
state-chain/pallets/cf-ingress-egress/src/lib.rs Outdated Show resolved Hide resolved
state-chain/pallets/cf-broadcast/src/lib.rs Outdated Show resolved Hide resolved
state-chain/runtime/src/lib.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@dandanlen dandanlen left a comment

Choose a reason for hiding this comment

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

Keep an eye on #4207 , I imagine there might be some conflicts.

dandanlen and others added 4 commits November 29, 2023 17:12
Fixed integration test harness that crashes at the 3rd epoch
Added a integration test to ensure test harness can advance to further epochs
@syan095 syan095 changed the title WIP: Feature: Resign failed CCM Feature: Resign failed CCM Nov 30, 2023
@syan095 syan095 marked this pull request as ready for review November 30, 2023 06:34
@syan095 syan095 requested a review from a team as a code owner November 30, 2023 06:34
@syan095 syan095 requested review from jerryafr and acdibble and removed request for a team November 30, 2023 06:34
@syan095
Copy link
Contributor Author

syan095 commented Nov 30, 2023

Keep an eye on #4207 , I imagine there might be some conflicts.

I've made a small change to the integration test harness's Polkadot signer so we can move past epoch 3 without error. This may conflict with Ramiz' change, but should be easy to resolve

Copy link
Collaborator

@dandanlen dandanlen left a comment

Choose a reason for hiding this comment

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

Thanks Roy

@dandanlen dandanlen changed the title Feature: Resign failed CCM feat: Re-sign failed CCMs Nov 30, 2023
@dandanlen dandanlen enabled auto-merge (squash) November 30, 2023 15:01
@dandanlen dandanlen merged commit 281d661 into main Nov 30, 2023
39 checks passed
@dandanlen dandanlen deleted the feature/resign-failed-ccm branch November 30, 2023 15:03
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.

None yet

2 participants