-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #54 from xpladev/test/evm
Activate EVM test
- Loading branch information
Showing
52 changed files
with
5,864 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
## Effects | ||
|
||
- [ ] Soft update | ||
- [ ] Breaking change | ||
- [ ] Chain fork related | ||
|
||
<!-- If internal PR & if it is needed to check from a specific person, please mention. Or you may delete it --> | ||
## Major Reviewer | ||
|
||
<!-- List them --> | ||
|
||
## Background | ||
<!--- Why is this change required? What problem does it solve? --> | ||
<!--- If it fixes an open issue, please link to the issue here. --> | ||
|
||
## Summary | ||
<!--- Provide a summary of your changes. --> | ||
<!--- It's a good idea to include the issue you are trying to solve and how to fix it. --> | ||
|
||
<!--- Add More if you need. --> | ||
|
||
## Checklist | ||
|
||
- [ ] Backward compatible? | ||
- [ ] Test enough in your local environment? | ||
- [ ] Add related test cases? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name-template: 'v$RESOLVED_VERSION' | ||
tag-template: 'v$RESOLVED_VERSION' | ||
categories: | ||
- title: '🚀 Features' | ||
label: 'enhancement' | ||
label: 'feature' | ||
|
||
- title: '⚙️ Fixes' | ||
label: 'fix' | ||
label: 'bug' | ||
label: 'hotfix' | ||
|
||
- title: 'Dependency upgrades (Tendermint, Cosmos SDK, EvmOS, etc)' | ||
label: 'dependency' | ||
|
||
change-template: '- $TITLE @$AUTHOR (#$NUMBER)' | ||
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks. | ||
version-resolver: | ||
major: | ||
labels: | ||
- 'major' | ||
minor: | ||
labels: | ||
- 'minor' | ||
patch: | ||
labels: | ||
- 'patch' | ||
default: patch | ||
template: | | ||
## EFFECTS | ||
- [ ] Soft update | ||
- [ ] Chain fork related | ||
## CHANGES | ||
$CHANGES |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Go | ||
|
||
on: | ||
push: | ||
branches: [ "main", "cube", "hypercube", "tesseract", "release/*" ] | ||
pull_request: | ||
branches: [ "*" ] | ||
|
||
jobs: | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
go-version: [1.18.x, 1.19.x] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
|
||
- name: Protogen test | ||
run: make proto-gen | ||
|
||
- name: Test | ||
run: | | ||
go mod tidy | ||
make test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Integration test | ||
|
||
on: | ||
push: | ||
branches: [ "main", "cube", "hypercube", "tesseract", "release/*" ] | ||
pull_request: | ||
branches: [ "*" ] | ||
|
||
jobs: | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Setup network | ||
run: | | ||
mkdir ~/genesis | ||
cd integration_test && docker-compose up -d | ||
docker ps | ||
sleep 10 | ||
- name: Set up Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.18.x | ||
|
||
- name: Integration test | ||
run: cd integration_test && go test | ||
|
||
- name: Teardown | ||
run: cd integration_test && docker-compose down |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name: Release Drafter | ||
on: | ||
push: | ||
branches: [ "main", "cube", "hypercube", "tesseract" ] | ||
|
||
jobs: | ||
update_release_draft: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: release-drafter/release-drafter@v5 | ||
|
||
with: | ||
config-name: release-drafter-config.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# | ||
# xpla localnet | ||
# | ||
# build: | ||
# docker build --force-rm -t xpladev/xpla . | ||
# run: | ||
# docker run --rm -it --env-file=path/to/.env --name xpla-localnet xpladev/xpla | ||
|
||
### BUILD | ||
FROM golang:1.18-alpine AS build | ||
WORKDIR /localnet | ||
|
||
# Create appuser. | ||
RUN adduser -D -g '' valiuser | ||
# Install required binaries | ||
RUN apk add --update --no-cache zip git make cmake build-base linux-headers musl-dev libc-dev | ||
|
||
# Copy source files | ||
COPY . /localnet/ | ||
|
||
ENV LIBWASMVM_VERSION=v1.0.0 | ||
|
||
RUN git clone --depth 1 https://github.com/microsoft/mimalloc; cd mimalloc; mkdir build; cd build; cmake ..; make -j$(nproc); make install | ||
ENV MIMALLOC_RESERVE_HUGE_OS_PAGES=4 | ||
|
||
# See https://github.com/CosmWasm/wasmvm/releases | ||
ADD https://github.com/CosmWasm/wasmvm/releases/download/${LIBWASMVM_VERSION}/libwasmvm_muslc.aarch64.a /lib/libwasmvm_muslc.aarch64.a | ||
ADD https://github.com/CosmWasm/wasmvm/releases/download/${LIBWASMVM_VERSION}/libwasmvm_muslc.x86_64.a /lib/libwasmvm_muslc.x86_64.a | ||
RUN sha256sum /lib/libwasmvm_muslc.aarch64.a | grep 7d2239e9f25e96d0d4daba982ce92367aacf0cbd95d2facb8442268f2b1cc1fc | ||
RUN sha256sum /lib/libwasmvm_muslc.x86_64.a | grep f6282df732a13dec836cda1f399dd874b1e3163504dbd9607c6af915b2740479 | ||
|
||
# Copy the library you want to the final location that will be found by the linker flag `-lwasmvm_muslc` | ||
RUN cp /lib/libwasmvm_muslc.`uname -m`.a /lib/libwasmvm_muslc.a | ||
|
||
# Build executable | ||
RUN LEDGER_ENABLED=false BUILD_TAGS=muslc LDFLAGS='-linkmode=external -extldflags "-L/localnet/mimalloc/build -lmimalloc -Wl,-z,muldefs -static"' make build | ||
|
||
# -------------------------------------------------------- | ||
FROM alpine:3.15 AS runtime | ||
|
||
WORKDIR /opt | ||
RUN [ "mkdir", "-p", "/opt/integration_test" ] | ||
|
||
COPY --from=build /localnet/build/xplad /usr/bin/xplad | ||
COPY --from=build /localnet/integration_test /opt/integration_test | ||
|
||
# Expose Cosmos ports | ||
EXPOSE 9090 | ||
EXPOSE 8545 | ||
EXPOSE 26656 | ||
#EXPOSE 26657 | ||
|
||
# Set entry point | ||
CMD [ "/usr/bin/xplad", "version" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# only for integration test purpose! | ||
XPLAHOME=/opt/.xpla |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Integration Test | ||
|
||
This module is basically for the automated integration test. But if you want to execute by yourself for testing (test testing) purpose, this tests are also executable on your local. Please follow the step below: | ||
|
||
## Prerequisites | ||
|
||
- Docker >= 20.10 | ||
- Docker compose >= 2.12 | ||
|
||
## How to run | ||
|
||
```bash | ||
# 1. From the repo root, move to the integration_test, and execute docker compose | ||
cd integration_test | ||
docker-compose up -d | ||
|
||
# 2. Wait for building. Once done without error, you may check the nodes running | ||
docker ps | ||
|
||
#CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES | ||
#648b7146ce8c integration_test-node1 "sh -c 'MONIKER=vali…" 44 minutes ago Up 44 minutes 0.0.0.0:8545->8545/tcp, 0.0.0.0:9090->9090/tcp, 0.0.0.0:26656->26656/tcp xpla-localnet-validator1 | ||
#97279d567135 integration_test-node2 "sh -c 'MONIKER=vali…" 44 minutes ago Up 44 minutes 8545/tcp, 9090/tcp, 0.0.0.0:9100->9100/tcp, 26656/tcp, 0.0.0.0:26666->26666/tcp xpla-localnet-validator2 | ||
#f604f68c3f82 integration_test-node3 "sh -c 'MONIKER=vali…" 44 minutes ago Up 44 minutes 8545/tcp, 9090/tcp, 0.0.0.0:9110->9110/tcp, 26656/tcp, 0.0.0.0:26676->26676/tcp xpla-localnet-validator3 | ||
#c3d0d9daefd2 integration_test-node4 "sh -c 'MONIKER=vali…" 44 minutes ago Up 44 minutes 8545/tcp, 9090/tcp, 0.0.0.0:9120->9120/tcp, 26656/tcp, 0.0.0.0:26686->26686/tcp xpla-localnet-validator4 | ||
|
||
# 3. Execute tests | ||
go test | ||
|
||
# Do not execute short mode | ||
# (X) go test -short | ||
|
||
# ... | ||
# PASS | ||
# ok github.com/xpladev/xpla/integration_test 29.365s | ||
|
||
# If you see the pass sign, you may down the nodes | ||
docker-compose down | ||
``` | ||
|
||
## Test scenario | ||
|
||
### WASM | ||
|
||
- Send `delegation` tx | ||
- Upload the contract binary and get a code ID | ||
- With the code ID above, try to instantiate the contract | ||
- Execute the contract | ||
- Assert from querying the contract in each test step by assertion |
Oops, something went wrong.