Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ratankaliani committed Aug 15, 2024
1 parent c4f3911 commit c3a0b83
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 25 deletions.
13 changes: 5 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ The SP1 Tendermint template is a simple example of a ZK Tendermint light client
TENDERMINT_RPC_URL=https://rpc.celestia-mocha.com/ cargo run --bin genesis --release
```

This will show the tendermint vkey hash, trusted header hash, and trusted height, which you will
need to initialize the SP1 Tendermint contract.
This will show the data for the genesis block as well as SP1 Tendermint program verification key
which you will need to initialize the SP1 Tendermint contract.

2. Deploy the `SP1Tendermint` contract with the initialization parameters:

Expand Down Expand Up @@ -54,18 +54,15 @@ The SP1 Tendermint template is a simple example of a ZK Tendermint light client
# Export the PRIVATE_KEY you will use to deploy the contract & relay proofs.
export PRIVATE_KEY=<PRIVATE_KEY>
# Optional
# If you're using the Succinct network, set SP1_PROVER to "network". Otherwise, set it to "local" or "mock".
export SP1_PROVER={network|local|mock}
# Only required if SP1_PROVER is set to "network".
# To use the Succinct proving network, set `SP1_PRIVATE_KEY` to your private key on the proving network.
export SP1_PRIVATE_KEY=<SP1_PRIVATE_KEY>
```

5. Run the Tendermint operator.
```shell
cd ../operator
TENDERMINT_RPC_URL=https://rpc.celestia-mocha.com/ CHAIN_ID=11155111 RPC_URL=https://ethereum-sepolia.publicnode.com/ CONTRACT_ADDRESS=<SP1_TENDERMINT_ADDRESS> RUST_LOG=info cargo run --bin operator --release
SP1_PROVER=network TENDERMINT_RPC_URL=https://rpc.celestia-mocha.com/ CHAIN_ID=11155111 RPC_URL=https://ethereum-sepolia.publicnode.com/ CONTRACT_ADDRESS=<SP1_TENDERMINT_ADDRESS> RUST_LOG=info cargo run --bin operator --release
```

## Contract Tests
Expand All @@ -76,7 +73,7 @@ To generate fixtures for local testing run:
```shell
# Generates fixture.json (valid proof)
$ cd operator
$ RUST_LOG=info TENDERMINT_RPC_URL="https://rpc.celestia-mocha.com/" cargo run --bin fixture --release -- --trusted-block 500 --target-block 1000
$ RUST_LOG=info SP1_PROVER=network TENDERMINT_RPC_URL="https://rpc.celestia-mocha.com/" cargo run --bin fixture --release -- --trusted-block 500 --target-block 1000
# Generates mock_fixture.json (mock proof)
$ cd operator
Expand Down
26 changes: 9 additions & 17 deletions operator/bin/genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,28 +26,20 @@ async fn main() -> anyhow::Result<()> {
// Generate the vkey hash to use in the contract.
let prover = MockProver::new();
let (_, vk) = prover.setup(TENDERMINT_ELF);
println!("TENDERMINT_VKEY_HASH={}", vk.bytes32());

let tendermint_client = TendermintRPCClient::default();

if let Some(trusted_block) = args.trusted_block {
let (trusted_height, trusted_header_hash) = if let Some(trusted_block) = args.trusted_block {
let commit = tendermint_client.get_commit(trusted_block).await?;
println!("TRUSTED_HEIGHT={}", trusted_block);
println!(
"TRUSTED_HEADER_HASH={}",
commit.result.signed_header.header.hash()
);
(trusted_block, commit.result.signed_header.header.hash())
} else {
let latest_commit = tendermint_client.get_latest_commit().await?;
println!(
"TRUSTED_HEIGHT={}",
latest_commit.result.signed_header.header.height.value()
);
println!(
"TRUSTED_HEADER_HASH={}",
latest_commit.result.signed_header.header.hash()
);
}
(
latest_commit.result.signed_header.header.height.value(),
latest_commit.result.signed_header.header.hash(),
)
};

println!("TENDERMINT_VKEY_HASH={} TRUSTED_HEIGHT={} TRUSTED_HEADER_HASH={}", vk.bytes32(), trusted_height, trusted_header_hash);

Ok(())
}

0 comments on commit c3a0b83

Please sign in to comment.