forked from OffchainLabs/nitro-testnode
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix the L3 node * Add comments for l3node with espresso mode * Fix smoke test * Add l3 node test in smoke test * Separate the l3 test bash * Add flake.nix --------- Co-authored-by: sveitser <[email protected]>
- Loading branch information
1 parent
792eaed
commit 85aeb89
Showing
9 changed files
with
205 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
if ! has nix_direnv_version || ! nix_direnv_version 3.0.5; then | ||
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.5/direnvrc" "sha256-RuwIS+QKFj/T9M2TFXScjBsLR6V3A17YVoEW/Q6AZ1w=" | ||
fi | ||
|
||
use nix | ||
watch_file flake.nix | ||
watch_file flake.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ | ||
description = "A Nix-flake-based Node.js development environment"; | ||
|
||
inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.*.tar.gz"; | ||
inputs.foundry.url = "github:shazow/foundry.nix/monthly"; # Use monthly branch for permanent releases | ||
|
||
outputs = { self, nixpkgs, foundry }: | ||
let | ||
supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; | ||
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f { | ||
pkgs = import nixpkgs { | ||
inherit system; overlays = [ | ||
foundry.overlay | ||
self.overlays.default | ||
]; | ||
}; | ||
}); | ||
in | ||
{ | ||
overlays.default = final: prev: rec { | ||
nodejs = prev.nodejs; | ||
yarn = (prev.yarn.override { inherit nodejs; }); | ||
}; | ||
|
||
devShells = forEachSupportedSystem ({ pkgs }: { | ||
default = pkgs.mkShell { | ||
packages = with pkgs; [ | ||
nodejs | ||
yarn | ||
openssl # used by test-node.bash | ||
foundry-bin | ||
]; | ||
shellHook = '' | ||
yarn install --cwd "$PWD/scripts" | ||
export PATH="$PWD/scripts/node_modules/.bin:$PATH" | ||
''; | ||
}; | ||
}); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
./test-node.bash --init-force --espresso --latest-espresso-image --l3node --l3-token-bridge --l3-fee-token --detach | ||
|
||
echo "Sending L3 transaction" | ||
user=user_l3 | ||
./test-node.bash script send-l3 --ethamount 5 --to $user --wait | ||
userAddress=$(docker compose run scripts print-address --account $user | tail -n 1 | tr -d '\r\n') | ||
|
||
balance=$(cast balance $userAddress --rpc-url http://localhost:3347) | ||
|
||
if [ "$balance" -eq 0 ]; then | ||
echo "Transfer failed in l3 node" | ||
exit 1 | ||
fi | ||
|
||
rollupAddress=$(docker compose run --entrypoint sh poster -c "jq -r '.[0].rollup.rollup' /config/deployed_l3_chain_info.json | tail -n 1 | tr -d '\r\n'") | ||
while true; do | ||
confirmed=$(cast call --rpc-url http://localhost:8547 $rollupAddress 'latestConfirmed()(uint256)') | ||
echo "Number of confirmed staking nodes: $confirmed" | ||
if [ "$confirmed" -gt 0 ]; then | ||
break | ||
else | ||
echo "Waiting for more confirmed nodes ..." | ||
fi | ||
sleep 5 | ||
done | ||
|
||
echo "Smoke test succeeded." | ||
docker compose down |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters