Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
10 changes: 10 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
if ! has nix_direnv_version || ! nix_direnv_version 3.0.6; then
URL=https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.6/direnvrc
HASH=sha256-RYcUJaRMf8oF5LznDrlCXbkOQrywm0HDv1VjYGaJGdM=
source_url "$URL" "$HASH"
fi

watch_file flake.lock
watch_file flake.nix

use flake . --verbose --show-trace
20 changes: 17 additions & 3 deletions .github/workflows/deploy-subgraph.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
workflow_dispatch:
inputs:
network:
description: 'Network to deploy to'
description: "Network to deploy to"
required: true
type: choice
options:
Expand Down Expand Up @@ -32,8 +32,22 @@ jobs:
submodules: recursive
fetch-depth: 0

- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- uses: nixbuild/nix-quick-install-action@v30
with:
nix_conf: |
keep-env-derivations = true
keep-outputs = true
- name: Restore and save Nix store
uses: nix-community/cache-nix-action@v6
with:
# restore and save a cache using this key
primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', '**/flake.lock') }}
# if there's no cache hit, restore a cache by this prefix
restore-prefixes-first-match: nix-${{ runner.os }}-
# collect garbage until the Nix store size (in bytes) is at most this number
# before trying to save a new cache
# 1G = 1073741824
gc-max-store-size-linux: 1G

- run: nix develop -c rainix-sol-prelude

Expand Down
18 changes: 16 additions & 2 deletions .github/workflows/manual-rs-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,22 @@ jobs:
fetch-depth: 0
submodules: recursive

- uses: DeterminateSystems/nix-installer-action@v4
- uses: DeterminateSystems/magic-nix-cache-action@v2
- uses: nixbuild/nix-quick-install-action@v30
with:
nix_conf: |
keep-env-derivations = true
keep-outputs = true
- name: Restore and save Nix store
uses: nix-community/cache-nix-action@v6
with:
# restore and save a cache using this key
primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', '**/flake.lock') }}
# if there's no cache hit, restore a cache by this prefix
restore-prefixes-first-match: nix-${{ runner.os }}-
# collect garbage until the Nix store size (in bytes) is at most this number
# before trying to save a new cache
# 1G = 1073741824
gc-max-store-size-linux: 1G

- run: |
git config --global user.email "${{ secrets.CI_GIT_EMAIL }}"
Expand Down
24 changes: 19 additions & 5 deletions .github/workflows/manual-sol-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
workflow_dispatch:
inputs:
network:
description: 'Network to deploy to'
description: "Network to deploy to"
required: true
type: choice
options:
Expand Down Expand Up @@ -41,14 +41,28 @@ jobs:
submodules: recursive
fetch-depth: 0

- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- uses: nixbuild/nix-quick-install-action@v30
with:
nix_conf: |
keep-env-derivations = true
keep-outputs = true
- name: Restore and save Nix store
uses: nix-community/cache-nix-action@v6
with:
# restore and save a cache using this key
primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', '**/flake.lock') }}
# if there's no cache hit, restore a cache by this prefix
restore-prefixes-first-match: nix-${{ runner.os }}-
# collect garbage until the Nix store size (in bytes) is at most this number
# before trying to save a new cache
# 1G = 1073741824
gc-max-store-size-linux: 1G

# - run: nix develop --command rainix-sol-prelude
# - run: nix develop --command rainix-sol-prelude
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot Jun 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Cleanup: Remove unused commented-out step
The commented-out nix develop --command rainix-sol-prelude line appears vestigial. Consider removing it to declutter the workflow.

🤖 Prompt for AI Agents
In .github/workflows/manual-sol-artifacts.yml at line 61, there is a
commented-out step running `nix develop --command rainix-sol-prelude` that is no
longer used. Remove this commented-out line entirely to clean up and declutter
the workflow file.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not relevant for this PR

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@0xgleb, understood! You're right that cleaning up commented code falls outside the scope of this PR, which is focused on upgrading Rust and rainix versions. I'll note that this suggestion can be addressed in a future cleanup effort if desired.

- name: deploy to ${{ inputs.network }}
run: nix develop --command rainix-sol-artifacts
env:
DEPLOY_BROADCAST: '1'
DEPLOY_BROADCAST: "1"
DEPLOYMENT_KEY: ${{ github.ref == 'refs/heads/main' && secrets.PRIVATE_KEY || secrets.PRIVATE_KEY_DEV }}
ETH_RPC_URL: ${{ secrets[env.rpc_secret_name] || vars[env.rpc_secret_name] || '' }}
ETHERSCAN_API_KEY: ${{ secrets[env.etherscan_api_key_secret_name] || vars[env.etherscan_api_key_secret_name] || ''}}
Expand Down
19 changes: 16 additions & 3 deletions .github/workflows/manual-subgraph-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,22 @@ jobs:
fetch-depth: 0
submodules: recursive

- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v4
- uses: DeterminateSystems/magic-nix-cache-action@v2
- uses: nixbuild/nix-quick-install-action@v30
with:
nix_conf: |
keep-env-derivations = true
keep-outputs = true
- name: Restore and save Nix store
uses: nix-community/cache-nix-action@v6
with:
# restore and save a cache using this key
primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', '**/flake.lock') }}
# if there's no cache hit, restore a cache by this prefix
restore-prefixes-first-match: nix-${{ runner.os }}-
# collect garbage until the Nix store size (in bytes) is at most this number
# before trying to save a new cache
# 1G = 1073741824
gc-max-store-size-linux: 1G

- run: nix develop --command subgraph-deploy
env:
Expand Down
21 changes: 17 additions & 4 deletions .github/workflows/rainix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,22 @@ jobs:
fetch-depth: 0
submodules: recursive

- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v4
- uses: DeterminateSystems/magic-nix-cache-action@v2
- uses: nixbuild/nix-quick-install-action@v30
with:
nix_conf: |
keep-env-derivations = true
keep-outputs = true
- name: Restore and save Nix store
uses: nix-community/cache-nix-action@v6
with:
# restore and save a cache using this key
primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', '**/flake.lock') }}
# if there's no cache hit, restore a cache by this prefix
restore-prefixes-first-match: nix-${{ runner.os }}-
# collect garbage until the Nix store size (in bytes) is at most this number
# before trying to save a new cache
# 1G = 1073741824
gc-max-store-size-linux: 1G

- run: nix develop -c rainix-sol-prelude
- run: nix develop -c rainix-rs-prelude
Expand All @@ -42,4 +55,4 @@ jobs:
run: nix develop -c ${{ matrix.task }}

- name: Build for wasm target
run: nix develop -c cargo build --target wasm32-unknown-unknown
run: nix develop -c cargo build --target wasm32-unknown-unknown
19 changes: 16 additions & 3 deletions .github/workflows/subgraph-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,22 @@ jobs:
fetch-depth: 0
submodules: recursive

- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v4
- uses: DeterminateSystems/magic-nix-cache-action@v2
- uses: nixbuild/nix-quick-install-action@v30
with:
nix_conf: |
keep-env-derivations = true
keep-outputs = true
- name: Restore and save Nix store
uses: nix-community/cache-nix-action@v6
with:
# restore and save a cache using this key
primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', '**/flake.lock') }}
# if there's no cache hit, restore a cache by this prefix
restore-prefixes-first-match: nix-${{ runner.os }}-
# collect garbage until the Nix store size (in bytes) is at most this number
# before trying to save a new cache
# 1G = 1073741824
gc-max-store-size-linux: 1G

- name: Build subgraph
run: nix develop -c subgraph-build
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
out
cache
.DS_Store

.vscode
.direnv/

# Rust
target
7 changes: 1 addition & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
[workspace]
resolver = "2"
members = [
"crates/bindings",
"crates/cli",
"crates/metaboard",
]
members = ["crates/bindings", "crates/cli", "crates/metaboard"]

[workspace.package]
author = "Rain Open Source Software Ltd"
license = "LicenseRef-DCL-1.0"

[workspace.dependencies]
Expand Down
1 change: 0 additions & 1 deletion crates/bindings/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ version = "0.1.0"
edition = "2021"
description = "Solidity bindings for rain metadata."
license.workspace = true
author.workspace = true
repository = "https://github.com/rainlanguage/rain.metadata"

[dependencies]
Expand Down
1 change: 0 additions & 1 deletion crates/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ version = "0.0.2-alpha.6"
edition = "2021"
description = "Tooling and utilities for RainLanguage metadata."
license.workspace = true
author.workspace = true
repository = "https://github.com/rainlanguage/rain.metadata"

[features]
Expand Down
14 changes: 7 additions & 7 deletions crates/cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
//! building the binary.
//!
//! - `cli`: A [mod@clap] based CLI app module for functionalities of this library, this feature
//! has [mod@tokio] dependency with features enabled that are compatible for `wasm` family target builds,
//! Enabling this feature will also enable `json-schema` feature.
//! This feature is required for building the binary crate.
//! has [mod@tokio] dependency with features enabled that are compatible for `wasm` family target builds,
//! Enabling this feature will also enable `json-schema` feature.
//! This feature is required for building the binary crate.
//! - `json-schema`: Enables implementation of [Json Schema](schemars::JsonSchema) for different [types] of Rain meta.
//! - `tokio-full`: Installs [mod@tokio] with full features which is a dependency of `cli` feature, this
//! allows for multi-threading of the CLI app (binary), however it results in erroneous builds for `wasm` target family
//! as explained in [tokio docs](https://docs.rs/tokio/latest/tokio/#wasm-support).this feature is only effective for
//! binary crate and using it for lib crate just installs a [mod@tokio] with full feature as a dependency as the entire
//! lib crate doesn't depend on [mod@tokio]. This is because [mod@tokio] is only used as a runtime for binray crate.
//! allows for multi-threading of the CLI app (binary), however it results in erroneous builds for `wasm` target family
//! as explained in [tokio docs](https://docs.rs/tokio/latest/tokio/#wasm-support).this feature is only effective for
//! binary crate and using it for lib crate just installs a [mod@tokio] with full feature as a dependency as the entire
//! lib crate doesn't depend on [mod@tokio]. This is because [mod@tokio] is only used as a runtime for binray crate.
//!
//! ## Example
//! ```ignore
Expand Down
10 changes: 5 additions & 5 deletions crates/cli/src/meta/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ impl<'de> Deserialize<'de> for RainMetaDocumentV1Item {
2 => content_type = Some(map.next_value()?),
3 => content_encoding = Some(map.next_value()?),
4 => content_language = Some(map.next_value()?),
other => Err(serde::de::Error::custom(&format!(
other => Err(serde::de::Error::custom(format!(
"found unexpected key in the map: {other}"
)))?,
};
Expand Down Expand Up @@ -805,7 +805,7 @@ impl Store {
if let Ok(meta) = search(&hex::encode_prefixed(hash), &self.subgraphs).await {
self.store_content(&meta.bytes);
self.cache.insert(hash.to_vec(), meta.bytes);
return self.get_meta(hash);
self.get_meta(hash)
} else {
None
}
Expand All @@ -816,7 +816,7 @@ impl Store {
if !self.cache.contains_key(hash) {
self.update(hash).await
} else {
return self.get_meta(hash);
self.get_meta(hash)
}
}

Expand All @@ -827,12 +827,12 @@ impl Store {
if keccak256(bytes).0 == hash {
self.store_content(bytes);
self.cache.insert(hash.to_vec(), bytes.to_vec());
return self.cache.get(hash);
self.cache.get(hash)
} else {
None
}
} else {
return self.get_meta(hash);
self.get_meta(hash)
}
}

Expand Down
3 changes: 1 addition & 2 deletions crates/metaboard/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ version = "0.1.0"
edition = "2021"
description = "A subgraph client for the Rain Metaboard."
license.workspace = true
author.workspace = true
repository = "https://github.com/rainlanguage/rain.metadata"

[dependencies]
Expand All @@ -21,4 +20,4 @@ tokio = { workspace = true }
serde_json = { workspace = true }

[build-dependencies]
cynic-codegen = { version = "3" }
cynic-codegen = { version = "3" }
Loading