Skip to content

Commit

Permalink
Bump SP1Beefy (#370)
Browse files Browse the repository at this point in the history
  • Loading branch information
seunlanlege authored Jan 22, 2025
1 parent 7c62bbb commit a472064
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 64 deletions.
47 changes: 29 additions & 18 deletions docs/pages/developers/network/relayer.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -175,15 +175,23 @@ max_rpc_payload_size = 150000000
# misuse can cause the rpc to be overloaded with queries
# initial_height = 1000

# (Optional) Frequency in seconds to poll the chain
# (Optional) Frequency in seconds to poll the chain
# for new state machine update events
# poll_interval = 10

# (Optional) Hyperbridge's consensus state id
# Only add this if relaying to a solochain.
# Relaying between solochains and parachains with the
# same relayer instance is not supported.
# For Paseo Testnet: PAS0
# For Polkadot Mainnet: DOT0
# consensus_state_id = "PAS0"

# Relayer config, required
[relayer]
# Define your profitability configuration.
# Define your profitability configuration.
# 0 -> 0% i.e relay all requests, even unprofitable ones.
# 1 -> 1%. ie fees provided for requests must be
# 1 -> 1%. ie fees provided for requests must be
# profitable by at least 1%. etc.
minimum_profit_percentage = 0

Expand All @@ -195,23 +203,25 @@ withdrawal_frequency = 86400
# defaults to $100
minimum_withdrawal_amount = 100

# If not empty, tesseract will only deliver requests
# If not empty, tesseract will only deliver requests
# to the specified state-machines
delivery_endpoints = [
"EVM-11155111",
"EVM-421614",
"EVM-11155420",
"EVM-84532",
"EVM-97"
"EVM-97",
"SUBSTRATE-myid",
"POLKADOT-2100"
]

# (Optional)
# (Optional)
# If not empty, will filter requests to be delivered
# by originating module identifier (eg contract address/pallet ids)
# module_filter = []

# (Optional)
# How frequently to retry unprofitable or
# (Optional)
# How frequently to retry unprofitable or
# failed messages in seconds.
# If this is value not supplied retries will not be enabled.
# unprofitable_retry_frequency = 600
Expand Down Expand Up @@ -256,9 +266,9 @@ consensus_state_id = "ETH0"

# Etherscan api key for querying the
# state machine's native token price.
# Do note that ethereum and all
# Do note that ethereum and all
# its L2's use ETH as the native token
# So they can all share the same key
# So they can all share the same key
#
# Bsc on the other hand uses the BNB token
# and would need its own API key from bscscan
Expand All @@ -268,7 +278,7 @@ etherscan_api_key = ""
ismp_host = ""

# (Optional)
# Maximum block range that should be used to query eth_getLogs
# Maximum block range that should be used to query eth_getLogs
# in a single rpc call. if this parameter is not supplied,
# the range will not be split into smaller chunks
# and will be queried at once. This might be needed
Expand All @@ -278,7 +288,7 @@ ismp_host = ""
# hex-encoded private key for the relayer account on this chain
signer = ""

# (Optional)
# (Optional)
# Maximum number of concurrent requests to be used for tx tracing.
# If not supplied will trace entire tx batches at once.
# This increases tracing speeds by tracing txs concurrently
Expand All @@ -287,20 +297,20 @@ signer = ""
# If using an rpc provider, ensure that they support a
# large number of `debug_traceCall` requests/sec.
#
# Note: if you use the same provider for all your endpoints
# Note: if you use the same provider for all your endpoints
# then a very high request/sec threshold is required (> 1000 / sec)
#
# eg 5 transactions would be traced concurrently on this client
# tracing_batch_size = 5

# (Optional)
# (Optional)
# Percentage buffer to add to gas prices
# to increase likelihood of the transactions
# going through e.g 1%, 2%
# gas_price_buffer = 1

# (Optional)
# The execution client implementation,
# The execution client implementation,
# only Geth or Erigon are fully supported
# The possible values: "Geth" | "Erigon"
# If this field is not set, the default is "Geth"
Expand All @@ -312,7 +322,7 @@ signer = ""
# misuse can cause the rpc to be overloaded with queries
# initial_height = 1000

# (Optional) Frequency in seconds to poll the chain
# (Optional) Frequency in seconds to poll the chain
# for new state machine update events
# poll_interval = 10

Expand All @@ -333,6 +343,7 @@ hashing = "Blake2"
rpc_ws = "ws://127.0.0.1:9944" # example endpoint

# The consensus state identifier for this chain on hyperbridge.
# "PARA" for parachains
consensus_state_id = "PARA"

# (Optional)
Expand All @@ -344,13 +355,13 @@ consensus_state_id = "PARA"
# Unneeded if the chain uses unsigned extrinsics for pallet-ismp
# signer = ""

# (Optional) Frequency in seconds to poll the chain
# (Optional) Frequency in seconds to poll the chain
# for new state machine update events
# poll_interval = 10

# (Optional) initial height
# This sets the height at which to start querying messages,
# This exists for testing and development,
# This exists for testing and development,
# misuse can cause the rpc to be overloaded with queries
# initial_height = 1000
```
Expand Down
2 changes: 1 addition & 1 deletion evm/lib/sp1-contracts
Submodule sp1-contracts updated 44 files
+1,390 −1,573 Cargo.lock
+1 −1 Cargo.toml
+21 −10 README.md
+3 −2 contracts/deployments/1.json
+3 −2 contracts/deployments/10.json
+3 −2 contracts/deployments/11155111.json
+3 −2 contracts/deployments/11155420.json
+3 −2 contracts/deployments/17000.json
+3 −2 contracts/deployments/42161.json
+3 −2 contracts/deployments/421614.json
+3 −2 contracts/deployments/534351.json
+3 −2 contracts/deployments/534352.json
+3 −2 contracts/deployments/8453.json
+3 −2 contracts/deployments/84532.json
+21 −0 contracts/script/deploy/SP1VerifierGatewayGroth16.s.sol
+1 −1 contracts/script/deploy/SP1VerifierGatewayPlonk.s.sol
+2 −2 contracts/script/deploy/v1.0.1/SP1Verifier.s.sol
+2 −2 contracts/script/deploy/v1.0.7-testnet/SP1Verifier.s.sol
+2 −2 contracts/script/deploy/v1.0.8-testnet/SP1Verifier.s.sol
+2 −2 contracts/script/deploy/v1.1.0/SP1Verifier.s.sol
+2 −2 contracts/script/deploy/v1.2.0-rc1/SP1VerifierGroth16.s.sol
+2 −2 contracts/script/deploy/v1.2.0-rc1/SP1VerifierPlonk.s.sol
+2 −2 contracts/script/deploy/v1.2.0/SP1VerifierGroth16.s.sol
+2 −2 contracts/script/deploy/v1.2.0/SP1VerifierPlonk.s.sol
+2 −2 contracts/script/deploy/v2.0.0/SP1VerifierGroth16.s.sol
+2 −2 contracts/script/deploy/v2.0.0/SP1VerifierPlonk.s.sol
+2 −2 contracts/script/deploy/v3.0.0-rc1/SP1VerifierGroth16.s.sol
+2 −2 contracts/script/deploy/v3.0.0-rc1/SP1VerifierPlonk.s.sol
+2 −2 contracts/script/deploy/v3.0.0-rc3/SP1VerifierGroth16.s.sol
+2 −2 contracts/script/deploy/v3.0.0-rc3/SP1VerifierPlonk.s.sol
+2 −2 contracts/script/deploy/v3.0.0-rc4/SP1VerifierGroth16.s.sol
+2 −2 contracts/script/deploy/v3.0.0-rc4/SP1VerifierPlonk.s.sol
+2 −2 contracts/script/deploy/v3.0.0/SP1VerifierGroth16.s.sol
+2 −2 contracts/script/deploy/v3.0.0/SP1VerifierPlonk.s.sol
+38 −0 contracts/script/deploy/v4.0.0-rc.3/SP1VerifierGroth16.s.sol
+38 −0 contracts/script/deploy/v4.0.0-rc.3/SP1VerifierPlonk.s.sol
+1 −1 contracts/src/SP1MockVerifier.sol
+1 −1 contracts/src/SP1VerifierGateway.sol
+1 −1 contracts/src/v3.0.0/Groth16Verifier.sol
+578 −0 contracts/src/v4.0.0-rc.3/Groth16Verifier.sol
+1,379 −0 contracts/src/v4.0.0-rc.3/PlonkVerifier.sol
+57 −0 contracts/src/v4.0.0-rc.3/SP1VerifierGroth16.sol
+59 −0 contracts/src/v4.0.0-rc.3/SP1VerifierPlonk.sol
+1 −1 rust-toolchain
76 changes: 38 additions & 38 deletions evm/script/DeployHostUpdates.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {BaseScript} from "./BaseScript.sol";
import "../src/modules/HandlerV1.sol";

import {SP1Beefy} from "../src/consensus/SP1Beefy.sol";
import {SP1Verifier} from "@sp1-contracts/v2.0.0/SP1VerifierPlonk.sol";
import {SP1Verifier} from "@sp1-contracts/v4.0.0-rc.3/SP1VerifierGroth16.sol";
import {SP1Beefy} from "../src/consensus/SP1Beefy.sol";

contract DeployScript is BaseScript {
Expand All @@ -20,44 +20,44 @@ contract DeployScript is BaseScript {
function run() external {
vm.startBroadcast(uint256(privateKey));

// SP1Verifier verifier = new SP1Verifier();
// SP1Beefy consensusClient = new SP1Beefy(verifier);
SP1Verifier verifier = new SP1Verifier();
SP1Beefy consensusClient = new SP1Beefy(verifier);

// HandlerV1 handler = new HandlerV1();
BeefyV1 consensusClient = new BeefyV1{salt: salt}();

if (host.toSlice().startsWith("ethereum".toSlice())) {
HostParams memory params = EvmHost(ETHEREUM_HOST).hostParams();
params.consensusClient = address(consensusClient);
// params.handler = address(handler);
EvmHost(ETHEREUM_HOST).updateHostParams(params);
} else if (host.toSlice().startsWith("arbitrum".toSlice())) {
HostParams memory params = EvmHost(ARBITRUM_HOST).hostParams();
params.consensusClient = address(consensusClient);
// params.handler = address(handler);
EvmHost(ARBITRUM_HOST).updateHostParams(params);
} else if (host.toSlice().startsWith("optimism".toSlice())) {
HostParams memory params = EvmHost(OPTIMISM_HOST).hostParams();
params.consensusClient = address(consensusClient);
// params.handler = address(handler);
EvmHost(OPTIMISM_HOST).updateHostParams(params);
} else if (host.toSlice().startsWith("base".toSlice())) {
HostParams memory params = EvmHost(BASE_HOST).hostParams();
params.consensusClient = address(consensusClient);
// params.handler = address(handler);
EvmHost(BASE_HOST).updateHostParams(params);
} else if (host.toSlice().startsWith("bsc".toSlice())) {
HostParams memory params = EvmHost(BNB_HOST).hostParams();
params.consensusClient = address(consensusClient);
// params.handler = address(handler);
EvmHost(BNB_HOST).updateHostParams(params);
} else if (host.toSlice().startsWith("gnosis".toSlice())) {
HostParams memory params = EvmHost(GNOSIS_HOST).hostParams();
params.consensusClient = address(consensusClient);
// params.handler = address(handler);
EvmHost(GNOSIS_HOST).updateHostParams(params);
} else {
revert("Unknown Host");
}
// BeefyV1 consensusClient = new BeefyV1{salt: salt}();

// if (host.toSlice().startsWith("ethereum".toSlice())) {
// HostParams memory params = EvmHost(ETHEREUM_HOST).hostParams();
// params.consensusClient = address(consensusClient);
// // params.handler = address(handler);
// EvmHost(ETHEREUM_HOST).updateHostParams(params);
// } else if (host.toSlice().startsWith("arbitrum".toSlice())) {
// HostParams memory params = EvmHost(ARBITRUM_HOST).hostParams();
// params.consensusClient = address(consensusClient);
// // params.handler = address(handler);
// EvmHost(ARBITRUM_HOST).updateHostParams(params);
// } else if (host.toSlice().startsWith("optimism".toSlice())) {
// HostParams memory params = EvmHost(OPTIMISM_HOST).hostParams();
// params.consensusClient = address(consensusClient);
// // params.handler = address(handler);
// EvmHost(OPTIMISM_HOST).updateHostParams(params);
// } else if (host.toSlice().startsWith("base".toSlice())) {
// HostParams memory params = EvmHost(BASE_HOST).hostParams();
// params.consensusClient = address(consensusClient);
// // params.handler = address(handler);
// EvmHost(BASE_HOST).updateHostParams(params);
// } else if (host.toSlice().startsWith("bsc".toSlice())) {
// HostParams memory params = EvmHost(BNB_HOST).hostParams();
// params.consensusClient = address(consensusClient);
// // params.handler = address(handler);
// EvmHost(BNB_HOST).updateHostParams(params);
// } else if (host.toSlice().startsWith("gnosis".toSlice())) {
// HostParams memory params = EvmHost(GNOSIS_HOST).hostParams();
// params.consensusClient = address(consensusClient);
// // params.handler = address(handler);
// EvmHost(GNOSIS_HOST).updateHostParams(params);
// } else {
// revert("Unknown Host");
// }
}
}
6 changes: 3 additions & 3 deletions evm/src/consensus/SP1Beefy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ contract SP1Beefy is IConsensusClient, ERC165 {
using HeaderImpl for Header;

// SP1 verification key
bytes32 public verificationKey = bytes32(0x0071ba110ada2601c43635dabd6abea7180d3132fd75df662cac13505ade1f5d);
bytes32 public verificationKey = bytes32(0x004609733a0366baf52880d2a058a858c8c83479d4b1fca39c1a14666375419f);

// Sp1 verifier contract
ISP1Verifier internal _verifier;
Expand All @@ -58,8 +58,8 @@ contract SP1Beefy is IConsensusClient, ERC165 {
}

/*
* @dev Given some opaque consensus proof, produce the new consensus state and newly finalized intermediate states.
*/
* @dev Given some opaque consensus proof, produce the new consensus state and newly finalized intermediate states.
*/
function verifyConsensus(
bytes calldata encodedState,
bytes calldata encodedProof
Expand Down
8 changes: 4 additions & 4 deletions evm/test/SP1BeefyTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
pragma solidity 0.8.20;

import "forge-std/Test.sol";
import {SP1Verifier} from "@sp1-contracts/v3.0.0/SP1VerifierGroth16.sol";
import {SP1Verifier} from "@sp1-contracts/v4.0.0-rc.3/SP1VerifierGroth16.sol";
import {ISP1Verifier} from "@sp1-contracts/ISP1Verifier.sol";

import "../src/consensus/SP1Beefy.sol";
Expand Down Expand Up @@ -52,12 +52,12 @@ contract SP1BeefyTest is Test {

function testPolkadotVerifier() public view {
bytes
memory proof = hex"090690900a331610accb89fe31c04e9d4e0af42b9a99c946330fa6955af1254eb86aa8d3156ad94ef914c0f0901e9226264c7ebbd95145ec8e4a49dca2d348300d1fff3f19cd79389cd6fa52de5d8b0dfe2d60e5d53f7c706c0568c46dfc19c7bb232a951b01fc65f1360369a2ac0c50bbb41163127840d1dedc2e3f6ee98338bd59c7b81e8ea4f720ca1a2b9f7207e27ccb833c4965503a47e4fa62ea5e419555bfdd6421af119e05ad9e13adc643de98945d29f6a6b8d2a470a218e4a2abc9092b693618e7ecf7e780dbe7580bccfe2d5be334035c7ac5361d435cbc760c7896290f7b2b109a2dbe6c47e8401ab119a2da052fb3c0933f3e1669a59437bd8bc8dc157b";
memory proof = hex"11b6a09d0602783a739ff23a34879d0f31c9742293407605ad35b2ab9f2112445436251c2929a1f895ee9c0a7185734a57da30feaa42de756ef44ac2383ad0146f525ed41ea56e5485fe3d329cec126256c2c19918560e93fea6e69d6c1287aba55359e020f8368e1be185cabcaf87407e6e700be708bb4f0e3d800fea43e7e06f95d8a7141f29d97bbdec0ead4c051dc1a8ff931bf470e7f48bf8edba580d1a1e7f93bf2c7fc4b3124ccbbcaa0cb0243a3be77001d71fc4eb020bfce79d88ce520a9cf611b8032714b5f7429e0bd89c76474f67e0b8f02c0a1cc9fd3cbc8fdf6039a89904236d309f7153c388b5c66d5e5bdc484f4272b71aa246b121bbac05fd50bbe5";

bytes
memory publicInputs = hex"0000000000000000000000000000000000000000000000000000000000000020a2f65237d65bf11eaf9883b0c994bc18a95ab47b43b572d7aff843b432973c9b000000000000000000000000000000000000000000000000000000000000019068ac81e3764c16d937384d2efebff4111285fda59d98dde537b309aeb0832d9100000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000001e7cfa25980d95567aa5b02809fb9e3485b1c54296b3ff471a70d12ef5314edd1";
memory publicInputs = hex"00000000000000000000000000000000000000000000000000000000000000209b5eebd2ca5ae7248ba20456bd8866e6a233ea23c4079303c5b19971f05c40c900000000000000000000000000000000000000000000000000000000000001f38055badaa1bf16bbbb8cd6fe066815bb9e1f23ae46d9641cb88d88aeff1b9569000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000016482008a0af7995d30781c057b8decb26eac6bcebf646283fe386a919b833822";

bytes32 verificationKey = bytes32(0x0071ba110ada2601c43635dabd6abea7180d3132fd75df662cac13505ade1f5d);
bytes32 verificationKey = bytes32(0x004609733a0366baf52880d2a058a858c8c83479d4b1fca39c1a14666375419f);

ISP1Verifier(address(sp1)).verifyProof(verificationKey, publicInputs, proof);

Expand Down

0 comments on commit a472064

Please sign in to comment.