Skip to content

Commit 049c70f

Browse files
authored
feat: add mkCosmosDevnet builder (#1328)
2 parents 9cd5a2b + 40f6a35 commit 049c70f

File tree

13 files changed

+780
-1559
lines changed

13 files changed

+780
-1559
lines changed

e2e/all-tests.nix

+4-4
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
upgrade-with-tokenfactory-state = upgrades.upgrade-with-tokenfactory-state;
2222

2323
virtualisation-works = e2e.mkTest {
24-
name = "devnet";
24+
name = "full-dev-setup";
2525
nodes = {
2626
devnet = _: {
2727
imports = [
@@ -31,13 +31,13 @@
3131
diskSize = 4 * 1024;
3232
arion = {
3333
backend = "docker";
34-
projects.devnet.settings = networks.devnet;
34+
projects.full-dev-setup.settings = networks.modules.full-dev-setup;
3535
};
3636
};
3737
};
3838
};
3939
testScript = ''
40-
devnet.wait_for_unit("arion-${networks.devnet.project.name}")
40+
devnet.wait_for_unit("arion-${networks.modules.full-dev-setup.project.name}")
4141
'';
4242
};
4343

@@ -52,7 +52,7 @@
5252
'';
5353

5454
nodes = {
55-
devnetEth = e2e.devnetEth.node;
55+
devnetEth = e2e.devnetEthNode.node;
5656
};
5757
};
5858

e2e/e2e.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
diskSize = 4 * 1024;
4242
arion = {
4343
backend = "docker";
44-
projects.union-devnet.settings = networks.modules.devnet-minimal;
44+
projects.union-devnet.settings = networks.modules.devnet-union-minimal;
4545
};
4646
};
4747
};

flake.lock

+19-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

+5-12
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@
7070
url = "github:CosmWasm/wasmvm/v1.5.2";
7171
flake = false;
7272
};
73+
wasmvm-1_5_0 = {
74+
url = "github:CosmWasm/wasmvm/v1.5.0";
75+
flake = false;
76+
};
7377
oxlint = {
7478
url = "github:web-infra-dev/oxc/oxlint_v0.2.6";
7579
flake = false;
@@ -183,10 +187,7 @@
183187
./tools/iaviewer/iaviewer.nix
184188
./networks/e2e-setup.nix
185189
./networks/devnet.nix
186-
./networks/genesis/devnet-minimal.nix
187-
./networks/genesis/devnet.nix
188190
./networks/simulation/simd.nix
189-
./networks/simulation/genesis.nix
190191
./testnet-validator.nix
191192
./e2e/all-tests.nix
192193
./e2e/e2e.nix
@@ -246,6 +247,7 @@
246247
iohk-nix.overlays.crypto
247248
foundry.overlay
248249
(_: _: {
250+
keygen = self'.packages.keygen;
249251
solc =
250252
let
251253
jsoncppVersion = "1.9.3";
@@ -307,15 +309,6 @@
307309
'';
308310

309311
devnetConfig = {
310-
genesisOverwrites = {
311-
app_state = {
312-
staking.params = {
313-
epoch_length = "8";
314-
jailed_validator_threshold = "10";
315-
};
316-
slashing.params = { signed_blocks_window = "10"; };
317-
};
318-
};
319312
validatorCount = 4;
320313
ethereum = { beacon = { validatorCount = 128; }; };
321314
};

networks/devnet.nix

+72-51
Original file line numberDiff line numberDiff line change
@@ -3,53 +3,65 @@
33
let
44
arion = inputs'.arion.packages.default;
55

6-
services = {
7-
devnet-union = (builtins.listToAttrs (builtins.genList
8-
(id: {
9-
name = "uniond-${toString id}";
10-
value = import ./services/uniond.nix {
11-
inherit pkgs;
12-
inherit id;
13-
inherit mkNodeId dbg;
14-
uniond = self'.packages.uniond;
15-
devnet-genesis = self'.packages.devnet-union-genesis;
16-
devnet-priv-validator-keys = self'.packages.devnet-union-priv-validator-keys;
17-
devnet-validator-node-ids = self'.packages.devnet-union-validator-node-ids;
18-
devnet-validator-node-keys = self'.packages.devnet-union-validator-node-keys;
19-
};
20-
})
21-
devnetConfig.validatorCount));
22-
23-
devnet-simd = (builtins.listToAttrs (builtins.genList
24-
(id: {
25-
name = "simd-${toString id}";
26-
value = import ./services/simd.nix {
27-
inherit pkgs;
28-
inherit id;
29-
simd = self'.packages.simd;
30-
simd-genesis = self'.packages.simd-genesis;
31-
simd-validator-keys = self'.packages.simd-validator-keys;
32-
simd-validator-node-ids = self'.packages.simd-validator-node-ids;
33-
};
34-
})
35-
devnetConfig.validatorCount));
36-
37-
union-testnet-genesis = (builtins.listToAttrs (builtins.genList
38-
(id: {
39-
name = "uniond-${toString id}";
40-
value = import ./services/unionvisor.nix {
41-
inherit pkgs;
42-
inherit id;
43-
uniond = (get-flake inputs.v0_15_0).packages.${system}.uniond;
44-
unionvisor = self'.packages.unionvisor;
45-
devnet-genesis = self'.packages.minimal-genesis;
46-
devnet-validator-keys = self'.packages.minimal-validator-keys;
47-
devnet-validator-node-ids = self'.packages.minimal-validator-node-ids;
48-
network = "union-minimal-1";
49-
bundle = self'.packages.bundle-testnet-next;
6+
mkCosmosDevnet = import ./mkCosmosDevnet.nix { inherit pkgs dbg; };
7+
8+
devnet-union = mkCosmosDevnet {
9+
node = self'.packages.uniond;
10+
chainId = "union-devnet-1";
11+
chainName = "union";
12+
keyType = "bn254";
13+
validatorCount = 4;
14+
genesisOverwrites = {
15+
app_state = {
16+
staking.params = {
17+
epoch_length = "8";
18+
jailed_validator_threshold = "10";
5019
};
51-
})
52-
4));
20+
slashing.params = { signed_blocks_window = "10"; };
21+
};
22+
};
23+
lightClients = [
24+
self'.packages.ethereum-light-client-minimal
25+
self'.packages.ethereum-light-client-mainnet
26+
];
27+
cosmwasmContracts = [
28+
self'.packages.ucs00-pingpong
29+
self'.packages.ucs01-relay
30+
];
31+
portIncrease = 0;
32+
};
33+
34+
devnet-simd = mkCosmosDevnet {
35+
node = self'.packages.simd;
36+
chainId = "simd-devnet-1";
37+
chainName = "simd";
38+
keyType = "ed25519";
39+
validatorCount = 4;
40+
lightClients = [
41+
self'.packages.cometbls-light-client
42+
];
43+
cosmwasmContracts = [
44+
self'.packages.ucs00-pingpong
45+
self'.packages.ucs01-relay
46+
];
47+
portIncrease = 100;
48+
};
49+
50+
devnet-union-minimal = mkCosmosDevnet {
51+
node = (get-flake inputs.v0_19_0).packages.${system}.uniond;
52+
chainId = "union-minimal-devnet-1";
53+
chainName = "union-minimal";
54+
keyType = "bn254";
55+
validatorCount = 4;
56+
portIncrease = 0;
57+
};
58+
59+
services = {
60+
devnet-union = devnet-union.services;
61+
62+
devnet-simd = devnet-simd.services;
63+
64+
devnet-union-minimal = devnet-union-minimal.services;
5365

5466
devnet-eth = {
5567
geth = import ./services/geth.nix {
@@ -79,16 +91,16 @@
7991
services = services.devnet-eth // services.devnet-union // services.postgres;
8092
};
8193

82-
devnet-minimal = {
83-
project.name = "devnet-minimal";
84-
services = services.union-testnet-genesis;
85-
};
86-
8794
devnet-union = {
8895
project.name = "devnet-union";
8996
services = services.devnet-union;
9097
};
9198

99+
devnet-union-minimal = {
100+
project.name = "devnet-union-minimal";
101+
services = services.devnet-union-minimal;
102+
};
103+
92104
devnet-simd = {
93105
project.name = "devnet-simd";
94106
services = services.devnet-simd;
@@ -151,9 +163,18 @@
151163
packages = {
152164
full-dev-setup = mkCi (system == "x86_64-linux") (mkArionBuild build.full-dev-setup "full-dev-setup");
153165
devnet-union = mkCi (system == "x86_64-linux") (mkArionBuild build.devnet-union "devnet-union");
166+
devnet-union-home = mkCi false (devnet-union.devnet-home);
154167
devnet-simd = mkCi (system == "x86_64-linux") (mkArionBuild build.devnet-simd "devnet-simd");
155168
devnet-eth = mkCi (system == "x86_64-linux") (mkArionBuild build.devnet-eth "devnet-eth");
156169
voyager-queue = mkCi false (mkArionBuild build.voyager-queue "voyager-queue");
170+
171+
# FIXME: This shouldn't be defined in this file
172+
devnet-eth-config = pkgs.linkFarm "devnet-eth-config" [
173+
{ name = "genesis.json"; path = "${./genesis/devnet-eth/genesis.json}"; }
174+
{ name = "dev-key0.prv"; path = "${./genesis/devnet-eth/dev-key0.prv}"; }
175+
{ name = "dev-key1.prv"; path = "${./genesis/devnet-eth/dev-key1.prv}"; }
176+
{ name = "dev-jwt.prv"; path = "${./genesis/devnet-eth/dev-jwt.prv}"; }
177+
];
157178
};
158179

159180
_module.args.networks.modules = modules;

0 commit comments

Comments
 (0)