Skip to content

Commit

Permalink
Merge pull request #424 from bnb-chain/develop
Browse files Browse the repository at this point in the history
release: prepare release for v0.2.4-alpha.2
  • Loading branch information
randyahx authored Aug 16, 2023
2 parents bc06b1b + 4d46186 commit fc04720
Show file tree
Hide file tree
Showing 109 changed files with 4,625 additions and 2,480 deletions.
30 changes: 30 additions & 0 deletions .github/ISSUE_TEMPLATE/bug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
name: Report a bug
about: Something with greenfield is not working as expected
title: ''
labels: 'type:bug'
assignees: ''
---

#### System information

Greenfield version: `gnfd version`
OS & Version: Windows/Linux/OSX
Commit hash : (if `develop`)

#### Expected behaviour


#### Actual behaviour


#### Steps to reproduce the behaviour


#### Backtrace

````
[backtrace]
````

When submitting logs: please submit them as text and not screenshots.
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: Request a feature
about: Report a missing feature - e.g. as a step before submitting a PR
title: ''
labels: 'type:feature'
assignees: ''
---

# Rationale

Why should this feature exist?
What are the use-cases?

# Implementation

Do you have ideas regarding the implementation of this feature?
Are you willing to implement this feature?
9 changes: 9 additions & 0 deletions .github/ISSUE_TEMPLATE/question.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
name: Ask a question
about: Something is unclear
title: ''
labels: 'type:docs'
assignees: ''
---

This should only be used in very rare cases e.g. if you are not 100% sure if something is a bug or asking a question that leads to improving the documentation. For general questions please use [discord](https://discord.gg/bnbchain).
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
# Changelog

## v0.2.4-alpha.2
This release contains 4 features and 4 bugfixes.

Features:
* [#411](https://github.com/bnb-chain/greenfield/pull/411) feat: add RemoveExpiredPolicies to add method to remove expired data from kvstore
* [#413](https://github.com/bnb-chain/greenfield/pull/413) feat: implement cross-chain mechanism between op and greenfield
* [#415](https://github.com/bnb-chain/greenfield/pull/415) feat: enable plain store for full node
* [#420](https://github.com/bnb-chain/greenfield/pull/420) feat: skip sig verification on genesis block

Bugfixes:
* [#416](https://github.com/bnb-chain/greenfield/pull/416) fix: update the dependencies to the latest develop branch
* [#419](https://github.com/bnb-chain/greenfield/pull/419) fix: validate bls key and proof before submitting proposal
* [#410](https://github.com/bnb-chain/greenfield/pull/410) fix: fix group member key collision issues
* [#422](https://github.com/bnb-chain/greenfield/pull/422) fix: fix the SettleTimestamp calculation

Chores:
* [#408](https://github.com/bnb-chain/greenfield/pull/408) chore: payment refactor to use global store prices for billing
* [#409](https://github.com/bnb-chain/greenfield/pull/409) chore: add issue template
* [#414](https://github.com/bnb-chain/greenfield/pull/414) chore: modify default gas
* [#417](https://github.com/bnb-chain/greenfield/pull/417) chore: adapt to cross chain token mintable version
* [#421](https://github.com/bnb-chain/greenfield/pull/421) chore: update go version to 1.20


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

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,5 @@ lint:
proto-gen-check: proto-gen
git diff --exit-code

ci: proto-format-check build test e2e_init_localchain e2e_test lint proto-gen-check
ci: proto-format-check build unit_test e2e_init_localchain e2e_test lint proto-gen-check
echo "ci passed"
57 changes: 33 additions & 24 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ var (
stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking},
stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
govtypes.ModuleName: {authtypes.Burner},
paymentmoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner, authtypes.Staking},
paymentmoduletypes.ModuleName: {authtypes.Burner, authtypes.Staking},
crosschaintypes.ModuleName: {authtypes.Minter},
permissionmoduletypes.ModuleName: nil,
bridgemoduletypes.ModuleName: nil,
Expand Down Expand Up @@ -312,12 +312,6 @@ func New(
memKeys: memKeys,
}

app.CrossChainKeeper = crosschainkeeper.NewKeeper(
appCodec,
keys[crosschaintypes.StoreKey],
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)

// set the BaseApp's parameter store
app.ConsensusParamsKeeper = consensusparamkeeper.NewKeeper(appCodec, keys[consensusparamtypes.StoreKey], authtypes.NewModuleAddress(govtypes.ModuleName).String())
bApp.SetParamStore(&app.ConsensusParamsKeeper)
Expand Down Expand Up @@ -354,6 +348,14 @@ func New(
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)

app.CrossChainKeeper = crosschainkeeper.NewKeeper(
appCodec,
keys[crosschaintypes.StoreKey],
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
app.StakingKeeper,
app.BankKeeper,
)

app.DistrKeeper = distrkeeper.NewKeeper(
appCodec,
keys[distrtypes.StoreKey],
Expand Down Expand Up @@ -455,11 +457,8 @@ func New(
app.PaymentKeeper = *paymentmodulekeeper.NewKeeper(
appCodec,
keys[paymentmoduletypes.StoreKey],

app.BankKeeper,
app.AccountKeeper,
app.SpKeeper,

authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)
paymentModule := paymentmodule.NewAppModule(appCodec, app.PaymentKeeper, app.AccountKeeper, app.BankKeeper)
Expand Down Expand Up @@ -702,17 +701,19 @@ func New(
}
}

// enable diff for reconciliation
bankIavl, ok := ms.GetCommitStore(keys[banktypes.StoreKey]).(*iavl.Store)
if !ok {
tmos.Exit("cannot convert bank store to ival store")
}
bankIavl.EnableDiff()
paymentIavl, ok := ms.GetCommitStore(keys[paymentmoduletypes.StoreKey]).(*iavl.Store)
if !ok {
tmos.Exit("cannot convert payment store to ival store")
if app.IsIavlStore() {
//enable diff for reconciliation
bankIavl, ok := ms.GetCommitStore(keys[banktypes.StoreKey]).(*iavl.Store)
if !ok {
tmos.Exit("cannot convert bank store to ival store")
}
bankIavl.EnableDiff()
paymentIavl, ok := ms.GetCommitStore(keys[paymentmoduletypes.StoreKey]).(*iavl.Store)
if !ok {
tmos.Exit("cannot convert payment store to ival store")
}
paymentIavl.EnableDiff()
}
paymentIavl.EnableDiff()

app.initModules(ctx)

Expand All @@ -734,7 +735,7 @@ func (app *App) initModules(ctx sdk.Context) {

func (app *App) initCrossChain() {
app.CrossChainKeeper.SetSrcChainID(sdk.ChainID(app.appConfig.CrossChain.SrcChainId))
app.CrossChainKeeper.SetDestChainID(sdk.ChainID(app.appConfig.CrossChain.DestBscChainId))
app.CrossChainKeeper.SetDestBscChainID(sdk.ChainID(app.appConfig.CrossChain.DestBscChainId))
}

func (app *App) initBridge() {
Expand Down Expand Up @@ -762,10 +763,18 @@ func (app *App) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.R

// EndBlocker application updates every end block
func (app *App) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock {
lastBlockTime := app.GetCheckState().Context().BlockHeader().Time.Unix()
ctx = ctx.WithValue(spmodule.LastBlockTimeKey, lastBlockTime)

resp := app.mm.EndBlock(ctx, req)
bankIavl, _ := app.CommitMultiStore().GetCommitStore(sdk.NewKVStoreKey(banktypes.StoreKey)).(*iavl.Store)
paymentIavl, _ := app.CommitMultiStore().GetCommitStore(sdk.NewKVStoreKey(paymentmoduletypes.StoreKey)).(*iavl.Store)
app.reconcile(ctx, bankIavl, paymentIavl)
if app.IsIavlStore() {
bankIavl, _ := app.CommitMultiStore().GetCommitStore(sdk.NewKVStoreKey(banktypes.StoreKey)).(*iavl.Store)
paymentIavl, _ := app.CommitMultiStore().GetCommitStore(sdk.NewKVStoreKey(paymentmoduletypes.StoreKey)).(*iavl.Store)

reconCtx, _ := ctx.CacheContext()
reconCtx = reconCtx.WithGasMeter(sdk.NewInfiniteGasMeter())
app.reconcile(reconCtx, bankIavl, paymentIavl)
}
return resp
}

Expand Down
5 changes: 3 additions & 2 deletions app/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ package app_test
import (
"testing"

"github.com/bnb-chain/greenfield/sdk/client/test"
"github.com/bnb-chain/greenfield/testutil"
dbm "github.com/cometbft/cometbft-db"
"github.com/cometbft/cometbft/libs/log"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"

"github.com/bnb-chain/greenfield/sdk/client/test"
"github.com/bnb-chain/greenfield/testutil"
)

func TestExportAppStateAndValidators(t *testing.T) {
Expand Down
1 change: 1 addition & 0 deletions cmd/gnfd/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@ func (a appCreator) newApp(
baseapp.SetIAVLDisableFastNode(cast.ToBool(appOpts.Get(server.FlagDisableIAVLFastNode))),
baseapp.SetChainID(chainID),
baseapp.SetEnableUnsafeQuery(cast.ToBool(appOpts.Get(server.FlagEnableUnsafeQuery))),
baseapp.SetEnablePlainStore(cast.ToBool(appOpts.Get(server.FlagEnablePlainStore))),
)
}

Expand Down
22 changes: 18 additions & 4 deletions deployment/localup/localup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ function init() {

# create genesis accounts
${bin} keys add validator${i} --keyring-backend test --home ${workspace}/.local/validator${i} > ${workspace}/.local/validator${i}/info 2>&1
${bin} keys add validator_delegator${i} --keyring-backend test --home ${workspace}/.local/validator${i} > ${workspace}/.local/validator${i}/delegator_info 2>&1
${bin} keys add validator_bls${i} --keyring-backend test --home ${workspace}/.local/validator${i} --algo eth_bls > ${workspace}/.local/validator${i}/bls_info 2>&1
${bin} keys add relayer${i} --keyring-backend test --home ${workspace}/.local/relayer${i} > ${workspace}/.local/relayer${i}/relayer_info 2>&1
${bin} keys add challenger${i} --keyring-backend test --home ${workspace}/.local/challenger${i} > ${workspace}/.local/challenger${i}/challenger_info 2>&1
Expand Down Expand Up @@ -58,6 +59,12 @@ function generate_genesis() {
validator_addrs+=("$(${bin} keys show validator${i} -a --keyring-backend test --home ${workspace}/.local/validator${i})")
done

declare -a deletgator_addrs=()
for ((i=0;i<${size};i++));do
# export delegator addresses
deletgator_addrs+=("$(${bin} keys show validator_delegator${i} -a --keyring-backend test --home ${workspace}/.local/validator${i})")
done

declare -a relayer_addrs=()
for ((i=0;i<${size};i++));do
# export validator addresses
Expand All @@ -77,6 +84,11 @@ function generate_genesis() {
${bin} add-genesis-account $validator_addr ${GENESIS_ACCOUNT_BALANCE}${STAKING_BOND_DENOM} --home ${workspace}/.local/validator${i}
done

for deletgator_addr in "${deletgator_addrs[@]}";do
# init genesis account in genesis state
${bin} add-genesis-account $deletgator_addr ${GENESIS_ACCOUNT_BALANCE}${STAKING_BOND_DENOM} --home ${workspace}/.local/validator${i}
done

for relayer_addr in "${relayer_addrs[@]}";do
# init genesis account in genesis state
${bin} add-genesis-account $relayer_addr ${GENESIS_ACCOUNT_BALANCE}${STAKING_BOND_DENOM} --home ${workspace}/.local/validator${i}
Expand All @@ -90,13 +102,14 @@ function generate_genesis() {
rm -rf ${workspace}/.local/validator${i}/config/gentx/

validatorAddr=${validator_addrs[$i]}
deletgatorAddr=${deletgator_addrs[$i]}
relayerAddr="$(${bin} keys show relayer${i} -a --keyring-backend test --home ${workspace}/.local/relayer${i})"
challengerAddr="$(${bin} keys show challenger${i} -a --keyring-backend test --home ${workspace}/.local/challenger${i})"
blsKey="$(${bin} keys show validator_bls${i} --keyring-backend test --home ${workspace}/.local/validator${i} --output json | jq -r .pubkey_hex)"
blsProof="$(${bin} keys sign "${blsKey}" --from validator_bls${i} --keyring-backend test --home ${workspace}/.local/validator${i})"

# create bond validator tx
${bin} gentx validator${i} ${STAKING_BOND_AMOUNT}${STAKING_BOND_DENOM} $validatorAddr $relayerAddr $challengerAddr $blsKey $blsProof \
${bin} gentx "${STAKING_BOND_AMOUNT}${STAKING_BOND_DENOM}" "$validatorAddr" "$deletgatorAddr" "$relayerAddr" "$challengerAddr" "$blsKey" "$blsProof" \
--home ${workspace}/.local/validator${i} \
--keyring-backend=test \
--chain-id=${CHAIN_ID} \
Expand Down Expand Up @@ -153,6 +166,8 @@ function generate_genesis() {
sed -i -e "s/\"discontinue_confirm_period\": \"604800\"/\"discontinue_confirm_period\": \"5\"/g" ${workspace}/.local/validator${i}/config/genesis.json
sed -i -e "s/\"discontinue_deletion_max\": \"100\"/\"discontinue_deletion_max\": \"2\"/g" ${workspace}/.local/validator${i}/config/genesis.json
sed -i -e "s/\"voting_period\": \"30s\"/\"voting_period\": \"5s\"/g" ${workspace}/.local/validator${i}/config/genesis.json
sed -i -e "s/\"update_global_price_interval\": \"0\"/\"update_global_price_interval\": \"1\"/g" ${workspace}/.local/validator${i}/config/genesis.json
sed -i -e "s/\"update_price_disallowed_days\": 2/\"update_price_disallowed_days\": 0/g" ${workspace}/.local/validator${i}/config/genesis.json
#sed -i -e "s/\"community_tax\": \"0.020000000000000000\"/\"community_tax\": \"0\"/g" ${workspace}/.local/validator${i}/config/genesis.json
sed -i -e "s/log_level = \"info\"/\log_level= \"debug\"/g" ${workspace}/.local/validator${i}/config/config.toml
done
Expand Down Expand Up @@ -222,7 +237,7 @@ function generate_sp_genesis {
spmaintenance_addr=("$(${bin} keys show sp${i}_maintenance -a --keyring-backend test --home ${workspace}/.local/sp${i})")
validator0Addr="$(${bin} keys show validator0 -a --keyring-backend test --home ${workspace}/.local/validator0)"
# create bond storage provider tx
${bin} spgentx sp${i} ${SP_MIN_DEPOSIT_AMOUNT}${STAKING_BOND_DENOM} \
${bin} spgentx ${SP_MIN_DEPOSIT_AMOUNT}${STAKING_BOND_DENOM} \
--home ${workspace}/.local/sp${i} \
--creator=${spoperator_addr} \
--operator-address=${spoperator_addr} \
Expand All @@ -243,8 +258,7 @@ function generate_sp_genesis {
--node-id "sp${i}" \
--ip 127.0.0.1 \
--gas "" \
--output-document=${workspace}/.local/gensptx/gentx-sp${i}.json \
--from sp${i}
--output-document=${workspace}/.local/gensptx/gentx-sp${i}.json
done

rm -rf ${workspace}/.local/validator0/config/gensptx/
Expand Down
6 changes: 4 additions & 2 deletions e2e/core/basesuite.go
Original file line number Diff line number Diff line change
Expand Up @@ -444,8 +444,10 @@ func (s *BaseSuite) NewSpAcc() *StorageProvider {
maintenanceAcc := userAccs[5]

blsKm := s.GenRandomBlsKeyManager()
return &StorageProvider{OperatorKey: operatorAcc, SealKey: fundingAcc,
FundingKey: approvalAcc, ApprovalKey: sealAcc, GcKey: gcAcc, MaintenanceKey: maintenanceAcc, BlsKey: blsKm}
return &StorageProvider{
OperatorKey: operatorAcc, SealKey: fundingAcc,
FundingKey: approvalAcc, ApprovalKey: sealAcc, GcKey: gcAcc, MaintenanceKey: maintenanceAcc, BlsKey: blsKm,
}
}

func (s *BaseSuite) CreateNewStorageProvider() *StorageProvider {
Expand Down
Loading

0 comments on commit fc04720

Please sign in to comment.