Skip to content

Commit

Permalink
fix: fix nightly tests
Browse files Browse the repository at this point in the history
  • Loading branch information
benluelo committed Nov 1, 2023
1 parent cc3fa2c commit f2b5b6a
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 18 deletions.
13 changes: 13 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ members = [
"lib/*/fuzz",
"tools/generate-rust-sol-bindings",
"light-clients/*",
"e2e/*",
"generated/rust",
"generated/contracts",
"ucli",
Expand Down
6 changes: 5 additions & 1 deletion e2e/all-tests.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
(lib.flip withSystem ({ e2e, networks, pkgs, nixpkgs, crane, self', ... }:
let
epoch-staking = import ./epoch-staking.nix { inherit e2e pkgs; };
upgrades = import ./upgrades.nix { inherit e2e pkgs; unionvisor = self'.packages.unionvisor; bundle = self'.packages.bundle-testnet-next; };
upgrades = import ./upgrades.nix {
inherit e2e pkgs;
unionvisor = self'.packages.unionvisor;
bundle = self'.packages.bundle-testnet-next;
};
in
{
ensure-blocks = import ./ensure-blocks/ensure-blocks.nix { inherit e2e networks pkgs nixpkgs crane; };
Expand Down
11 changes: 3 additions & 8 deletions e2e/ensure-blocks/ensure-blocks.nix
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
{ e2e, pkgs, crane, ... }:
let
ensure-blocks = pkgs.lib.meta.getExe (crane.lib.buildPackage {
inherit (crane.lib.crateNameFromCargoToml { cargoToml = ./Cargo.toml; }) pname version;
buildInputs = [ pkgs.pkg-config pkgs.openssl ];
PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig";
src = crane.lib.cleanCargoSource ./.;
doCheck = false;
cargoVendorDir = crane.lib.vendorCargoDeps { cargoLock = ./Cargo.lock; };
});
ensure-blocks = pkgs.lib.meta.getExe (crane.buildWorkspaceMember {
crateDirFromRoot = "e2e/ensure-blocks";
}).packages.ensure-blocks;
in

e2e.mkTestWithDevnetSetup {
Expand Down
21 changes: 15 additions & 6 deletions e2e/upgrades.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{ e2e, pkgs, unionvisor, bundle, ... }:
let
unionvisorbn = pkgs.lib.meta.getExe unionvisor;
unionvisorBin = pkgs.lib.meta.getExe unionvisor;

mkUpgradeProposal = version: height: pkgs.runCommand "upgrade-proposal" { } ''
mkdir -p $out
Expand All @@ -23,14 +23,21 @@ let
mv proposal-${version}.json $out
'';

forEachNode = f: ''
${f "0"}
${f "1"}
${f "2"}
${f "3"}
'';

upgradeTo = version: height: ''
union.succeed('docker cp ${mkUpgradeProposal version height}/proposal-${version}.json devnet-minimal-uniond-0-1:/proposal-${version}.json')
union.succeed('docker exec devnet-minimal-uniond-0-1 ${unionvisorbn} --root . call --bundle ${bundle} -- tx gov submit-proposal proposal-${version}.json --from val-0 --keyring-backend test --home ./home -y')
union.succeed('docker exec devnet-minimal-uniond-0-1 ${unionvisorBin} --root . call --bundle /bundle -- tx gov submit-proposal proposal-${version}.json --from val-0 --keyring-backend test --home ./home -y')
union.shell_interact()
${forEachNode (id: "union.succeed('docker exec devnet-minimal-uniond-${id}-1 ${unionvisorBin} --root . call --bundle /bundle -- tx gov vote 1 yes --keyring-backend test --from val-${id} --home ./home -y')")}
union.succeed('docker exec devnet-minimal-uniond-0-1 ${unionvisorbn} --root . call --bundle ${bundle} -- tx gov vote 1 yes --keyring-backend test --from val-0 --home ./home -y')
union.succeed('docker exec devnet-minimal-uniond-1-1 ${unionvisorbn} --root . call --bundle ${bundle} -- tx gov vote 1 yes --keyring-backend test --from val-1 --home ./home -y')
union.succeed('docker exec devnet-minimal-uniond-2-1 ${unionvisorbn} --root . call --bundle ${bundle} -- tx gov vote 1 yes --keyring-backend test --from val-2 --home ./home -y')
union.succeed('docker exec devnet-minimal-uniond-3-1 ${unionvisorbn} --root . call --bundle ${bundle} -- tx gov vote 1 yes --keyring-backend test --from val-3 --home ./home -y')
union.wait_until_succeeds('[[ $(curl "http://localhost:26660/block" --fail --silent | ${pkgs.lib.meta.getExe pkgs.jq} ".result.block.header.height | tonumber > ${toString height}") == "true" ]]')
'';
in
Expand All @@ -41,6 +48,8 @@ in
testScript = ''
union.wait_for_open_port(${toString e2e.unionNode.wait_for_open_port})
${forEachNode (id: "union.succeed('docker cp ${bundle} devnet-minimal-uniond-${id}-1:/bundle')")}
# Ensure the union network commits more than one block
union.wait_until_succeeds('[[ $(curl "http://localhost:26660/block" --fail --silent | ${pkgs.lib.meta.getExe pkgs.jq} ".result.block.header.height | tonumber > 1") == "true" ]]')
Expand Down
1 change: 0 additions & 1 deletion lib/unionlabs/src/ibc/lightclients/tendermint/fraction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ impl From<protos::ibc::lightclients::tendermint::v1::Fraction> for Fraction {
}
}

// TODO(benluelo): This will be replaced with tendermint once the solidity contract types are regenerated
#[cfg(feature = "ethabi")]
impl From<Fraction> for contracts::glue::IbcLightclientsTendermintV1FractionData {
fn from(value: Fraction) -> Self {
Expand Down
2 changes: 1 addition & 1 deletion networks/devnet.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
devnet-validator-keys = self'.packages.minimal-validator-keys;
devnet-validator-node-ids = self'.packages.minimal-validator-node-ids;
network = "union-minimal-1";
bundle = self'.packages.bundle-testnet;
bundle = self'.packages.bundle-testnet-3;
};
})
4));
Expand Down
2 changes: 1 addition & 1 deletion unionvisor/src/bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ impl Bundle {

// Read `bundle/meta.json` and deserialize into `BundleMeta`
let meta = path.join("meta.json");
let meta = fs::read_to_string(meta)?;
let meta = fs::read_to_string(dbg!(meta))?;
let meta = serde_json::from_str(&meta)?;

// Check if bundle contains genesis.json
Expand Down

0 comments on commit f2b5b6a

Please sign in to comment.