Skip to content

Conversation

@vzotova
Copy link
Member

@vzotova vzotova commented Sep 30, 2025

Type of PR:

  • Bugfix
  • Feature
  • Documentation
  • Other

Required reviews:

  • 1
  • 2
  • 3

What this does:

High-level idea of the changes introduced in this PR.
List relevant API changes (if any), as well as related PRs and issues.

Issues fixed/closed:

  • Fixes #...

Why it's needed:

Explain how this PR fits in the greater context of the NuCypher Network.
E.g., if this PR address a nucypher/productdev issue, let reviewers know!

Notes for reviewers:

What should reviewers focus on?
Is there a particular commit/function/section of your PR that requires more attention from reviewers?

@vzotova vzotova self-assigned this Sep 30, 2025
@vzotova vzotova force-pushed the extract-handover branch 2 times, most recently from 2336e35 to dfc2669 Compare October 1, 2025 20:58
@vzotova vzotova changed the title [WIP] Extract handover functions to the new contract Extract handover functions to the new contract Oct 2, 2025
@vzotova vzotova marked this pull request as ready for review October 2, 2025 23:58
Copy link
Member

@manumonti manumonti left a comment

Choose a reason for hiding this comment

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

LGTM! 👌, but I have some questions


// Storage area for sentinel values
uint256[15] internal __preSentinelGap;
uint256[14] internal __preSentinelGap;
Copy link
Member

Choose a reason for hiding this comment

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

What is the reason to modifying the size of this from 15 to 14? Just curious.

Copy link
Member Author

Choose a reason for hiding this comment

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

because another slot from the gap was consumed by adding handoverCoordinator

mapping(bytes32 handoverKey => Handover handover) public handovers;
// Note: Adjust the __preSentinelGap size if more contract variables are added

uint256[20] internal __gap;
Copy link
Member

Choose a reason for hiding this comment

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

Not understanding what is this variable.

Copy link
Member Author

Choose a reason for hiding this comment

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

in case we inherit contract and then upgrade it we want to have ability to add new variables to that contract, so we reduce gap and add new variable without any changes in child contract.


ITACoChildApplication public immutable application;
Coordinator public immutable coordinator;
uint32 public immutable handoverTimeout;
Copy link
Member

Choose a reason for hiding this comment

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

I know this is not the purpouse of this PR, but I'm curious: why making handoverTimeout immutable and not something that we can modify?

Copy link
Member Author

Choose a reason for hiding this comment

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

cheaper on gas, basically it's constant that can be changed by upgrade

if (t0 == 0) {
return HandoverState.NON_INITIATED;
} else if (block.timestamp > deadline) {
// Handover failed due to timeout
Copy link
Member

Choose a reason for hiding this comment

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

Probably I'm misunderstanding how handovers work, but if we reached the timeout, it doesn't necessary means that the handover failed, right? The handover could be succesful AND we have reached the timeout.

Copy link
Member Author

Choose a reason for hiding this comment

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

if it's outside timeout it means that blinded share and transcript were not provided in time which means something wrong with one of the nodes

Copy link
Member

Choose a reason for hiding this comment

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

Ah, right, right. When handover is finished requestTimestamp is set to 0. I didn't realize that.

handover.requestTimestamp = 0;
handover.incomingProvider = address(0);
delete handover.blindedShare;
delete handover.transcript;
Copy link
Member

Choose a reason for hiding this comment

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

Not the scope of this PR, but we should consider deleting the transcripts of all participants since these are no longer valid (can't recreate an transcript aggregation after a handover). See #427

Copy link
Member

@manumonti manumonti left a comment

Choose a reason for hiding this comment

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

LGTM! 🙌

Copy link
Member

@derekpierre derekpierre left a comment

Choose a reason for hiding this comment

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

This change would imply changes to nucypher to use the HandoverCoordinator instead of Coordinator contract? i.e. we will need a HandoverCoordinatorAgent and updated calls made to that agent for handovers?

constants:
TACO_CHILD_APPLICATION: "0x42F30AEc1A36995eEFaf9536Eb62BD751F982D32"
DKG_TIMEOUT_SECONDS: 3600 # 1 hour
HANDOVER_TIMEOUT_SECONDS: 900 # 15 minutes
Copy link
Member

Choose a reason for hiding this comment

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

This constant is no longer needed in this file.

@@ -0,0 +1,22 @@
#!/usr/bin/python3
Copy link
Member

@derekpierre derekpierre Oct 14, 2025

Choose a reason for hiding this comment

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

Does this script work? I think you might need a separate script and yml file for just deploying/upgrading the handover coordinator because the values needed for the deployment of HandoverCoordinator are obtained from other prior deployments and NOT from the registry?

Copy link
Member

Choose a reason for hiding this comment

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

Also the handover timeout in child.yml (initial deployment) is old releative to upgrade-coordinator (latest deployment update).

Copy link
Member Author

Choose a reason for hiding this comment

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

added new scripts and configs

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.

3 participants