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

Last minute changes to Coordinator #187

Merged
merged 10 commits into from
Nov 16, 2023
Merged

Conversation

cygnusv
Copy link
Member

@cygnusv cygnusv commented Nov 15, 2023

Type of PR:

  • Bugfix
  • Feature
  • Documentation
  • Other

Required reviews:

  • 1
  • 2
  • 3

What this does:

  • Main change in the contract was refactoring RitualState to allow discerning active and expired rituals at the protocol state level.
  • Introduces some missing events (see RitualAuthoritySet and ReimbursementPoolSet events #178)
  • Enforces minimum stake of providers during ritual initiation
  • Additional tests

Related PRs:

Issues fixed/closed:

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?

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.

🎸

initiator_balance_after_refund = erc20.balanceOf(initiator)
coordinator_balance_after_refund = erc20.balanceOf(coordinator)
refund = initiator_balance_after_refund - initiator_balance_before_refund
assert refund == coordinator.getRitualInitiationCost(nodes, ONE_DAY)
Copy link
Member

Choose a reason for hiding this comment

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

💥

@@ -253,6 +274,7 @@ contract Coordinator is Initializable, AccessControlDefaultAdminRulesUpgradeable
ritual.endTimestamp = ritual.initTimestamp + duration;
ritual.accessController = accessController;

uint96 minAuthorization = application.minimumAuthorization();
Copy link
Member

Choose a reason for hiding this comment

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

I'd suggest to move this variable either to immutable or to variable, each call is slower because of using inner call. I know that is not crucial but would be good to make

Copy link
Member Author

Choose a reason for hiding this comment

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

@@ -438,13 +467,14 @@ contract Coordinator is Initializable, AccessControlDefaultAdminRulesUpgradeable
currency.safeTransferFrom(msg.sender, address(this), ritualCost);
}

function processPendingFee(uint32 ritualId) public {
function processPendingFee(uint32 ritualId) public returns (uint256) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
function processPendingFee(uint32 ritualId) public returns (uint256) {
function processPendingFee(uint32 ritualId) public returns (uint256 refundableFee ) {

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 derekpierre merged commit 820b8a4 into nucypher:main Nov 16, 2023
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.

RitualAuthoritySet and ReimbursementPoolSet events
4 participants