Skip to content

Commit

Permalink
Merge branch 'master' into tokenfactory-metadata-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
philipsu522 authored Jun 12, 2023
2 parents 7fe8437 + 8863dbf commit 882b17f
Show file tree
Hide file tree
Showing 53 changed files with 1,487 additions and 466 deletions.
31 changes: 27 additions & 4 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,21 @@ defaults:
shell: bash

jobs:

build:
runs-on: ubuntu-latest
timeout-minutes: 15
timeout-minutes: 20
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Pyyaml
run: |
pip3 install pyyaml
- name: Set up Go
uses: actions/setup-go@v3
Expand All @@ -35,7 +44,21 @@ jobs:
do
sleep 10
done
sleep 5
sleep 10
- name: Verify Sei Chain is able to start up
run: ./docker/integration_test/startup_test.sh
run: python3 integration_test/scripts/runner.py integration_test/startup/startup_test.yaml

- name: Testing Dex Module
run: |
docker exec sei-node-0 integration_test/contracts/deploy_dex_contract.sh mars
python3 integration_test/scripts/runner.py integration_test/dex_module/place_order_test.yaml
- name: Testing Wasm Module
run: |
docker exec sei-node-0 integration_test/contracts/deploy_timelocked_token_contract.sh
python3 integration_test/scripts/runner.py integration_test/wasm_module/timelocked_token_delegation_test.yaml
python3 integration_test/scripts/runner.py integration_test/wasm_module/timelocked_token_admin_test.yaml
python3 integration_test/scripts/runner.py integration_test/wasm_module/timelocked_token_withdraw_test.yaml
docker exec sei-node-0 integration_test/contracts/deploy_timelocked_token_contract.sh
python3 integration_test/scripts/runner.py integration_test/wasm_module/timelocked_token_emergency_withdraw_test.yaml
35 changes: 0 additions & 35 deletions .github/workflows/unit-test-coverage.yml

This file was deleted.

57 changes: 55 additions & 2 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
paths:
- "**.go"
branches:
- main
- master
- release/**

jobs:
Expand All @@ -28,8 +28,61 @@ jobs:
go.mod
go.sum
Makefile
- name: Get data from Go build cache
uses: actions/cache@v3
with:
path: |
~/go/pkg/mod
~/.cache/golangci-lint
~/.cache/go-build
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
- name: Run Go Tests
run: |
NUM_SPLIT=20
make test-group-${{matrix.part}} NUM_SPLIT=20
if: env.GIT_DIFF
- uses: actions/upload-artifact@v3
with:
name: "${{ github.sha }}-${{ matrix.part }}-coverage"
path: ./${{ matrix.part }}.profile.out

upload-coverage-report:
needs: tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.19

# Download all coverage reports from the 'tests' job
- name: Download coverage reports
uses: actions/download-artifact@v3

- name: Set GOPATH
run: echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV

- name: Add GOPATH/bin to PATH
run: echo "GOBIN=$(go env GOPATH)/bin" >> $GITHUB_ENV

- name: Install gocovmerge
run: go get github.com/wadey/gocovmerge && go install github.com/wadey/gocovmerge

- name: Merge coverage reports
run: gocovmerge $(find . -type f -name '*profile.out') > coverage.txt

- name: Check coverage report lines
run: wc -l coverage.txt
continue-on-error: true

- name: Check coverage report files
run: ls **/*profile.out
continue-on-error: true

# Now we upload the merged report to Codecov
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage.txt
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ parallelization/**/artifacts/
parallelization/**/target/
parallelization/**/Cargo.lock

# integration test resources
integration_test/**/*.txt

# Coverage Files
coverage.html
coverage.out
coverage.out
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -197,4 +197,4 @@ $(BUILDDIR)/packages.txt:$(GO_TEST_FILES) $(BUILDDIR)
split-test-packages:$(BUILDDIR)/packages.txt
split -d -n l/$(NUM_SPLIT) $< $<.
test-group-%:split-test-packages
cat $(BUILDDIR)/packages.txt.$* | xargs go test -mod=readonly -timeout=10m -race -coverprofile=$(BUILDDIR)/$*.profile.out
cat $(BUILDDIR)/packages.txt.$* | xargs go test -parallel 4 -mod=readonly -timeout=10m -race -coverprofile=$*.profile.out -covermode=atomic
19 changes: 19 additions & 0 deletions aclmapping/dex/mappings.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ func DexPlaceOrdersDependencyGenerator(keeper aclkeeper.Keeper, ctx sdk.Context,
return []sdkacltypes.AccessOperation{}, ErrPlaceOrdersGenerator
}

moduleAdr := keeper.AccountKeeper.GetModuleAddress(dextypes.ModuleName)

senderBankAddrIdentifier := hex.EncodeToString(banktypes.CreateAccountBalancesPrefixFromBech32(placeOrdersMsg.Creator))
contractAddr := placeOrdersMsg.ContractAddr

Expand Down Expand Up @@ -110,6 +112,23 @@ func DexPlaceOrdersDependencyGenerator(keeper aclkeeper.Keeper, ctx sdk.Context,
IdentifierTemplate: senderBankAddrIdentifier,
},

// update the amounts for dex module balance
{
AccessType: sdkacltypes.AccessType_READ,
ResourceType: sdkacltypes.ResourceType_KV_AUTH_ADDRESS_STORE,
IdentifierTemplate: hex.EncodeToString(authtypes.AddressStoreKey(moduleAdr)),
},
{
AccessType: sdkacltypes.AccessType_READ,
ResourceType: sdkacltypes.ResourceType_KV_BANK_BALANCES,
IdentifierTemplate: hex.EncodeToString(banktypes.CreateAccountBalancesPrefix(moduleAdr)),
},
{
AccessType: sdkacltypes.AccessType_WRITE,
ResourceType: sdkacltypes.ResourceType_KV_BANK_BALANCES,
IdentifierTemplate: hex.EncodeToString(banktypes.CreateAccountBalancesPrefix(moduleAdr)),
},

// Gets Account Info for the sender
{
AccessType: sdkacltypes.AccessType_READ,
Expand Down
10 changes: 10 additions & 0 deletions aclmapping/tokenfactory/mappings.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,16 @@ func TokenFactoryBurnDependencyGenerator(keeper aclkeeper.Keeper, ctx sdk.Contex
ResourceType: sdkacltypes.ResourceType_KV_AUTH_ADDRESS_STORE,
IdentifierTemplate: hex.EncodeToString(authtypes.AddressStoreKey(moduleAdr)),
},
{
AccessType: sdkacltypes.AccessType_READ,
ResourceType: sdkacltypes.ResourceType_KV_BANK_BALANCES,
IdentifierTemplate: hex.EncodeToString(banktypes.CreateAccountBalancesPrefix(moduleAdr)),
},
{
AccessType: sdkacltypes.AccessType_WRITE,
ResourceType: sdkacltypes.ResourceType_KV_BANK_BALANCES,
IdentifierTemplate: hex.EncodeToString(banktypes.CreateAccountBalancesPrefix(moduleAdr)),
},

// Checks balance for receiver
{
Expand Down
4 changes: 4 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -1308,6 +1308,10 @@ func (app *App) ProcessBlock(ctx sdk.Context, txs [][]byte, req BlockProcessRequ
prioritizedResults, ctx := app.BuildDependenciesAndRunTxs(ctx, prioritizedTxs)
txResults = append(txResults, prioritizedResults...)

// Finalize all Bank Module Transfers here so that events are included for prioritiezd txs
deferredWriteEvents := app.BankKeeper.WriteDeferredOperations(ctx)
events = append(events, deferredWriteEvents...)

midBlockEvents := app.MidBlock(ctx, req.GetHeight())
events = append(events, midBlockEvents...)

Expand Down
6 changes: 3 additions & 3 deletions app/params/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ func SetTendermintConfigs(config *tmcfg.Config) {
config.Mempool.TTLNumBlocks = 100
// Consensus Configs
config.Consensus.GossipTransactionKeyOnly = true
config.Consensus.UnsafeProposeTimeoutOverride = 1 * time.Second
config.Consensus.UnsafeProposeTimeoutDeltaOverride = 500 * time.Millisecond
config.Consensus.UnsafeProposeTimeoutOverride = 300 * time.Millisecond
config.Consensus.UnsafeProposeTimeoutDeltaOverride = 50 * time.Millisecond
config.Consensus.UnsafeVoteTimeoutOverride = 50 * time.Millisecond
config.Consensus.UnsafeVoteTimeoutDeltaOverride = 500 * time.Millisecond
config.Consensus.UnsafeVoteTimeoutDeltaOverride = 50 * time.Millisecond
config.Consensus.UnsafeCommitTimeoutOverride = 100 * time.Millisecond
config.Consensus.UnsafeBypassCommitTimeoutOverride = &UnsafeBypassCommitTimeoutOverride
// Metrics
Expand Down
20 changes: 18 additions & 2 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
coverage:
precision: 2
round: down
status:
project:
default:
target: 80%
target: 60%
threshold: 1% # allow this much decrease on project

comment:
layout: "reach,diff,flags,tree,betaprofiling"
behavior: default # update if exists else create new
require_changes: true

ignore:
- "**/*_pb.go" # Auto-generated files
- "docs"
- "*.md"
- "*.rst"
- "**/*pb*.go"
- "tests/**/*"
- "x/**/test_common.go"
- "scripts/"
- "contrib"
8 changes: 4 additions & 4 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: '3.3'
services:
node0:
platform: linux/amd64
container_name: sei-node0
container_name: sei-node-0
image: "sei-chain/localnode"
ports:
- "26656-26658:26656-26658"
Expand All @@ -24,7 +24,7 @@ services:

node1:
platform: linux/amd64
container_name: sei-node1
container_name: sei-node-1
image: "sei-chain/localnode"
ports:
- "26659-26661:26656-26658"
Expand All @@ -45,7 +45,7 @@ services:

node2:
platform: linux/amd64
container_name: sei-node2
container_name: sei-node-2
image: "sei-chain/localnode"
environment:
- ID=2
Expand All @@ -66,7 +66,7 @@ services:

node3:
platform: linux/amd64
container_name: sei-node3
container_name: sei-node-3
image: "sei-chain/localnode"
environment:
- ID=3
Expand Down
21 changes: 0 additions & 21 deletions docker/integration_test/startup_test.sh

This file was deleted.

5 changes: 4 additions & 1 deletion docker/localnode/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ FROM ubuntu:latest
RUN apt-get update && \
apt-get install -y make git golang jq python3 curl vim
RUN rm -rf build/generated
SHELL ["/bin/bash", "-c"]


VOLUME [ "/sei-protocol" ]
VOLUME [ "/root/go/pkg/mod" ]
Expand All @@ -21,4 +23,5 @@ COPY scripts/step2_genesis.sh /usr/bin/genesis.sh
COPY scripts/step3_add_validator_to_genesis.sh /usr/bin/add_validator_to_gensis.sh
COPY scripts/step4_persistent_peers.sh /usr/bin/persistent_peers.sh
COPY scripts/step5_start_sei.sh /usr/bin/start_sei.sh
COPY scripts/step6_start_price_feeder.sh /usr/bin/start_price_feeder.sh
COPY scripts/step6_start_price_feeder.sh /usr/bin/start_price_feeder.sh
ENV PATH "$PATH:$HOME/go/bin"
14 changes: 7 additions & 7 deletions docker/localnode/scripts/step2_genesis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ override_genesis() {
override_genesis '.app_state["crisis"]["constant_fee"]["denom"]="usei"'
override_genesis '.app_state["mint"]["params"]["mint_denom"]="usei"'
override_genesis '.app_state["staking"]["params"]["bond_denom"]="usei"'
override_genesis '.app_state["oracle"]["params"]["vote_period"]="1"'
override_genesis '.app_state["oracle"]["params"]["vote_period"]="2"'
override_genesis '.app_state["slashing"]["params"]["signed_blocks_window"]="10000"'
override_genesis '.app_state["slashing"]["params"]["min_signed_per_window"]="0.050000000000000000"'
override_genesis '.app_state["staking"]["params"]["max_validators"]="50"'
override_genesis '.consensus_params["block"]["max_gas"]="5000000000"'
override_genesis '.app_state["staking"]["params"]["unbonding_time"]="86400s"'
override_genesis '.app_state["staking"]["params"]["unbonding_time"]="10s"'

# We already added node0's genesis account in configure_init, remove it here since we're going to re-add it in the "add genesis accounts" step
override_genesis '.app_state["auth"]["accounts"]=[]'
Expand All @@ -30,14 +30,14 @@ override_genesis '.app_state["genutil"]["gen_txs"]=[]'

# gov parameters
override_genesis '.app_state["gov"]["deposit_params"]["min_deposit"][0]["denom"]="usei"'
#override_genesis '.app_state["gov"]["deposit_params"]["min_expedited_deposit"][0]["denom"]="usei"'
#override_genesis '.app_state["gov"]["deposit_params"]["max_deposit_period"]="300s"'
override_genesis '.app_state["gov"]["deposit_params"]["min_expedited_deposit"][0]["denom"]="usei"'
override_genesis '.app_state["gov"]["deposit_params"]["max_deposit_period"]="300s"'
override_genesis '.app_state["gov"]["voting_params"]["voting_period"]="300s"'
#override_genesis '.app_state["gov"]["voting_params"]["expedited_voting_period"]="120s"'
override_genesis '.app_state["gov"]["voting_params"]["expedited_voting_period"]="120s"'
override_genesis '.app_state["gov"]["tally_params"]["quorum"]="0.5"'
override_genesis '.app_state["gov"]["tally_params"]["threshold"]="0.5"'
#override_genesis '.app_state["gov"]["tally_params"]["expedited_quorum"]="0.9"'
#override_genesis '.app_state["gov"]["tally_params"]["expedited_threshold"]="0.9"'
override_genesis '.app_state["gov"]["tally_params"]["expedited_quorum"]="0.9"'
override_genesis '.app_state["gov"]["tally_params"]["expedited_threshold"]="0.9"'

# add genesis accounts for each node
while read account; do
Expand Down
Loading

0 comments on commit 882b17f

Please sign in to comment.