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
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
- name: Clippy
run: cargo clippy --workspace -- -D warnings
- name: Test
run: cargo test --workspace
run: cargo test --workspace -- --test-threads=1
- name: Build Contracts
run: cargo build --target wasm32-unknown-unknown --release -p escrow -p reputation -p job_registry

Expand Down
106 changes: 106 additions & 0 deletions .github/workflows/build-contracts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: Build Soroban Contracts

on:
push:
paths:
- 'contracts/**'
- '.github/workflows/build-contracts.yml'
pull_request:
paths:
- 'contracts/**'
- '.github/workflows/build-contracts.yml'

env:
CARGO_TERM_COLOR: always

jobs:
build-wasm:
name: Build Contract WASM
runs-on: ubuntu-latest

strategy:
matrix:
contract: [escrow, job_registry, reputation]

steps:
- uses: actions/checkout@v4

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

- name: Install Soroban CLI
run: |
cargo install --locked --version 22.0.0 soroban-cli
soroban --version

- name: Install binaryen (wasm-opt)
run: sudo apt-get update && sudo apt-get install -y binaryen

- name: Cache cargo registry
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-

- name: Build ${{ matrix.contract }} contract
run: |
cargo build --target wasm32-unknown-unknown --release -p ${{ matrix.contract }}

- name: Optimize WASM
run: |
wasm-opt target/wasm32-unknown-unknown/release/${{ matrix.contract }}.wasm \
-o target/wasm32-unknown-unknown/release/${{ matrix.contract }}.optimized.wasm \
-Oz --enable-bulk-memory

- name: Upload WASM artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.contract }}-wasm
path: target/wasm32-unknown-unknown/release/${{ matrix.contract }}.optimized.wasm
retention-days: 30

- name: Generate WASM hash
run: |
wasm_file="target/wasm32-unknown-unknown/release/${{ matrix.contract }}.optimized.wasm"
if [ -f "$wasm_file" ]; then
sha256sum "$wasm_file" > "${{ matrix.contract }}.sha256"
echo "WASM hash: $(cat ${{ matrix.contract }}.sha256)"
fi

- name: Upload hash artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.contract }}-hash
path: ${{ matrix.contract }}.sha256
retention-days: 30

test-contracts:
name: Test Contracts
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

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

- name: Install Soroban CLI
run: |
cargo install --locked --version 22.0.0 soroban-cli
soroban --version

- name: Run contract tests
run: |
cargo test -p escrow -p reputation -p job_registry
env:
RUST_BACKTRACE: 1
16 changes: 10 additions & 6 deletions backend/src/routes/jobs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ async fn list_jobs(

if let Some(q) = params.query {
query_builder.push(" AND (title ILIKE ");
query_builder.push_bind(format!("%{}%", q));
query_builder.push_bind(format!("%{q}%"));
query_builder.push(" OR description ILIKE ");
query_builder.push_bind(format!("%{}%", q));
query_builder.push_bind(format!("%{q}%"));
query_builder.push(")");
}

Expand All @@ -71,21 +71,25 @@ async fn list_jobs(
if let Some(tag) = params.tag {
if tag != "all" {
query_builder.push(" AND (title ILIKE ");
query_builder.push_bind(format!("%{}%", tag));
query_builder.push_bind(format!("%{tag}%"));
query_builder.push(" OR description ILIKE ");
query_builder.push_bind(format!("%{}%", tag));
query_builder.push_bind(format!("%{tag}%"));
query_builder.push(")");
}
}

match params.sort.as_deref() {
Some("budget") => query_builder.push(" ORDER BY budget_usdc DESC"),
Some("budget") => {
query_builder.push(" ORDER BY budget_usdc DESC");
}
Some("reputation") => {
// Reputation sort requires joining with a reputation table or calculating score.
// For now, we'll just sort by created_at as a fallback.
query_builder.push(" ORDER BY created_at DESC");
}
_ => query_builder.push(" ORDER BY created_at DESC"),
_ => {
query_builder.push(" ORDER BY created_at DESC");
}
}

let jobs = query_builder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,14 @@
}
}
},
{
"key": {
"symbol": "requires_multisig"
},
"val": {
"bool": false
}
},
{
"key": {
"symbol": "status"
Expand Down Expand Up @@ -1715,6 +1723,14 @@
}
}
},
{
"key": {
"symbol": "requires_multisig"
},
"val": {
"bool": false
}
},
{
"key": {
"symbol": "status"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,14 @@
}
}
},
{
"key": {
"symbol": "requires_multisig"
},
"val": {
"bool": false
}
},
{
"key": {
"symbol": "status"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,14 @@
}
}
},
{
"key": {
"symbol": "requires_multisig"
},
"val": {
"bool": false
}
},
{
"key": {
"symbol": "status"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,14 @@
}
}
},
{
"key": {
"symbol": "requires_multisig"
},
"val": {
"bool": false
}
},
{
"key": {
"symbol": "status"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,14 @@
}
}
},
{
"key": {
"symbol": "requires_multisig"
},
"val": {
"bool": false
}
},
{
"key": {
"symbol": "status"
Expand Down Expand Up @@ -1770,6 +1778,14 @@
}
}
},
{
"key": {
"symbol": "requires_multisig"
},
"val": {
"bool": false
}
},
{
"key": {
"symbol": "status"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,14 @@
}
}
},
{
"key": {
"symbol": "requires_multisig"
},
"val": {
"bool": false
}
},
{
"key": {
"symbol": "status"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,14 @@
}
}
},
{
"key": {
"symbol": "requires_multisig"
},
"val": {
"bool": false
}
},
{
"key": {
"symbol": "status"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -905,6 +905,14 @@
}
}
},
{
"key": {
"symbol": "requires_multisig"
},
"val": {
"bool": false
}
},
{
"key": {
"symbol": "status"
Expand Down Expand Up @@ -2956,6 +2964,14 @@
}
}
},
{
"key": {
"symbol": "requires_multisig"
},
"val": {
"bool": false
}
},
{
"key": {
"symbol": "status"
Expand Down Expand Up @@ -3483,6 +3499,14 @@
}
}
},
{
"key": {
"symbol": "requires_multisig"
},
"val": {
"bool": false
}
},
{
"key": {
"symbol": "status"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,14 @@
}
}
},
{
"key": {
"symbol": "requires_multisig"
},
"val": {
"bool": false
}
},
{
"key": {
"symbol": "status"
Expand Down Expand Up @@ -1890,6 +1898,14 @@
}
}
},
{
"key": {
"symbol": "requires_multisig"
},
"val": {
"bool": false
}
},
{
"key": {
"symbol": "status"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,14 @@
}
}
},
{
"key": {
"symbol": "requires_multisig"
},
"val": {
"bool": false
}
},
{
"key": {
"symbol": "status"
Expand Down Expand Up @@ -408,7 +416,7 @@
"data": {
"vec": [
{
"string": "caught panic 'job already exists' from contract function 'Symbol(obj#45)'"
"string": "caught panic 'job already exists' from contract function 'Symbol(obj#47)'"
},
{
"u64": 1
Expand Down
Loading
Loading