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

wip: streamline kurtosis devnet test scenarios #35

Merged
merged 2 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ demo:

# spin up the bolt devnet
up:
kurtosis run --enclave bolt-devnet github.com/chainbound/ethereum-package --args-file ./scripts/kurtosis_config.yaml
chmod +x ./scripts/start-devnet.sh
./scripts/start-devnet.sh

# turn down the bolt devnet and remove the enclave
down:
Expand Down
12 changes: 0 additions & 12 deletions bolt-contracts/script/Counter.s.sol

This file was deleted.

29 changes: 29 additions & 0 deletions bolt-contracts/script/DeployOnDevnet.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

import {Script, console} from "forge-std/Script.sol";

import {BoltRegistry} from "../src/contracts/BoltRegistry.sol";
import {BoltChallenger} from "../src/contracts/BoltChallenger.sol";

contract DeployOnDevnet is Script {
function setUp() public {}

function run() public {
// Relic protocol contracts
address relicReliquary = 0x5E4DE6Bb8c6824f29c44Bd3473d44da120387d08;
address relicBlockHeaderProver = 0x9f9A1eb0CF9340538297c853915DCc06Eb6D72c4;
address relicAccountInfoProver = 0xf74105AE736Ca0C4B171a2EC4F1D4B0b6EBB99ae;

vm.startBroadcast();

BoltRegistry registry = new BoltRegistry();
console.log("BoltRegistry deployed at", address(registry));

BoltChallenger challenger =
new BoltChallenger(address(registry), relicReliquary, relicBlockHeaderProver, relicAccountInfoProver);
console.log("BoltChallenger deployed at", address(challenger));

vm.stopBroadcast();
}
}
5 changes: 3 additions & 2 deletions bolt-contracts/src/contracts/BoltChallenger.sol
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,9 @@ contract BoltChallenger is IBoltChallenger {
reliquary = IReliquary(_reliquary);

// Check if the provided provers are valid
reliquary.checkProver(reliquary.provers(_blockHeaderProver));
reliquary.checkProver(reliquary.provers(_accountInfoProver));
// TODO: readd this for mainnet deployment (currently disabled for testing)
// reliquary.checkProver(reliquary.provers(_blockHeaderProver));
// reliquary.checkProver(reliquary.provers(_accountInfoProver));

blockHeaderProver = IProver(_blockHeaderProver);
accountInfoProver = IProver(_accountInfoProver);
Expand Down
2 changes: 1 addition & 1 deletion bolt-contracts/test/BoltChallenger.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ contract BoltChallengerTest is Test {

function setUp() public {
// Set up mainnet forking
vm.createSelectFork("https://eth.merkle.io", 19932764);
vm.createSelectFork("https://cloudflare-eth.com", 19932764);
assertEq(block.number, 19932764);

(alice, alicePk) = makeAddrAndKey("alice");
Expand Down
25 changes: 25 additions & 0 deletions scripts/start-devnet.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

echo "Starting the devnet..."

# spin up the kurtosis devnet
kurtosis run --enclave bolt-devnet github.com/chainbound/ethereum-package --args-file ./scripts/kurtosis_config.yaml
echo "Devnet online! Waiting for the RPC to be available..."
sleep 5

RPC=$(kurtosis port print bolt-devnet el-1-geth-lighthouse rpc)
PK="bcdf20249abf0ed6d944c0288fad489e33f66b3960d9e6229c1cd214ed3bbe31"
echo "RPC endpoint: $RPC"

# wait for the rpc to be available
while ! curl -s -X POST --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' "$RPC" > /dev/null; do
sleep 1
done

# deploy the contracts
(
cd ./bolt-contracts || exit
forge build # make sure the contracts are compiled before deploying
forge script script/DeployOnDevnet.s.sol --broadcast --rpc-url "$RPC" --private-key "$PK"
)
echo "Contracts deployed!"