-
Notifications
You must be signed in to change notification settings - Fork 11
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
TACo Threshold Application #99
Conversation
tests/application/conftest.py
Outdated
def encode_function_data(initializer=None, *args): | ||
"""Encodes the function call so we can work with an initializer. | ||
Args: | ||
initializer ([brownie.network.contract.ContractTx], optional): |
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.
brownie?
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.
✔️
import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; | ||
import "@openzeppelin-upgradeable/contracts/access/OwnableUpgradeable.sol"; | ||
import "../threshold/IApplication.sol"; | ||
import "../threshold/IStaking.sol"; |
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'm wondering if we could import these interfaces directly from the Threshold repo. See https://docs.apeworx.io/ape/stable/userguides/dependencies.html#github
Not necessarily a change we want to introduce now, but worth exploring
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.
definitely, I planned do that (or at least try to) but forgot
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.
✔️
|
||
StakingProviderInfo storage info = stakingProviderInfo[_stakingProvider]; | ||
require(info.tReward > 0, "No reward to withdraw"); | ||
uint96 value = info.tReward; |
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.
Isn't it slightly more efficient to do the require after this line using value
?
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 (info.authorized == 0) { | ||
_stakingProviderFromOperator[info.operator] = address(0); | ||
info.operator = address(0); | ||
info.operatorConfirmed == false; |
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.
Do you mean =
here? Same in line 457 and 483. Although, before that, see my comment in confirmOperatorAddress()
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.
yeah, I fixed this bug in #98, and added proper tests
/** | ||
* @notice Make a confirmation by operator | ||
*/ | ||
function confirmOperatorAddress() external { |
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.
Let's take a step back here. Can we work without the operator confirmation? Making the operator node transact in both Ethereum mainnet (even if it's only for 1 TX) and Polygon (for rituals in the Coordinator) seems a hurdle for operators.
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 that case I'd do confirmation on Polygon but it increases complexity to do that properly
and I'm not in favor of removing it, same reason as before: helps to exclude people who does nothing
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.
helps to exclude people who does nothing
Given that for the moment we will be using the Merkle rewards approach, the operator confirmation (regardless if it's on mainnet or Polygon) is something we can drop. But let's leave this for further discussion, and not this PR.
… to set in app, restricts access to update PolygonRoot
…s bug with releasing operator
…perator with StakeInfo
App <-> bridge
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.
🎸 Skimmed the tests but looks good.
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!
I found some typos and TODO's which I suspect are easy to solve. But nothing relevant. Great job!
contracts/contracts/Adjudicator.sol
Outdated
|
||
mapping (address => uint256) public penaltyHistory; | ||
mapping (bytes32 => bool) public evaluatedCFrags; | ||
|
||
uint256[50] private reservedSlots; |
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.
Weren't we going to remove it and re-introduce it if we make Adjudicator upgradeable? For reference: #100
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.
✔️
* @title PRE Application | ||
* @notice Contract handles PRE configuration | ||
*/ | ||
contract SimplePREApplication { |
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.
👋
/** | ||
* @notice Make a confirmation by operator | ||
*/ | ||
function confirmOperatorAddress() external { |
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 for this PR, but I'd get rid of operator confirmation. See #103
* @param _penalty Penalty | ||
* @param _investigator Investigator | ||
*/ | ||
function slash( |
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.
Let's discuss (not for this PR) if we should not launch with slashing (or alternatively, deactivate slashing by tuning the parameters). See #104
@@ -6,7 +6,7 @@ pragma solidity ^0.8.0; | |||
* @title StakeInfo | |||
* @notice StakeInfo |
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.
We should change the docstrings here
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.
✔️
|
||
simple_pre = project.SimplePREApplication.deploy( | ||
# TODO deploy proxy |
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.
Opened an issue to track this: #105
/** | ||
* @notice Bond operator | ||
* @param _stakingProvider Staking provider address | ||
* @param _operator Operator address. Must be a EOA, not a contract address |
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.
* @param _operator Operator address. Must be a EOA, not a contract address | |
* @param _operator Operator address. Must be an EOA, not a contract address |
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.
✔️
Co-authored-by: Manuel Montenegro <manuel@nucypher.com> Co-authored-by: David Núñez <david@nucypher.com> Co-authored-by: Derek Pierre <derek.pierre@gmail.com>
This PR introduces the contracts for installation of CBD+PRE as a threshold network application (Includes "Full PRE Application").