Skip to content

Commit

Permalink
EPROD-1110 removed https endpoints for tests (#199)
Browse files Browse the repository at this point in the history
  • Loading branch information
veeso authored Jan 16, 2025
1 parent efd1e16 commit 9b344d0
Show file tree
Hide file tree
Showing 13 changed files with 24 additions and 168 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 'Build and Deploy'
name: "Build and Deploy"

on:
workflow_call:
Expand Down Expand Up @@ -41,7 +41,7 @@ jobs:

- name: Install dfx
uses: dfinity/setup-dfx@main
with:
with:
dfx-version: "0.23.0"

- name: Install Protobuf compiler
Expand Down Expand Up @@ -70,9 +70,6 @@ jobs:
export RUST_BACKTRACE="full"
sudo apt update
sudo apt install -y gcc-multilib libunwind-dev ca-certificates
mkdir -p /usr/local/share/ca-certificates/
sudo cp btc-deploy/mkcert/* /usr/local/share/ca-certificates/
sudo update-ca-certificates --fresh --verbose
- name: build solidity contracts
run: |
Expand Down
7 changes: 0 additions & 7 deletions btc-deploy/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,3 @@ services:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
POSTGRES_PORT: 5432

evm-rpc-canister-proxy:
image: ghcr.io/bitfinity-network/testing-local-ssl-proxy:latest
ports:
- "8002:8002"
extra_hosts:
- "host.docker.internal:host-gateway"
28 changes: 0 additions & 28 deletions btc-deploy/mkcert/localhost+3-key.pem

This file was deleted.

24 changes: 0 additions & 24 deletions btc-deploy/mkcert/localhost+3.crt

This file was deleted.

40 changes: 0 additions & 40 deletions btc-deploy/mkcert/rootCA-key.pem

This file was deleted.

27 changes: 0 additions & 27 deletions btc-deploy/mkcert/rootCA.crt

This file was deleted.

29 changes: 6 additions & 23 deletions docs/deploy.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Deploy

- [Deploy](#deploy)
- [Requirements](#requirements)
- [Ubuntu 24.04 additional dependencies](#ubuntu-2404-additional-dependencies)
- [Build](#build)
- [Local test EVM deployment](#local-test-evm-deployment)
- [Bridge deployment](#bridge-deployment)
- [Erc20 bridge](#erc20-bridge)
- [Requirements](#requirements)
- [Ubuntu 24.04 additional dependencies](#ubuntu-2404-additional-dependencies)
- [Build](#build)
- [Local test EVM deployment](#local-test-evm-deployment)
- [Bridge deployment](#bridge-deployment)
- [Erc20 bridge](#erc20-bridge)

## Requirements

Expand All @@ -23,23 +23,6 @@
```

- Install [just](https://just.systems/) command runner.
- Install SSL certificates to make the `local-ssl-proxy` in the docker images able to work.

On Debian-based systems it should be enough to run

```sh
sudo cp btc-deploy/mkcert/* /usr/local/share/ca-certificates/
sudo update-ca-certificates --fresh --verbose
```

On Arch linux based systems

```sh
sudo trust anchor btc-deploy/mkcert/*
sudo update-ca-trust
```

While on MacOS you should install them by clicking on the certificates in the mkcert folder.

### Ubuntu 24.04 additional dependencies

Expand Down
4 changes: 2 additions & 2 deletions src/bridge-did/src/init/brc20.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ impl Brc20BridgeConfig {
if self
.indexer_urls
.iter()
.any(|url| !url.starts_with("https"))
.any(|url| !url.starts_with("https") && !url.starts_with("http://localhost"))
{
return Err("Indexer url must specify https url".to_string());
return Err("Indexer url must etiher specify https url or be localhost".to_string());
}

Ok(())
Expand Down
8 changes: 5 additions & 3 deletions src/bridge-did/src/init/rune.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,12 @@ pub enum IndexerType {
impl IndexerType {
fn validate(&self) -> Result<(), String> {
match self {
Self::OrdHttp { url } if !url.starts_with("https") => {
Err("Indexer url must specify https url".to_string())
Self::OrdHttp { url }
if url.starts_with("https") || url.starts_with("http://localhost") =>
{
Ok(())
}
_ => Ok(()),
_ => Err("Indexer url must etiher specify https url or be localhost".to_string()),
}
}

Expand Down
5 changes: 2 additions & 3 deletions src/integration-tests/tests/context/brc20_bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ use ord_rs::Utxo;
use tokio::sync::{Mutex, RwLock};
use tokio::time::Instant;

use super::CanisterType;
use crate::context::TestContext;
use crate::utils::brc20_helper::Brc20Helper;
use crate::utils::btc_rpc_client::BitcoinRpcClient;
Expand Down Expand Up @@ -214,7 +213,7 @@ async fn brc20_setup(brc20_to_deploy: &[Brc20InitArgs]) -> anyhow::Result<Brc20W
impl Brc20Context<crate::dfx_tests::DfxTestContext> {
pub async fn dfx(brc20_to_deploy: &[Brc20InitArgs]) -> Self {
let context =
crate::dfx_tests::DfxTestContext::new(&CanisterType::BRC20_CANISTER_SET).await;
crate::dfx_tests::DfxTestContext::new(&super::CanisterType::BRC20_CANISTER_SET).await;

Self::new(context, brc20_to_deploy).await
}
Expand All @@ -227,7 +226,7 @@ impl Brc20Context<crate::pocket_ic_integration_test::PocketIcTestContext> {
use std::net::{IpAddr, Ipv4Addr, SocketAddr};

let context = crate::pocket_ic_integration_test::PocketIcTestContext::new_with(
&CanisterType::BRC20_CANISTER_SET,
&super::CanisterType::BRC20_CANISTER_SET,
|builder| {
builder
.with_ii_subnet()
Expand Down
6 changes: 3 additions & 3 deletions src/integration-tests/tests/context/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1075,7 +1075,7 @@ pub trait TestContext {
.expect("authorize failed");
assert!(res, "authorize failed");
let hostname = format!(
"https://127.0.0.1:8002/?canisterId={}",
"http://{}.raw.localhost:8000",
self.canisters().external_evm()
);
println!("EVM-RPC provider hostname: {hostname}");
Expand Down Expand Up @@ -1472,7 +1472,7 @@ pub fn rune_bridge_canister_init_data(
btc_cache_timeout_secs: None,
min_confirmations: 1,
indexers: vec![IndexerType::OrdHttp {
url: "https://localhost:8001".to_string(),
url: "http://localhost:8000".to_string(),
}],
deposit_fee: 500_000,
mempool_timeout: Duration::from_secs(60),
Expand All @@ -1493,7 +1493,7 @@ pub fn brc20_bridge_canister_init_data(
Brc20BridgeConfig {
network: BitcoinNetwork::Regtest,
min_confirmations: 1,
indexer_urls: HashSet::from_iter(["https://localhost:8005".to_string()]),
indexer_urls: HashSet::from_iter(["http://localhost:8004".to_string()]),
deposit_fee: 500_000,
mempool_timeout: Duration::from_secs(60),
indexer_consensus_threshold: 1,
Expand Down
6 changes: 3 additions & 3 deletions src/integration-tests/tests/context/rune_bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ use rune_bridge::ops::RuneDepositRequestData;
use tokio::sync::{Mutex, RwLock};
use tokio::time::Instant;

use super::CanisterType;
use crate::context::TestContext;
use crate::utils::btc_rpc_client::BitcoinRpcClient;
use crate::utils::miner::{Exit, Miner};
Expand Down Expand Up @@ -158,7 +157,8 @@ async fn rune_setup(runes_to_etch: &[String]) -> anyhow::Result<RuneWallet> {
#[cfg(feature = "dfx_tests")]
impl RunesContext<crate::dfx_tests::DfxTestContext> {
pub async fn dfx(runes_to_etch: &[String]) -> Self {
let context = crate::dfx_tests::DfxTestContext::new(&CanisterType::RUNE_CANISTER_SET).await;
let context =
crate::dfx_tests::DfxTestContext::new(&super::CanisterType::RUNE_CANISTER_SET).await;

Self::new(context, runes_to_etch).await
}
Expand All @@ -171,7 +171,7 @@ impl RunesContext<crate::pocket_ic_integration_test::PocketIcTestContext> {
use std::net::{IpAddr, Ipv4Addr, SocketAddr};

let context = crate::pocket_ic_integration_test::PocketIcTestContext::new_with(
&CanisterType::RUNE_CANISTER_SET,
&super::CanisterType::RUNE_CANISTER_SET,
|builder| {
builder
.with_ii_subnet()
Expand Down
1 change: 1 addition & 0 deletions src/integration-tests/tests/dfx_tests/brc20_bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ async fn test_should_deposit_and_withdraw_brc20_tokens() {
}

#[tokio::test]
#[serial_test::serial]
async fn test_brc20_bridge_stress_test() {
let context = crate::dfx_tests::DfxTestContext::new(&CanisterType::BRC20_CANISTER_SET).await;

Expand Down

0 comments on commit 9b344d0

Please sign in to comment.