Skip to content

Commit

Permalink
feat: use soldeer for solidity dependencies (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
shekohex authored Nov 11, 2024
1 parent bcd0e9b commit bf649e0
Show file tree
Hide file tree
Showing 12 changed files with 61 additions and 16 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/build-setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@

- name: Verify Forge installation
run: forge --version

- name: Install Solidity Dependencies
run: forge soldeer update -d
18 changes: 13 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: CI

on:
pull_request:
branches: [ main ]
branches: [main]
push:
branches: [ main ]
branches: [main]
workflow_dispatch:

concurrency:
Expand All @@ -30,7 +30,6 @@ jobs:
toolchain: nightly-2024-10-13
components: rustfmt


- name: Check Formatting
run: cargo fmt -- --check

Expand All @@ -50,6 +49,9 @@ jobs:
- name: Verify Forge installation
run: forge --version

- name: Install Solidity Dependencies
run: forge soldeer update -d

- uses: dtolnay/rust-toolchain@nightly
with:
toolchain: nightly-2024-10-13
Expand Down Expand Up @@ -81,6 +83,9 @@ jobs:
- name: Verify Forge installation
run: forge --version

- name: Install Solidity Dependencies
run: forge soldeer update -d

- uses: dtolnay/rust-toolchain@nightly
with:
toolchain: nightly-2024-10-13
Expand Down Expand Up @@ -116,6 +121,9 @@ jobs:
- name: Verify Forge installation
run: forge --version

- name: Install Solidity Dependencies
run: forge soldeer update -d

- uses: dtolnay/rust-toolchain@nightly
with:
toolchain: nightly-2024-10-13
Expand All @@ -135,7 +143,7 @@ jobs:
- name: Download Tangle Node
uses: robinraju/release-downloader@v1
with:
repository: 'tangle-network/tangle'
repository: "tangle-network/tangle"
# A flag to set the download target as latest release
# The default value is 'false'
latest: false
Expand All @@ -149,7 +157,7 @@ jobs:
# The name of the file to download.
# Use this field only to specify filenames other than tarball or zipball, if any.
# Supports wildcard pattern (eg: '*', '*.deb', '*.zip' etc..)
fileName: 'tangle-testnet-manual-seal-linux-amd64'
fileName: "tangle-testnet-manual-seal-linux-amd64"

# Download the attached tarball (*.tar.gz)
tarBall: false
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/foundry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
workflow_dispatch:

concurrency:
group: rust-validation-${{ github.head_ref }}
group: forge-validation-${{ github.head_ref }}
cancel-in-progress: true

env:
Expand All @@ -33,6 +33,9 @@ jobs:
with:
version: nightly

- name: Install Solidity Dependencies
run: forge soldeer update -d

- name: Run Forge build
run: |
forge --version
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ jobs:
uses: "foundry-rs/foundry-toolchain@v1"
- name: "Verify Forge installation"
run: "forge --version"
- name: "Install Solidity Dependencies"
run: "forge soldeer update -d"
- name: Install dist
run: ${{ matrix.install_dist }}
# Get the dist-manifest
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,7 @@ docs/
blueprint.json
blueprint.lock
keystores/


# Soldeer
/dependencies
7 changes: 0 additions & 7 deletions .gitmodules

This file was deleted.

1 change: 0 additions & 1 deletion contracts/lib/tnt-core
Submodule tnt-core deleted from b51a73
2 changes: 1 addition & 1 deletion contracts/src/FrostBlueprint.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: UNLICENSE
pragma solidity >=0.8.13;

import "tnt-core/src/BlueprintServiceManagerBase.sol";
import "tnt-core/BlueprintServiceManagerBase.sol";

/**
* @title FrostBlueprint
Expand Down
6 changes: 6 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@
# Environment variables
RUST_SRC_PATH = "${toolchain}/lib/rustlib/src/rust/library";
LD_LIBRARY_PATH = lib.makeLibraryPath [ pkgs.gmp pkgs.libclang pkgs.openssl.dev pkgs.stdenv.cc.cc ];
# Add Forge from foundry to $HOME/.config/.foundry/bin/forge
# by symlinking it to the flake's bin
shellHook = ''
mkdir -p $HOME/.config/.foundry/bin
ln -s ${pkgs.foundry-bin}/bin/forge $HOME/.config/.foundry/bin/forge
'';
};
});
}
7 changes: 6 additions & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ out = "contracts/out"
script = "contracts/script"
cache_path = "contracts/cache"
broadcast = "contracts/broadcast"
libs = ["contracts/lib"]
libs = ["dependencies"]
auto_detect_remappings = true

[dependencies]
forge-std = "1.9.4"
"@openzeppelin-contracts" = "5.1.0"
tnt-core = { version = "0.1.0", git = "https://github.com/tangle-network/tnt-core.git", rev = "b51a732e80e9f8fb9245b4e58968f2bd54a37b66" }

# See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options
3 changes: 3 additions & 0 deletions remappings.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@openzeppelin-contracts/=dependencies/@openzeppelin-contracts-5.1.0/
forge-std/=dependencies/forge-std-1.9.4/src/
tnt-core/=dependencies/tnt-core-0.1.0/src/
19 changes: 19 additions & 0 deletions soldeer.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[[dependencies]]
name = "@openzeppelin-contracts"
version = "5.1.0"
url = "https://soldeer-revisions.s3.amazonaws.com/@openzeppelin-contracts/5_1_0_19-10-2024_10:28:52_contracts.zip"
checksum = "fd3d1ea561cb27897008aee18ada6e85f248eb161c86e4435272fc2b5777574f"
integrity = "cb6cf6e878f2943b2291d5636a9d72ac51d43d8135896ceb6cf88d36c386f212"

[[dependencies]]
name = "forge-std"
version = "1.9.4"
url = "https://soldeer-revisions.s3.amazonaws.com/forge-std/1_9_4_25-10-2024_14:36:59_forge-std-1.9.zip"
checksum = "b5be24beb5e4dab5e42221b2ad1288b64c826bee5ee71b6159ba93ffe86f14d4"
integrity = "3874463846ab995a6a9a88412913cacec6144f7605daa1af57c2d8bf3f210b13"

[[dependencies]]
name = "tnt-core"
version = "0.1.0"
git = "https://github.com/tangle-network/tnt-core.git"
rev = "b51a732e80e9f8fb9245b4e58968f2bd54a37b66"

0 comments on commit bf649e0

Please sign in to comment.