Skip to content

Commit

Permalink
Condor (#41)
Browse files Browse the repository at this point in the history
* Condor compilation + test result: 70 passed; 51 failed;

* Fixing some tests

* Fix some tests

* Ignore some tests funding contracts

* Update toolchain

* Update npm packages in client-js

* Clippy

* Revert client-js changes

* stash events

* Fix some tests CES

* small change

* Add native events tests

* Doc

* get_optional_named_arg_with_user_errors revert on error

* test ci

* Revert ci
  • Loading branch information
gRoussac authored Oct 20, 2024
1 parent 235807a commit 42d6c1d
Show file tree
Hide file tree
Showing 45 changed files with 3,835 additions and 2,525 deletions.
62 changes: 60 additions & 2 deletions .github/workflows/ci-cep-85-client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,65 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
- name: Checkout
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b #v3.0.2
# # Replace by above service with docker image of stable 2.0
# - name: Clone casper-nctl-2-docker repository
# run: |
# git clone https://github.com/gRoussac/casper-nctl-2-docker.git

# - name: Build and start the service
# run: |
# cd casper-nctl-2-docker
# make build-start 2.0
# cd ..

# - name: Wait for the service to be ready
# run: |
# echo "Waiting for the service to be ready on port 11101..."
# for i in {1..30}; do # wait for up to 30 seconds
# if nc -z localhost 11101; then
# echo "Service is up!"
# echo "Wait 45s for nctl to boot and create keys"
# sleep 45 # - name: wait for up to 45 seconds for an era like
# break
# fi
# echo "Waiting..."
# sleep 1
# done

# # Check if the service is still not ready after 30 seconds
# if ! nc -z localhost 11101; then
# echo "Service did not start in time!"
# exit 1
# fi

# # - name: List files in the users directory
# # run: |
# # echo "Listing files in the users directory of the service container..."
# # docker exec ${{ job.services.casper-nctl.id }} ls /app/casper-nctl/assets/net-1/users/

# # - name: List files in user-1 directory
# # run: |
# # echo "Listing files in ./assets/users/user-1/:"
# # ls -la ./casper-nctl-2-docker/assets/users/user-1/

# # WARNING: These accounts, and their private keys, are now publicly known.
# # Any funds sent to them on Mainnet or any other live network WILL BE LOST.
# - name: Set SECRET_KEY_USER_1 and SECRET_KEY_USER_2 environment variables
# run: |
# echo "SECRET_KEY_USER_1=$(sed -n '2p' ./casper-nctl-2-docker/assets/users/user-1/secret_key.pem)" >> $GITHUB_ENV
# echo "SECRET_KEY_USER_2=$(sed -n '2p' ./casper-nctl-2-docker/assets/users/user-2/secret_key.pem)" >> $GITHUB_ENV

# - name: Delete user-1 directory
# run: |
# echo "Deleting ./casper-nctl-2-docker directories..."
# sudo rm -rf ./casper-nctl-2-docker

# - name: Print GITHUB_ENV
# run: |
# echo "Contents of GITHUB_ENV:"
# cat $GITHUB_ENV

- uses: actions/checkout@v2

- name: Swatinem cache
uses: Swatinem/rust-cache@cb2cf0cc7c5198d3364b9630e2c3d457f160790c #v1.4.0
Expand All @@ -43,6 +100,7 @@ jobs:
uses: actions/setup-node@5b949b50c3461bbcd5a540b150c368278160234a #v3.4.0
with:
node-version: ${{ matrix.node-version }}
registry-url: 'https://registry.npmjs.org'

- name: Install
working-directory: ./client-js
Expand Down
17 changes: 12 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,26 +1,33 @@
ALL_CONTRACTS = cep85 cep85-test-contract
CONTRACT_TARGET_DIR = contracts/target/wasm32-unknown-unknown/release
TARGET_DIR = $(CURDIR)/target
CONTRACT_TARGET_DIR = $(TARGET_DIR)/wasm32-unknown-unknown/release
PINNED_TOOLCHAIN := $(shell cat contracts/rust-toolchain)

export CARGO_TARGET_DIR=$(TARGET_DIR)

prepare:
rustup target add wasm32-unknown-unknown
rustup component add clippy --toolchain ${PINNED_TOOLCHAIN}
rustup component add rustfmt --toolchain ${PINNED_TOOLCHAIN}
rustup component add rust-src --toolchain ${PINNED_TOOLCHAIN}

.PHONY: build-contract
build-contract:
cd contracts/cep85 && cargo build --release
cd contracts/cep85 && RUSTFLAGS="-C target-cpu=mvp" cargo build --release --target wasm32-unknown-unknown -Z build-std=std,panic_abort
wasm-strip $(CONTRACT_TARGET_DIR)/cep85.wasm

.PHONY: build-all-contracts
build-all-contracts:
cd contracts && cargo build --release $(patsubst %,-p %, $(ALL_CONTRACTS))
cd contracts && RUSTFLAGS="-C target-cpu=mvp" cargo build --release --target wasm32-unknown-unknown $(patsubst %,-p %, $(ALL_CONTRACTS)) -Z build-std=std,panic_abort
$(foreach WASM, $(ALL_CONTRACTS), wasm-strip $(CONTRACT_TARGET_DIR)/$(subst -,_,$(WASM)).wasm ;)
cd client/make_dictionary_item_key && RUSTFLAGS="-C target-cpu=mvp" cargo build --release --target wasm32-unknown-unknown -Z build-std=std,panic_abort
wasm-strip $(CONTRACT_TARGET_DIR)/cep85_make_dictionary_item_key.wasm

setup-test: build-all-contracts
mkdir -p tests/wasm
cp $(CONTRACT_TARGET_DIR)/cep85.wasm tests/wasm
cp $(CONTRACT_TARGET_DIR)/cep85_test_contract.wasm tests/wasm
cp $(CONTRACT_TARGET_DIR)/cep85_make_dictionary_item_key.wasm tests/wasm

test: setup-test
cd tests && cargo test
Expand All @@ -33,11 +40,11 @@ clippy:

check-lint: clippy
cd contracts && cargo fmt -- --check
cd tests && cargo +$(PINNED_TOOLCHAIN) fmt -- --check
cd tests && cargo fmt -- --check

format:
cd contracts && cargo fmt
cd tests && cargo +$(PINNED_TOOLCHAIN) fmt
cd tests && cargo fmt

clean:
cd contracts && cargo clean
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,3 +237,10 @@ The expected behavior of the multi-token contract implementation is asserted by
| 79 | InvalidValue |
| 80 | MissingValue |
| 81 | NonSuppliedTokenId |
| 82 | FailedToConvertBytes |
| 83 | InvalidContext |
| 84 | UrefNotFound |
| 85 | FailedToReadFromStorage |
| 86 | FailedToInsertToSecurityList |
| 87 | FailedToGetKey |
| 88 | InvalidKeyType |
Loading

0 comments on commit 42d6c1d

Please sign in to comment.