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

feat: upload the files #29

Open
wants to merge 46 commits into
base: main
Choose a base branch
from
Open

feat: upload the files #29

wants to merge 46 commits into from

Conversation

bakhshandeh
Copy link
Member

Staking & NodeManager

@bakhshandeh
Copy link
Member Author

Error texts are too long and not good for smart contracts. These texts are better:

length mismatch
!owner -- sender is not owner
0 amount
node not found
...

* Only callable by the ADMIN_ROLE.
* @param nodeId The ID of the node to be deactivated.
*/
function deactiveNode(uint64 nodeId)
Copy link
Member Author

@bakhshandeh bakhshandeh Jun 30, 2023

Choose a reason for hiding this comment

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

We need a function to let the ADMIN activate a node. Otherwise, a node could be deactivated and its staked amount will be locked

Copy link
Member Author

Choose a reason for hiding this comment

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

Let's allow the admin to decative a node via staking contract

* Only callable by the DAO_ROLE.
* @param role The role to be added.
*/
function addNodeRole(bytes32 role) public onlyRole(DAO_ROLE) {
Copy link
Member Author

Choose a reason for hiding this comment

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

We do not use byte32 role anywhere.
Is it safe to remove it?

Muon node can define the roles and just save the ids in the contract.

@bakhshandeh
Copy link
Member Author

Need to discuss more:
What happens when a node loose its peerId or nodeAddress? Should we allow editing?

uint8 nodesIndex = 0;
lastIndex = 0;

for (uint256 i = startIndex; i > 0; i--) {
Copy link
Member Author

Choose a reason for hiding this comment

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

It does not check editLog[0].
This works:

for (uint256 i = startIndex+1; i > 0; i--) {
            EditLog memory log = editLogs[i-1];

*/
modifier whenFunctionNotPaused(string memory functionName) {
require(
!functionPauseStates[functionName].isPaused,
Copy link
Member Author

Choose a reason for hiding this comment

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

This is calling by all of the user functions. If we define constants and use uint8 as the mapping key, it wil be more gas efficient.

uint8 public constant FUNCTION_GET_REWARD = 1;
// ... other functions

... getReward() functionNotPaused(FUNCTION_GET_REWARD)

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.

2 participants