Skip to content
Closed
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
11 changes: 11 additions & 0 deletions .github/actionlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
self-hosted-runner:
# Labels of self-hosted runner in array of strings.
labels:
- buildjet-2vcpu-ubuntu-2204
- buildjet-4vcpu-ubuntu-2204
- buildjet-8vcpu-ubuntu-2204
- buildjet-16vcpu-ubuntu-2204
# Configuration variables in array of strings defined in your repository or
# organization. `null` means disabling configuration variables check.
# Empty array means no configuration variable is allowed.
config-variables: null
18 changes: 18 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Please see the documentation for all configuration options:
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "cargo"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
# pnpm is handled by the "npm" package ecosystem
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"
15 changes: 15 additions & 0 deletions .github/workflows/ci-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Lint GitHub Actions workflows
on: [push, pull_request]

jobs:
actionlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download actionlint
id: get_actionlint
run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
shell: bash
- name: Check workflow files
run: ${{ steps.get_actionlint.outputs.executable }} -color
shell: bash
62 changes: 62 additions & 0 deletions .github/workflows/js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
on:
push:
branches:
- main
pull_request:
branches:
- "*"
types:
- opened
- synchronize
- reopened
- ready_for_review

name: js-tests

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
js:
name: js tests
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest

steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown

- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9

- name: Cache dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo
**/target
**/node_modules
key: ${{ runner.os }}-deps-${{ hashFiles('**/Cargo.lock', '**/pnpm-lock.yaml') }}

- name: Run hasher.rs tests
working-directory: hasher.rs
run: |
pnpm install
pnpm build
pnpm test
59 changes: 59 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
on:
push:
branches:
- main
paths:
- ".cargo/**"
- "**/*.rs"
- "**/Cargo.*"
- ".github/workflows/rust.yml"
pull_request:
branches:
- "*"
paths:
- "**/*.rs"
- "**/Cargo.*"
- ".github/workflows/rust.yml"

types:
- opened
- synchronize
- reopened
- ready_for_review

name: rust

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy

- name: Cache dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo
**/target
key: ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }}

- name: Check formatting, lint & run tests
run: |
for dir in concurrent bounded-vec hash-set indexed; do
cd $dir
cargo fmt -- --check
cargo clippy --all-targets -- -D warnings
cargo test --all-targets
cd ..
done
3 changes: 2 additions & 1 deletion bounded-vec/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1270,7 +1270,7 @@ mod test {
}

for element in vec.iter_mut() {
*element = *element * 2;
*element *= 2;
}

for (i, element) in vec.iter().enumerate() {
Expand Down Expand Up @@ -1491,6 +1491,7 @@ mod test {
}

#[test]
#[allow(clippy::unnecessary_cast)]
fn test_cyclic_bounded_vec_first() {
let mut vec = CyclicBoundedVec::with_capacity(500);

Expand Down
4 changes: 2 additions & 2 deletions bounded-vec/src/offset/copy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ mod test {
assert_eq!(offset, 0);
let vec: BoundedVec<i64> = read_bounded_vec_at(&buf, &mut offset, &metadata);
for (i, element) in vec.iter().enumerate() {
assert_eq!(i as i64, -(*element as i64));
assert_eq!(i as i64, - *element);
}
assert_eq!(offset, 256);

Expand All @@ -223,7 +223,7 @@ mod test {
assert_eq!(offset, 256);
let vec: BoundedVec<u64> = read_bounded_vec_at(&buf, &mut offset, &metadata);
for (i, element) in vec.iter().enumerate() {
assert_eq!(i as u64, *element as u64);
assert_eq!(i as u64, *element);
}
assert_eq!(offset, 512);

Expand Down
46 changes: 32 additions & 14 deletions concurrent/Cargo.lock

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

10 changes: 5 additions & 5 deletions concurrent/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@ solana = [
[dependencies]
borsh = "0.10"
bytemuck = { version = "1.17", features = ["derive"] }
light-bounded-vec = { version = "1.1.0" }
light-hasher = { version = "1.1.0" }
light-utils = { version = "1.1.0" }
light-bounded-vec = { version = "1.1.0", path = "../bounded-vec" }
light-hasher = { version = "1.1.0", path = "../hasher" }
light-utils = { version = "1.1.0", path = "../utils" }
memoffset = "0.9"
solana-program = { version="=1.18.22", optional = true }
thiserror = "1.0"

[dev-dependencies]
ark-bn254 = "0.4"
ark-ff = "0.4"
light-merkle-tree-reference = { version = "1.1.0" }
light-hash-set = { version = "1.1.0", features = ["solana"] }
light-merkle-tree-reference = { version = "1.1.0", path = "../reference" }
light-hash-set = { version = "1.1.0", features = ["solana"], path = "../hash-set" }
rand = "0.8"
solana-program = { version="=1.18.22" }
spl-account-compression = { version = "0.3.0", default-features = false}
Expand Down
2 changes: 1 addition & 1 deletion concurrent/src/copy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::ops::Deref;
use crate::{errors::ConcurrentMerkleTreeError, ConcurrentMerkleTree};
use light_bounded_vec::{BoundedVecMetadata, CyclicBoundedVecMetadata};
use light_hasher::Hasher;
use light_utils::offset::copy::{read_bounded_vec_at, read_cyclic_bounded_vec_at, read_value_at};
use light_bounded_vec::offset::copy::{read_bounded_vec_at, read_cyclic_bounded_vec_at, read_value_at};
use memoffset::{offset_of, span_of};

#[derive(Debug)]
Expand Down
10 changes: 5 additions & 5 deletions concurrent/src/zero_copy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use light_bounded_vec::{
BoundedVec, BoundedVecMetadata, CyclicBoundedVec, CyclicBoundedVecMetadata,
};
use light_hasher::Hasher;
use light_utils::offset::zero_copy::{read_array_like_ptr_at, read_ptr_at, write_at};
use light_bounded_vec::offset::zero_copy::{read_array_like_ptr_at, read_ptr_at, write_at};
use memoffset::{offset_of, span_of};

use crate::{errors::ConcurrentMerkleTreeError, ConcurrentMerkleTree};
Expand Down Expand Up @@ -128,7 +128,7 @@ where
}
}

impl<'a, H, const HEIGHT: usize> Deref for ConcurrentMerkleTreeZeroCopy<'a, H, HEIGHT>
impl<H, const HEIGHT: usize> Deref for ConcurrentMerkleTreeZeroCopy<'_, H, HEIGHT>
where
H: Hasher,
{
Expand All @@ -139,7 +139,7 @@ where
}
}

impl<'a, H, const HEIGHT: usize> Drop for ConcurrentMerkleTreeZeroCopy<'a, H, HEIGHT>
impl<H, const HEIGHT: usize> Drop for ConcurrentMerkleTreeZeroCopy<'_, H, HEIGHT>
where
H: Hasher,
{
Expand Down Expand Up @@ -244,7 +244,7 @@ where
}
}

impl<'a, H, const HEIGHT: usize> Deref for ConcurrentMerkleTreeZeroCopyMut<'a, H, HEIGHT>
impl<H, const HEIGHT: usize> Deref for ConcurrentMerkleTreeZeroCopyMut<'_, H, HEIGHT>
where
H: Hasher,
{
Expand All @@ -254,7 +254,7 @@ where
&self.0.merkle_tree
}
}
impl<'a, H, const HEIGHT: usize> DerefMut for ConcurrentMerkleTreeZeroCopyMut<'a, H, HEIGHT>
impl<H, const HEIGHT: usize> DerefMut for ConcurrentMerkleTreeZeroCopyMut<'_, H, HEIGHT>
where
H: Hasher,
{
Expand Down
Loading
Loading