Skip to content

Commit

Permalink
normalize casper-node-config and casper-chainspec
Browse files Browse the repository at this point in the history
  • Loading branch information
marijanp committed Aug 9, 2024
1 parent ed0ba18 commit c6f8310
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 25 deletions.
30 changes: 14 additions & 16 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,7 @@
targets.wasm32-unknown-unknown.stable.rust-std
];
craneLib = inputs.crane.lib.${system}.overrideToolchain rustToolchain;

# TODO reuse in nixos tests
cctlConfig = {
chainspec = pkgs.fetchurl {
url = "https://raw.githubusercontent.com/cspr-rad/casper-node/a8ba82edc949959ea3240f06cc9d64db50d42d64/resources/production/chainspec.toml";
hash = "sha256-tStzzhCa/NtmmvMcPjkpB23RN8qhDjAYkMOjo2Tvess=";
};
config = pkgs.fetchurl {
url = "https://raw.githubusercontent.com/cspr-rad/casper-node/53136ac5f004f2ae70a75b4eeb2ff7d907aff6aa/resources/local/config.toml";
hash = "sha256-ZuNbxw0nBjuONEZRK8Ru96zZQak4MEQ/eM1fA6esyCM=";
};
};
cctl = inputs'.cctl.packages.cctl.override { casper-node = inputs'.csprpkgs.packages.casper-node; };

kairosContractsAttrs = {
src = lib.cleanSourceWith {
Expand Down Expand Up @@ -180,8 +169,8 @@

PATH_TO_WASM_BINARIES = "${self'.packages.kairos-contracts}/bin";
PATH_TO_SESSION_BINARIES = "${self'.packages.kairos-session-code}/bin";
CCTL_CONFIG = "${cctlConfig.config}";
CCTL_CHAINSPEC = "${cctlConfig.chainspec}";
CCTL_CONFIG = self'.packages.casper-node-config;
CCTL_CHAINSPEC = self'.packages.casper-chainspec;
KAIROS_SERVER_MIGRATIONS = kairosServerMigrations;

meta.mainProgram = "kairos-server";
Expand All @@ -194,8 +183,8 @@
CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_LINKER = "lld";
PATH_TO_WASM_BINARIES = "${self'.packages.kairos-contracts}/bin";
PATH_TO_SESSION_BINARIES = "${self'.packages.kairos-session-code}/bin";
CCTL_CONFIG = "${cctlConfig.config}";
CCTL_CHAINSPEC = "${cctlConfig.chainspec}";
CCTL_CONFIG = self'.packages.casper-node-config;
CCTL_CHAINSPEC = self'.packages.casper-chainspec;
KAIROS_SERVER_MIGRATIONS = kairosServerMigrations;
inputsFrom = [ self'.packages.kairos self'.packages.kairos-contracts ];
packages = [ pkgs.diesel-cli ];
Expand Down Expand Up @@ -252,6 +241,15 @@
kairos-session-code = craneLib.buildPackage (kairosSessionCodeAttrs // {
pname = "kairos-session-code";
});

casper-chainspec = pkgs.fetchurl {
url = "https://raw.githubusercontent.com/cspr-rad/casper-node/a8ba82edc949959ea3240f06cc9d64db50d42d64/resources/production/chainspec.toml";
hash = "sha256-tStzzhCa/NtmmvMcPjkpB23RN8qhDjAYkMOjo2Tvess=";
};
casper-node-config = pkgs.fetchurl {
url = "https://raw.githubusercontent.com/cspr-rad/casper-node/53136ac5f004f2ae70a75b4eeb2ff7d907aff6aa/resources/local/config.toml";
hash = "sha256-ZuNbxw0nBjuONEZRK8Ru96zZQak4MEQ/eM1fA6esyCM=";
};
};

checks = {
Expand Down
2 changes: 1 addition & 1 deletion nixos/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ in
./tests/end-to-end.nix
{
inherit mkKairosHostConfig;
inherit (self.packages.${pkgs.system}) kairos kairos-contracts casper-client-rs;
inherit (self.packages.${pkgs.system}) kairos kairos-contracts casper-client-rs casper-node-config casper-chainspec;
cctlModule = self.nixosModules.cctl;
};
};
Expand Down
12 changes: 4 additions & 8 deletions nixos/tests/end-to-end.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
, fetchurl
, casper-client-rs
, writeShellScript
, casper-chainspec
, casper-node-config
, jq
}:
let
Expand Down Expand Up @@ -44,14 +46,8 @@ nixosTest {
port = cctlPort;
workingDirectory = cctlWorkingDirectory;
contract = { "${contractHashName}" = kairos-contracts + "/bin/demo-contract-optimized.wasm"; };
chainspec = fetchurl {
url = "https://raw.githubusercontent.com/cspr-rad/casper-node/53136ac5f004f2ae70a75b4eeb2ff7d907aff6aa/resources/local/chainspec.toml.in";
hash = "sha256-b/6c5o3JXFlaTgTHxs8JepaHzjMG75knzlKKqRd/7pc=";
};
config = fetchurl {
url = "https://raw.githubusercontent.com/cspr-rad/casper-node/53136ac5f004f2ae70a75b4eeb2ff7d907aff6aa/resources/local/config.toml";
hash = "sha256-ZuNbxw0nBjuONEZRK8Ru96zZQak4MEQ/eM1fA6esyCM=";
};
chainspec = casper-chainspec;
config = casper-node-config;
};

services.kairos = {
Expand Down

0 comments on commit c6f8310

Please sign in to comment.