Skip to content

Commit 2f8547d

Browse files
authored
chore(voyager): clean up nix (#4151)
2 parents 293ca83 + 17f850d commit 2f8547d

File tree

28 files changed

+220
-141
lines changed

28 files changed

+220
-141
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ chrono = { version = "0.4.26", default-features = false }
361361
clap = { version = "4.3.0", default-features = false, features = ["std"] } # clap has a fake std feature that is required to be enabled by default
362362
color-eyre = { version = "0.6.2", default-features = false }
363363
cosmwasm-schema = { version = "2.1.4", default-features = false }
364-
cosmwasm-std = { version = "2.1.4", default-features = false }
364+
cosmwasm-std = { version = "2.1.4", default-features = false, features = ["std"] } # cosmwasm-std has a fake std feature that is requried to be enabled by default
365365
crossbeam-queue = { version = "0.3.8", default-features = false }
366366
cw-storage-plus = { version = "2.0.0", default-features = false }
367367
dashmap = { version = "5.5.3", default-features = false }

flake.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

garnix.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ builds:
5858
- 'packages.*.uniond-release-image'
5959
- 'packages.*.voyager'
6060
- 'packages.*.voyager-modules'
61+
- 'checks.*.all-crates-buildable-individually'
62+
- 'packages.*.voyager-modules-plugins-names'
6163
branch: main
6264
# build x86_64 on all branches
6365
- include:
@@ -102,4 +104,6 @@ builds:
102104
- 'packages.*.uniond-release-image'
103105
- 'packages.*.voyager'
104106
- 'packages.*.voyager-modules'
107+
- 'checks.*.all-crates-buildable-individually'
108+
- 'packages.*.voyager-modules-plugins-names'
105109
enableGithubOrgAccessTokens: true

lib/aptos-verifier/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ workspace = true
1414
[dependencies]
1515
bcs = { workspace = true }
1616
hex-literal = { workspace = true }
17-
sha3 = { workspace = true }
17+
sha3 = { workspace = true, features = ["std"] }
1818
thiserror = { workspace = true }
1919
unionlabs = { workspace = true }

lib/bob-light-client-types/src/header.rs

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,25 +47,34 @@ pub struct L2Header {
4747
pub receipts_root: H256,
4848
// Box since 256 bytes is quite large
4949
pub logs_bloom: Box<H2048>,
50-
#[serde(with = "unionlabs::primitives::uint::u256_big_endian_hex")]
50+
#[cfg_attr(
51+
feature = "serde",
52+
serde(with = "unionlabs::primitives::uint::u256_big_endian_hex")
53+
)]
5154
pub difficulty: U256,
52-
#[serde(with = "unionlabs::primitives::uint::u256_big_endian_hex")]
55+
#[cfg_attr(
56+
feature = "serde",
57+
serde(with = "unionlabs::primitives::uint::u256_big_endian_hex")
58+
)]
5359
pub number: U256,
54-
#[serde(with = "::serde_utils::u64_hex")]
60+
#[cfg_attr(feature = "serde", serde(with = "::serde_utils::u64_hex"))]
5561
pub gas_limit: u64,
56-
#[serde(with = "::serde_utils::u64_hex")]
62+
#[cfg_attr(feature = "serde", serde(with = "::serde_utils::u64_hex"))]
5763
pub gas_used: u64,
58-
#[serde(with = "::serde_utils::u64_hex")]
64+
#[cfg_attr(feature = "serde", serde(with = "::serde_utils::u64_hex"))]
5965
pub timestamp: u64,
6066
pub extra_data: H72,
6167
pub mix_hash: H256,
6268
pub nonce: H64,
63-
#[serde(with = "unionlabs::primitives::uint::u256_big_endian_hex")]
69+
#[cfg_attr(
70+
feature = "serde",
71+
serde(with = "unionlabs::primitives::uint::u256_big_endian_hex")
72+
)]
6473
pub base_fee_per_gas: U256,
6574
pub withdrawals_root: H256,
66-
#[serde(with = "::serde_utils::u64_hex")]
75+
#[cfg_attr(feature = "serde", serde(with = "::serde_utils::u64_hex"))]
6776
pub blob_gas_used: u64,
68-
#[serde(with = "::serde_utils::u64_hex")]
77+
#[cfg_attr(feature = "serde", serde(with = "::serde_utils::u64_hex"))]
6978
pub excess_blob_gas: u64,
7079
pub parent_beacon_block_root: H256,
7180
}

lib/ibc-union-spec/src/types/connection.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ pub mod ethabi {
130130
}
131131
}
132132

133+
#[cfg(feature = "ibc-solidity-compat")]
133134
#[derive(Debug, Clone, PartialEq, thiserror::Error)]
134135
pub enum Error {
135136
#[error("invalid connection state")]

lib/voyager-message/src/call.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ pub struct FetchBlocks {
8181
/// The returned [`Op`] ***MUST*** resolve to an [`OrderedHeaders`] data.
8282
/// This is the entrypoint called when a client update is requested, and
8383
/// is intended to be called in the queue of an
84-
/// [`AggregateMsgUpdateClientsFromOrderedHeaders`] message, which will
84+
/// [`AggregateSubmitTxFromOrderedHeaders`] message, which will
8585
/// be used to build the actual [`MsgUpdateClient`]s.
8686
#[model]
8787
pub struct FetchUpdateHeaders {

tools/rust/crane.nix

Lines changed: 84 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -332,8 +332,6 @@
332332
pname = pname';
333333
version = version';
334334

335-
src = crateRepoSource;
336-
337335
dummySrc = craneLib.mkDummySrc crateRepoSource;
338336

339337
# defaults to "--all-targets" otherwise, which breaks some stuff
@@ -405,6 +403,9 @@
405403
(cargoBuild.buildPackage (
406404
extraBuildEnv
407405
// crateAttrs
406+
// {
407+
src = crateRepoSource;
408+
}
408409
// (lib.optionalAttrs (builtins.length crateDirsFromRoot' == 1) {
409410
meta.mainProgram = pname';
410411
})
@@ -435,6 +436,7 @@
435436
passthru = (old.passthru or { }) // {
436437
inherit release;
437438
craneAttrs = crateAttrs // {
439+
src = crateRepoSource;
438440
inherit cargoArtifacts;
439441
};
440442
};
@@ -448,19 +450,16 @@
448450
};
449451
};
450452

451-
cargoWorkspaceSrc =
452-
let
453-
allCargoTomls = builtins.listToAttrs (
454-
map (
455-
dep: lib.nameValuePair dep (lib.importTOML "${root}/${dep}/Cargo.toml")
456-
) workspaceCargoToml.workspace.members
457-
);
458-
in
453+
allCargoTomls = builtins.listToAttrs (
454+
map (
455+
dep: lib.nameValuePair dep (lib.importTOML "${root}/${dep}/Cargo.toml")
456+
) workspaceCargoToml.workspace.members
457+
);
459458

460-
mkCleanSrc {
461-
workspaceMembers = mkRootPaths workspaceCargoToml.workspace.members;
462-
extraIncludes = mkRootPaths ((getIncludes allCargoTomls) ++ (getExtraIncludes allCargoTomls));
463-
};
459+
cargoWorkspaceSrc = mkCleanSrc {
460+
workspaceMembers = mkRootPaths workspaceCargoToml.workspace.members;
461+
extraIncludes = mkRootPaths ((getIncludes allCargoTomls) ++ (getExtraIncludes allCargoTomls));
462+
};
464463
in
465464
{
466465
_module.args = {
@@ -517,6 +516,77 @@
517516
{
518517
cargo-workspace-clippy = craneLib.cargoClippy (cargoWorkspaceAttrs // { inherit cargoArtifacts; });
519518
cargo-workspace-test = craneLib.cargoTest (cargoWorkspaceAttrs // { inherit cargoArtifacts; });
519+
# NOTE: This is currently broken, as some crate features are not working properly
520+
all-crates-buildable-individually = craneLib.mkCargoDerivation (
521+
(builtins.removeAttrs cargoWorkspaceAttrs [
522+
"cargoTestExtraArgs"
523+
"cargoClippyExtraArgs"
524+
])
525+
// {
526+
inherit cargoArtifacts;
527+
pname = "cargo-workspace-individual-check";
528+
# strictDeps = true;
529+
passAsFile = [ "actualBuildPhase" ];
530+
buildPhaseCargoCommand = null;
531+
buildPhase = ''
532+
. "$actualBuildPhasePath"
533+
'';
534+
# if we don't do this (and pass as file above), we hit "Argument list too long"
535+
# no clue why
536+
actualBuildPhase = lib.concatMapStringsSep "\n\n" (
537+
cargoToml:
538+
let
539+
features = builtins.attrNames (builtins.removeAttrs (cargoToml.features or { }) [ "default" ]);
540+
541+
subsets =
542+
xs: n:
543+
if n == 0 then
544+
[ [ ] ]
545+
else if xs == [ ] then
546+
[ ]
547+
else
548+
let
549+
x = builtins.head xs;
550+
xs' = builtins.tail xs;
551+
in
552+
(map (ys: [ x ] ++ ys) (subsets xs' (n - 1))) ++ (subsets xs' n);
553+
554+
allFeatureCombinations = lib.concatLists (
555+
builtins.genList (subsets features) (dbg (builtins.length (dbg features) + 1))
556+
);
557+
in
558+
if cargoToml.package.name == "protos" then
559+
"cargo clippy -p protos --all-features --tests -- -Dwarnings"
560+
else if features == [ ] then
561+
"cargo clippy -p ${cargoToml.package.name} --no-default-features --tests -- -Dwarnings"
562+
else
563+
lib.concatMapStringsSep "\n" (
564+
features:
565+
"cargo clippy -p ${cargoToml.package.name} --no-default-features ${
566+
lib.optionalString (features != [ ]) "-F${lib.concatMapStringsSep "," (f: f) features}"
567+
} --tests -- -Dwarnings"
568+
) allFeatureCombinations
569+
) (builtins.attrValues allCargoTomls);
570+
doInstallCargoArtifacts = false;
571+
}
572+
);
573+
# this would probably be better for caching but it's an insanely massive derivation
574+
# all-crates-buildable-individually = pkgs.linkFarmFromDrvs "all-crates-buildable-individually" (
575+
# dbg (
576+
# map (
577+
# p:
578+
# craneLib.cargoClippy (
579+
# cargoWorkspaceAttrs
580+
# // {
581+
# inherit cargoArtifacts;
582+
# pname = "${p.name}-individual-check";
583+
# cargoClippyExtraArgs = "-p ${p.name} --tests -- -Dwarnings";
584+
# doInstallCargoArtifacts = false;
585+
# }
586+
# )
587+
# ) (pkgs.lib.mapAttrsToList lib.nameValuePair allCargoTomls)
588+
# )
589+
# );
520590
};
521591

522592
# FIXME: currently ICE, https://github.com/unionlabs/union/actions/runs/8882618404/job/24387814904

unionvisor/unionvisor.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
stdenv,
1212
get-flake,
1313
uniondBundleVersions,
14+
dbg,
1415
...
1516
}:
1617
let

voyager/modules/client-bootstrap/arbitrum/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ arbitrum-client = { workspace = true }
1717
arbitrum-light-client-types = { workspace = true, features = ["serde"] }
1818
arbitrum-types = { workspace = true }
1919
embed-commit = { workspace = true }
20-
ibc-union-spec.workspace = true
20+
ibc-union-spec = { workspace = true, features = ["serde"] }
2121
jsonrpsee = { workspace = true, features = ["macros", "server", "tracing"] }
2222
serde = { workspace = true, features = ["derive"] }
2323
serde_json = { workspace = true }

0 commit comments

Comments
 (0)