Skip to content

Commit

Permalink
Add sepolia config (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
Wizdave97 committed Nov 12, 2023
1 parent 9119b0c commit d923d84
Show file tree
Hide file tree
Showing 13 changed files with 82 additions and 82 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:

- name: Build
run: |
cargo +nightly build --release -p hyperbridge --features goerli
cargo +nightly build --release -p hyperbridge --features sepolia
mv ./target/release/hyperbridge ./
- name: Install Cargo get
Expand Down
68 changes: 34 additions & 34 deletions client/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ use types::{
token_gateway::{AssetReceivedFilter, SendParams, TokenGateway},
};

static CROSS_CHAIN_MESSENGER_ADDRESS: H160 = H160(hex!("7067AC432584D7a00A75804EaF010498c263819d"));
static GATEWAY_ADDRESS: H160 = H160(hex!("0e366Fa0506F2dfF080648a99083A6a2F7D175e0"));
static FAUCET_ADDRESS: H160 = H160(hex!("368F3d726C904C0113b6C8A8923D4Bfe8b0b19E7"));
static MULTICHAIN_TOKEN: H160 = H160(hex!("00155be25de526F458D1C303feEA6983Dbe007ad"));
static CROSS_CHAIN_MESSENGER_ADDRESS: H160 = H160(hex!("96ae1E0309C38C594b3721a1256fC080ca3fE061"));
static GATEWAY_ADDRESS: H160 = H160(hex!("29311a33601ab2352d813992fa5cefe969ba45b1"));
static FAUCET_ADDRESS: H160 = H160(hex!("501d6bb926600cd5347d51d217e322999978cc1d"));
static MULTICHAIN_TOKEN: H160 = H160(hex!("87c686875dD4d74F32D6eF399d17425F0d9F77cc"));

#[tokio::main]
async fn main() -> Result<(), anyhow::Error> {
Expand All @@ -74,7 +74,7 @@ async fn main() -> Result<(), anyhow::Error> {
.with_chain_id(source.chain_id());
let provider = Provider::<Ws>::connect_with_reconnects(source.execution_rpc(), 1000).await?;
let mut substrate =
OnlineClient::<KeccakSubstrateChain>::from_url("ws://34.22.152.185:9933").await?;
OnlineClient::<KeccakSubstrateChain>::from_url("ws://34.140.78.68:9933").await?;
let signer = Arc::new(provider.clone().with_signer(signer));

// initiate transaction
Expand Down Expand Up @@ -106,7 +106,7 @@ async fn main() -> Result<(), anyhow::Error> {
token_contract: MULTICHAIN_TOKEN,
timeout: 3 * 60 * 60,
})
.gas(100_000)
.gas(150_000)
.send()
.await?
.await?
Expand Down Expand Up @@ -538,42 +538,42 @@ impl ChainInfo for Ethereum {
fn execution_rpc(&self) -> String {
match self {
Ethereum::Base =>
"wss://base-goerli.g.alchemy.com/v2/T61-8vjm3pbzXg8qv-xgCFuceiH-yKx8".to_string(),
"wss://small-compatible-yard.base-sepolia.quiknode.pro/ca5a8b1907ef065b10c260ecb13802b574e82220".to_string(),
Ethereum::ExecutionLayer =>
"wss://eth-goerli.g.alchemy.com/v2/ExCoqYRMmgK6D-XonUfuMfr8UJYuvH-q".to_string(),
"wss://eth-sepolia.g.alchemy.com/v2/YfHY8davK9lcmyjydissrUxrc_gUbFjZ".to_string(),
Ethereum::Optimism =>
"wss://opt-goerli.g.alchemy.com/v2/K5J-ceP4ULgjvQuO2gPvikNoLE4oeuSO".to_string(),
"wss://yolo-billowing-daylight.optimism-sepolia.quiknode.pro/ad2efd5fe6b1422db784640f7702552797ac12e0".to_string(),
Ethereum::Arbitrum =>
"wss://arb-goerli.g.alchemy.com/v2/_8F-Kfgm9ETkRHKII67WmQDgClbl7TJC".to_string(),
"wss://arb-sepolia.g.alchemy.com/v2/7cwLO5j3I9qI5KvLMjr_BmwXxaIPbRZi".to_string(),
}
}

fn chain_id(&self) -> u64 {
match self {
Ethereum::ExecutionLayer => 5,
Ethereum::Arbitrum => 421613,
Ethereum::Optimism => 420,
Ethereum::Base => 84531,
Ethereum::ExecutionLayer => 11155111,
Ethereum::Arbitrum => 421614,
Ethereum::Optimism => 11155420,
Ethereum::Base => 84532,
}
}

fn handler(&self) -> Address {
match self {
Ethereum::ExecutionLayer => H160(hex!("1df0f722a40aaFB36B10edc6641201eD6ce37d91")),
Ethereum::Arbitrum => H160(hex!("11f6d0323B4b8154b0b8874FB4183970bdd64C23")),
Ethereum::Optimism => H160(hex!("394e341299A928bC72b01A56f22125921707D7F7")),
Ethereum::Base => H160(hex!("A3002B1a247Fd8E2a2A5A4abFe76ca49A03B4063")),
Ethereum::ExecutionLayer => H160(hex!("577efa5c6184e10d54fda5eb195f7eca30644082")),
Ethereum::Arbitrum => H160(hex!("4221d52aa25d80bb4741d430f16f5769ca99bc58")),
Ethereum::Optimism => H160(hex!("4221D52aa25d80Bb4741D430f16f5769cA99bc58")),
Ethereum::Base => H160(hex!("3cfb5eE8D00c2620e0A63FD25deAA2d7a671F449")),
}
}

fn etherscan(&self, transaction: H256) -> String {
match self {
Ethereum::Base => format!("https://goerli.basescan.org/tx/{transaction:?}"),
Ethereum::ExecutionLayer => format!("https://goerli.etherscan.io/tx/{transaction:?}"),
Ethereum::Base => format!("https://base-sepolia.blockscout.com/tx/{transaction:?}"),
Ethereum::ExecutionLayer => format!("https://sepolia.etherscan.io/tx/{transaction:?}"),
Ethereum::Optimism => {
format!("https://goerli-optimism.etherscan.io/tx/{transaction:?}")
format!("https://sepolia-optimism.etherscan.io/tx/{transaction:?}")
},
Ethereum::Arbitrum => format!("https://testnet.arbiscan.io/tx/{transaction:?}"),
Ethereum::Arbitrum => format!("https://sepolia.arbiscan.io/tx/{transaction:?}"),
}
}
}
Expand Down Expand Up @@ -650,14 +650,14 @@ pub enum Action {

#[derive(clap::ValueEnum, Debug, Clone, Copy)]
pub enum Network {
/// Goerli
Goerli,
/// Optimism Goerli
OpGoerli,
/// Arbitrum Goerli
ArbGoerli,
/// Base Goerli
BaseGoerli,
/// Sepolia
Sepolia,
/// Optimism Sepolia
OpSepolia,
/// Arbitrum Sepolia
ArbSepolia,
/// Base Sepolia
BaseSepolia,
}

impl From<types::runtime::api::runtime_types::ismp::host::Ethereum> for Ethereum {
Expand All @@ -680,10 +680,10 @@ impl From<types::runtime::api::runtime_types::ismp::host::Ethereum> for Ethereum
impl From<Network> for Ethereum {
fn from(value: Network) -> Self {
match value {
Network::Goerli => Ethereum::ExecutionLayer,
Network::ArbGoerli => Ethereum::Arbitrum,
Network::OpGoerli => Ethereum::Optimism,
Network::BaseGoerli => Ethereum::Base,
Network::Sepolia => Ethereum::ExecutionLayer,
Network::ArbSepolia => Ethereum::Arbitrum,
Network::OpSepolia => Ethereum::Optimism,
Network::BaseSepolia => Ethereum::Base,
}
}
}
Expand Down
16 changes: 8 additions & 8 deletions evm/foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ out = "out"
libs = ["lib"]

[rpc_endpoints]
goerli = "${GOERLI_RPC_URL}"
optimism-goerli = "${OPTIMISM_GOERLI_RPC_URL}"
arbitrum-goerli = "${ARBITRUM_GOERLI_RPC_URL}"
base-goerli = "${BASE_GOERLI_RPC_URL}"
sepolia = "${SEPOLIA_RPC_URL}"
optimism-sepolia = "${OPTIMISM_SEPOLIA_RPC_URL}"
arbitrum-sepolia = "${ARBITRUM_SEPOLIA_RPC_URL}"
base-sepolia = "${BASE_SEPOLIA_RPC_URL}"

[etherscan]
goerli = { key = "${GOERLI_ETHERSCAN_API_KEY}", chain = 5, url = " https://api-goerli.etherscan.io/api" }
optimism-goerli = { key = "${OPTIMISM_ETHERSCAN_API_KEY}", chain = 420, url = "https://api-goerli-optimistic.etherscan.io/api" }
arbitrum-goerli = { key = "${ARBITRUM_ETHERSCAN_API_KEY}", chain = 421613, url = "https://api-goerli.arbiscan.io/api" }
base-goerli = { key = "${BASE_ETHERSCAN_API_KEY}", chain = 84531, url = "https://api-goerli.basescan.org/api" }
sepolia = { key = "${SEPOLIA_ETHERSCAN_API_KEY}", chain = 11155111, url = " https://api-sepolia.etherscan.io/api" }
optimism-sepolia = { key = "${OPTIMISM_ETHERSCAN_API_KEY}", chain = 11155420, url = "https://api-sepolia-optimism.etherscan.io/api" }
arbitrum-sepolia = { key = "${ARBITRUM_ETHERSCAN_API_KEY}", chain = 421614, url = "https://api-sepolia.arbiscan.io/api" }
base-sepolia = { key = "${BASE_ETHERSCAN_API_KEY}", chain = 84532, url = "https://api-sepolia.basescan.org/api" }
26 changes: 13 additions & 13 deletions evm/script/DeployGateway.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ import "../test/CrossChainMessenger.sol";
contract DeployScript is Script {
bytes32 public salt = keccak256(bytes("gargantua-v0.0.5"));

address public GOERLI_HOST = 0xDaC0797eb874d7a4A53521DD16250fbEb85797f0;
address public ARB_GOERLI_HOST = 0xa8070743D9e2B4aa3dEF52ed04A8e045F16C3252;
address public OP_GOERLI_HOST = 0xB8D705737d63Ce49ec8c491b968D29F497D431f1;
address public BASE_GOERLI_HOST =
0x5Cd82e710385e7e14c5fa97B9Ceae31150Be8dFd;
address public SEPOLIA_HOST = 0x5b5F63C8f3985CaFE1CE53E6374f42AB60dE5a6B;
address public ARB_SEPOLIA_HOST = 0x43E136611Cf74E165116a47e6F9C58AFCc80Ec54;
address public OP_SEPOLIA_HOST = 0x0124f458900FCd101c4CE31A9772fD2c5e6d65BF;
address public BASE_SEPOLIA_HOST =
0x87825f839d95c6021c0e821917F93aDB299eD6F8;

bytes32 public constant MINTER_ROLE = keccak256("MINTER ROLE");
bytes32 public constant BURNER_ROLE = keccak256("BURNER ROLE");
Expand All @@ -25,24 +25,24 @@ contract DeployScript is Script {
address admin = vm.envAddress("ADMIN");
bytes32 privateKey = vm.envBytes32("PRIVATE_KEY");

vm.createSelectFork("goerli");
vm.createSelectFork("sepolia");
vm.startBroadcast(uint256(privateKey));
deployMessenger(GOERLI_HOST, admin);
deployMessenger(SEPOLIA_HOST, admin);
vm.stopBroadcast();

vm.createSelectFork("arbitrum-goerli");
vm.createSelectFork("arbitrum-sepolia");
vm.startBroadcast(uint256(privateKey));
deployMessenger(ARB_GOERLI_HOST, admin);
deployMessenger(ARB_SEPOLIA_HOST, admin);
vm.stopBroadcast();

vm.createSelectFork("optimism-goerli");
vm.createSelectFork("optimism-sepolia");
vm.startBroadcast(uint256(privateKey));
deployMessenger(OP_GOERLI_HOST, admin);
deployMessenger(OP_SEPOLIA_HOST, admin);
vm.stopBroadcast();

vm.createSelectFork("base-goerli");
vm.createSelectFork("base-sepolia");
vm.startBroadcast(uint256(privateKey));
deployMessenger(BASE_GOERLI_HOST, admin);
deployMessenger(BASE_SEPOLIA_HOST, admin);
vm.stopBroadcast();
}

Expand Down
8 changes: 4 additions & 4 deletions evm/script/DeployIsmp.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,16 @@ contract DeployScript is Script {
string memory host,
HostParams memory params
) public returns (address) {
if (Strings.equal(host, "goerli") || Strings.equal(host, "ethereum")) {
if (Strings.equal(host, "sepolia") || Strings.equal(host, "ethereum")) {
EthereumHost host = new EthereumHost{salt: salt}(params);
return address(host);
} else if (Strings.equal(host, "arbitrum-goerli")) {
} else if (Strings.equal(host, "arbitrum-sepolia")) {
ArbitrumHost host = new ArbitrumHost{salt: salt}(params);
return address(host);
} else if (Strings.equal(host, "optimism-goerli")) {
} else if (Strings.equal(host, "optimism-sepolia")) {
OptimismHost host = new OptimismHost{salt: salt}(params);
return address(host);
} else if (Strings.equal(host, "base-goerli")) {
} else if (Strings.equal(host, "base-sepolia")) {
BaseHost host = new BaseHost{salt: salt}(params);
return address(host);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ std = [
"serde"
]
mainnet = []
goerli = []
sepolia = []
Original file line number Diff line number Diff line change
Expand Up @@ -74,29 +74,29 @@ pub const NEXT_SYNC_COMMITTEE_INDEX_LOG2: u64 = 5;
pub const BLOCK_ROOTS_INDEX_LOG2: u64 = 5;
pub const HISTORICAL_ROOTS_INDEX_LOG2: u64 = 5;

#[cfg(feature = "goerli")]
pub use goerli::*;
#[cfg(feature = "sepolia")]
pub use sepolia::*;

#[cfg(feature = "mainnet")]
pub use mainnet::*;

use crate::ssz::ByteVector;
#[cfg(all(not(feature = "mainnet"), not(feature = "goerli")))]
#[cfg(all(not(feature = "mainnet"), not(feature = "sepolia")))]
pub use devnet::*;

#[cfg(feature = "goerli")]
pub mod goerli {
#[cfg(feature = "sepolia")]
pub mod sepolia {
use super::*;
pub const SLOTS_PER_EPOCH: Slot = 32;
pub const GENESIS_VALIDATORS_ROOT: [u8; 32] =
hex_literal::hex!("043db0d9a83813551ee2f33450d23797757d430911a9320530ad8a0eabc43efb");
pub const BELLATRIX_FORK_VERSION: Version = hex_literal::hex!("02001020");
pub const ALTAIR_FORK_VERSION: Version = hex_literal::hex!("01001020");
pub const GENESIS_FORK_VERSION: Version = hex_literal::hex!("00001020");
pub const ALTAIR_FORK_EPOCH: Epoch = 36660;
pub const BELLATRIX_FORK_EPOCH: Epoch = 112260;
pub const CAPELLA_FORK_EPOCH: Epoch = 162304;
pub const CAPELLA_FORK_VERSION: Version = hex_literal::hex!("03001020");
hex_literal::hex!("d8ea171f3c94aea21ebc42a1ed61052acf3f9209c00e4efbaaddac09ed9b8078");
pub const BELLATRIX_FORK_VERSION: Version = hex_literal::hex!("90000071");
pub const ALTAIR_FORK_VERSION: Version = hex_literal::hex!("90000070");
pub const GENESIS_FORK_VERSION: Version = hex_literal::hex!("90000069");
pub const ALTAIR_FORK_EPOCH: Epoch = 50;
pub const BELLATRIX_FORK_EPOCH: Epoch = 100;
pub const CAPELLA_FORK_EPOCH: Epoch = 56832;
pub const CAPELLA_FORK_VERSION: Version = hex_literal::hex!("90000072");
pub const EPOCHS_PER_SYNC_COMMITTEE_PERIOD: Epoch = 256;
}

Expand All @@ -116,7 +116,7 @@ pub mod mainnet {
pub const EPOCHS_PER_SYNC_COMMITTEE_PERIOD: Epoch = 256;
}

#[cfg(all(not(feature = "mainnet"), not(feature = "goerli")))]
#[cfg(all(not(feature = "mainnet"), not(feature = "sepolia")))]
pub mod devnet {
use super::*;
use hex_literal::hex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@ std = [
"bls_on_arkworks/std",
"ark-bls12-381/std"
]
goerli = ["sync-committee-primitives/goerli", "sync-committee-verifier/goerli"]
sepolia = ["sync-committee-primitives/sepolia", "sync-committee-verifier/sepolia"]
mainnet = ["sync-committee-primitives/mainnet", "sync-committee-verifier/mainnet"]

Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ std = [
"ark-bls12-381/std",
"bls/std"
]
goerli = ["sync-committee-primitives/goerli"]
sepolia = ["sync-committee-primitives/sepolia"]
mainnet = ["sync-committee-primitives/mainnet"]

[dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion parachain/modules/ismp/sync-committee/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,5 @@ std = [
"pallet-ismp/std",
]

goerli = ["sync-committee-verifier/goerli", "sync-committee-primitives/goerli"]
sepolia = ["sync-committee-verifier/sepolia", "sync-committee-primitives/sepolia"]
mainnet = ["sync-committee-verifier/mainnet", "sync-committee-primitives/mainnet"]
4 changes: 2 additions & 2 deletions parachain/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ upgrade-guid = "E148C7E5-DD8C-4069-A929-7819413D7954"
path-guid = "7E49FF96-173C-489B-8BB4-3933C5A62BFE"

[package.metadata.dist]
features = ["goerli"]
features = ["sepolia"]

[dependencies]
# crates.io
Expand Down Expand Up @@ -96,5 +96,5 @@ try-runtime = [
"try-runtime-cli/try-runtime",
"hyperbridge-runtime/try-runtime"
]
goerli = ["hyperbridge-runtime/goerli"]
sepolia = ["hyperbridge-runtime/sepolia"]
mainnet = ["hyperbridge-runtime/mainnet"]
2 changes: 1 addition & 1 deletion parachain/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -168,5 +168,5 @@ try-runtime = [
"parachain-info/try-runtime",
]

goerli = ["ismp-sync-committee/goerli"]
sepolia = ["ismp-sync-committee/sepolia"]
mainnet = ["ismp-sync-committee/mainnet"]
2 changes: 1 addition & 1 deletion parachain/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("hyperbridge"),
impl_name: create_runtime_str!("hyperbridge"),
authoring_version: 1,
spec_version: 109,
spec_version: 110,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
Expand Down

0 comments on commit d923d84

Please sign in to comment.