-
Notifications
You must be signed in to change notification settings - Fork 12
Extract handover functions to the new contract #431
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
base: main
Are you sure you want to change the base?
Conversation
2336e35 to
dfc2669
Compare
dfc2669 to
136a375
Compare
manumonti
left a comment
There was a problem hiding this 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; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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
manumonti
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 🙌
derekpierre
left a comment
There was a problem hiding this 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 |
There was a problem hiding this comment.
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 | |||
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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
Type of PR:
Required reviews:
What this does:
Issues fixed/closed:
Why it's needed:
Notes for reviewers: