Skip to content

Commit

Permalink
test: initial subxt test
Browse files Browse the repository at this point in the history
test: init subxt-tests

test: tests arrays, builtins, balances

test: placeholder impl

test: cross-contract call, event parsing
Signed-off-by: Raymond Yeh <extraymond@gmail.com>

test: init subxt-tests

test: tests arrays, builtins, balances

test: placeholder impl

test: cross-contract call, event parsing

test: implment flipper, issue666, msg_sender, primitives tests

Signed-off-by: Raymond Yeh <extraymond@gmail.com>

test: add randomizer test

Signed-off-by: Raymond Yeh <extraymond@gmail.com>

refactor: use contract-transcode

Signed-off-by: Raymond Yeh <extraymond@gmail.com>

refactor: subxt into own crate

Signed-off-by: Raymond Yeh <extraymond@gmail.com>

test: test randomizer, store, swithc to contract-transcode

Signed-off-by: Raymond Yeh <extraymond@gmail.com>

test: test array_strunct_mapping_storage, structs

Signed-off-by: Raymond Yeh <extraymond@gmail.com>

test: uniswapv2 test

Signed-off-by: Raymond Yeh <extraymond@gmail.com>

test: add uniswapv2-factory tests

Signed-off-by: Raymond Yeh <extraymond@gmail.com>

ci: trigger ci build for subxt

Signed-off-by: Raymond Yeh <extraymond@gmail.com>

test: fix unused var

Signed-off-by: Raymond Yeh <extraymond@gmail.com>

build: missing build command

Signed-off-by: Raymond Yeh <extraymond@gmail.com>

test: initial subxt test

test: init subxt-tests

test: tests arrays, builtins, balances

test: placeholder impl

test: cross-contract call, event parsing
Signed-off-by: Raymond Yeh <extraymond@gmail.com>

test: init subxt-tests

test: tests arrays, builtins, balances

test: placeholder impl

test: cross-contract call, event parsing

test: implment flipper, issue666, msg_sender, primitives tests

Signed-off-by: Raymond Yeh <extraymond@gmail.com>

test: add randomizer test

Signed-off-by: Raymond Yeh <extraymond@gmail.com>

refactor: subxt into own crate

Signed-off-by: Raymond Yeh <extraymond@gmail.com>

fix: give Address typename

Signed-off-by: Raymond Yeh <extraymond@gmail.com>

test: make sure generated abi follow upstream jsonschema

Signed-off-by: Raymond Yeh <extraymond@gmail.com>

test: finish uniswap-v2-factory test

Signed-off-by: Raymond Yeh <extraymond@gmail.com>

test: test uniswapv2pair

Signed-off-by: Raymond Yeh <extraymond@gmail.com>

ci: add missing config

Signed-off-by: Raymond Yeh <extraymond@gmail.com>

ci: produce test binary for subxt

Signed-off-by: Raymond Yeh <extraymond@gmail.com>

build: mandate rust version for subxt

Signed-off-by: Raymond Yeh <extraymond@gmail.com>

ci: remove uneeded container

Signed-off-by: Raymond Yeh <extraymond@gmail.com>

ci: fix launch cmd

Signed-off-by: Raymond Yeh <extraymond@gmail.com>

ci: typo

Signed-off-by: Raymond Yeh <extraymond@gmail.com>
  • Loading branch information
Raymond Yeh authored and extraymond committed Sep 5, 2022
1 parent 7db12d4 commit 9e9a8d8
Show file tree
Hide file tree
Showing 30 changed files with 5,802 additions and 2 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,19 @@ jobs:
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose --workspace
- run: apt-get update && apt-get install jq -y
- name: build integration-test binary for subxt
run : eval "cp $(cargo test --no-run --message-format=json | jq '. | select(.executable != null) | .executable') test-binary"
working-directory: ./integration/subxt-tests
- uses: actions/upload-artifact@master
with:
name: solang-linux-x86-64
path: ./target/debug/solang
- uses: actions/upload-artifact@master
with:
name: test-binary
path: ./integration/subxt-tests/test-binary


linux-arm:
name: Linux Arm
Expand Down Expand Up @@ -283,6 +292,39 @@ jobs:
run: npm run test
working-directory: ./integration/substrate

substrate-subxt:
name: Substrate Integration test with subxt
runs-on: ubuntu-20.04
needs: linux-x86-64
steps:
- name: Checkout sources
uses: actions/checkout@v2
# We can't run substrate as a github actions service, since it requires
# command line arguments. See https://github.com/actions/runner/pull/1152
- name: Start substrate
run: docker run -d -p 9944:9944 paritytech/contracts-ci-linux:production substrate-contracts-node --dev --ws-external
- uses: actions/download-artifact@master
with:
name: solang-linux-x86-64
path: bin
- run: |
chmod 755 ./bin/solang
echo "$(pwd)/bin" >> $GITHUB_PATH
- uses: actions/download-artifact@master
with:
name: test-binary
path: bin
- run: |
chmod 755 ./bin/test-binary
echo "$(pwd)/bin" >> $GITHUB_PATH
- run: solang compile --target substrate ../substrate/*.sol -o ./contracts/
working-directory: ./integration/subxt-tests
- run: solang compile --target substrate ../substrate/test/*.sol -o ./contracts/
working-directory: ./integration/subxt-tests
- name: Deploy and test contracts
run: test-binary --test-threads=1
working-directory: ./integration/subxt-tests

vscode:
name: Visual Code Extension
runs-on: ubuntu-20.04
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ Cargo.lock
/target
**/*.rs.bk
bundle.ll
/.vscode
/.vscode
integration/subxt-tests/contracts/
integration/subxt-tests/target/
12 changes: 12 additions & 0 deletions integration/substrate/createpair.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
pragma solidity ^0.8.0;
import "./UniswapV2Pair.sol";

contract Creator {
address public pair;

constructor() public {
pair = address(new UniswapV2Pair());
}

}

28 changes: 28 additions & 0 deletions integration/subxt-tests/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[package]
edition = "2021"
name = "subxt-tests"
version = "0.1.0"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
anyhow = "1.0.62"
async-trait = "0.1.57"
contract-metadata = "1.5.0"
contract-transcode = "0.1.0"
hex = "0.4.3"
ink_metadata = "3.3.1"
jsonschema = "0.16.0"
num-bigint = "0.4.3"
once_cell = "1.14.0"
pallet-contracts-primitives = {git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.27"}
parity-scale-codec = "3.1.5"
rand = "0.8.5"
serde_json = "1.0.85"
sp-core = "6.0.0"
sp-keyring = "6.0.0"
subxt = "0.23.0"
tokio = {version = "1.20.1", features = ["rt-multi-thread", "macros", "time"]}

[workspace]
members = []
Loading

0 comments on commit 9e9a8d8

Please sign in to comment.