diff --git a/Tiltfile b/Tiltfile index 1c9042d02e..008557f6ce 100644 --- a/Tiltfile +++ b/Tiltfile @@ -36,6 +36,7 @@ update_settings(max_parallel_updates = 10) # Runtime configuration config.define_bool("ci", False, "We are running in CI") config.define_bool("manual", False, "Set TRIGGER_MODE_MANUAL by default") +config.define_bool("m1", False, "Build Solana from source for m1 arm64") config.define_string("num", False, "Number of guardian nodes to run") @@ -100,6 +101,7 @@ btc = cfg.get("btc", False) redis = cfg.get('redis', ci) generic_relayer = cfg.get("generic_relayer", ci) query_server = cfg.get("query_server", ci) +m1 = cfg.get("m1", False) if ci: guardiand_loglevel = cfg.get("guardiand_loglevel", "warn") @@ -485,6 +487,16 @@ if solana or pythnet: # solana local devnet + dockerfile = "solana/Dockerfile.test-validator" + if m1: + dockerfile = "solana/Dockerfile.test-validator.m1" + + docker_build( + ref = "solana-test-validator", + context = "solana", + dockerfile = dockerfile + ) + k8s_yaml_with_ns("devnet/solana-devnet.yaml") k8s_resource( diff --git a/devnet/solana-devnet.yaml b/devnet/solana-devnet.yaml index 6b467d8347..420bbc3a7a 100644 --- a/devnet/solana-devnet.yaml +++ b/devnet/solana-devnet.yaml @@ -35,9 +35,9 @@ spec: terminationGracePeriodSeconds: 1 containers: - name: devnet - image: solana-contract + image: solana-test-validator command: - - /root/.local/share/solana/install/active_release/bin/solana-test-validator + - solana-test-validator - --bpf-program - Bridge1p5gheXUvJ6jGWGeCsgPKgnE3YgdGKRVCMY9o - /opt/solana/deps/bridge.so diff --git a/solana/Dockerfile.test-validator b/solana/Dockerfile.test-validator new file mode 100644 index 0000000000..0176a499eb --- /dev/null +++ b/solana/Dockerfile.test-validator @@ -0,0 +1 @@ +FROM solana-contract diff --git a/solana/Dockerfile.test-validator.m1 b/solana/Dockerfile.test-validator.m1 new file mode 100644 index 0000000000..ef41c8afd6 --- /dev/null +++ b/solana/Dockerfile.test-validator.m1 @@ -0,0 +1,36 @@ +FROM solana-contract +FROM --platform=linux/arm64/v8 ubuntu:20.04@sha256:4489868cec4ea83f1e2c8e9f493ac957ec1451a63428dbec12af2894e6da4429 + +RUN apt-get update && DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install -y curl wget libssl-dev libudev-dev pkg-config zlib1g-dev llvm clang cmake make libprotobuf-dev protobuf-compiler + +# --default-toolchain must match https://github.com/anza-xyz/agave/blob/v2.0.17/rust-toolchain.toml +# alternatively, this could do something like the following +# RUN source solana/ci/rust-version.sh && \ +# curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain "$rust_stable" +# RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain "1.78.0" && . $HOME/.cargo/env && rustup component add rustfmt +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain "1.73.0" && . $HOME/.cargo/env && rustup component add rustfmt + +ENV PATH=/root/.cargo/bin:$PATH + +WORKDIR /build + +# version 2.0.17 is incompatible with the existing devnet_setup.sh +# ENV solana_version=2.0.17 +ENV solana_version=1.17.29 + +RUN wget https://github.com/anza-xyz/agave/archive/refs/tags/v${solana_version}.tar.gz + +RUN tar -xf v${solana_version}.tar.gz + +WORKDIR /build/agave-${solana_version} + +# the full build OOMed with 24GB RAM allocated to Docker, so use --validator-only to slim it down and speed it up +# except that the following command apparently didn't build solana-test-validator +# RUN ./scripts/cargo-install-all.sh . --validator-only +# so just explicitly build solana-test-validator +RUN ./cargo build --profile release --bin solana-test-validator +RUN mkdir bin && cp target/release/solana-test-validator bin/solana-test-validator + +ENV PATH=/build/agave-${solana_version}/bin:$PATH + +COPY --from=solana-contract /opt/solana/deps/ /opt/solana/deps/