0a7f9a39a9
This is a rewrite of the build system with `jbuilder`, with just a minimal toplevel Makefile for backward compatibility. This first patch preserves the project architecture, we only gain proper dependencies handling and always up-to-date `.merlin` files. A latter patch may split the project in smaller "sub-package", i.e. multiple `.opam` files. The embedded versions of the economic protocol are now compiled with `jbuilder` instead of `tezos-protocol-compiler`, potentially allowing proper inlining at the cost of slightly-less-stricter sandboxing. Nevertheless, dynamically loaded protocol are still compiled with the `tezos-protocol-compiler` and thus strictly sandboxed ; and a CI rule also checks the proper sandboxing of embedded protocols. This patch is coauthored with @hnrgrgr
47 lines
1.3 KiB
Bash
47 lines
1.3 KiB
Bash
#! /usr/bin/env bash
|
|
|
|
node_dirs=()
|
|
node_pids=()
|
|
|
|
start_sandboxed_node() {
|
|
|
|
id=$1
|
|
max_peer_id=${max_peer_id:-9}
|
|
shift 1
|
|
|
|
port=$((19730 + id))
|
|
rpc=$((18730 + id))
|
|
expected_pow="${expected_pow:-0.0}"
|
|
expected_connections="${expected_connections:-3}"
|
|
node_dir="$(mktemp -d -t tezos-node.XXXXXXXX)"
|
|
peers=("--no-bootstrap-peers")
|
|
for peer_port in $(seq 19730 $((19730 + max_peer_id))); do
|
|
peers+=("--peer")
|
|
peers+=("127.0.0.1:$peer_port")
|
|
done
|
|
peers+=("--closed")
|
|
local_node="${local_node:-$src_dir/_build/default/src/node_main.exe}"
|
|
node="$local_node"
|
|
sandbox_file="${sandbox_file:-$script_dir/sandbox.json}"
|
|
sandbox_param="--sandbox=$sandbox_file"
|
|
|
|
node_dirs+=("$node_dir")
|
|
|
|
$node config init \
|
|
--data-dir "$node_dir" \
|
|
--net-addr "127.0.0.1:$port" \
|
|
--rpc-addr "127.0.0.1:$rpc" \
|
|
--expected-pow "$expected_pow" \
|
|
--connections "$expected_connections"
|
|
$node identity generate "$expected_pow" --data-dir "$node_dir"
|
|
$node run --data-dir "$node_dir" "${peers[@]}" "$sandbox_param" "$@" &
|
|
node_pids+=("$!")
|
|
|
|
}
|
|
|
|
cleanup_nodes() {
|
|
[ -z "${node_pids[0]}" ] || kill "${node_pids[@]}"
|
|
for pid in "${node_pids[@]}" ; do wait "$pid" ; done
|
|
rm -rf "${node_dirs[@]}"
|
|
}
|