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

Coordinator: moves rituals from array to mapping #307

Merged
merged 3 commits into from
Aug 19, 2024

Conversation

vzotova
Copy link
Member

@vzotova vzotova commented Aug 15, 2024

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 Aug 15, 2024
@vzotova vzotova changed the title [WIP] Coordinator: moves rituals from array to mapping Coordinator: moves rituals from array to mapping Aug 15, 2024
@vzotova vzotova marked this pull request as ready for review August 15, 2024 18:05
assert not ritual_struct[8] # aggregationMismatch
assert ritual_struct[9] == global_allow_list.address # accessController
assert ritual_struct[10] == (b"\x00" * 32, b"\x00" * 16) # publicKey
assert not ritual_struct[11] # aggregatedTranscript
Copy link
Member

@derekpierre derekpierre Aug 15, 2024

Choose a reason for hiding this comment

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

If I'm understanding this test correctly, you are creating and checking 3 rituals:

  1. first one mimics ritual that was created before any concept of fee model - fee model is 0x...0
  2. second mimics ritual that was created with a fee model address but was initiated with the storage before your current storage change fix
  3. third mimics ritual that was created with your current storage change fix

For v7.5.x (so unreleased code for next release) we use index 12 for fee model, if available - nucypher/nucypher@2c2cb5d#diff-911a370c18d0d0e3ea62099fc5ff6daa16915da19cf5399f24e404b7d8d6d168R597.

  • Is that still fine or will that be problematic?
  • If not problematic, should we also check the values in the struct at index 12 (fee model) in this test?

Copy link
Member Author

@vzotova vzotova Aug 15, 2024

Choose a reason for hiding this comment

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

for client that supports new fee model architecture - everything should stay the same, so yeah feeModel is 12th in structure.
I'll add test in check

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 this check
interesting that ritual_struct[12] is participants array and not fee model
I'm not sure if it's ape behavior or abi enhanced for nested structs comparing to what was before, anyway could you check if 7.5.x would work with this update, please

Copy link
Member

Choose a reason for hiding this comment

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

interesting that ritual_struct[12] is participants array and not fee model

Indeed. This was how we realized we needed to get participants for a ritual in a separate call.

could you check if 7.5.x would work with this update, please

Ran the acceptance tests for v7.5.x with the following update to the ape-config.yaml:

diff --git a/tests/acceptance/ape-config.yaml b/tests/acceptance/ape-config.yaml
index b44995ae6..3d3d34ce2 100644
--- a/tests/acceptance/ape-config.yaml
+++ b/tests/acceptance/ape-config.yaml
@@ -5,8 +5,8 @@ plugins:

 dependencies:
   - name: nucypher-contracts
-    github: nucypher/nucypher-contracts
-    ref: main
+    github: vzotova/nucypher-contracts
+    ref: coordinator-layout
     config_override:
       solidity:
         version: 0.8.23

and the acceptance tests all pass without any changes 🎉 .

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.

🎸

@@ -128,35 +131,57 @@ contract Coordinator is Initializable, AccessControlDefaultAdminRulesUpgradeable
__AccessControlDefaultAdminRules_init(0, _admin);
}

function initializeNumberOfRituals() external reinitializer(2) {
Copy link
Member

Choose a reason for hiding this comment

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

Should we include something to make sure that this function is called before the contract is used?

Copy link
Member Author

Choose a reason for hiding this comment

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

I thought about that but honestly - it will only increase gas for checking and we can upgrade together with reinitialize (should be possible)

Copy link
Member

Choose a reason for hiding this comment

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

Maybe let's add a dev comment reminding to use upgradeAndCall do it.

Copy link
Member Author

Choose a reason for hiding this comment

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

✔️

@derekpierre
Copy link
Member

Do we need a follow-up issue with a rollout plan for these changes? See #309
(@cygnusv , @vzotova, @arjunhassard )

@derekpierre derekpierre merged commit 852f66d into nucypher:main Aug 19, 2024
2 checks passed
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.

4 participants