Skip to content

Commit

Permalink
Merge pull request #406 from bnb-chain/develop
Browse files Browse the repository at this point in the history
release: prepare release for 0.2.4-alpha.1
  • Loading branch information
randyahx authored Aug 8, 2023
2 parents 25e642b + e207200 commit bc06b1b
Show file tree
Hide file tree
Showing 192 changed files with 19,496 additions and 6,162 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/buf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ on:

jobs:
protobuf-check:
strategy:
matrix:
go-version: [1.20.x]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -26,6 +29,7 @@ jobs:
- name: Test protobuf changes generates new go files
run: |
export PATH="$PATH:$(go env GOPATH)/bin"
go mod tidy
make tools proto-gen-check
- name: Test protobuf swagger changes
run: |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build Test
name: Build

on:
push:
Expand Down Expand Up @@ -51,7 +51,3 @@ jobs:
- name: Test Build
run: |
make build
- name: Uint Test
run: |
make test
22 changes: 6 additions & 16 deletions .github/workflows/e2e-test.yml → .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: End to End Test
name: Tests / Code Coverage

on:
push:
Expand All @@ -9,7 +9,7 @@ on:
pull_request:

jobs:
end-to-end-test:
tests:
strategy:
matrix:
go-version: [1.20.x]
Expand Down Expand Up @@ -44,32 +44,22 @@ jobs:
${{ runner.os }}-go-
- name: Setup GitHub Token
run: git config --global url.https://$GH_ACCESS_TOKEN@github.com/.insteadOf https://github.com/
- name: Build
- name: run tests
run: |
make build
- name: start e2e local chain
run: |
make e2e_start_localchain
sleep 5
- name: run e2e test
run: |
make e2e_test
- name: stop e2e local chain
run: |
make e2e_stop_localchain
make test
- name: make coverage report
id: coverage-report
if: github.event_name == 'pull_request'
continue-on-error: true
run: |
echo '## E2E Test Coverage Report' >> coverage-report.txt
echo '## Test Coverage Report' >> coverage-report.txt
echo 'commit-id: ${{ github.event.pull_request.head.sha }}' >> coverage-report.txt
echo 'generated by https://github.com/vladopajic/go-test-coverage' >> coverage-report.txt
echo >> coverage-report.txt
echo '<details><summary>Additional details and impacted files</summary>' >> coverage-report.txt
echo >> coverage-report.txt
echo '```' >> coverage-report.txt
make check-e2e-coverage >> coverage-report.txt
make check-coverage >> coverage-report.txt
echo '```' >> coverage-report.txt
echo >> coverage-report.txt
echo '</details>' >> coverage-report.txt
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ build/
vendor/
.local
.task
coverage.out
15 changes: 12 additions & 3 deletions .testcoverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,19 @@ exclude:
- \.pb\.go$ # excludes all protobuf generated files
- \.pb\.gw\.go$ # excludes all protobuf generated files
- .*_mocks.go$ # excludes all protobuf generated files
- types/.*
- simulation/.*
- testutil/.*
- e2e/.*
- e2e/.*
- .*/cli/.*
- sdk/.*
- version/.*
- cmd/gnfd/.*
- internal/sequence/.*

- x/gensp/.*
- .*/module.go
- .*/module_simulation.go

# NOTES:
# - symbol `/` in all path regexps will be replaced by
# current OS file path separator to properly work on Windows
# current OS file path separator to properly work on Windows
49 changes: 49 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,54 @@
# Changelog

## v0.2.4-alpha.1
This release includes 4 features, 9 bugfixes and 2 documentation updates.

Features:
* [#374](https://github.com/bnb-chain/greenfield/pull/374) feat: group member expiration
* [#390](https://github.com/bnb-chain/greenfield/pull/390) feat: add flag to enable/disable heavy queries and refactor apis
* [#399](https://github.com/bnb-chain/greenfield/pull/399) feat: add new query APIs for group and group member
* [#403](https://github.com/bnb-chain/greenfield/pull/403) feat: sp maintenance mode

Bugfixes:
* [#377](https://github.com/bnb-chain/greenfield/pull/377) fix: improve e2e tests to include more coverage from server side
* [#379](https://github.com/bnb-chain/greenfield/pull/379) fix: error member name in transferInRefundPackageType
* [#383](https://github.com/bnb-chain/greenfield/pull/383) fix: fix lock balance not updated for frozen payment account
* [#385](https://github.com/bnb-chain/greenfield/pull/385) fix: fix returned operation type in group cross chain app
* [#391](https://github.com/bnb-chain/greenfield/pull/391) fix: add cancel mb event for discontinue and delete
* [#398](https://github.com/bnb-chain/greenfield/pull/398) fix: register gov cross-chain app
* [#400](https://github.com/bnb-chain/greenfield/pull/400) fix: allow edit-sp by cmd without blskey
* [#401](https://github.com/bnb-chain/greenfield/pull/401) fix: add group existence check when verify permission
* [#375](https://github.com/bnb-chain/greenfield/pull/375) fix: fix defining err for ErrInvalidBlsPubKey

Chores:
* [#376](https://github.com/bnb-chain/greenfield/pull/376) chore: add unit tests for the storage module
* [#378](https://github.com/bnb-chain/greenfield/pull/378) chore: add unit test cases for challenge module
* [#380](https://github.com/bnb-chain/greenfield/pull/380) chore: add unit test cases for payment module
* [#381](https://github.com/bnb-chain/greenfield/pull/381) chore: add tests for bridge module
* [#387](https://github.com/bnb-chain/greenfield/pull/387) chore: add more e2e test cases for payment module
* [#388](https://github.com/bnb-chain/greenfield/pull/388) chore: add cli tests
* [#389](https://github.com/bnb-chain/greenfield/pull/389) chore: add more test cases for cross chain apps

Documentation:
* [#402](https://github.com/bnb-chain/greenfield/pull/402) docs: update testnet asset to v0.2.3
* [#404](https://github.com/bnb-chain/greenfield/pull/404) docs: update document site link

## 0.2.3
This is a official release for v0.2.3, includes all the changes since v0.2.2.

Bugfixes:
* [#375](https://github.com/bnb-chain/greenfield/pull/375) fix: defining err
* [#379](https://github.com/bnb-chain/greenfield/pull/379) fix: error member name in transferInRefundPackageType
* [#383](https://github.com/bnb-chain/greenfield/pull/383) fix: lock balance not updated for frozen payment account
* [#385](https://github.com/bnb-chain/greenfield/pull/385) fix: returned operation type in group cross chain app

Chores:
* [#376](https://github.com/bnb-chain/greenfield/pull/376) chore: add unit tests for the storage module
* [#377](https://github.com/bnb-chain/greenfield/pull/377) chore: improve e2e tests to include more coverage from server side
* [#380](https://github.com/bnb-chain/greenfield/pull/380) chore: add unit test cases for payment module
* [#381](https://github.com/bnb-chain/greenfield/pull/381) chore: add tests for bridge module
* [#383](https://github.com/bnb-chain/greenfield/pull/383) chore: add unit test cases for challenge module

## 0.2.3-alpha.7
This release includes 2 features and 3 bugfixes.

Expand Down
22 changes: 12 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.PHONY: build build-linux build-macos build-windows
.PHONY: tools proto-gen proto-format test e2e_test ci lint
.PHONY: tools proto-gen proto-format test e2e_init_localchain e2e_test ci lint
.PHONY: install-go-test-coverage check-coverage

VERSION=$(shell git describe --tags --always)
Expand All @@ -21,6 +21,7 @@ format:
tools:
go install github.com/cosmos/gogoproto/protoc-gen-gocosmos
go install github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway
go install github.com/golang/mock/mockgen@v1.6.0

proto-gen:
cd proto && buf generate && cp -r github.com/bnb-chain/greenfield/x/* ../x && cp -r github.com/bnb-chain/greenfield/types/* ../types && rm -rf github.com && go mod tidy
Expand Down Expand Up @@ -48,22 +49,23 @@ docker-image:
go mod vendor # temporary, should be removed after open source
docker build . -t ${IMAGE_NAME}

test:
unit_test:
go test -failfast $$(go list ./... | grep -v e2e | grep -v sdk)

e2e_start_localchain:
bash ./deployment/localup/localup.sh all 1 7
e2e_init_localchain: build
bash ./deployment/localup/localup.sh init 1 7
bash ./deployment/localup/localup.sh generate 1 7

e2e_stop_localchain:
bash ./deployment/localup/localup.sh stop
e2e_test: e2e_init_localchain
go test -p 1 -failfast -v ./e2e/... -timeout 99999s

e2e_test:
go test -p 1 -failfast -v ./e2e/... -coverpkg=./... -covermode=atomic -coverprofile=./coverage.out -timeout 99999s
test: e2e_init_localchain
go test -p 1 -failfast -v $$(go list ./... | grep -v sdk) -coverpkg=./... -covermode=atomic -coverprofile=./coverage.out -timeout 99999s

install-go-test-coverage:
@go install github.com/vladopajic/go-test-coverage/v2@latest

check-e2e-coverage: install-go-test-coverage
check-coverage: install-go-test-coverage
@go-test-coverage --config=./.testcoverage.yml || true

lint:
Expand All @@ -73,5 +75,5 @@ lint:
proto-gen-check: proto-gen
git diff --exit-code

ci: proto-format-check build test e2e_start_localchain e2e_test lint proto-gen-check
ci: proto-format-check build test e2e_init_localchain e2e_test lint proto-gen-check
echo "ci passed"
60 changes: 30 additions & 30 deletions app/ante/ante_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func (suite *AnteTestSuite) TestAnteHandler() {
bz, _ := hex.DecodeString(test.TEST_PUBKEY)
faucetPubKey := &ethsecp256k1.PubKey{Key: bz}
err := suite.app.BankKeeper.SendCoins(suite.ctx, faucetPubKey.Address().Bytes(), acc.GetAddress(), sdk.Coins{sdk.Coin{
Denom: sdk.DefaultBondDenom,
Denom: test.TEST_TOKEN_NAME,
Amount: sdk.NewInt(100000000000000),
}})
if err != nil {
Expand All @@ -53,89 +53,89 @@ func (suite *AnteTestSuite) TestAnteHandler() {
"success - DeliverTx EIP712 signed Cosmos Tx MsgSend",
func() sdk.Tx {
gas := uint64(12e3)
fee := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewIntFromUint64(gas)))
txBuilder := suite.CreateTestEIP712TxBuilderMsgSend(addr, privKey, "greenfield_9000-1", gas, fee)
fee := sdk.NewCoins(sdk.NewCoin(test.TEST_TOKEN_NAME, sdk.NewIntFromUint64(gas)))
txBuilder := suite.CreateTestEIP712TxBuilderMsgSend(addr, privKey, test.TEST_CHAIN_ID, gas, fee)
return txBuilder.GetTx()
}, true, false, true,
},
{
"success - DeliverTx EIP712 signed Cosmos Tx MsgDelegate",
func() sdk.Tx {
gas := uint64(12e3)
fee := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewIntFromUint64(gas)))
txBuilder := suite.CreateTestEIP712TxBuilderMsgDelegate(addr, privKey, "greenfield_9000-1", gas, fee)
fee := sdk.NewCoins(sdk.NewCoin(test.TEST_TOKEN_NAME, sdk.NewIntFromUint64(gas)))
txBuilder := suite.CreateTestEIP712TxBuilderMsgDelegate(addr, privKey, test.TEST_CHAIN_ID, gas, fee)
return txBuilder.GetTx()
}, true, false, true,
},
{
"success - DeliverTx EIP712 signed Cosmos Tx MsgCreateValidator",
func() sdk.Tx {
gas := uint64(2e8)
fee := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewIntFromUint64(gas)))
txBuilder := suite.CreateTestEIP712MsgCreateValidator(addr, privKey, "greenfield_9000-1", gas, fee)
fee := sdk.NewCoins(sdk.NewCoin(test.TEST_TOKEN_NAME, sdk.NewIntFromUint64(gas)))
txBuilder := suite.CreateTestEIP712MsgCreateValidator(addr, privKey, test.TEST_CHAIN_ID, gas, fee)
return txBuilder.GetTx()
}, true, false, true,
},
{
"success - DeliverTx EIP712 signed Cosmos Tx MsgGrantAllowance",
func() sdk.Tx {
gas := uint64(16e3)
fee := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewIntFromUint64(gas)))
txBuilder := suite.CreateTestEIP712GrantAllowance(addr, privKey, "greenfield_9000-1", gas, fee)
fee := sdk.NewCoins(sdk.NewCoin(test.TEST_TOKEN_NAME, sdk.NewIntFromUint64(gas)))
txBuilder := suite.CreateTestEIP712GrantAllowance(addr, privKey, test.TEST_CHAIN_ID, gas, fee)
return txBuilder.GetTx()
}, true, false, true,
},
{
"success - DeliverTx EIP712 signed Cosmos Tx MsgEditValidator",
func() sdk.Tx {
gas := uint64(2e7)
fee := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewIntFromUint64(gas)))
txBuilder := suite.CreateTestEIP712MsgEditValidator(addr, privKey, "greenfield_9000-1", gas, fee)
fee := sdk.NewCoins(sdk.NewCoin(test.TEST_TOKEN_NAME, sdk.NewIntFromUint64(gas)))
txBuilder := suite.CreateTestEIP712MsgEditValidator(addr, privKey, test.TEST_CHAIN_ID, gas, fee)
return txBuilder.GetTx()
}, true, false, true,
},
{
"success - DeliverTx EIP712 signed Cosmos Tx MsgSubmitProposalV1",
func() sdk.Tx {
gas := uint64(2e8)
fee := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewIntFromUint64(gas)))
txBuilder := suite.CreateTestEIP712TxBuilderMsgSubmitProposalV1(addr, privKey, "greenfield_9000-1", gas, fee)
fee := sdk.NewCoins(sdk.NewCoin(test.TEST_TOKEN_NAME, sdk.NewIntFromUint64(gas)))
txBuilder := suite.CreateTestEIP712TxBuilderMsgSubmitProposalV1(addr, privKey, test.TEST_CHAIN_ID, gas, fee)
return txBuilder.GetTx()
}, true, false, true,
},
{
"success - DeliverTx EIP712 signed Cosmos Tx MsgGrant",
func() sdk.Tx {
gas := uint64(16e3)
fee := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewIntFromUint64(gas)))
txBuilder := suite.CreateTestEIP712TxBuilderMsgGrant(addr, privKey, "greenfield_9000-1", gas, fee)
fee := sdk.NewCoins(sdk.NewCoin(test.TEST_TOKEN_NAME, sdk.NewIntFromUint64(gas)))
txBuilder := suite.CreateTestEIP712TxBuilderMsgGrant(addr, privKey, test.TEST_CHAIN_ID, gas, fee)
return txBuilder.GetTx()
}, true, false, true,
},
{
"fails - DeliverTx legacy msg MsgSubmitProposal v1beta",
func() sdk.Tx {
gas := uint64(2000000000)
fee := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewIntFromUint64(gas)))
deposit := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewIntFromUint64(20)))
txBuilder := suite.CreateTestEIP712SubmitProposal(addr, privKey, "greenfield_9000-1", gas, fee, deposit)
fee := sdk.NewCoins(sdk.NewCoin(test.TEST_TOKEN_NAME, sdk.NewIntFromUint64(gas)))
deposit := sdk.NewCoins(sdk.NewCoin(test.TEST_TOKEN_NAME, sdk.NewIntFromUint64(20)))
txBuilder := suite.CreateTestEIP712SubmitProposal(addr, privKey, test.TEST_CHAIN_ID, gas, fee, deposit)
return txBuilder.GetTx()
}, true, false, false,
},
{
"fails - DeliverTx unregistered msg type MsgSubmitEvidence",
func() sdk.Tx {
gas := uint64(2000000000)
fee := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewIntFromUint64(gas)))
txBuilder := suite.CreateTestEIP712MsgSubmitEvidence(addr, privKey, "greenfield_9000-1", gas, fee)
fee := sdk.NewCoins(sdk.NewCoin(test.TEST_TOKEN_NAME, sdk.NewIntFromUint64(gas)))
txBuilder := suite.CreateTestEIP712MsgSubmitEvidence(addr, privKey, test.TEST_CHAIN_ID, gas, fee)
return txBuilder.GetTx()
}, true, false, false,
},
{
"fails - DeliverTx EIP712 signed Cosmos Tx with wrong Chain ID",
func() sdk.Tx {
gas := uint64(12e3)
fee := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewIntFromUint64(gas)))
fee := sdk.NewCoins(sdk.NewCoin(test.TEST_TOKEN_NAME, sdk.NewIntFromUint64(gas)))
txBuilder := suite.CreateTestEIP712TxBuilderMsgSend(addr, privKey, "ethermint_9002-1", gas, fee)
return txBuilder.GetTx()
}, true, false, false,
Expand All @@ -144,19 +144,19 @@ func (suite *AnteTestSuite) TestAnteHandler() {
"fails - DeliverTx EIP712 signed Cosmos Tx with different gas fees",
func() sdk.Tx {
gas := uint64(12e3)
fee := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewIntFromUint64(gas)))
txBuilder := suite.CreateTestEIP712TxBuilderMsgSend(addr, privKey, "greenfield_9000-1", gas, fee)
fee := sdk.NewCoins(sdk.NewCoin(test.TEST_TOKEN_NAME, sdk.NewIntFromUint64(gas)))
txBuilder := suite.CreateTestEIP712TxBuilderMsgSend(addr, privKey, test.TEST_CHAIN_ID, gas, fee)
txBuilder.SetGasLimit(uint64(300000))
txBuilder.SetFeeAmount(sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(30))))
txBuilder.SetFeeAmount(sdk.NewCoins(sdk.NewCoin(test.TEST_TOKEN_NAME, sdkmath.NewInt(30))))
return txBuilder.GetTx()
}, true, false, false,
},
{
"fails - DeliverTx EIP712 signed Cosmos Tx with empty signature",
func() sdk.Tx {
gas := uint64(12e3)
fee := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewIntFromUint64(gas)))
txBuilder := suite.CreateTestEIP712TxBuilderMsgSend(addr, privKey, "greenfield_9000-1", gas, fee)
fee := sdk.NewCoins(sdk.NewCoin(test.TEST_TOKEN_NAME, sdk.NewIntFromUint64(gas)))
txBuilder := suite.CreateTestEIP712TxBuilderMsgSend(addr, privKey, test.TEST_CHAIN_ID, gas, fee)
sigsV2 := signing.SignatureV2{
PubKey: privKey.PubKey(),
}
Expand All @@ -169,8 +169,8 @@ func (suite *AnteTestSuite) TestAnteHandler() {
"fails - DeliverTx EIP712 signed Cosmos Tx with invalid sequence",
func() sdk.Tx {
gas := uint64(12e3)
fee := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewIntFromUint64(gas)))
txBuilder := suite.CreateTestEIP712TxBuilderMsgSend(addr, privKey, "greenfield_9000-1", gas, fee)
fee := sdk.NewCoins(sdk.NewCoin(test.TEST_TOKEN_NAME, sdk.NewIntFromUint64(gas)))
txBuilder := suite.CreateTestEIP712TxBuilderMsgSend(addr, privKey, test.TEST_CHAIN_ID, gas, fee)
nonce, err := suite.app.AccountKeeper.GetSequence(suite.ctx, addr)
suite.Require().NoError(err)
sigsV2 := signing.SignatureV2{
Expand All @@ -189,8 +189,8 @@ func (suite *AnteTestSuite) TestAnteHandler() {
"fails - DeliverTx EIP712 signed Cosmos Tx with invalid signMode",
func() sdk.Tx {
gas := uint64(12e3)
fee := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewIntFromUint64(gas)))
txBuilder := suite.CreateTestEIP712TxBuilderMsgSend(addr, privKey, "greenfield_9000-1", gas, fee)
fee := sdk.NewCoins(sdk.NewCoin(test.TEST_TOKEN_NAME, sdk.NewIntFromUint64(gas)))
txBuilder := suite.CreateTestEIP712TxBuilderMsgSend(addr, privKey, test.TEST_CHAIN_ID, gas, fee)
nonce, err := suite.app.AccountKeeper.GetSequence(suite.ctx, addr)
suite.Require().NoError(err)
sigsV2 := signing.SignatureV2{
Expand Down
Loading

0 comments on commit bc06b1b

Please sign in to comment.