From 3a90ffd398fa68b31e306d10919cd4cc787b05f1 Mon Sep 17 00:00:00 2001 From: "fletcher.fan" Date: Fri, 4 Dec 2020 11:35:13 +0800 Subject: [PATCH 1/9] fee config for owner transfer --- types/upgrade.go | 1 + x/paramHub/genesis.go | 27 ++++++++++++++------------- x/paramHub/hub.go | 7 +++++++ x/paramHub/types/types.go | 1 + 4 files changed, 23 insertions(+), 13 deletions(-) diff --git a/types/upgrade.go b/types/upgrade.go index 2f1125018..d80f4b946 100644 --- a/types/upgrade.go +++ b/types/upgrade.go @@ -11,6 +11,7 @@ const ( BEP3 = "BEP3" // https://github.com/binance-chain/BEPs/pull/30 BEP8 = "BEP8" // Mini-BEP2 token LaunchBscUpgrade = "LaunchBscUpgrade" + BEP82 = "BEP82" // https://github.com/binance-chain/BEPs/pull/82 ) var MainNetConfig = UpgradeConfig{ diff --git a/x/paramHub/genesis.go b/x/paramHub/genesis.go index d29e36c40..0d51e924f 100644 --- a/x/paramHub/genesis.go +++ b/x/paramHub/genesis.go @@ -7,19 +7,20 @@ import ( const ( // Operate fee - ProposeFee = 10e8 - DepositFee = 125e3 - SideProposeFee = 10e8 - SideDepositFee = 125e3 - SideVoteFee = 1e8 - ListingFee = 2000e8 - IssueFee = 1000e8 - MintFee = 200e8 - BurnFee = 1e8 - FreezeFee = 1e6 - TimeLockFee = 1e6 - TimeUnlockFee = 1e6 - TimeRelockFee = 1e6 + ProposeFee = 10e8 + DepositFee = 125e3 + SideProposeFee = 10e8 + SideDepositFee = 125e3 + SideVoteFee = 1e8 + ListingFee = 2000e8 + IssueFee = 1000e8 + MintFee = 200e8 + BurnFee = 1e8 + FreezeFee = 1e6 + TimeLockFee = 1e6 + TimeUnlockFee = 1e6 + TimeRelockFee = 1e6 + TransferOwnershipFee = 1e6 // TODO SetAccountFlagsFee = 1e8 diff --git a/x/paramHub/hub.go b/x/paramHub/hub.go index 4a48196d2..4e328bf75 100644 --- a/x/paramHub/hub.go +++ b/x/paramHub/hub.go @@ -70,6 +70,12 @@ func RegisterUpgradeBeginBlocker(paramHub *ParamHub) { } paramHub.UpdateFeeParams(ctx, miniTokenFeeParams) }) + sdk.UpgradeMgr.RegisterBeginBlocker(sdk.BEP82, func(ctx sdk.Context) { + updateFeeParams := []param.FeeParam{ + ¶m.FixedFeeParams{MsgType: "transfer_ownership", Fee: TransferOwnershipFee, FeeFor: sdk.FeeForProposer}, + } + paramHub.UpdateFeeParams(ctx, updateFeeParams) + }) } func EndBreatheBlock(ctx sdk.Context, paramHub *ParamHub) { @@ -112,6 +118,7 @@ func init() { "timeLock": fees.FixedFeeCalculatorGen, "timeUnlock": fees.FixedFeeCalculatorGen, "timeRelock": fees.FixedFeeCalculatorGen, + "transfer_ownership": fees.FixedFeeCalculatorGen, "send": bank.TransferFeeCalculatorGen, "HTLT": fees.FixedFeeCalculatorGen, "depositHTLT": fees.FixedFeeCalculatorGen, diff --git a/x/paramHub/types/types.go b/x/paramHub/types/types.go index 3b4a4eed7..3e2d4e1eb 100644 --- a/x/paramHub/types/types.go +++ b/x/paramHub/types/types.go @@ -33,6 +33,7 @@ var ( "tokensBurn": {}, "setAccountFlags": {}, "tokensFreeze": {}, + "transfer_ownership": {}, "create_validator": {}, "remove_validator": {}, "timeLock": {}, From 03d1be97f15068714091e9ee9b583e294cc490a3 Mon Sep 17 00:00:00 2001 From: Erheng Lu Date: Mon, 28 Dec 2020 11:22:35 +0800 Subject: [PATCH 2/9] (iavl) #5276 Fix potential race condition in iavlIterator#Close. --- store/iavlstore.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/store/iavlstore.go b/store/iavlstore.go index 1b2b21fab..52c016931 100644 --- a/store/iavlstore.go +++ b/store/iavlstore.go @@ -381,9 +381,13 @@ func (iter *iavlIterator) Value() []byte { return val } -// Implements Iterator. +// Close closes the IAVL iterator by closing the quit channel and waiting for +// the iterCh to finish/close. func (iter *iavlIterator) Close() { close(iter.quitCh) + // wait iterCh to close + for range iter.iterCh { + } } //---------------------------------------- From 8ac3eab7c4c70ff6488c3f2514df5dbea379b2aa Mon Sep 17 00:00:00 2001 From: Erheng Lu Date: Mon, 28 Dec 2020 12:25:45 +0800 Subject: [PATCH 3/9] Allow tx send (generate-only) to actually work offline #4234 --- x/bank/client/cli/sendtx.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/x/bank/client/cli/sendtx.go b/x/bank/client/cli/sendtx.go index c8abc3f64..a5b5e9be2 100644 --- a/x/bank/client/cli/sendtx.go +++ b/x/bank/client/cli/sendtx.go @@ -31,10 +31,6 @@ func SendTxCmd(cdc *codec.Codec) *cobra.Command { WithCodec(cdc). WithAccountDecoder(authcmd.GetAccountDecoder(cdc)) - if err := cliCtx.EnsureAccountExists(); err != nil { - return err - } - toStr := viper.GetString(flagTo) to, err := sdk.AccAddressFromBech32(toStr) From b57c1ae75b6cae015c6e897c7b24835789a9fccf Mon Sep 17 00:00:00 2001 From: "fletcher.fan" Date: Mon, 28 Dec 2020 17:13:33 +0800 Subject: [PATCH 4/9] rename msg type --- x/paramHub/hub.go | 4 ++-- x/paramHub/types/types.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/x/paramHub/hub.go b/x/paramHub/hub.go index 4e328bf75..4d66e1ef9 100644 --- a/x/paramHub/hub.go +++ b/x/paramHub/hub.go @@ -72,7 +72,7 @@ func RegisterUpgradeBeginBlocker(paramHub *ParamHub) { }) sdk.UpgradeMgr.RegisterBeginBlocker(sdk.BEP82, func(ctx sdk.Context) { updateFeeParams := []param.FeeParam{ - ¶m.FixedFeeParams{MsgType: "transfer_ownership", Fee: TransferOwnershipFee, FeeFor: sdk.FeeForProposer}, + ¶m.FixedFeeParams{MsgType: "transferOwnership", Fee: TransferOwnershipFee, FeeFor: sdk.FeeForProposer}, } paramHub.UpdateFeeParams(ctx, updateFeeParams) }) @@ -118,7 +118,7 @@ func init() { "timeLock": fees.FixedFeeCalculatorGen, "timeUnlock": fees.FixedFeeCalculatorGen, "timeRelock": fees.FixedFeeCalculatorGen, - "transfer_ownership": fees.FixedFeeCalculatorGen, + "transferOwnership": fees.FixedFeeCalculatorGen, "send": bank.TransferFeeCalculatorGen, "HTLT": fees.FixedFeeCalculatorGen, "depositHTLT": fees.FixedFeeCalculatorGen, diff --git a/x/paramHub/types/types.go b/x/paramHub/types/types.go index 3e2d4e1eb..ebe2897fb 100644 --- a/x/paramHub/types/types.go +++ b/x/paramHub/types/types.go @@ -33,7 +33,7 @@ var ( "tokensBurn": {}, "setAccountFlags": {}, "tokensFreeze": {}, - "transfer_ownership": {}, + "transferOwnership": {}, "create_validator": {}, "remove_validator": {}, "timeLock": {}, From 32ba1b501a6f4f3a5b421c47bf00c43dcb61ec43 Mon Sep 17 00:00:00 2001 From: HaoyangLiu Date: Mon, 4 Jan 2021 13:56:40 +0800 Subject: [PATCH 5/9] R4R: Fix failack payload (#247) * remove header before insert it into fail ack package * add missed proposal type --- types/upgrade.go | 1 + x/gov/client/utils.go | 6 ++++++ x/oracle/handler.go | 16 ++++++++++++---- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/types/upgrade.go b/types/upgrade.go index d80f4b946..8e9a8e998 100644 --- a/types/upgrade.go +++ b/types/upgrade.go @@ -12,6 +12,7 @@ const ( BEP8 = "BEP8" // Mini-BEP2 token LaunchBscUpgrade = "LaunchBscUpgrade" BEP82 = "BEP82" // https://github.com/binance-chain/BEPs/pull/82 + FixFailAckPackage = "FixFailAckPackage" ) var MainNetConfig = UpgradeConfig{ diff --git a/x/gov/client/utils.go b/x/gov/client/utils.go index 9bed23a3d..15294407c 100644 --- a/x/gov/client/utils.go +++ b/x/gov/client/utils.go @@ -32,6 +32,12 @@ func NormalizeProposalType(proposalType string) string { return "CreateValidator" case "RemoveValidator", "remove_validator": return "RemoveValidator" + case "SCParamsChange", "sc_params_change": + return "SCParamsChange" + case "CSCParamsChange", "csc_params_change": + return "CSCParamsChange" + case "ManageChanPermission", "manage_chan_permission": + return "ManageChanPermission" } return "" } diff --git a/x/oracle/handler.go b/x/oracle/handler.go index b053bd2ab..6deb8ca7d 100644 --- a/x/oracle/handler.go +++ b/x/oracle/handler.go @@ -144,11 +144,19 @@ func handlePackage(ctx sdk.Context, oracleKeeper Keeper, chainId sdk.ChainID, pa var sendSequence int64 = -1 if packageType == sdk.SynCrossChainPackageType { if crash { - sendSeq, err := oracleKeeper.IbcKeeper.CreateRawIBCPackageById(ctx, chainId, - pack.ChannelId, sdk.FailAckCrossChainPackageType, pack.Payload) - if err != nil { + var ibcErr sdk.Error + var sendSeq uint64 + if sdk.IsUpgrade(sdk.FixFailAckPackage) && len(pack.Payload) >= sTypes.PackageHeaderLength { + sendSeq, ibcErr = oracleKeeper.IbcKeeper.CreateRawIBCPackageById(ctx, chainId, + pack.ChannelId, sdk.FailAckCrossChainPackageType, pack.Payload[sTypes.PackageHeaderLength:]) + } else { + logger.Error("found payload without header", "channelID", pack.ChannelId, "sequence", pack.Sequence, "payload", hex.EncodeToString(pack.Payload)) + sendSeq, ibcErr = oracleKeeper.IbcKeeper.CreateRawIBCPackageById(ctx, chainId, + pack.ChannelId, sdk.FailAckCrossChainPackageType, pack.Payload) + } + if ibcErr != nil { logger.Error("failed to write FailAckCrossChainPackage", "err", err) - return sdk.Event{}, err + return sdk.Event{}, ibcErr } sendSequence = int64(sendSeq) } else { From 0fbea09287104768cc962525cb3248224628c313 Mon Sep 17 00:00:00 2001 From: "fletcher.fan" Date: Mon, 11 Jan 2021 11:26:36 +0800 Subject: [PATCH 6/9] change minimum length to 2 --- types/coin.go | 4 ++-- types/coin_test.go | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/types/coin.go b/types/coin.go index c4efdc1e4..2d8c94433 100644 --- a/types/coin.go +++ b/types/coin.go @@ -285,11 +285,11 @@ func (coins Coins) Sort() Coins { // Parsing var ( - // Denominations can be 3 ~ 10 characters long (8 + .B suffix). + // Denominations can be 2 ~ 10 characters long (8 + .B suffix). // Extra token symbol tx hash suffix can be 2 ~ 6 characters long. reAmt = `[[:digit:]]+` reSpc = `\:` - reDnm = `[[:alnum:]]{3,8}(\.[[:alpha:]])?(-[0-9A-Z]{2,6})?` + reDnm = `[[:alnum:]]{2,8}(\.[[:alpha:]])?(-[0-9A-Z]{2,6})?` reCoin = regexp.MustCompile(fmt.Sprintf(`^(%s)%s(%s)$`, reAmt, reSpc, reDnm)) ) diff --git a/types/coin_test.go b/types/coin_test.go index 87a32179b..374631644 100644 --- a/types/coin_test.go +++ b/types/coin_test.go @@ -302,6 +302,7 @@ func TestParse(t *testing.T) { {"98:bar , 1:foo ", true, Coins{{"bar", 98}, {"foo", one}}}, {" 55:bling\n", true, Coins{{"bling", 55}}}, {"2:foo, 97:bar", true, Coins{{"bar", 97}, {"foo", 2}}}, + {"10:ba-1BC", true, Coins{{"ba-1BC", 10}}}, {"5:mycoin,", false, nil}, // no empty coins in a list {"2:3foo, 97:bar", true, Coins{{"3foo", 2}, {"bar", 97}}}, // 3foo is invalid coin name {"11me:coin, 12you:coin", false, nil}, // no spaces in coin names From f365b16400dfee8e03a0a1d38229b1809381a4cd Mon Sep 17 00:00:00 2001 From: erhenglu Date: Tue, 12 Jan 2021 13:56:40 +0800 Subject: [PATCH 7/9] fix fee compatibility --- x/paramHub/genesis.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x/paramHub/genesis.go b/x/paramHub/genesis.go index 0d51e924f..12fe66ac7 100644 --- a/x/paramHub/genesis.go +++ b/x/paramHub/genesis.go @@ -68,9 +68,9 @@ const ( //MiniToken fee TinyIssueFee = 2e8 - MiniIssueFee = 4e8 + MiniIssueFee = 3e8 MiniSetUriFee = 37500 - MiniListingFee = 10e8 + MiniListingFee = 8e8 ) var DefaultGenesisState = param.GenesisState{ From fa8a689030258548c692b9b81a5dc4e9949ec868 Mon Sep 17 00:00:00 2001 From: erhenglu Date: Sat, 16 Jan 2021 18:12:07 +0800 Subject: [PATCH 8/9] update changelog --- CHANGELOG.md | 10 ++++++++++ go.mod | 4 +--- go.sum | 4 ++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 558fab0d2..af8fdab39 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Changelog +##v0.25.0-binance.24 +* [sdk] [\#248](https://github.com/binance-chain/bnc-cosmos-sdk/pull/248) owner transfer +* [sdk] Allow tx send (generate-only) to actually work offline #4234 +* [sdk] (iavl) #5276 Fix potential race condition in iavlIterator#Close. +* [sdk] [\#247](https://github.com/binance-chain/bnc-cosmos-sdk/pull/247) Fix failack payload +* [sdk] [\#251](https://github.com/binance-chain/bnc-cosmos-sdk/pull/251) change minimum length to 2 +* [sdk] [\#252](https://github.com/binance-chain/bnc-cosmos-sdk/pull/252) Fix Fee compatibility issue + + + ## v0.25.0 binance.20 * [sdk] [\#163](https://github.com/binance-chain/bnc-cosmos-sdk/pull/163) Tss for project team diff --git a/go.mod b/go.mod index 36806c108..3ec4971b4 100644 --- a/go.mod +++ b/go.mod @@ -15,8 +15,6 @@ require ( github.com/ipfs/go-log v0.0.1 github.com/mattn/go-isatty v0.0.10 github.com/mitchellh/go-homedir v1.1.0 - github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect - github.com/modern-go/reflect2 v1.0.1 // indirect github.com/pelletier/go-toml v1.4.0 github.com/pkg/errors v0.8.1 github.com/prometheus/client_golang v1.1.0 @@ -37,7 +35,7 @@ require ( replace ( github.com/tendermint/go-amino => github.com/binance-chain/bnc-go-amino v0.14.1-binance.2 github.com/tendermint/iavl => github.com/binance-chain/bnc-tendermint-iavl v0.12.0-binance.4 - github.com/tendermint/tendermint => github.com/binance-chain/bnc-tendermint v0.32.3-binance.3 + github.com/tendermint/tendermint => github.com/binance-chain/bnc-tendermint v0.32.3-binance.5 github.com/zondax/ledger-cosmos-go => github.com/binance-chain/ledger-cosmos-go v0.9.9-binance.3 golang.org/x/crypto => github.com/tendermint/crypto v0.0.0-20190823183015-45b1026d81ae ) diff --git a/go.sum b/go.sum index 1bbab60e4..11d3ea5f2 100644 --- a/go.sum +++ b/go.sum @@ -24,8 +24,8 @@ github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQ github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/binance-chain/bnc-go-amino v0.14.1-binance.2 h1:XcbcfisVItk92UKoGbtNT8nbcfadj3H3ayuM2srAfVs= github.com/binance-chain/bnc-go-amino v0.14.1-binance.2/go.mod h1:yaElUUxWtv/TC/ldGtlKAvS1vKwokxgJ1d97I+6is80= -github.com/binance-chain/bnc-tendermint v0.32.3-binance.3 h1:b8SqtWmtHPhPQ2ADzUgO9sr+ChKL9ho4dTorBjGAAyY= -github.com/binance-chain/bnc-tendermint v0.32.3-binance.3/go.mod h1:kN5dNxE8voFtDqx2HjbM8sBIH5cUuMtLg0XEHjqzUiY= +github.com/binance-chain/bnc-tendermint v0.32.3-binance.5 h1:t+gCaAoN3PLMFFayY8EtUkEftir9a0DM9uK2DR6ZCwU= +github.com/binance-chain/bnc-tendermint v0.32.3-binance.5/go.mod h1:kN5dNxE8voFtDqx2HjbM8sBIH5cUuMtLg0XEHjqzUiY= github.com/binance-chain/bnc-tendermint-iavl v0.12.0-binance.4 h1:BhaV2iiGWfRC6iB8HHOYJeUDwtQMB2pUA4ah+KCbBhI= github.com/binance-chain/bnc-tendermint-iavl v0.12.0-binance.4/go.mod h1:Zmh8GRdNJB8DULIOBar3JCZp6tSpcvM1NGKfE9U2EzA= github.com/binance-chain/ledger-cosmos-go v0.9.9-binance.3 h1:FFpFbkzlP2HUyxQCm0eoU6mkfgMNynfqZRbeWqlaLdQ= From ac22916397adf59a5c5cb7af5d7d2c4385b183ad Mon Sep 17 00:00:00 2001 From: erhenglu Date: Mon, 18 Jan 2021 14:00:33 +0800 Subject: [PATCH 9/9] modify changelog --- CHANGELOG.md | 2 +- x/paramHub/genesis.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index af8fdab39..c628255ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ ##v0.25.0-binance.24 * [sdk] [\#248](https://github.com/binance-chain/bnc-cosmos-sdk/pull/248) owner transfer * [sdk] Allow tx send (generate-only) to actually work offline #4234 -* [sdk] (iavl) #5276 Fix potential race condition in iavlIterator#Close. +* [store] (iavl) #5276 Fix potential race condition in iavlIterator#Close. * [sdk] [\#247](https://github.com/binance-chain/bnc-cosmos-sdk/pull/247) Fix failack payload * [sdk] [\#251](https://github.com/binance-chain/bnc-cosmos-sdk/pull/251) change minimum length to 2 * [sdk] [\#252](https://github.com/binance-chain/bnc-cosmos-sdk/pull/252) Fix Fee compatibility issue diff --git a/x/paramHub/genesis.go b/x/paramHub/genesis.go index 12fe66ac7..3daa0709f 100644 --- a/x/paramHub/genesis.go +++ b/x/paramHub/genesis.go @@ -20,7 +20,7 @@ const ( TimeLockFee = 1e6 TimeUnlockFee = 1e6 TimeRelockFee = 1e6 - TransferOwnershipFee = 1e6 // TODO + TransferOwnershipFee = 1e6 SetAccountFlagsFee = 1e8