diff --git a/Justfile b/Justfile index f39a93890..8b7e71413 100644 --- a/Justfile +++ b/Justfile @@ -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: diff --git a/bolt-contracts/script/Counter.s.sol b/bolt-contracts/script/Counter.s.sol deleted file mode 100644 index df9ee8b02..000000000 --- a/bolt-contracts/script/Counter.s.sol +++ /dev/null @@ -1,12 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity ^0.8.13; - -import {Script, console} from "forge-std/Script.sol"; - -contract CounterScript is Script { - function setUp() public {} - - function run() public { - vm.broadcast(); - } -} diff --git a/bolt-contracts/script/DeployOnDevnet.s.sol b/bolt-contracts/script/DeployOnDevnet.s.sol new file mode 100644 index 000000000..ac015c5b5 --- /dev/null +++ b/bolt-contracts/script/DeployOnDevnet.s.sol @@ -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(); + } +} diff --git a/bolt-contracts/test/BoltChallenger.t.sol b/bolt-contracts/test/BoltChallenger.t.sol index b2a3ac34a..866ec536f 100644 --- a/bolt-contracts/test/BoltChallenger.t.sol +++ b/bolt-contracts/test/BoltChallenger.t.sol @@ -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"); diff --git a/scripts/start-devnet.sh b/scripts/start-devnet.sh new file mode 100755 index 000000000..124b709c5 --- /dev/null +++ b/scripts/start-devnet.sh @@ -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!"