Skip to content

Commit 9cbe073

Browse files
authored
Merge pull request #374 from Ackee-Blockchain/develop
0.11.0
2 parents de2eed3 + 2bbced1 commit 9cbe073

File tree

578 files changed

+24775
-71425
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

578 files changed

+24775
-71425
lines changed

.github/actions/setup-afl/action.yaml

Lines changed: 0 additions & 9 deletions
This file was deleted.

.github/actions/setup-honggfuzz/action.yml

Lines changed: 0 additions & 16 deletions
This file was deleted.

.github/actions/setup-rust/action.yml

Lines changed: 0 additions & 23 deletions
This file was deleted.
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
name: "Setup Trident"
22

33
runs:
4-
# This setup does not use caching, so it always installs Trident fresh
54
using: "composite"
65
steps:
7-
# Install Trident from the local crates/cli directory
86
- name: Install Trident
9-
run: cargo install --path crates/cli
7+
run: make install
108
shell: bash

.github/workflows/changelog.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212
jobs:
1313
Check-Changelog:
1414
name: Check Changelog Action
15-
runs-on: ubuntu-20.04
15+
runs-on: ubuntu-24.04
1616
steps:
1717
- uses: tarides/changelog-check-action@v2
1818
with:

.github/workflows/fuzz.yml

Lines changed: 59 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -11,155 +11,82 @@ on:
1111
- master
1212

1313
env:
14-
HONGGFUZZ_VERSION: 0.5.56 # Honggfuzz version to install in the environment
15-
AFL_VERSION: 0.15.10 # AFL version to install in the environment
16-
14+
CARGO_TERM_COLOR: always
15+
SOLANA_VERSION: "v2.2.16"
16+
RUST_VERSION: "1.86"
1717

1818
jobs:
19-
Fuzz-Tests:
20-
name: Fuzz Tests
21-
runs-on: ubuntu-20.04
22-
steps:
23-
- run: echo "Starting Fuzz Tests"
24-
25-
simple-cpi-6:
26-
name: Fuzz Tests (simple-cpi-6)
27-
needs: Fuzz-Tests
28-
# Runs on an Ubuntu 20.04 runner
29-
runs-on: ubuntu-20.04
19+
fuzz-tests:
20+
name: Fuzz Tests - ${{ matrix.test.name }}
21+
runs-on: ubuntu-24.04
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
test:
26+
- name: "Simple CPI"
27+
path: "examples/cpi"
28+
cache-key: "simple-cpi"
29+
- name: "Trident Benchmark Maze 0"
30+
path: "examples/trident-benchmark/maze_0"
31+
cache-key: "maze-0"
32+
- name: "Trident Benchmark Maze 1"
33+
path: "examples/trident-benchmark/maze_1"
34+
cache-key: "maze-1"
35+
- name: "Trident Benchmark Maze 2"
36+
path: "examples/trident-benchmark/maze_2"
37+
cache-key: "maze-2"
38+
- name: "Trident Benchmark Maze 3"
39+
path: "examples/trident-benchmark/maze_3"
40+
cache-key: "maze-3"
41+
- name: "Trident Benchmark Maze 4"
42+
path: "examples/trident-benchmark/maze_4"
43+
cache-key: "maze-4"
44+
- name: "Metaplex CPI"
45+
path: "examples/metaplex"
46+
cache-key: "metaplex"
47+
3048
steps:
3149
- uses: actions/checkout@v3
32-
name: Checkout Repository # Checkout the repository to get access to the project files
50+
name: Checkout Repository
3351

34-
# https://github.com/Swatinem/rust-cache
35-
- name: Cache Rust and its Packages
36-
# Caches Rust dependencies to avoid redundant downloads and speed up builds
37-
uses: Swatinem/rust-cache@v2
38-
with:
39-
prefix-key: "fuzz"
40-
shared-key: "trident-rust-cache" # Using a shared cache key for multiple jobs
41-
42-
- name: Setup Rust Environment
43-
# Sets up the Rust environment (e.g., installing Rust and required components)
44-
uses: ./.github/actions/setup-rust/
45-
46-
- name: Install Trident
47-
# Sets up the Trident
48-
uses: ./.github/actions/setup-trident/
52+
- name: Install system packages
53+
run: sudo apt-get update && sudo apt-get install -y build-essential libudev-dev protobuf-compiler libprotobuf-dev
54+
shell: bash
4955

50-
- name: Setup AFL
51-
# Sets up AFL, a fuzzing tool that will be used by Trident
52-
uses: ./.github/actions/setup-afl/
53-
54-
- name: Setup Honggfuzz
55-
# Sets up Honggfuzz, a fuzzing tool that will be used by Trident
56-
uses: ./.github/actions/setup-honggfuzz/
57-
58-
# Cache the target folder, which stores the build artifacts generated by the fuzzing process
59-
- name: Cache Target Folder
60-
uses: actions/cache@v3
56+
- uses: hubbleprotocol/[email protected]
57+
id: solana-setup
6158
with:
62-
path: examples/cpi/simple-cpi-6/trident-tests/fuzzing/honggfuzz/hfuzz_target # Cache the folder where build artifacts are stored
63-
key: target-${{ runner.os }}-simple-cpi-6 # Unique key for caching based on OS and test
64-
65-
# Run the fuzzing test using Trident in the simple-cpi-6 directory
66-
- name: Test Fuzz
67-
working-directory: examples/cpi/simple-cpi-6/trident-tests # Set the working directory for the fuzzing test
68-
run: trident fuzz run-hfuzz fuzz_0 # Run the fuzz test with trident
69-
70-
arbitrary-limit-inputs-5:
71-
name: Fuzz Tests (arbitrary-limit-inputs-5)
72-
needs: Fuzz-Tests
73-
# Runs on an Ubuntu 20.04 runner for a different fuzz test
74-
runs-on: ubuntu-20.04
75-
steps:
76-
- uses: actions/checkout@v3
77-
name: Checkout Repository # Checkout the repository
59+
solana-version: ${{ env.SOLANA_VERSION }}
60+
rust-version: ${{ env.RUST_VERSION }}
61+
rust-shared-key: "trident-testing"
7862

79-
# https://github.com/Swatinem/rust-cache
80-
- name: Cache Rust and its Packages
81-
# Caches Rust dependencies to avoid redundant downloads and speed up builds
63+
- name: Rust Cache
64+
id: rust-cache
8265
uses: Swatinem/rust-cache@v2
8366
with:
84-
prefix-key: "fuzz" # Using a locally shared cache key
85-
shared-key: "trident-rust-cache" # Using a shared cache key for multiple jobs
86-
87-
- name: Setup Rust Environment
88-
# Sets up the Rust environment (e.g., installing Rust and required components)
89-
uses: ./.github/actions/setup-rust/
67+
cache-on-failure: true
68+
shared-key: "trident-fuzzing"
69+
key: fuzz-tests-${{ runner.os }}-${{ matrix.test.cache-key }}
70+
workspaces: |
71+
./${{ matrix.test.path }}
72+
./${{ matrix.test.path }}/trident-tests
9073
9174
- name: Install Trident
92-
# Sets up the Trident
75+
if: steps.rust-cache.outputs.cache-hit != 'true'
9376
uses: ./.github/actions/setup-trident/
9477

95-
- name: Setup AFL
96-
# Sets up AFL, a fuzzing tool that will be used by Trident
97-
uses: ./.github/actions/setup-afl/
98-
99-
- name: Setup Honggfuzz
100-
# Sets up Honggfuzz, a fuzzing tool that will be used by Trident
101-
uses: ./.github/actions/setup-honggfuzz/
78+
- name: Build Solana Program
79+
working-directory: ${{ matrix.test.path }}
80+
run: cargo build-sbf
10281

103-
# Cache the target folder, which stores the build artifacts generated by the fuzzing process
104-
- name: Cache Target Folder
105-
uses: actions/cache@v3
106-
with:
107-
path: examples/common_issues/arbitrary-limit-inputs-5/trident-tests/fuzzing/honggfuzz/hfuzz_target # Cache the folder where build artifacts are stored
108-
key: target-${{ runner.os }}-arbitrary-limit-inputs-5 # Unique key for caching based on OS and test
109-
110-
# Run the fuzzing test using Trident in the arbitrary-limit-inputs-5 directory
111-
- name: Test Fuzz
112-
working-directory: examples/common_issues/arbitrary-limit-inputs-5/trident-tests # Set the working directory for the fuzzing test
113-
run: trident fuzz run-hfuzz fuzz_0 # Run the fuzz test with trident
114-
115-
cpi-metaplex-7:
116-
name: Fuzz Tests (cpi-metaplex-7)
117-
needs: Fuzz-Tests
118-
# Runs on an Ubuntu 20.04 runner for a different fuzz test
119-
runs-on: ubuntu-20.04
120-
steps:
121-
- uses: actions/checkout@v3
122-
name: Checkout Repository # Checkout the repository
123-
124-
# https://github.com/Swatinem/rust-cache
125-
- name: Cache Rust and its Packages
126-
# Caches Rust dependencies to avoid redundant downloads and speed up builds
127-
uses: Swatinem/rust-cache@v2
128-
with:
129-
prefix-key: "fuzz" # Using a locally shared cache key
130-
shared-key: "trident-rust-cache" # Using a shared cache key for multiple jobs
131-
132-
- name: Setup Rust Environment
133-
# Sets up the Rust environment (e.g., installing Rust and required components)
134-
uses: ./.github/actions/setup-rust/
135-
136-
- name: Install Trident
137-
# Sets up the Trident
138-
uses: ./.github/actions/setup-trident/
139-
140-
- name: Setup AFL
141-
# Sets up AFL, a fuzzing tool that will be used by Trident
142-
uses: ./.github/actions/setup-afl/
143-
144-
- name: Setup Honggfuzz
145-
# Sets up Honggfuzz, a fuzzing tool that will be used by Trident
146-
uses: ./.github/actions/setup-honggfuzz/
147-
148-
# Cache the target folder, which stores the build artifacts generated by the fuzzing process
149-
- name: Cache Target Folder
150-
uses: actions/cache@v3
151-
with:
152-
path: examples/cpi/cpi-metaplex-7/trident-tests/fuzzing/honggfuzz/hfuzz_target # Cache the folder where build artifacts are stored
153-
key: target-${{ runner.os }}-cpi-metaplex-7 # Unique key for caching based on OS and test
82+
- name: Run Fuzz Test
83+
working-directory: ${{ matrix.test.path }}/trident-tests
84+
run: trident fuzz run fuzz_0
15485

155-
# Run the fuzzing test using Trident in the cpi-metaplex-7 directory
156-
- name: Test Fuzz
157-
working-directory: examples/cpi/cpi-metaplex-7/trident-tests # Set the working directory for the fuzzing test
158-
run: trident fuzz run-hfuzz fuzz_0 # Run the fuzz test with trident
15986

16087
checks:
16188
name: Fuzz Tests (Checks)
162-
needs: [simple-cpi-6, arbitrary-limit-inputs-5,cpi-metaplex-7]
163-
runs-on: ubuntu-20.04
89+
needs: fuzz-tests
90+
runs-on: ubuntu-24.04
16491
steps:
165-
- run: echo "All fuzz tests completed successfully"
92+
- run: echo "All fuzz tests completed successfully"

.github/workflows/lint.yml

Lines changed: 33 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -10,52 +10,57 @@ on:
1010
- develop
1111
- master
1212

13+
env:
14+
CARGO_TERM_COLOR: always
15+
RUST_VERSION: "1.86"
1316

1417
jobs:
1518
Lint-Workspace:
1619
name: Lint Workspace
17-
runs-on: ubuntu-20.04
20+
runs-on: ubuntu-24.04
1821
steps:
1922
- run: echo "Starting Lint-Workspace"
2023

2124
lint:
2225
name: Lint
2326
needs: Lint-Workspace
24-
# This job runs on an Ubuntu 20.04 runner
25-
runs-on: ubuntu-20.04
27+
runs-on: ubuntu-24.04
2628
steps:
27-
- uses: actions/checkout@v3 # Checkout the code from the repository
29+
- uses: actions/checkout@v3
2830

29-
# https://github.com/Swatinem/rust-cache
30-
- name: Cache Rust and its Packages
31-
# Cache Rust dependencies using Swatinem's rust-cache action to speed up builds
31+
32+
- name: Install system packages
33+
run: sudo apt-get update && sudo apt-get install -y build-essential libudev-dev protobuf-compiler libprotobuf-dev
34+
shell: bash
35+
36+
- name: Rust Cache
37+
id: rust-cache
3238
uses: Swatinem/rust-cache@v2
3339
with:
34-
prefix-key: "lint" # Using a locally shared cache key
35-
shared-key: "trident-rust-cache" # Use a shared cache key across multiple jobs to reuse cache
36-
cache-directories: "~/.rustup" # Additional non workspace directories to be cached, separated by newlines.
37-
38-
- name: Setup Rust Environment
39-
# Set up the Rust environment (e.g., install nightly, Rust components)
40-
uses: ./.github/actions/setup-rust/
41-
42-
- name: Cargo build
43-
# Build the Trident workspace
44-
run: cargo build --release --all-features
45-
- name: Cargo fmt
46-
# Run cargo fmt to check if the code is formatted correctly
47-
run: cargo fmt --check
48-
- name: Cargo clippy
49-
# Run Clippy to check for code linting issues and fail on warnings
50-
run: cargo clippy -- -D warnings
51-
- name: Cargo test
52-
# Run tests to ensure the project works as expected
53-
run: cargo test
40+
cache-on-failure: true
41+
shared-key: "trident-lint"
42+
key: lint-${{ runner.os }}
43+
workspaces: |
44+
./
45+
46+
- name: Install Rust Toolchain Components
47+
run: |
48+
rustup install nightly
49+
rustup component add rustfmt clippy
50+
rustup component add rustfmt clippy --toolchain nightly
51+
shell: bash
52+
53+
- name: Format
54+
run: make format-checks
55+
- name: Clippy
56+
run: make clippy
57+
- name: Test
58+
run: make test
5459

5560

5661
checks:
5762
name: Lint-Workspace (Checks)
5863
needs: lint
59-
runs-on: ubuntu-20.04
64+
runs-on: ubuntu-24.04
6065
steps:
6166
- run: echo "Lint Workspace completed successfully"

.rustfmt.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
imports_granularity = "Item"

.vscode/settings.json

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)