Skip to content

Commit

Permalink
wip: deploy on devnet forge script
Browse files Browse the repository at this point in the history
  • Loading branch information
merklefruit committed May 28, 2024
1 parent e39dedf commit 3401145
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 14 deletions.
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();
}
}
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!"

0 comments on commit 3401145

Please sign in to comment.