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

SM-385 CLI #186

Merged
merged 11 commits into from
Aug 19, 2024
Merged

SM-385 CLI #186

merged 11 commits into from
Aug 19, 2024

Conversation

JCSanPedro
Copy link
Collaborator

This is a supporting PR for SM-385. It's main contribution is that it re-implements the deployment script, and also the initialisation script for the local test network.

We also move from ganache -> foundry anvil for the local test node. Ganache has been deprecated, whilst anvil is still being supported, and allows us to save chain state with the --state state.json option.

Testing the CLI has also prompted some minor changes/fixes in the contract code, which has been included in this PR as well. These changes include:

  • Allowing protocol time manager to get next before protocol has started
  • Adding method to Directory to get all entries for a given directory

Copy link
Contributor

@Nick95550 Nick95550 left a comment

Choose a reason for hiding this comment

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

Just a couple minors

@@ -224,6 +230,7 @@ contract StakingOrchestrator is IStakingOrchestrator, Initializable, AccessContr
_grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
_grantRole(onlyOwner, msg.sender);
_grantRole(onlyStakingManager, address(_syloStakingManager));
_grantRole(onlyStakingManager, address(_seekerStakingManager));
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should create a seperate role for this

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's intended for the onlyStakingManager to cover both roles. Seems redundant to define two distinct roles

Comment on lines 146 to 155
DirectoryEntry memory entry;
DirectoryEntry[] memory entries = directories[cycleId][periodId].entries;

for (uint256 i; i < entryLength; ++i) {
entry = entries[i];
nodes[i] = entry.stakee;
boundaries[i] = entry.boundary;
}

return (nodes, boundaries);
Copy link
Contributor

Choose a reason for hiding this comment

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

Whats the reason for storing a varibale in entry here ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Also what is the benefit in returning the boundaries ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It is just a generally useful utility method for debugging. Allows us to see all of the nodes that have joined a directory, and what staking value they joined with.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It also allows a local client to perform the scan method locally which is benefecial if it knows it will need to call scan multiple times for the same directory.

Comment on lines 44 to 57

## Build docker

```sh
yarn docker-ganache
```

## Run docker

The options used to run the local ganache node should be set correctly
to ensure that it re-uses the same directory for the chain state.

```sh
docker run -p 8545:8545 dn3010/sylo-ethereum-testnet:0.1.0 `bash -c ganache-cli --host 0.0.0.0 --db ganache-data --blockTime 5`
Copy link
Contributor

Choose a reason for hiding this comment

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

I think these need editing

@Nick95550 Nick95550 merged commit eafef0f into v2/seeker-staking Aug 19, 2024
6 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.

2 participants