Skip to content

Commit cdd6953

Browse files
committed
fixing ci on behalf of contributor
1 parent da3fad7 commit cdd6953

6 files changed

Lines changed: 19 additions & 57 deletions

File tree

.github/workflows/CI.yaml

Lines changed: 1 addition & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -88,48 +88,4 @@ jobs:
8888
${{ runner.os }}-cargo-build-
8989
${{ runner.os }}-cargo-
9090
- name: Build all crates
91-
run: cargo build --all --verbose
92-
93-
wasm-check:
94-
name: WASM Compatibility Check
95-
runs-on: ubuntu-latest
96-
steps:
97-
- uses: actions/checkout@v4
98-
- name: Install Rust toolchain
99-
uses: dtolnay/rust-toolchain@stable
100-
with:
101-
targets: wasm32-unknown-unknown
102-
- name: Cache cargo registry
103-
uses: actions/cache@v4
104-
with:
105-
path: |
106-
~/.cargo/registry
107-
~/.cargo/git
108-
contracts/target
109-
key: ${{ runner.os }}-cargo-wasm-${{ hashFiles('contracts/Cargo.lock') }}
110-
restore-keys: |
111-
${{ runner.os }}-cargo-wasm-
112-
${{ runner.os }}-cargo-
113-
- name: Build for WASM target
114-
run: cargo build --all --target wasm32-unknown-unknown --verbose
115-
116-
ci-success:
117-
name: CI Success
118-
runs-on: ubuntu-latest
119-
needs: [format, clippy, test, build, wasm-check]
120-
if: always()
121-
defaults:
122-
run:
123-
working-directory: .
124-
steps:
125-
- name: Check all jobs
126-
run: |
127-
if [[ "${{ needs.format.result }}" != "success" || \
128-
"${{ needs.clippy.result }}" != "success" || \
129-
"${{ needs.test.result }}" != "success" || \
130-
"${{ needs.build.result }}" != "success" || \
131-
"${{ needs.wasm-check.result }}" != "success" ]]; then
132-
echo "One or more CI jobs failed"
133-
exit 1
134-
fi
135-
echo "All CI jobs passed successfully"
91+
run: cargo build --all --verbose

contracts/assetsup/src/asset.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use soroban_sdk::{contracttype, Address, BytesN, String};
1+
use soroban_sdk::{Address, BytesN, String, contracttype};
22

33
use crate::types::{AssetStatus, AssetType};
44

contracts/assetsup/src/lib.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#![no_std]
2-
use soroban_sdk::{Address, Env, contract, contractimpl, contracttype, BytesN};
2+
use soroban_sdk::{Address, BytesN, Env, contract, contractimpl, contracttype};
33

4-
pub(crate) mod types;
5-
pub(crate) mod errors;
64
pub(crate) mod asset;
5+
pub(crate) mod errors;
6+
pub(crate) mod types;
77

88
#[contracttype]
99
#[derive(Clone, Debug, Eq, PartialEq)]
@@ -34,7 +34,7 @@ impl AssetUpContract {
3434
// Access control
3535
asset.owner.require_auth();
3636

37-
if asset.name.len() == 0 {
37+
if asset.name.is_empty() {
3838
panic!("Name cannot be empty");
3939
}
4040

@@ -47,7 +47,10 @@ impl AssetUpContract {
4747
Ok(())
4848
}
4949

50-
pub fn get_asset(env: Env, asset_id: BytesN<32>) -> Result<asset::Asset, errors::ContractError> {
50+
pub fn get_asset(
51+
env: Env,
52+
asset_id: BytesN<32>,
53+
) -> Result<asset::Asset, errors::ContractError> {
5154
let key = asset::DataKey::Asset(asset_id);
5255
let store = env.storage().persistent();
5356
match store.get::<_, asset::Asset>(&key) {

contracts/assetsup/src/tests/asset.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,20 @@
22

33
extern crate std;
44

5-
use soroban_sdk::{testutils::Address as _, Address, BytesN, Env, String};
5+
use soroban_sdk::{Address, BytesN, Env, String, testutils::Address as _};
66

7-
use crate::{asset::Asset, types::{AssetStatus, AssetType}, errors::ContractError};
7+
use crate::{
8+
asset::Asset,
9+
types::{AssetStatus, AssetType},
10+
};
811

912
use super::initialize::setup_test_environment;
1013

1114
fn make_bytes32(env: &Env, seed: u32) -> BytesN<32> {
1215
let mut arr = [0u8; 32];
1316
// Simple deterministic fill
14-
for i in 0..32 {
15-
arr[i] = ((seed as usize + i) % 256) as u8;
17+
for (i, item) in arr.iter_mut().enumerate() {
18+
*item = ((seed as usize + i) % 256) as u8;
1619
}
1720
BytesN::from_array(env, &arr)
1821
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
mod initialize;
21
mod asset;
2+
mod initialize;

contracts/assetsup/src/types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#![allow(clippy::upper_case_acronyms)]
2-
use soroban_sdk::{contracttype};
2+
use soroban_sdk::contracttype;
33

44
#[contracttype]
55
#[derive(Clone, Debug, Eq, PartialEq)]

0 commit comments

Comments
 (0)