Skip to content

Commit 29afd27

Browse files
committed
style: Reformat zkVM-related source
1 parent 4fccdef commit 29afd27

File tree

19 files changed

+240
-215
lines changed

19 files changed

+240
-215
lines changed

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ A Nix flake offering blockchain development tools
77
This repo is provided as a Nix Flake. The packages defined here can be consumed
88
via one of the flake output categories:
99

10-
* `overlays.default` (which you can e.g. apply on top of Nixpkgs)
11-
* All packages are placed inside the `metacraft-labs` namespace
12-
* For example: `metacraft-labs.solana`
13-
* `packages.${arch}.${pkg}` - suitable for use with `nix shell`
10+
- `overlays.default` (which you can e.g. apply on top of Nixpkgs)
11+
- All packages are placed inside the `metacraft-labs` namespace
12+
- For example: `metacraft-labs.solana`
13+
- `packages.${arch}.${pkg}` - suitable for use with `nix shell`
1414

1515
### Blockchain Node Software
1616

1717
| package name | description | supported platforms |
18-
|------------------------------------------|-------------------------------------------------------------------------------------------------------------------------|---------------------------------------------|
18+
| ---------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ------------------------------------------- |
1919
| [avalanche-cli]([avalanche-url]) | Helps developers develop and test subnets | x86_64-linux, x86_64-darwin, aarch64-darwin |
2020
| [bnb-beacon-node]([bnb-beacon-node-url]) | Blockchain with a flexible set of native assets and pluggable modules | x86_64-linux, x86_64-darwin, aarch64-darwin |
2121
| [cardano]([cardano-url]) | HTTP server & command-line for managing UTxOs and HD wallets in Cardano | x86_64-linux, x86_64-darwin |
@@ -33,7 +33,7 @@ via one of the flake output categories:
3333
### ZK Circuit-related Software
3434

3535
| package name | description | supported platforms |
36-
|----------------------------------------|----------------------------------------------------------------------------|---------------------------------------------|
36+
| -------------------------------------- | -------------------------------------------------------------------------- | ------------------------------------------- |
3737
| [circom]([circom-url]) | zkSnark circuit compiler | x86_64-linux, x86_64-darwin, aarch64-darwin |
3838
| [circom_runtime]([circom_runtime-url]) | The code needed to calculate the witness by a circuit compiled with circom | x86_64-linux, x86_64-darwin, aarch64-darwin |
3939
| [ffiasm]([ffiasm-url]) | A script that generates a Finite field Library in Intel64 and ARM Assembly | x86_64-linux, x86_64-darwin |
@@ -47,7 +47,7 @@ via one of the flake output categories:
4747
#### Virtual Machines
4848

4949
| package name | description | supported platforms |
50-
|------------------------|--------------------------------------------------------------------------------------------------------------------|---------------------|
50+
| ---------------------- | ------------------------------------------------------------------------------------------------------------------ | ------------------- |
5151
| [jolt]([jolt-url]) | RISC-V-based zkVM with simplicity, speed and extensibility in mind | x86_64-linux |
5252
| [nexus]([nexus-url]) | A modular, extensible and highly-parallelized zkVM | x86_64-linux |
5353
| [risc0]([risc0-url]) | Zero-knowledge verifiable general computing platform based on zk-STARKS and RISC-V | x86_64-linux |
@@ -58,30 +58,30 @@ via one of the flake output categories:
5858
#### Virtual Machine Rust forks
5959

6060
| package name | description | supported platforms |
61-
|------------------------------------------|-----------------------------------------------------------|---------------------|
61+
| ---------------------------------------- | --------------------------------------------------------- | ------------------- |
6262
| [jolt-guest-rust]([jolt-guest-rust-url]) | Rust with the riscv32im-jolt-zkvm-elf compilation target | x86_64-linux |
6363
| [risc0-rust]([risc0-rust-url]) | Rust with the riscv32im-risc0-zkvm-elf compilation target | x86_64-linux |
6464

6565
### General Dev Tools
6666

6767
| package name | description | supported platforms |
68-
|------------------------------|---------------------------------------------------------------------------------------------------------------------------|---------------------------------------------|
68+
| ---------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------- |
6969
| [emscripten][emscripten-url] | An LLVM-to-WebAssembly Compiler | x86_64-linux, x86_64-darwin, aarch64-darwin |
7070
| [kurtosis]([kurtosis-url]) | A platform for packaging and launching ephemeral backend stacks with a focus on approachability for the average developer | x86_64-linux |
7171

7272
### Libraries
7373

7474
#### Cryptography-related
7575

76-
| package name | description | supported platforms |
77-
|----------------------------|--------------------------------------------------------------------------------|---------------------------------------------|
78-
| [blst]([blst-url]) | Multilingual BLS12-381 signature library | x86_64-linux, x86_64-darwin, aarch64-darwin |
79-
| [py-ecc]([py-ecc-url]) | Python implementation of ECC pairing and bn_128 and bls12_381 curve operations | x86_64-linux |
76+
| package name | description | supported platforms |
77+
| ---------------------- | ------------------------------------------------------------------------------ | ------------------------------------------- |
78+
| [blst]([blst-url]) | Multilingual BLS12-381 signature library | x86_64-linux, x86_64-darwin, aarch64-darwin |
79+
| [py-ecc]([py-ecc-url]) | Python implementation of ECC pairing and bn_128 and bls12_381 curve operations | x86_64-linux |
8080

8181
#### General-purpose
8282

8383
| package name | description | supported platforms |
84-
|----------------------------|------------------------------------------------|---------------------|
84+
| -------------------------- | ---------------------------------------------- | ------------------- |
8585
| [pistache]([pistache-url]) | A high-performance REST toolkit written in C++ | x86_64-linux |
8686

8787
[cosmos-url]: https://github.com/hyphacoop/testnets/blob/master/local/previous-local-testnets/v7-theta/priv_validator_key.json

flake.nix

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,12 @@
6464
pkgs = final;
6565
inherit config;
6666
};
67-
devShells.nexus = import ./shells/nexus.nix {pkgs = final;};
68-
devShells.jolt = import ./shells/jolt.nix {pkgs = final;};
69-
devShells.zkm = import ./shells/zkm.nix {pkgs = final;};
70-
devShells.zkwasm = import ./shells/zkwasm.nix {pkgs = final;};
71-
devShells.sp1 = import ./shells/sp1.nix {pkgs = final;};
72-
devShells.risc0 = import ./shells/risc0.nix {pkgs = final;};
67+
devShells.nexus = import ./shells/nexus.nix { pkgs = final; };
68+
devShells.jolt = import ./shells/jolt.nix { pkgs = final; };
69+
devShells.zkm = import ./shells/zkm.nix { pkgs = final; };
70+
devShells.zkwasm = import ./shells/zkwasm.nix { pkgs = final; };
71+
devShells.sp1 = import ./shells/sp1.nix { pkgs = final; };
72+
devShells.risc0 = import ./shells/risc0.nix { pkgs = final; };
7373
};
7474
};
7575
}

packages/all-packages.nix

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -130,25 +130,27 @@
130130
polkadot = polkadot-generic { };
131131
polkadot-fast = polkadot-generic { enableFastRuntime = true; };
132132

133-
fetchGitHubFile = {
134-
owner,
135-
repo,
136-
rev,
137-
file,
138-
hash
139-
}:
133+
fetchGitHubFile =
134+
{
135+
owner,
136+
repo,
137+
rev,
138+
file,
139+
hash,
140+
}:
140141
pkgs.fetchurl {
141-
url = "https://raw.githubusercontent.com/${owner}/${repo}/${rev}/${file}";
142-
inherit hash;
142+
url = "https://raw.githubusercontent.com/${owner}/${repo}/${rev}/${file}";
143+
inherit hash;
143144
};
144145

145-
fetchGitHubReleaseAsset = {
146-
owner,
147-
repo,
148-
tag,
149-
asset,
150-
hash
151-
}:
146+
fetchGitHubReleaseAsset =
147+
{
148+
owner,
149+
repo,
150+
tag,
151+
asset,
152+
hash,
153+
}:
152154
pkgs.fetchzip {
153155
url = "https://github.com/${owner}/${repo}/releases/download/${tag}/${asset}";
154156
inherit hash;
@@ -224,9 +226,9 @@
224226
inherit corepack-shims;
225227
}
226228
// lib.optionalAttrs hostPlatform.isLinux rec {
227-
kurtosis = callPackage ./kurtosis/default.nix {};
229+
kurtosis = callPackage ./kurtosis/default.nix { };
228230

229-
wasmd = callPackage ./wasmd/default.nix {};
231+
wasmd = callPackage ./wasmd/default.nix { };
230232

231233
# Solana
232234
# solana-validator = callPackage ./solana-validator {};
Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
{ stdenv,
1+
{
2+
stdenv,
23
fetchGitHubReleaseAsset,
34
autoPatchelfHook,
45
zlib,
@@ -7,28 +8,28 @@
78
let
89
nightly-hash = "8af9d45d5e09a04832cc9b2e1df993fd1ce49d02";
910
in
10-
stdenv.mkDerivation rec {
11-
name = "jolt-guest-rust"; # Used when guest is compiled with std
12-
version = "nightly-${nightly-hash}";
11+
stdenv.mkDerivation rec {
12+
name = "jolt-guest-rust"; # Used when guest is compiled with std
13+
version = "nightly-${nightly-hash}";
1314

14-
nativeBuildInputs = [
15-
autoPatchelfHook
16-
stdenv.cc.cc.lib
17-
zlib
18-
];
15+
nativeBuildInputs = [
16+
autoPatchelfHook
17+
stdenv.cc.cc.lib
18+
zlib
19+
];
1920

20-
installPhase = ''
21-
runHook preInstall
22-
mkdir -p $out
23-
cp -r ./* $out/
24-
runHook postInstall
25-
'';
21+
installPhase = ''
22+
runHook preInstall
23+
mkdir -p $out
24+
cp -r ./* $out/
25+
runHook postInstall
26+
'';
2627

27-
src = fetchGitHubReleaseAsset {
28-
owner = "a16z";
29-
repo = "rust";
30-
tag = "${version}";
31-
asset = "rust-toolchain-x86_64-unknown-linux-gnu.tar.gz";
32-
hash = "sha256-aAhqLAvbeIh60R/E1c85KxWmYDH2SOpXhQChW3y3wgQ=";
33-
};
34-
}
28+
src = fetchGitHubReleaseAsset {
29+
owner = "a16z";
30+
repo = "rust";
31+
tag = "${version}";
32+
asset = "rust-toolchain-x86_64-unknown-linux-gnu.tar.gz";
33+
hash = "sha256-aAhqLAvbeIh60R/E1c85KxWmYDH2SOpXhQChW3y3wgQ=";
34+
};
35+
}

packages/jolt/default.nix

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
{ rust-bin,
1+
{
2+
rust-bin,
23
craneLib-nightly,
34
fetchFromGitHub,
45
fetchGitHubFile,
@@ -31,39 +32,40 @@ let
3132
};
3233
};
3334

34-
rust-toolchain = rust-bin.fromRustupToolchainFile
35-
(fetchGitHubFile {
36-
inherit (commonArgs.src) owner repo rev;
37-
file = "rust-toolchain.toml";
38-
hash = "sha256-Fyj+Bp/dt3epuTN9kXN+r7Z3gzXYCDrcVEPWTr1sQqk=";
39-
});
35+
rust-toolchain = rust-bin.fromRustupToolchainFile (fetchGitHubFile {
36+
inherit (commonArgs.src) owner repo rev;
37+
file = "rust-toolchain.toml";
38+
hash = "sha256-Fyj+Bp/dt3epuTN9kXN+r7Z3gzXYCDrcVEPWTr1sQqk=";
39+
});
4040
craneLib = craneLib-nightly.overrideToolchain rust-toolchain;
4141
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
4242
in
43-
craneLib.buildPackage (commonArgs
44-
// (installSourceAndCargo rust-toolchain)
45-
// rec {
46-
inherit cargoArtifacts;
43+
craneLib.buildPackage (
44+
commonArgs
45+
// (installSourceAndCargo rust-toolchain)
46+
// rec {
47+
inherit cargoArtifacts;
4748

48-
postPatch = ''
49-
sed -i 's|package =.*git = "https://github.com/a16z/jolt"|path = "'$out'"|' src/main.rs
50-
sed -i '44,46d' jolt-core/src/host/toolchain.rs
51-
'';
49+
postPatch = ''
50+
sed -i 's|package =.*git = "https://github.com/a16z/jolt"|path = "'$out'"|' src/main.rs
51+
sed -i '44,46d' jolt-core/src/host/toolchain.rs
52+
'';
5253

53-
# Different toolchain is used when guest has std features
54-
# https://github.com/a16z/jolt/blob/fa45507aaddb1815bafd54332e4b14173a7f8699/jolt-core/src/host/mod.rs#L132-L134
55-
postInstall = ''
56-
rm $out/bin/cargo
57-
cat <<EOF > $out/bin/cargo
58-
#!/bin/sh
59-
if [ -n "\''${RUSTUP_TOOLCHAIN+x}" ]
60-
then
61-
export PATH="${jolt-guest-rust}/rust/build/host/stage2/bin:\$PATH"
62-
fi
63-
${rust-toolchain}/bin/cargo \$@
64-
EOF
65-
chmod +x $out/bin/cargo
66-
'';
54+
# Different toolchain is used when guest has std features
55+
# https://github.com/a16z/jolt/blob/fa45507aaddb1815bafd54332e4b14173a7f8699/jolt-core/src/host/mod.rs#L132-L134
56+
postInstall = ''
57+
rm $out/bin/cargo
58+
cat <<EOF > $out/bin/cargo
59+
#!/bin/sh
60+
if [ -n "\''${RUSTUP_TOOLCHAIN+x}" ]
61+
then
62+
export PATH="${jolt-guest-rust}/rust/build/host/stage2/bin:\$PATH"
63+
fi
64+
${rust-toolchain}/bin/cargo \$@
65+
EOF
66+
chmod +x $out/bin/cargo
67+
'';
6768

68-
doCheck = false;
69-
})
69+
doCheck = false;
70+
}
71+
)

packages/nexus/default.nix

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
{ rust-bin,
1+
{
2+
rust-bin,
23
craneLib-nightly,
34
fetchFromGitHub,
45
installSourceAndCargo,
@@ -30,19 +31,21 @@ let
3031
};
3132

3233
rust-toolchain = rust-bin.nightly.latest.default.override {
33-
targets = ["riscv32i-unknown-none-elf"];
34+
targets = [ "riscv32i-unknown-none-elf" ];
3435
};
3536
craneLib = craneLib-nightly.overrideToolchain rust-toolchain;
3637
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
3738
in
38-
craneLib.buildPackage (commonArgs
39-
// (installSourceAndCargo rust-toolchain)
40-
// rec {
41-
inherit cargoArtifacts;
39+
craneLib.buildPackage (
40+
commonArgs
41+
// (installSourceAndCargo rust-toolchain)
42+
// rec {
43+
inherit cargoArtifacts;
4244

43-
postPatch = ''
44-
sed -i '/"add"/{n;s/--git/--path/;n;s|".*"|"'$out'/runtime"|}' cli/src/command/new.rs
45-
'';
45+
postPatch = ''
46+
sed -i '/"add"/{n;s/--git/--path/;n;s|".*"|"'$out'/runtime"|}' cli/src/command/new.rs
47+
'';
4648

47-
doCheck = false;
48-
})
49+
doCheck = false;
50+
}
51+
)

packages/risc0-rust/default.nix

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
{ stdenv,
1+
{
2+
stdenv,
23
fetchGitHubReleaseAsset,
34
autoPatchelfHook,
45
zlib,
@@ -24,7 +25,7 @@ stdenv.mkDerivation rec {
2425
src = fetchGitHubReleaseAsset {
2526
owner = "risc0";
2627
repo = "rust";
27-
tag = "r0.${version}";
28+
tag = "r0.${version}";
2829
asset = "rust-toolchain-x86_64-unknown-linux-gnu.tar.gz";
2930
hash = "sha256-CzeZKT5Ubjk9nZZ2I12ak5Vnv2kFQNuueyzAF+blprU=";
3031
};

0 commit comments

Comments
 (0)