Skip to content

Commit

Permalink
Merge branch 'main' into smuu/20241213-bump-to-latest-celestia
Browse files Browse the repository at this point in the history
  • Loading branch information
smuu committed Dec 16, 2024
2 parents b3c8b6c + 93a85ec commit d140a9e
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 23 deletions.
19 changes: 16 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,23 @@ jobs:
- name: Run the docker-compose stack
run: docker compose -f ci/docker-compose.yml up --no-build -d

- name: Wait for bridge node to start
- name: Wait for bridge node 0 to start
run: |
docker compose -f ci/docker-compose.yml logs -f |
awk '/Configuration finished. Running a bridge node/ {print;exit}'
while ! docker compose -f ci/docker-compose.yml logs bridge-0 | grep -q 'Configuration finished. Running a bridge node'; do
sleep 1
done
- name: Wait for bridge node 1 to start
run: |
while ! docker compose -f ci/docker-compose.yml logs bridge-1 | grep -q 'Configuration finished. Running a bridge node'; do
sleep 1
done
- name: Wait for light node 0 to start
run: |
while ! docker compose -f ci/docker-compose.yml logs light-0 | grep -q 'Configuration finished. Running a light node'; do
sleep 1
done
- name: Run integration tests
run: cargo test -p prism-tests --lib --release --features mock_prover
Expand Down
12 changes: 6 additions & 6 deletions ci/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ services:
- LIGHT_COUNT=1
volumes:
- credentials:/credentials
- genesis:/genesis
- shared:/shared

bridge-0:
image: bridge
Expand All @@ -32,7 +32,7 @@ services:
- 26658:26658
volumes:
- credentials:/credentials
- genesis:/genesis
- shared:/shared

bridge-1:
image: bridge
Expand All @@ -53,7 +53,7 @@ services:
- 36658:26658
volumes:
- credentials:/credentials
- genesis:/genesis
- shared:/shared

light-0:
image: light
Expand All @@ -74,7 +74,7 @@ services:
- 46658:26658
volumes:
- credentials:/credentials
- genesis:/genesis
- shared:/shared

volumes:
# local volume where node's credentials can persist
Expand All @@ -84,8 +84,8 @@ volumes:
type: "none"
o: "bind"
device: "./credentials"
# a temporary fs where the genesis hash is announced
genesis:
# a temporary fs where the nodes share data
shared:
driver_opts:
type: tmpfs
device: tmpfs
8 changes: 4 additions & 4 deletions ci/run-bridge.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ CREDENTIALS_DIR="/credentials"
# node credentials
NODE_KEY_FILE="$CREDENTIALS_DIR/$NODE_NAME.key"
NODE_JWT_FILE="$CREDENTIALS_DIR/$NODE_NAME.jwt"
# directory where validator will write the genesis hash
GENESIS_DIR="/genesis"
GENESIS_HASH_FILE="$GENESIS_DIR/genesis_hash"
TRUSTED_PEERS_FILE="$GENESIS_DIR/trusted_peers"
# directory where validator will write the genesis hash and the bridge node their peers addresses
SHARED_DIR="/shared"
GENESIS_HASH_FILE="$SHARED_DIR/genesis_hash"
TRUSTED_PEERS_FILE="$SHARED_DIR/trusted_peers"

# Wait for the validator to set up and provision us via shared dir
wait_for_provision() {
Expand Down
17 changes: 11 additions & 6 deletions ci/run-lightnode.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ CREDENTIALS_DIR="/credentials"
# node credentials
NODE_KEY_FILE="$CREDENTIALS_DIR/$NODE_NAME.key"
NODE_JWT_FILE="$CREDENTIALS_DIR/$NODE_NAME.jwt"
# directory where validator will write the genesis hash
GENESIS_DIR="/genesis"
GENESIS_HASH_FILE="$GENESIS_DIR/genesis_hash"
TRUSTED_PEERS_FILE="$GENESIS_DIR/trusted_peers"
# directory where validator will write the genesis hash and the bridge node their peers addresses
SHARED_DIR="/shared"
GENESIS_HASH_FILE="$SHARED_DIR/genesis_hash"
TRUSTED_PEERS_FILE="$SHARED_DIR/trusted_peers"

# Wait for the validator to set up and provision us via shared dir
wait_for_provision() {
Expand All @@ -36,9 +36,14 @@ wait_for_provision() {

while true; do
if [[ -e "$TRUSTED_PEERS_FILE" ]]; then

echo "Trusted peers file exists"

trusted_peers="$(cat "$TRUSTED_PEERS_FILE")"
comma_count=$(echo "$trusted_peers" | grep -o "," | wc -l)
if [[ $comma_count -eq $((BRIDGE_COUNT - 1)) ]]; then
echo "Trusted peers: $trusted_peers"
peer_count=$(echo "$trusted_peers" | tr ',' '\n' | wc -l)
echo "Peer count: $peer_count"
if [[ $peer_count -eq $BRIDGE_COUNT ]]; then
echo "$BRIDGE_COUNT bridge nodes are ready"
break
else
Expand Down
6 changes: 3 additions & 3 deletions ci/run-validator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ BRIDGE_COINS="200000000000000utia"
VALIDATOR_COINS="1000000000000000utia"
# a directory and the files shared with the bridge nodes
CREDENTIALS_DIR="/credentials"
# directory where validator will write the genesis hash
GENESIS_DIR="/genesis"
GENESIS_HASH_FILE="$GENESIS_DIR/genesis_hash"
# directory where validator will write the genesis hash and the bridge node their peers addresses
SHARED_DIR="/shared"
GENESIS_HASH_FILE="$SHARED_DIR/genesis_hash"

# Get the address of the node of given name
node_address() {
Expand Down
2 changes: 1 addition & 1 deletion crates/tests/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ async fn test_light_client_prover_talking() -> Result<()> {
pretty_env_logger::init();

let bridge_cfg = CelestiaConfig {
connection_string: "ws://localhost:36658".to_string(),
connection_string: "ws://localhost:26658".to_string(),
..CelestiaConfig::default()
};
let lc_cfg = CelestiaConfig {
Expand Down

0 comments on commit d140a9e

Please sign in to comment.