Skip to content

Commit

Permalink
Add darwin arm64 option to setup (#1935)
Browse files Browse the repository at this point in the history
* Add darwin arm64 option to setup

* remove debug

* fix 404 links for docs

* bump rust version

* add validators to test
  • Loading branch information
pepoviola authored Jan 2, 2025
1 parent ae6f741 commit 186e8ac
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 43 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ Below can be found some of the projects that are currently using Zombienet as in
- [Composable](https://github.com/ComposableFi/composable) via `nix run "composable#devnet-picasso"`
- [Gossamer](https://github.com/ChainSafe/gossamer/issues/2843)
- [Oak/Turing/Neumann](https://github.com/OAK-Foundation/OAK-blockchain/tree/master/zombienets)
- [Hydradx](https://github.com/galacticcouncil/HydraDX-node/tree/master/rococo-local)
- [Hydradx](https://github.com/galacticcouncil/HydraDX-node/tree/master/launch-configs/zombienet)
- [InvArch](https://github.com/InvArch/InvArch-Node/blob/34a6e2216bc79c9bcee2f2f4c0cd8243fe4dfc93/zombienet/rococo-and-tinkernet+basilisk.toml)
- [Mangata](https://github.com/mangata-finance/mangata-node/tree/develop/devops/zombienet)
- [Manta/Phala](https://github.com/Manta-Network/manta-indexer/pull/30)
Expand Down
2 changes: 1 addition & 1 deletion docs/src/projects.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Below can be found some of the projects that are currently using Zombienet as in
- [Acurast](https://github.com/Acurast/acurast-substrate/blob/10c3160a297ae6c3092ee692e6d3b632896fca65/Makefile)
- [Gossamer](https://github.com/ChainSafe/gossamer/issues/2843)
- [Oak/Turing/Neumann](https://github.com/OAK-Foundation/OAK-blockchain/tree/master/zombienets)
- [Hydradx](https://github.com/galacticcouncil/HydraDX-node/tree/master/rococo-local)
- [Hydradx](https://github.com/galacticcouncil/HydraDX-node/tree/master/launch-configs/zombienet)
- [InvArch](https://github.com/InvArch/InvArch-Node/blob/34a6e2216bc79c9bcee2f2f4c0cd8243fe4dfc93/zombienet/rococo-and-tinkernet+basilisk.toml)
- [Mangata](https://github.com/mangata-finance/mangata-node/tree/develop/devops/zombienet)
- [Manta/Phala](https://github.com/Manta-Network/manta-indexer/pull/30)
Expand Down
91 changes: 53 additions & 38 deletions javascript/packages/cli/src/actions/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ const options: OptIf = {};
* @returns
*/
export async function setup(params: any, opts?: any) {
// If the platform is MacOS then the repos needs to be cloned and run locally by the user
// If the platform is MacOS (intel) then the repos needs to be cloned and run locally by the user
// as polkadot and/or polkadot-parachain do not release a valid binaries for MacOS
if (process.platform === "darwin") {
if (process.platform === "darwin" && process.arch !== "arm64") {
console.log(
`${decorators.red(
"\n\n------------------------------------------------------------------------\n\nNote: ",
)} You are using MacOS. Please, clone Polkadot SDK from ` +
)} You are using MacOS (intel). Please, clone Polkadot SDK from ` +
decorators.cyan("https://github.com/paritytech/polkadot-sdk") +
` \n in order to build the polkadot and/or polkadot-parachain locally.\n At the moment there is no binaries for MacOs as releases.` +
decorators.red(
Expand All @@ -42,16 +42,18 @@ export async function setup(params: any, opts?: any) {
}

console.log(decorators.green("\n\n🧟🧟🧟 ZombieNet Setup 🧟🧟🧟\n\n"));
if (!["linux"].includes(process.platform)) {
if (!isValidHost()) {
console.log(
"Zombienet setup currently supports only linux. \n Alternative, you can use k8s or podman. For more read here: https://github.com/paritytech/zombienet#requirements-by-provider",
"Zombienet setup currently supports only linux(x64) and MacOS (arm64). \n Alternative, you can use k8s or podman. For more read here: https://github.com/paritytech/zombienet#requirements-by-provider",
);
return;
}

console.log(decorators.green("Gathering latest releases' versions...\n"));
const arch_sufix = process.arch === "arm64" ? "aarch64-apple-darwin" : "";

await new Promise<void>((resolve) => {
latestPolkadotReleaseURL(POLKADOT_SDK, POLKADOT).then(
latestPolkadotReleaseURL(POLKADOT_SDK, `${POLKADOT}-${arch_sufix}`).then(
(res: [string, string]) => {
options[POLKADOT] = {
name: POLKADOT,
Expand All @@ -64,46 +66,47 @@ export async function setup(params: any, opts?: any) {
});

await new Promise<void>((resolve) => {
latestPolkadotReleaseURL(POLKADOT_SDK, POLKADOT_PREPARE_WORKER).then(
(res: [string, string]) => {
options[POLKADOT_PREPARE_WORKER] = {
name: POLKADOT_PREPARE_WORKER,
url: res[0],
size: res[1],
};
resolve();
},
);
latestPolkadotReleaseURL(
POLKADOT_SDK,
`${POLKADOT_PREPARE_WORKER}-${arch_sufix}`,
).then((res: [string, string]) => {
options[POLKADOT_PREPARE_WORKER] = {
name: POLKADOT_PREPARE_WORKER,
url: res[0],
size: res[1],
};
resolve();
});
});

await new Promise<void>((resolve) => {
latestPolkadotReleaseURL(POLKADOT_SDK, POLKADOT_EXECUTE_WORKER).then(
(res: [string, string]) => {
options[POLKADOT_EXECUTE_WORKER] = {
name: POLKADOT_EXECUTE_WORKER,
url: res[0],
size: res[1],
};
resolve();
},
);
latestPolkadotReleaseURL(
POLKADOT_SDK,
`${POLKADOT_EXECUTE_WORKER}-${arch_sufix}`,
).then((res: [string, string]) => {
options[POLKADOT_EXECUTE_WORKER] = {
name: POLKADOT_EXECUTE_WORKER,
url: res[0],
size: res[1],
};
resolve();
});
});

await new Promise<void>((resolve) => {
latestPolkadotReleaseURL(POLKADOT_SDK, POLKADOT_PARACHAIN).then(
(res: [string, string]) => {
options[POLKADOT_PARACHAIN] = {
name: POLKADOT_PARACHAIN,
url: res[0],
size: res[1],
};
resolve();
},
);
latestPolkadotReleaseURL(
POLKADOT_SDK,
`${POLKADOT_PARACHAIN}-${arch_sufix}`,
).then((res: [string, string]) => {
options[POLKADOT_PARACHAIN] = {
name: POLKADOT_PARACHAIN,
url: res[0],
size: res[1],
};
resolve();
});
});

// If the platform is MacOS then the polkadot repo needs to be cloned and run locally by the user
// as polkadot do not release a binary for MacOS
if (params[0] === "all") {
params = [POLKADOT, POLKADOT_PARACHAIN];
}
Expand Down Expand Up @@ -165,6 +168,18 @@ export async function setup(params: any, opts?: any) {
}

// helper fns

// Check if the host is a valid platform/arch
const isValidHost = (): boolean => {
const isValid =
process.platform === "linux" && process.arch === "x64"
? true
: process.platform === "darwin" && process.arch === "arm64"
? true
: false;

return isValid;
};
// Download the binaries
const downloadBinaries = async (binaries: string[]): Promise<void> => {
try {
Expand Down
2 changes: 1 addition & 1 deletion scripts/ci/docker/zombienet_injected.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ RUN mkdir -p /etc/zombie-net
# USER nonroot

# install rust
ENV RUST_VERSION=1.80.0
ENV RUST_VERSION=1.81.0
RUN curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain $RUST_VERSION -y
ENV PATH $PATH:/home/nonroot/.cargo/bin
# install nextest
Expand Down
4 changes: 2 additions & 2 deletions tests/scale-net/0001-scale-net.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ chain = "rococo-local"

[[relaychain.node_groups]]
name = "a"
count = 1
count = 2
{% include("./a-group.toml")%}

[[relaychain.node_groups]]
name = "b"
count = 1
count = 2
{% include("./b-group.toml")%}

{% for id in [100,200] %}
Expand Down

0 comments on commit 186e8ac

Please sign in to comment.