-
Notifications
You must be signed in to change notification settings - Fork 89
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
add admin only functions #2512
add admin only functions #2512
Conversation
contracts/src/StakeTable.sol
Outdated
/// @dev The admin cannot be set to the zero address | ||
/// @param _admin The new admin | ||
function updateAdmin(address _admin) external { | ||
if (msg.sender != admin) revert Unauthorized(); |
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.
Is it a conscientious decision not to inherit from an existing contract with access control?
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.
you know what, i was thinking through it, wondered if this was more gas efficient
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.
switched to Ownable here dbcfeb3
contracts/src/StakeTable.sol
Outdated
@@ -269,7 +292,7 @@ contract StakeTable is AbstractStakeTable { | |||
BN254.G1Point memory blsSig, | |||
uint64 validUntilEpoch | |||
) external override { | |||
uint256 fixedStakeAmount = minStakeAmount(); | |||
uint256 fixedStakeAmount = minStakeAmount; | |||
|
|||
// Verify that the sender amount is the minStakeAmount | |||
if (amount < fixedStakeAmount) { |
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.
Why do we have this amount
variable if we are not using it? Everyone puts in the same amount (minStakeAmount
) when calling register()
.
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.
thanks for pointing this out, confirming with @veilgets. Are we doing a fixedAmount and thus the amount they stake has to be that fixedAmount or are we doing a variable amount that must be >= some minAmount?
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're choosing to go with a variable stake, so updated here 2feda04
I think this PR shouldn't close #2309 because it does not address all the items in it (e.g. validator threshold). |
@@ -207,7 +207,7 @@ contract StakeTable_register_Test is Test { | |||
} | |||
|
|||
function test_RevertWhen_WrongStakeAmount() external { | |||
uint64 depositAmount = 5 ether; | |||
uint64 depositAmount = uint64(stakeTable.minStakeAmount()) - 1; |
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.
Rename test function? Insufficent stake amount?
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.
true, updated 5dcb697
Closes #2310
Sub-issue of #2309
The admin of the contract will be a multisig and will have the ability to update
This PR:
This PR does not:
Key places to review:
How to test this PR:
forge test match-contract StakeTable