Skip to content

Commit

Permalink
remove sp1tendermint
Browse files Browse the repository at this point in the history
  • Loading branch information
ratankaliani committed May 31, 2024
1 parent c2a8e9e commit 644249e
Show file tree
Hide file tree
Showing 8 changed files with 808 additions and 121 deletions.
9 changes: 0 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,6 @@ The SP1 Tendermint template is a simple example of a Tendermint light client on
* The `program` directory contains a Succinct zkVM program that implements Tendermint light client verification logic.
* The `operator` directory contains a Rust program that interacts with the Solidity contract. It fetches the latest header and generates a proof of the update, and then updates the contract with the proof. It also contains several scripts to help with testing and deployment of the contract.

## Test Program

To test that your Tendermint program is working correctly, set `SP1_PROVER=mock` to use the mock prover, and then run the test script in the operator folder. If this executes successfully, you will see a message like `Successfully generated proof!`.

```shell
$ cd operator
$ RUST_LOG=info SP1_PROVER=mock TENDERMINT_RPC_URL="https://rpc.celestia-mocha.com/" cargo run --bin test --release -- --trusted-block 500 --target-block 1000
```

## End to end deployment

* Follow instructions to install [SP1](https://succinctlabs.github.io/sp1/).
Expand Down
42 changes: 1 addition & 41 deletions contracts/src/SP1Tendermint.sol
Original file line number Diff line number Diff line change
Expand Up @@ -23,46 +23,6 @@ contract SP1Tendermint {
verifier = ISP1Verifier(_verifier);
}

function reverseBytes64(uint64 input) internal pure returns (uint64) {
input =
((input & 0xFF00FF00FF00FF00) >> 8) |
((input & 0x00FF00FF00FF00FF) << 8);
input =
((input & 0xFFFF0000FFFF0000) >> 16) |
((input & 0x0000FFFF0000FFFF) << 16);
input =
((input & 0xFFFFFFFF00000000) >> 32) |
((input & 0x00000000FFFFFFFF) << 32);
return input;
}

function decodePublicValues(
bytes calldata publicValues
) public pure returns (bytes32, bytes32, uint64, uint64) {
require(publicValues.length == 80, "Invalid public values length");

bytes32 trustedHeaderHash;
bytes32 targetHeaderHash;
uint64 trustedHeight;
uint64 targetHeight;
assembly {
trustedHeaderHash := calldataload(add(publicValues.offset, 0x00))
targetHeaderHash := calldataload(add(publicValues.offset, 0x20))
trustedHeight := calldataload(add(publicValues.offset, 0x28))
targetHeight := calldataload(add(publicValues.offset, 0x30))
}

trustedHeight = reverseBytes64(trustedHeight);
targetHeight = reverseBytes64(targetHeight);

return (
trustedHeaderHash,
targetHeaderHash,
trustedHeight,
targetHeight
);
}

function verifyTendermintProof(
bytes calldata proof,
bytes calldata publicValues
Expand All @@ -72,7 +32,7 @@ contract SP1Tendermint {
bytes32 targetHeaderHash,
uint64 trustedHeight,
uint64 targetHeight
) = decodePublicValues(publicValues);
) = abi.decode(publicValues, (bytes32, bytes32, uint64, uint64));

if (
trustedHeaderHash != latestHeader && trustedHeight != latestHeight
Expand Down
8 changes: 0 additions & 8 deletions operator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,6 @@ path = "bin/operator.rs"
name = "fixture"
path = "bin/fixture.rs"

[[bin]]
name = "vkey"
path = "bin/vkey.rs"

[[bin]]
name = "test"
path = "bin/test.rs"

[[bin]]
name = "genesis"
path = "bin/genesis.rs"
Expand Down
58 changes: 0 additions & 58 deletions operator/bin/test.rs

This file was deleted.

Loading

0 comments on commit 644249e

Please sign in to comment.