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: Add succinct lightclient ISM #4334

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

Conversation

ltyu
Copy link
Contributor

@ltyu ltyu commented Aug 18, 2024

Add SP1LightClientIsm that uses Succinct SP1 Helios to verify message delivery using ZK prove source chain header.

  1. Message delivery uses the DispatchHook to store the messageId in dispatched on the source chain.
  2. At some point, the LightClient gets updated by Helios with the latest source chain head and executionStateRoot
  3. The Relayer calls Ism.getOffchainVerifyInfo(), which responds with metadata to make a request to the CCIP server.
  4. The CCIP server makes a request to the an RPC and calls eth_getProof to get the state and storage proofs for the DispatchedHook dispatched slot on the source chain.
  5. The Relayer calls process, and verify() receives the proofs to get the messageId on DispatchedHook.
Screenshot 2024-10-27 at 4 41 40 PM

These are the deployments that uses the Ism to create a bridge between holesky and basesepolia:
SP1LightClientISM: https://sepolia.basescan.org/address/0xc93cF66649631303b70b7640Fbe4aaE667d93475
SP1LightClient: https://sepolia.basescan.org/address/0x2241db9AE432C0f7DE41f88f2f28dF1242bF0315
Native: https://holesky.etherscan.io/address/0x720127655fbb415C4c289C2462c8096f38ABD4cC
Synthetic: https://sepolia.basescan.org/address/0x828616Ac3CFaCB309862d19625b5d7AA02e620E1


Deployment

  1. Follow Helios guide to deploy and start a LightClient server
  2. Deploy DispatchedHook on the source chain
  3. Deploy SP1LightClientISM on the destination chain
  4. Deploy warp route with the Hook and Ism on the respective chain
  5. Start the CCIP server

Known Issues

The consensus nodes are much slower the execution nodes (aka RPCs). This means that it takes a while (sometimes up to 20 mins) to receive the state proofs and update the LightClient.

Copy link

changeset-bot bot commented Aug 18, 2024

🦋 Changeset detected

Latest commit: 36a9d1f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 9 packages
Name Type
@hyperlane-xyz/ccip-server Minor
@hyperlane-xyz/core Minor
@hyperlane-xyz/helloworld Minor
@hyperlane-xyz/sdk Minor
@hyperlane-xyz/infra Minor
@hyperlane-xyz/cli Minor
@hyperlane-xyz/widgets Minor
@hyperlane-xyz/github-proxy Minor
@hyperlane-xyz/utils Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

codecov bot commented Aug 25, 2024

Codecov Report

Attention: Patch coverage is 84.21053% with 6 lines in your changes missing coverage. Please review.

Project coverage is 74.29%. Comparing base (0410815) to head (36a9d1f).
Report is 34 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4334      +/-   ##
==========================================
+ Coverage   73.97%   74.29%   +0.32%     
==========================================
  Files         101      105       +4     
  Lines        1460     1498      +38     
  Branches      191      195       +4     
==========================================
+ Hits         1080     1113      +33     
- Misses        359      364       +5     
  Partials       21       21              
Components Coverage Δ
core 84.61% <ø> (ø)
hooks 76.05% <100.00%> (+0.34%) ⬆️
isms 78.68% <88.46%> (+1.09%) ⬆️
token 89.01% <ø> (ø)
middlewares 77.39% <ø> (ø)

@ltyu ltyu marked this pull request as ready for review October 27, 2024 20:14
…server and ProofService to make a request to beacon node and RPC for proofs.
Copy link
Contributor

@nambrot nambrot left a comment

Choose a reason for hiding this comment

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

Just did a quick pass, probably would do another

}

/// @inheritdoc AbstractPostDispatchHook
function _quoteDispatch(
Copy link
Contributor

Choose a reason for hiding this comment

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

This should probably be configurable to correctly meter for the relayer gas consumption of the ISM?

* @title SP1LightClientIsm
* @notice Uses Succinct to verify that a message was delivered via a Hyperlane Mailbox and tracked by DispatchedHook
*/
contract SP1LightClientIsm is AbstractCcipReadIsm, OwnableUpgradeable {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm a bit out my comfort zone, but IIUC there should be some pretty general logic in here that could be extracted to a "StorageProofIsm"? Specifically, the storage proof logic seems independent of SP1 right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Move generalized logic to StorageProofIsm

import {StorageProof} from "../../libs/StateProofHelpers.sol";
import {ISuccinctProofsService} from "../../interfaces/ccip-gateways/ISuccinctProofsService.sol";

/**
Copy link
Contributor

Choose a reason for hiding this comment

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

I would love some readme/mermaid diagrams explain the general architecture

@@ -3,21 +3,15 @@ import dotenvFlow from 'dotenv-flow';
dotenvFlow.config();

const RPC_ADDRESS = process.env.RPC_ADDRESS as string;
const LIGHT_CLIENT_ADDR = process.env.LIGHT_CLIENT_ADDR as string;
Copy link
Contributor

Choose a reason for hiding this comment

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

I didn't realize that we have this already in the monorepo. I think we should have an opinion on whether they should be living in the monorepo. IMO at minimum it should be modular so that the default is not SP1?

Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

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

Olympix Integrated Security found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Review
Development

Successfully merging this pull request may close these issues.

2 participants