Prerequisites
- Foundry to compile, test and deploy contracts
The contracts in here are the foundation for the Wisp protocol.
crc-messages
├─ CRCInbox — "Abstract contract used as foundation for an inbox. Adds common functions and mappings."
├─ CRCOutbox — "Defines an outbox whose elements gets proven inside the destination rollup."
├─ libraries
| ├─ Types - "Contains the messages types used within the protocol"
├─ interfaces
| ├─ ICRCOutbox - "Interface for external contracts to work with the outbox"
| ├─ IMessageReceiver - "Interface that the contracts receiving messages should implement"
├─ inbox
| ├─ optimism
| ├─ OptimismInbox - "Inbox contract for Optimism Bedrock rollups like Optimism and Base"
lightclient
├─ BeaconLightClient — "On-chain Light Client for the Ethereum Protocol"
├─ BLSAggregatedSignatureVerifier — "Groth16 Verifier for a Aggregated BLS Verify ZKP"
├─ PoseidonCommitmentVerifier — "Groth16 Verifier for Sync Commitee Root mapping (SSZ to Poseidon)"
├─ Structs — "Contains the structs used within the Light Client protocol"
├─ interfaces
| ├─ IBeaconLightClient - "Interface of the on-chain Light Client"
├─ libraries
| ├─ Pairing - "Auxiliary library for ZKP Verification"
| ├─ SimpleSerialize - "Ethereum SSZ utility functions (encoding/decoding)"
forge install && forge build
In order to run the tests for the contracts execute forge test
Create and populate .env
file
cp .env.example .env
Light Client
In order to deploy the BeaconLightClient
:
forge script script/BeaconLightClient.s.sol --rpc-url {RPC} -vvvv --broadcast
Note You must configure the following properties:
startSyncCommitteePeriod
-> Sync Committee Period to start from. Current sync committee period can be computed byMath.floor(currentSlot/8192)
startSyncCommitteeRoot
-> TheSSZ
root of the current Sync Committee PeriodstartSyncCommitteePoseidon
-> ThePoseidon
root of the current Sync Committee Period
Messaging
forge script script/CRCOutbox.s.sol --rpc-url {RPC} -vvvv --broadcast
forge script script/OptimismInbox.s.sol --rpc-url {RPC} -vvvv --broadcast