Skip to content
This repository has been archived by the owner on Jun 24, 2024. It is now read-only.

Use git URL for normal cargo build, and vendored file path for Nix build #155

Merged
merged 5 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 76 additions & 15 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

[patch.crates-io]

sov-ibc = { path = "modules/sov-ibc" }
Expand All @@ -21,17 +20,79 @@ ibc-testkit = { git = "https://github.com/cosmos/ibc-rs.git"
basecoin = { git = "https://github.com/informalsystems/basecoin-rs.git", rev = "61256f9" }
jmt = { git = "https://github.com/penumbra-zone/jmt.git", rev = "1d007e11cb68aa5ca13e9a5af4a12e6439d5f7b6" }

sov-modules-api = { path = "vendor/sovereign-sdk/module-system/sov-modules-api" }
sov-state = { path = "vendor/sovereign-sdk/module-system/sov-state" }
sov-bank = { path = "vendor/sovereign-sdk/module-system/module-implementations/sov-bank" }
sov-sequencer-registry = { path = "vendor/sovereign-sdk/module-system/module-implementations/sov-sequencer-registry" }
sov-db = { path = "vendor/sovereign-sdk/full-node/sov-db" }
sov-rollup-interface = { path = "vendor/sovereign-sdk/rollup-interface" }
sov-mock-zkvm = { path = "vendor/sovereign-sdk/adapters/mock-zkvm" }
sov-prover-storage-manager = { path = "vendor/sovereign-sdk/full-node/sov-prover-storage-manager" }
sov-kernels = { path = "vendor/sovereign-sdk/module-system/sov-kernels" }
sov-modules-core = { path = "vendor/sovereign-sdk/module-system/sov-modules-core" }
sov-celestia-adapter = { path = "vendor/sovereign-sdk/adapters/celestia" }
sov-mock-da = { path = "vendor/sovereign-sdk/adapters/mock-da" }
const-rollup-config = { path = "vendor/sovereign-sdk/examples/const-rollup-config" }
sov-chain-state = { path = "vendor/sovereign-sdk/module-system/module-implementations/sov-chain-state" }

# The sovereign-sdk patches are specified in two modes.
# In the normal mode, the uncommented git URLs would allow Cargo to fetch from sovereign-sdk private git repository.
# In Nix mode, the git lines are commented, and the path lines are uncommented, to fetch sovereign-sdk
# modules from a local vendor file path.
# As a result, _both_ git and path entries for each sovereign-sdk module is required, with the path section commented.

[patch.crates-io.sov-modules-api]
# path = "vendor/sovereign-sdk/module-system/sov-modules-api"
git = "ssh://[email protected]/informalsystems/sovereign-sdk-wip.git"
rev = "63fa5f11"

[patch.crates-io.sov-state]
# path = "vendor/sovereign-sdk/module-system/sov-state"
git = "ssh://[email protected]/informalsystems/sovereign-sdk-wip.git"
rev = "63fa5f11"

[patch.crates-io.sov-bank]
# path = "vendor/sovereign-sdk/module-system/module-implementations/sov-bank"
git = "ssh://[email protected]/informalsystems/sovereign-sdk-wip.git"
rev = "63fa5f11"

[patch.crates-io.sov-sequencer-registry]
# path = "vendor/sovereign-sdk/module-system/module-implementations/sov-sequencer-registry"
git = "ssh://[email protected]/informalsystems/sovereign-sdk-wip.git"
rev = "63fa5f11"

[patch.crates-io.sov-db]
# path = "vendor/sovereign-sdk/full-node/sov-db"
git = "ssh://[email protected]/informalsystems/sovereign-sdk-wip.git"
rev = "63fa5f11"

[patch.crates-io.sov-rollup-interface]
# path = "vendor/sovereign-sdk/rollup-interface"
git = "ssh://[email protected]/informalsystems/sovereign-sdk-wip.git"
rev = "63fa5f11"

[patch.crates-io.sov-mock-zkvm]
# path = "vendor/sovereign-sdk/adapters/mock-zkvm"
git = "ssh://[email protected]/informalsystems/sovereign-sdk-wip.git"
rev = "63fa5f11"

[patch.crates-io.sov-prover-storage-manager]
# path = "vendor/sovereign-sdk/full-node/sov-prover-storage-manager"
git = "ssh://[email protected]/informalsystems/sovereign-sdk-wip.git"
rev = "63fa5f11"

[patch.crates-io.sov-kernels]
# path = "vendor/sovereign-sdk/module-system/sov-kernels"
git = "ssh://[email protected]/informalsystems/sovereign-sdk-wip.git"
rev = "63fa5f11"

[patch.crates-io.sov-modules-core]
# path = "vendor/sovereign-sdk/module-system/sov-modules-core"
git = "ssh://[email protected]/informalsystems/sovereign-sdk-wip.git"
rev = "63fa5f11"

[patch.crates-io.sov-celestia-adapter]
# path = "vendor/sovereign-sdk/adapters/celestia"
git = "ssh://[email protected]/informalsystems/sovereign-sdk-wip.git"
rev = "63fa5f11"

[patch.crates-io.sov-mock-da]
# path = "vendor/sovereign-sdk/adapters/mock-da"
git = "ssh://[email protected]/informalsystems/sovereign-sdk-wip.git"
rev = "63fa5f11"

[patch.crates-io.const-rollup-config]
# path = "vendor/sovereign-sdk/examples/const-rollup-config"
git = "ssh://[email protected]/informalsystems/sovereign-sdk-wip.git"
rev = "63fa5f11"

[patch.crates-io.sov-chain-state]
# path = "vendor/sovereign-sdk/module-system/module-implementations/sov-chain-state"
git = "ssh://[email protected]/informalsystems/sovereign-sdk-wip.git"
rev = "63fa5f11"
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

16 changes: 16 additions & 0 deletions Cargo.lock

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

44 changes: 40 additions & 4 deletions nix/sov-celestia-cw.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,42 @@
, sovereign-sdk-src
}:
let
# Use local file path instead of git URL for sovereign-sdk dependencies
patch-section = builtins.replaceStrings
[
"# path = \"vendor/sovereign-sdk"
"git = \"ssh://[email protected]/informalsystems/sovereign-sdk-wip.git\"\nrev = "
]
[
"path = \"vendor/sovereign-sdk"
"# git = \"ssh://[email protected]/informalsystems/sovereign-sdk-wip.git\"\n# rev = "
]
(builtins.readFile ../.cargo/config.toml)
;

# Comment out Cargo.lock lines that include sovereign-sdk source, since we switch to local file path
cargo-lock = builtins.replaceStrings
[ "source = \"git+ssh://[email protected]/informalsystems/sovereign-sdk-wip.git" ]
[ "# source = \"git+ssh://[email protected]/informalsystems/sovereign-sdk-wip.git" ]
(builtins.readFile ../Cargo.lock)
;

cargo-toml-file = builtins.toFile
"Cargo.toml"
( builtins.concatStringsSep
"\n"
[
(builtins.readFile ../Cargo.toml)
patch-section
]
)
;

cargo-lock-file = builtins.toFile
"Cargo.lock"
cargo-lock
;

sov-celestia-src = nixpkgs.stdenv.mkDerivation {
name = "sov-celestia-src";
dontUnpack = true;
Expand All @@ -16,11 +52,11 @@ let
cp -r ${../modules} $out/modules
cp -r ${../mocks} $out/mocks
cp -r ${../proto} $out/proto

cp -r ${sovereign-sdk-src} $out/vendor/sovereign-sdk
cp ${../Cargo.lock} $out/Cargo.lock

cat ${../Cargo.toml} > $out/Cargo.toml
cat ${../.cargo/config.toml} >> $out/Cargo.toml
cp ${cargo-lock-file} $out/Cargo.lock
cat ${cargo-toml-file} > $out/Cargo.toml
rnbguy marked this conversation as resolved.
Show resolved Hide resolved
'';
};

Expand All @@ -29,7 +65,7 @@ let
src = sov-celestia-src;

cargoLock = {
lockFile = ../Cargo.lock;
lockFile = cargo-lock-file;
outputHashes = {
"basecoin-0.1.0" = "sha256-7huJeHyrS8GVQqE3nu/VEHxuPWsFqEDo1kabLbenBYA=";
"celestia-proto-0.1.0" = "sha256-iUgrctxdJUyhfrEQ0zoVj5AKIqgj/jQVNli5/K2nxK0=";
Expand Down
1 change: 0 additions & 1 deletion vendor/sovereign-sdk
Submodule sovereign-sdk deleted from 63fa5f
Loading