Package Exports
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@symbioticfi/relay-contracts) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Symbiotic Relay Smart Contracts
Overview
Symbiotic Relay is a peer-to-peer side-network designed to collect and aggregate signatures from validators, maintain validator sets on the settlement contract.
To achieve that, Symbiotic provides a set of predefined smart contracts, in general, representing the following modules:
- VotingPowerProvider - provides the basic data regarding operators, vaults and their voting power, it allows constructing various onboarding schemes such as:
- OperatorsWhitelist - only whitelisted operators can register
- OperatorsBlacklist - blacklisted operators are unregistered and are forbidden to return back
- OperatorsJail - operators can be jailed for some amount of time and register back after that
- SharedVaults - shared (with other networks) vaults (like the ones with NetworkRestakeDelegator) can be added
- OperatorVaults - vaults that are attached to a single operator can be added
- MultiToken - possible to add new supported tokens on the go
- OpNetVaultAutoDeploy - enable auto-creation of the configured by you vault on each operator registration
- Also, there are ready bindings for slashing and rewards
- KeyRegistry - verifies and manages operators' keys; currently, these key types are supported:
- ValSetDriver - is used by the off-chain part of the Symbiotic Relay for validator set deriving and maintenance
- Settlement - requires a compressed validator set (header) to be committed each epoch, but allows verifying signatures made by the validator set; currently, it supports the following verification mechanics:
- SimpleVerifier - requires the whole validator set to be inputted on the verification, but in a compressed and efficient way, so that it is the best choice to use up to around 125 validators
- ZKVerifier - uses ZK verification made with gnark, allowing larger validator sets with an almost constant verification gas cost
- Network - a standard contract that can be used as a "network" address across the Symbiotic ecosystem, it enables verifiability of delays for different actions (e.g., change of the middleware or change of the resolver)
Examples
Can be found here.
Security
Security audits can be found here.
Repo init
Clone the repo:
git clone --recurse-submodules https://github.com/symbioticfi/middleware-sdk.gitCreate env configuration
cp .env.example .envKey parameters:
OPERATORS- number of operators in networkVERIFICATION_TYPE- signatures aggregation type, (0 for ZK, 1 for simple)
On-chain setup
Before running off-chain nodes need to set up on-chain contract.
To simplify local development, we've prepared a Docker image with an Anvil node and deployed Symbiotic contracts.
Build Docker image
docker build -t symbiotic-anvil .Run anvil node
docker run --rm -d -p 8545:8545 --env-file .env --name symbiotic-node symbiotic-anvilConfigure network
Use the right generate_genesis file depending on your system here.
docker run --rm -it --env-file .env --network host symbiotic-anvil yarn deploy:networkThis command will execute a list of transactions to set up network contracts.
In execution logs, you can see the deployed configuration and contract addresses.
Stop anvil node
docker stop symbiotic-nodeTests
forge testCoverage
forge coverage