vuls: init at 0.27.0
[NixPkgs.git] / nixos / tests / quorum.nix
blobdd0d1540e8455f31994390edd020a7e6ad425980
1 import ./make-test-python.nix ({ pkgs, ... }:
2 let
3   keystore =  {
4     address = "9377bc3936de934c497e22917b81aa8774ac3bb0";
5     crypto = {
6       cipher = "aes-128-ctr";
7       ciphertext = "ad8341d8ef225650403fd366c955f41095e438dd966a3c84b3d406818c1e366c";
8       cipherparams = {
9         iv = "2a09f7a72fd6dff7c43150ff437e6ac2";
10       };
11       kdf = "scrypt";
12       kdfparams = {
13         dklen = 32;
14         n = 262144;
15         p = 1;
16         r = 8;
17         salt = "d1a153845bb80cd6274c87c5bac8ac09fdfac5ff131a6f41b5ed319667f12027";
18       };
19       mac = "a9621ad88fa1d042acca6fc2fcd711f7e05bfbadea3f30f379235570c8e270d3";
20     };
21     id = "89e847a3-1527-42f6-a321-77de0a14ce02";
22     version = 3;
23   };
24   keystore-file = pkgs.writeText "keystore-file" (builtins.toJSON keystore);
27   name = "quorum";
28   meta = with pkgs.lib.maintainers; {
29     maintainers = [ mmahut ];
30   };
32   nodes = {
33     machine = { ... }: {
34       services.quorum = {
35         enable = true;
36         permissioned = false;
37         staticNodes = [ "enode://dd333ec28f0a8910c92eb4d336461eea1c20803eed9cf2c056557f986e720f8e693605bba2f4e8f289b1162e5ac7c80c914c7178130711e393ca76abc1d92f57@0.0.0.0:30303?discport=0" ];
38         genesis = {
39           alloc = {
40             "189d23d201b03ae1cf9113672df29a5d672aefa3" = {
41               balance = "0x446c3b15f9926687d2c40534fdb564000000000000";
42             };
43             "44b07d2c28b8ed8f02b45bd84ac7d9051b3349e6" = {
44               balance = "0x446c3b15f9926687d2c40534fdb564000000000000";
45             };
46             "4c1ccd426833b9782729a212c857f2f03b7b4c0d" = {
47               balance = "0x446c3b15f9926687d2c40534fdb564000000000000";
48             };
49             "7ae555d0f6faad7930434abdaac2274fd86ab516" = {
50               balance = "0x446c3b15f9926687d2c40534fdb564000000000000";
51             };
52             c1056df7c02b6f1a353052eaf0533cc7cb743b52 = {
53               balance = "0x446c3b15f9926687d2c40534fdb564000000000000";
54             };
55           };
56           coinbase = "0x0000000000000000000000000000000000000000";
57           config = {
58             byzantiumBlock = 1;
59             chainId = 10;
60             eip150Block = 1;
61             eip150Hash =
62               "0x0000000000000000000000000000000000000000000000000000000000000000";
63             eip155Block = 1;
64             eip158Block = 1;
65             homesteadBlock = 1;
66             isQuorum = true;
67             istanbul = {
68               epoch = 30000;
69               policy = 0;
70             };
71           };
72         difficulty = "0x1";
73         extraData =
74           "0x0000000000000000000000000000000000000000000000000000000000000000f8aff869944c1ccd426833b9782729a212c857f2f03b7b4c0d94189d23d201b03ae1cf9113672df29a5d672aefa39444b07d2c28b8ed8f02b45bd84ac7d9051b3349e694c1056df7c02b6f1a353052eaf0533cc7cb743b52947ae555d0f6faad7930434abdaac2274fd86ab516b8410000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0";
75         gasLimit = "0xe0000000";
76         gasUsed = "0x0";
77         mixHash =
78           "0x63746963616c2062797a616e74696e65206661756c7420746f6c6572616e6365";
79         nonce = "0x0";
80         number = "0x0";
81         parentHash =
82           "0x0000000000000000000000000000000000000000000000000000000000000000";
83         timestamp = "0x5cffc201";
84       };
85      };
86     };
87   };
89   testScript = ''
90     start_all()
91     machine.succeed("mkdir -p /var/lib/quorum/keystore")
92     machine.succeed(
93         'cp ${keystore-file} /var/lib/quorum/keystore/UTC--2020-03-23T11-08-34.144812212Z--${keystore.address}'
94     )
95     machine.succeed(
96         "echo fe2725c4e8f7617764b845e8d939a65c664e7956eb47ed7d934573f16488efc1 > /var/lib/quorum/nodekey"
97     )
98     machine.succeed("systemctl restart quorum")
99     machine.wait_for_unit("quorum.service")
100     machine.sleep(15)
101     machine.succeed('geth attach /var/lib/quorum/geth.ipc --exec "eth.accounts" | grep ${keystore.address}')
102   '';