Lido Community Staking Module (CSM) is a permissionless module allowing community stakers to operate Ethereum validators with lower entry costs. Stakers provide stETH bonds, serving as security collateral, and receive rewards in the form of bond rebase and staking rewards (including execution layer rewards), which are socialized across Lido’s staking modules.
More on CSM in the docs.
-
Install Foundry tools
-
Install Just
Some Linux distributions (like Arch Linux) might require additional install of netcat (nc). The preferred version is OpenBSD.
- Install project dependencies
just deps
- Config environment variables
cp .env.sample .env
Fill vars in the .env
file with your own values
- Build and test contracts
just
Run unit tests only
just test-unit
For the following tests, make sure that the following variables are set in the .env
file:
export CHAIN=holesky
export RPC_URL=<PUT_YOUR_URL_HERE>
Deploy CSM to the fork and run deployment
and integration
tests over it
just test-local
Run all tests in one (unit
, deployment
, integration
)
just test-all
It requires all unit tests to be green
just gas-report
Dependencies are managed using yarn. To install new dependencies, run:
yarn add <package-name>
Whenever you install new libraries using yarn, make sure to update your
remappings.txt
.
Deploy contracts to the local fork
just deploy-local
Set up environment for the local fork Further test commands require the following environment variables to be set:
export RPC_URL=http://127.0.0.1:8545
export DEPLOY_CONFIG=./artifacts/local/deploy-holesky.json
The result of deployment is ./artifacts/local/deploy-holesky.json
deployment config, which is required for integration testing
Verify deploy by running deployment
tests.
Note that these are meant to be run only right after deployment, so they don't supposed to be green after any actions in the contracts
just test-deployment
Integration tests should pass either before a vote, or after at any state of contracts
just test-integration
There also fork helper scripts to prepare a fork state for e.g. UI testing purposes, see fork.just to get all available commands
just vote
After a vote, you can test the contracts in the new state. It includes both integration
and post-voting
tests
just test-post-voting
Kill fork after testing
just kill-fork
The following commands are related to the deployment process:
- Dry run of deploy script to be sure it works as expected
just deploy-prod-dry
- Broadcast transactions
Note: pass
--legacy
arg in case of the following error:Failed to get EIP-1559 fees
just deploy-prod
After that there should be artifacts in the ./artifacts/latest
directory,
which is might be moved to the particular directory and committed
mv ./artifacts/latest ./artifacts/$CHAIN