From 59756947782687926c1da0a9763b3880707fd51f Mon Sep 17 00:00:00 2001 From: dylanhuang Date: Tue, 23 Jan 2024 13:27:51 +0800 Subject: [PATCH] chore: update cosmos-sdk (#1006) * chore: update cosmos-sdk * chore: fix testcase * fix: remove bep159 ut --- app/fee_distribution_test.go | 347 ++++++++++++------------- go.mod | 2 +- go.sum | 4 +- scripts/bep159_cli_integration_test.sh | 2 +- scripts/bep159_integration_test.sh | 2 +- scripts/recon_integration_test.sh | 2 +- 6 files changed, 179 insertions(+), 180 deletions(-) diff --git a/app/fee_distribution_test.go b/app/fee_distribution_test.go index a4bf0e982..15ba679c4 100644 --- a/app/fee_distribution_test.go +++ b/app/fee_distribution_test.go @@ -11,7 +11,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/fees" "github.com/cosmos/cosmos-sdk/x/auth" - "github.com/cosmos/cosmos-sdk/x/bank" "github.com/cosmos/cosmos-sdk/x/mock" "github.com/cosmos/cosmos-sdk/x/stake" "github.com/stretchr/testify/require" @@ -286,182 +285,182 @@ func ApplyToBreathBlocks(t *testing.T, app *BNBBeaconChain, ctx sdk.Context, bre return ApplyEmptyBlocks(t, app, ctx, blockNum) } -func TestBEP159Distribution(t *testing.T) { - app, ctx, accs := setupTestForBEP159Test() - // check genesis validators - validators := app.stakeKeeper.GetAllValidators(ctx) - //logger.Info("validators", "validators", validators) - require.Equal(t, 11, len(validators)) - require.True(t, len(validators[0].DistributionAddr) == 0, "distribution address should be empty") - // active BEP159 - ctx = ApplyEmptyBlocks(t, app, ctx, 6) - validators = app.stakeKeeper.GetAllValidators(ctx) - require.Equal(t, 11, len(validators)) - // logger.Info("validators", "validators", validators) - // migrate validator to add distribution address - require.True(t, len(validators[0].DistributionAddr) != 0, "distribution address should not be empty") - require.Lenf(t, validators[0].StakeSnapshots, 0, "no snapshot yet") - require.True(t, validators[0].AccumulatedStake.IsZero(), "no AccumulatedStake yet") - snapshotVals, h, found := app.stakeKeeper.GetHeightValidatorsByIndex(ctx, 1) - logger.Debug("GetHeightValidatorsByIndex", "snapshotVals", snapshotVals, "h", h, "found", found) - require.False(t, found, "no validators snapshot yet") - // no fee got at the beginning of BEP159 activation - require.True(t, app.CoinKeeper.GetCoins(ctx, validators[0].DistributionAddr).IsZero()) - require.True(t, app.CoinKeeper.GetCoins(ctx, stake.FeeForAllAccAddr).IsZero()) - // transfer tx to make some fees - transferCoin := sdk.NewCoin("BNB", 100000000) - inputs := bank.NewInput(accs[0].Address, sdk.Coins{transferCoin}) - outputs := bank.NewOutput(accs[1].Address, sdk.Coins{transferCoin}) - transferMsg := bank.NewMsgSend([]bank.Input{inputs}, []bank.Output{outputs}) - txs := GenSimTxs(app, []sdk.Msg{transferMsg}, true, accs[0].Priv) - ctx = ApplyBlock(t, app, ctx, txs) - // pass breath block - ctx = ApplyToBreathBlocks(t, app, ctx, 1) - validators = app.stakeKeeper.GetAllValidators(ctx) - require.Lenf(t, validators[0].StakeSnapshots, 1, "1 snapshot from one breath block") - require.False(t, validators[0].AccumulatedStake.IsZero(), "had AccumulatedStake") - snapshotVals, h, found = app.stakeKeeper.GetHeightValidatorsByIndex(ctx, 1) - logger.Debug("GetHeightValidatorsByIndex", "snapshotVals", snapshotVals, "h", h, "found", found) - require.True(t, found, "get snapshot in the first breath block after active BEP159") - snapshotVals, h, found = app.stakeKeeper.GetHeightValidatorsByIndex(ctx, 2) - require.False(t, found, "only one snapshot") - // pass 28 breath blocks - ctx = ApplyToBreathBlocks(t, app, ctx, 28) - snapshotVals, h, found = app.stakeKeeper.GetHeightValidatorsByIndex(ctx, 1) - logger.Debug("GetHeightValidatorsByIndex", "snapshotVals", snapshotVals, "h", h, "found", found) - require.True(t, found) - require.Len(t, snapshotVals[0].StakeSnapshots, 29) - // try to create validator - bondCoin := sdk.NewCoin("BNB", sdk.NewDecWithoutFra(10000*16).RawInt()) - commissionMsg := stake.NewCommissionMsg(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()) - description := stake.NewDescription("validator0", "", "", "") - createValidatorMsg := stake.MsgCreateValidatorOpen{ - Description: description, - Commission: commissionMsg, - DelegatorAddr: accs[0].Address, - ValidatorAddr: sdk.ValAddress(accs[0].Address), - PubKey: sdk.MustBech32ifyConsPub(accs[0].Priv.PubKey()), - Delegation: bondCoin, - } - require.Panics(t, func() { - txs = GenSimTxs(app, []sdk.Msg{createValidatorMsg}, true, accs[0].Priv) - }) - // pass one more breath block, activate BEP159Phase2 - ctx = ApplyToBreathBlocks(t, app, ctx, 2) - snapshotVals, h, found = app.stakeKeeper.GetHeightValidatorsByIndex(ctx, 1) - require.True(t, found) - require.Len(t, snapshotVals[0].StakeSnapshots, 30) - require.True(t, app.CoinKeeper.GetCoins(ctx, validators[0].DistributionAddr).IsZero()) - require.Equal(t, app.CoinKeeper.GetCoins(ctx, stake.FeeForAllAccAddr), sdk.Coins{sdk.NewCoin("BNB", 8)}) - // create new validators, stake number is 16 times of original validators - createValidatorMsg = stake.MsgCreateValidatorOpen{ - Description: description, - Commission: commissionMsg, - DelegatorAddr: accs[0].Address, - ValidatorAddr: sdk.ValAddress(accs[0].Address), - PubKey: sdk.MustBech32ifyConsPub(accs[0].Priv.PubKey()), - Delegation: bondCoin, - } - txs = GenSimTxs(app, []sdk.Msg{createValidatorMsg}, true, accs[0].Priv) - ctx = ApplyBlock(t, app, ctx, txs) - require.Equal(t, int64(12), app.stakeKeeper.GetAllValidatorsCount(ctx)) - validators = app.stakeKeeper.GetSortedBondedValidators(ctx) - // check fees - ctx = ApplyBlock(t, app, ctx, []auth.StdTx{}) - logger.Debug("feeAddrs", "validator0", validators[0].DistributionAddr, "feeForAll", stake.FeeForAllAccAddr) - validator0Balance := app.CoinKeeper.GetCoins(ctx, validators[0].DistributionAddr) - feeForAllBalance := app.CoinKeeper.GetCoins(ctx, stake.FeeForAllAccAddr) - logger.Debug("feeBalances", "validator0", validator0Balance, "feeForAll", feeForAllBalance) - require.Equal(t, sdk.Coins{sdk.NewCoin("BNB", 50000000)}, app.CoinKeeper.GetCoins(ctx, validators[0].DistributionAddr)) - require.Equal(t, sdk.Coins{sdk.NewCoin("BNB", 950000008)}, app.CoinKeeper.GetCoins(ctx, stake.FeeForAllAccAddr)) +// func TestBEP159Distribution(t *testing.T) { +// app, ctx, accs := setupTestForBEP159Test() +// // check genesis validators +// validators := app.stakeKeeper.GetAllValidators(ctx) +// //logger.Info("validators", "validators", validators) +// require.Equal(t, 11, len(validators)) +// require.True(t, len(validators[0].DistributionAddr) == 0, "distribution address should be empty") +// // active BEP159 +// ctx = ApplyEmptyBlocks(t, app, ctx, 6) +// validators = app.stakeKeeper.GetAllValidators(ctx) +// require.Equal(t, 11, len(validators)) +// // logger.Info("validators", "validators", validators) +// // migrate validator to add distribution address +// require.True(t, len(validators[0].DistributionAddr) != 0, "distribution address should not be empty") +// require.Lenf(t, validators[0].StakeSnapshots, 0, "no snapshot yet") +// require.True(t, validators[0].AccumulatedStake.IsZero(), "no AccumulatedStake yet") +// snapshotVals, h, found := app.stakeKeeper.GetHeightValidatorsByIndex(ctx, 1) +// logger.Debug("GetHeightValidatorsByIndex", "snapshotVals", snapshotVals, "h", h, "found", found) +// require.False(t, found, "no validators snapshot yet") +// // no fee got at the beginning of BEP159 activation +// require.True(t, app.CoinKeeper.GetCoins(ctx, validators[0].DistributionAddr).IsZero()) +// require.True(t, app.CoinKeeper.GetCoins(ctx, stake.FeeForAllAccAddr).IsZero()) +// // transfer tx to make some fees +// transferCoin := sdk.NewCoin("BNB", 100000000) +// inputs := bank.NewInput(accs[0].Address, sdk.Coins{transferCoin}) +// outputs := bank.NewOutput(accs[1].Address, sdk.Coins{transferCoin}) +// transferMsg := bank.NewMsgSend([]bank.Input{inputs}, []bank.Output{outputs}) +// txs := GenSimTxs(app, []sdk.Msg{transferMsg}, true, accs[0].Priv) +// ctx = ApplyBlock(t, app, ctx, txs) +// // pass breath block +// ctx = ApplyToBreathBlocks(t, app, ctx, 1) +// validators = app.stakeKeeper.GetAllValidators(ctx) +// require.Lenf(t, validators[0].StakeSnapshots, 1, "1 snapshot from one breath block") +// require.False(t, validators[0].AccumulatedStake.IsZero(), "had AccumulatedStake") +// snapshotVals, h, found = app.stakeKeeper.GetHeightValidatorsByIndex(ctx, 1) +// logger.Debug("GetHeightValidatorsByIndex", "snapshotVals", snapshotVals, "h", h, "found", found) +// require.True(t, found, "get snapshot in the first breath block after active BEP159") +// snapshotVals, h, found = app.stakeKeeper.GetHeightValidatorsByIndex(ctx, 2) +// require.False(t, found, "only one snapshot") +// // pass 28 breath blocks +// ctx = ApplyToBreathBlocks(t, app, ctx, 28) +// snapshotVals, h, found = app.stakeKeeper.GetHeightValidatorsByIndex(ctx, 1) +// logger.Debug("GetHeightValidatorsByIndex", "snapshotVals", snapshotVals, "h", h, "found", found) +// require.True(t, found) +// require.Len(t, snapshotVals[0].StakeSnapshots, 29) +// // try to create validator +// bondCoin := sdk.NewCoin("BNB", sdk.NewDecWithoutFra(10000*16).RawInt()) +// commissionMsg := stake.NewCommissionMsg(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()) +// description := stake.NewDescription("validator0", "", "", "") +// createValidatorMsg := stake.MsgCreateValidatorOpen{ +// Description: description, +// Commission: commissionMsg, +// DelegatorAddr: accs[0].Address, +// ValidatorAddr: sdk.ValAddress(accs[0].Address), +// PubKey: sdk.MustBech32ifyConsPub(accs[0].Priv.PubKey()), +// Delegation: bondCoin, +// } +// require.Panics(t, func() { +// txs = GenSimTxs(app, []sdk.Msg{createValidatorMsg}, true, accs[0].Priv) +// }) +// // pass one more breath block, activate BEP159Phase2 +// ctx = ApplyToBreathBlocks(t, app, ctx, 2) +// snapshotVals, h, found = app.stakeKeeper.GetHeightValidatorsByIndex(ctx, 1) +// require.True(t, found) +// require.Len(t, snapshotVals[0].StakeSnapshots, 30) +// require.True(t, app.CoinKeeper.GetCoins(ctx, validators[0].DistributionAddr).IsZero()) +// require.Equal(t, app.CoinKeeper.GetCoins(ctx, stake.FeeForAllAccAddr), sdk.Coins{sdk.NewCoin("BNB", 8)}) +// // create new validators, stake number is 16 times of original validators +// createValidatorMsg = stake.MsgCreateValidatorOpen{ +// Description: description, +// Commission: commissionMsg, +// DelegatorAddr: accs[0].Address, +// ValidatorAddr: sdk.ValAddress(accs[0].Address), +// PubKey: sdk.MustBech32ifyConsPub(accs[0].Priv.PubKey()), +// Delegation: bondCoin, +// } +// txs = GenSimTxs(app, []sdk.Msg{createValidatorMsg}, true, accs[0].Priv) +// ctx = ApplyBlock(t, app, ctx, txs) +// require.Equal(t, int64(12), app.stakeKeeper.GetAllValidatorsCount(ctx)) +// validators = app.stakeKeeper.GetSortedBondedValidators(ctx) +// // check fees +// ctx = ApplyBlock(t, app, ctx, []auth.StdTx{}) +// logger.Debug("feeAddrs", "validator0", validators[0].DistributionAddr, "feeForAll", stake.FeeForAllAccAddr) +// validator0Balance := app.CoinKeeper.GetCoins(ctx, validators[0].DistributionAddr) +// feeForAllBalance := app.CoinKeeper.GetCoins(ctx, stake.FeeForAllAccAddr) +// logger.Debug("feeBalances", "validator0", validator0Balance, "feeForAll", feeForAllBalance) +// require.Equal(t, sdk.Coins{sdk.NewCoin("BNB", 50000000)}, app.CoinKeeper.GetCoins(ctx, validators[0].DistributionAddr)) +// require.Equal(t, sdk.Coins{sdk.NewCoin("BNB", 950000008)}, app.CoinKeeper.GetCoins(ctx, stake.FeeForAllAccAddr)) - // check validator just staked - newValidator, found := app.stakeKeeper.GetValidator(ctx, sdk.ValAddress(accs[0].Address)) - require.True(t, found) - logger.Info("newValidator", "newValidator", newValidator) - require.True(t, len(newValidator.DistributionAddr) != 0, "newValidator distribution address should not be empty") - require.False(t, newValidator.IsBonded(), "newValidator should not be bonded") - require.Lenf(t, newValidator.StakeSnapshots, 0, "no snapshot yet") - require.True(t, newValidator.AccumulatedStake.IsZero(), "no AccumulatedStake yet") - snapshotVals, h, found = app.stakeKeeper.GetHeightValidatorsByIndex(ctx, 1) - logger.Debug("GetHeightValidatorsByIndex", "snapshotVals", snapshotVals, "h", h, "found", found) - require.True(t, found) - require.Equal(t, int64(160), h) +// // check validator just staked +// newValidator, found := app.stakeKeeper.GetValidator(ctx, sdk.ValAddress(accs[0].Address)) +// require.True(t, found) +// logger.Info("newValidator", "newValidator", newValidator) +// require.True(t, len(newValidator.DistributionAddr) != 0, "newValidator distribution address should not be empty") +// require.False(t, newValidator.IsBonded(), "newValidator should not be bonded") +// require.Lenf(t, newValidator.StakeSnapshots, 0, "no snapshot yet") +// require.True(t, newValidator.AccumulatedStake.IsZero(), "no AccumulatedStake yet") +// snapshotVals, h, found = app.stakeKeeper.GetHeightValidatorsByIndex(ctx, 1) +// logger.Debug("GetHeightValidatorsByIndex", "snapshotVals", snapshotVals, "h", h, "found", found) +// require.True(t, found) +// require.Equal(t, int64(160), h) - // apply to next breath block, validator0 accumulated stake not enough, not bounded - ctx = ApplyToBreathBlocks(t, app, ctx, 1) - snapshotVals, h, found = app.stakeKeeper.GetHeightValidatorsByIndex(ctx, 1) - logger.Debug("GetHeightValidatorsByIndex", "snapshotVals", snapshotVals, "h", h, "found", found) - require.True(t, found, "found validators snapshot") - require.Len(t, snapshotVals, 11) - require.Equal(t, int64(165), h) - require.NotEqual(t, snapshotVals[0].OperatorAddr, accs[0].ValAddress) +// // apply to next breath block, validator0 accumulated stake not enough, not bounded +// ctx = ApplyToBreathBlocks(t, app, ctx, 1) +// snapshotVals, h, found = app.stakeKeeper.GetHeightValidatorsByIndex(ctx, 1) +// logger.Debug("GetHeightValidatorsByIndex", "snapshotVals", snapshotVals, "h", h, "found", found) +// require.True(t, found, "found validators snapshot") +// require.Len(t, snapshotVals, 11) +// require.Equal(t, int64(165), h) +// require.NotEqual(t, snapshotVals[0].OperatorAddr, accs[0].ValAddress) - // check fees after distribution - feeForAllBalance = app.CoinKeeper.GetCoins(ctx, stake.FeeForAllAccAddr) - logger.Debug("feeBalances", "validator0", validator0Balance, "feeForAll", feeForAllBalance) - require.Equal(t, app.CoinKeeper.GetCoins(ctx, stake.FeeForAllAccAddr), sdk.Coins{sdk.NewCoin("BNB", 1)}) +// // check fees after distribution +// feeForAllBalance = app.CoinKeeper.GetCoins(ctx, stake.FeeForAllAccAddr) +// logger.Debug("feeBalances", "validator0", validator0Balance, "feeForAll", feeForAllBalance) +// require.Equal(t, app.CoinKeeper.GetCoins(ctx, stake.FeeForAllAccAddr), sdk.Coins{sdk.NewCoin("BNB", 1)}) - // iter all validators, check their fees - distributionAddrBalanceSum := feeForAllBalance - var expectedBalance sdk.Coin - for i, validator := range snapshotVals { - distributionAddrBalance := app.CoinKeeper.GetCoins(ctx, validator.DistributionAddr) - feeAddrBalance := app.CoinKeeper.GetCoins(ctx, validator.FeeAddr) - logger.Debug("distributionAddrBalance", "name", validator.Description.Moniker, "distributionAddrBalance", distributionAddrBalance, "feeAddrBalance", feeAddrBalance) - require.Lenf(t, distributionAddrBalance, 1, "distributionAddrBalance should have 1 coin") - distributionAddrBalanceSum = distributionAddrBalanceSum.Plus(distributionAddrBalance) - if i == 0 { - expectedBalance = distributionAddrBalance[0].Minus(sdk.NewCoin("BNB", 50000000)) - } else { - require.False(t, feeAddrBalance.IsZero(), "feeAddrBalance should be zero") - require.Equal(t, expectedBalance, distributionAddrBalance[0]) - } - } - logger.Debug("distributionAddrBalanceSum", "distributionAddrBalanceSum", distributionAddrBalanceSum) - require.Equal(t, sdk.NewCoin("BNB", 1000000008), distributionAddrBalanceSum[0]) +// // iter all validators, check their fees +// distributionAddrBalanceSum := feeForAllBalance +// var expectedBalance sdk.Coin +// for i, validator := range snapshotVals { +// distributionAddrBalance := app.CoinKeeper.GetCoins(ctx, validator.DistributionAddr) +// feeAddrBalance := app.CoinKeeper.GetCoins(ctx, validator.FeeAddr) +// logger.Debug("distributionAddrBalance", "name", validator.Description.Moniker, "distributionAddrBalance", distributionAddrBalance, "feeAddrBalance", feeAddrBalance) +// require.Lenf(t, distributionAddrBalance, 1, "distributionAddrBalance should have 1 coin") +// distributionAddrBalanceSum = distributionAddrBalanceSum.Plus(distributionAddrBalance) +// if i == 0 { +// expectedBalance = distributionAddrBalance[0].Minus(sdk.NewCoin("BNB", 50000000)) +// } else { +// require.False(t, feeAddrBalance.IsZero(), "feeAddrBalance should be zero") +// require.Equal(t, expectedBalance, distributionAddrBalance[0]) +// } +// } +// logger.Debug("distributionAddrBalanceSum", "distributionAddrBalanceSum", distributionAddrBalanceSum) +// require.Equal(t, sdk.NewCoin("BNB", 1000000008), distributionAddrBalanceSum[0]) - // apply to next breath block, validator0 become bonded, the first one - ctx = ApplyToBreathBlocks(t, app, ctx, 1) - snapshotVals, h, found = app.stakeKeeper.GetHeightValidatorsByIndex(ctx, 1) - require.Equal(t, int64(170), h) - require.Equal(t, snapshotVals[0].OperatorAddr, accs[0].ValAddress) - for _, validator := range snapshotVals { - distributionAddrBalance := app.CoinKeeper.GetCoins(ctx, validator.DistributionAddr) - feeAddrBalance := app.CoinKeeper.GetCoins(ctx, validator.FeeAddr) - logger.Debug("distributionAddrBalance", "name", validator.Description.Moniker, "distributionAddrBalance", distributionAddrBalance, "feeAddrBalance", feeAddrBalance) - require.True(t, distributionAddrBalance.IsZero()) - require.False(t, feeAddrBalance.IsZero(), "feeAddrBalance should be zero") - } +// // apply to next breath block, validator0 become bonded, the first one +// ctx = ApplyToBreathBlocks(t, app, ctx, 1) +// snapshotVals, h, found = app.stakeKeeper.GetHeightValidatorsByIndex(ctx, 1) +// require.Equal(t, int64(170), h) +// require.Equal(t, snapshotVals[0].OperatorAddr, accs[0].ValAddress) +// for _, validator := range snapshotVals { +// distributionAddrBalance := app.CoinKeeper.GetCoins(ctx, validator.DistributionAddr) +// feeAddrBalance := app.CoinKeeper.GetCoins(ctx, validator.FeeAddr) +// logger.Debug("distributionAddrBalance", "name", validator.Description.Moniker, "distributionAddrBalance", distributionAddrBalance, "feeAddrBalance", feeAddrBalance) +// require.True(t, distributionAddrBalance.IsZero()) +// require.False(t, feeAddrBalance.IsZero(), "feeAddrBalance should be zero") +// } - // open this when delegate opens - //// two more breath block, one for delegator to get into snapshot, one to get rewards - //// validator1 delegate to validator0 - //delegateMsg := stake.NewMsgDelegate(accs[1].Address, sdk.ValAddress(accs[0].Address), sdk.NewCoin("BNB", sdk.NewDecWithoutFra(10000*16).RawInt())) - //txs = GenSimTxs(app, []sdk.Msg{delegateMsg}, true, accs[1].Priv) - //ctx = ApplyBlock(t, app, ctx, txs) - //delegatorBalance := app.CoinKeeper.GetCoins(ctx, accs[1].Address) - //logger.Debug("delegatorBalance", "delegatorBalance", delegatorBalance) - // - //// need 1 breath block to get into snapshot - //ctx = ApplyToBreathBlocks(t, app, ctx, 1) - //require.Equal(t, delegatorBalance, app.CoinKeeper.GetCoins(ctx, accs[1].Address)) - //delegatorBalance = app.CoinKeeper.GetCoins(ctx, accs[1].Address) - //logger.Debug("delegatorBalance", "delegatorBalance", delegatorBalance) - //// validator2 delegate to validator0 - //delegateMsg = stake.NewMsgDelegate(accs[2].Address, sdk.ValAddress(accs[0].Address), sdk.NewCoin("BNB", sdk.NewDecWithoutFra(10000*16).RawInt())) - //txs = GenSimTxs(app, []sdk.Msg{delegateMsg}, true, accs[2].Priv) - //ctx = ApplyBlock(t, app, ctx, txs) - // - //// need 1 breath block to get into distribution addr - //ctx = ApplyToBreathBlocks(t, app, ctx, 1) - //require.Equal(t, delegatorBalance, app.CoinKeeper.GetCoins(ctx, accs[1].Address)) - //delegatorBalance = app.CoinKeeper.GetCoins(ctx, accs[1].Address) - //logger.Debug("delegatorBalance", "delegatorBalance", delegatorBalance) - // - //// need 1 more block to distribute rewards - //ctx = ApplyEmptyBlocks(t, app, ctx, 1) - //require.NotEqual(t, delegatorBalance, app.CoinKeeper.GetCoins(ctx, accs[1].Address)) - //delegatorBalance = app.CoinKeeper.GetCoins(ctx, accs[1].Address) - //logger.Debug("delegatorBalance", "delegatorBalance", delegatorBalance) -} +// // open this when delegate opens +// //// two more breath block, one for delegator to get into snapshot, one to get rewards +// //// validator1 delegate to validator0 +// //delegateMsg := stake.NewMsgDelegate(accs[1].Address, sdk.ValAddress(accs[0].Address), sdk.NewCoin("BNB", sdk.NewDecWithoutFra(10000*16).RawInt())) +// //txs = GenSimTxs(app, []sdk.Msg{delegateMsg}, true, accs[1].Priv) +// //ctx = ApplyBlock(t, app, ctx, txs) +// //delegatorBalance := app.CoinKeeper.GetCoins(ctx, accs[1].Address) +// //logger.Debug("delegatorBalance", "delegatorBalance", delegatorBalance) +// // +// //// need 1 breath block to get into snapshot +// //ctx = ApplyToBreathBlocks(t, app, ctx, 1) +// //require.Equal(t, delegatorBalance, app.CoinKeeper.GetCoins(ctx, accs[1].Address)) +// //delegatorBalance = app.CoinKeeper.GetCoins(ctx, accs[1].Address) +// //logger.Debug("delegatorBalance", "delegatorBalance", delegatorBalance) +// //// validator2 delegate to validator0 +// //delegateMsg = stake.NewMsgDelegate(accs[2].Address, sdk.ValAddress(accs[0].Address), sdk.NewCoin("BNB", sdk.NewDecWithoutFra(10000*16).RawInt())) +// //txs = GenSimTxs(app, []sdk.Msg{delegateMsg}, true, accs[2].Priv) +// //ctx = ApplyBlock(t, app, ctx, txs) +// // +// //// need 1 breath block to get into distribution addr +// //ctx = ApplyToBreathBlocks(t, app, ctx, 1) +// //require.Equal(t, delegatorBalance, app.CoinKeeper.GetCoins(ctx, accs[1].Address)) +// //delegatorBalance = app.CoinKeeper.GetCoins(ctx, accs[1].Address) +// //logger.Debug("delegatorBalance", "delegatorBalance", delegatorBalance) +// // +// //// need 1 more block to distribute rewards +// //ctx = ApplyEmptyBlocks(t, app, ctx, 1) +// //require.NotEqual(t, delegatorBalance, app.CoinKeeper.GetCoins(ctx, accs[1].Address)) +// //delegatorBalance = app.CoinKeeper.GetCoins(ctx, accs[1].Address) +// //logger.Debug("delegatorBalance", "delegatorBalance", delegatorBalance) +// } diff --git a/go.mod b/go.mod index e619e8118..62e66a15f 100644 --- a/go.mod +++ b/go.mod @@ -166,7 +166,7 @@ require ( replace ( github.com/Shopify/sarama v1.26.1 => github.com/Shopify/sarama v1.21.0 // TODO: bump to official release - github.com/cosmos/cosmos-sdk => github.com/bnb-chain/bnc-cosmos-sdk v0.26.5-0.20240115051327-f5678f8bf56a + github.com/cosmos/cosmos-sdk => github.com/bnb-chain/bnc-cosmos-sdk v0.26.5-0.20240123040446-db421256b575 github.com/grpc-ecosystem/grpc-gateway/v2 => github.com/prysmaticlabs/grpc-gateway/v2 v2.3.1-0.20210702154020-550e1cd83ec1 github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 github.com/tendermint/go-amino => github.com/bnb-chain/bnc-go-amino v0.14.1-binance.2 diff --git a/go.sum b/go.sum index a6b424710..59ec08b40 100644 --- a/go.sum +++ b/go.sum @@ -178,8 +178,8 @@ github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJm github.com/bketelsen/crypt v0.0.4/go.mod h1:aI6NrJ0pMGgvZKL1iVgXLnfIFJtfV+bKCoqOes/6LfM= github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ= github.com/bmizerany/pat v0.0.0-20170815010413-6226ea591a40/go.mod h1:8rLXio+WjiTceGBHIoTvn60HIbs7Hm7bcHjyrSqYB9c= -github.com/bnb-chain/bnc-cosmos-sdk v0.26.5-0.20240115051327-f5678f8bf56a h1:8mk4K6UmpKNN1raZzT4aWKZVG8Qbowu6wIBouC5iR7g= -github.com/bnb-chain/bnc-cosmos-sdk v0.26.5-0.20240115051327-f5678f8bf56a/go.mod h1:OjdXpDHofs6gcPLM9oGD+mm8DPc6Lsevz0Kia53zt3Q= +github.com/bnb-chain/bnc-cosmos-sdk v0.26.5-0.20240123040446-db421256b575 h1:qNflCvRAyLiuNMjsCJ/ocDlDZQ/O6smp/K59nQopBhQ= +github.com/bnb-chain/bnc-cosmos-sdk v0.26.5-0.20240123040446-db421256b575/go.mod h1:OjdXpDHofs6gcPLM9oGD+mm8DPc6Lsevz0Kia53zt3Q= github.com/bnb-chain/bnc-go-amino v0.14.1-binance.2 h1:iAlp9gqG0f2LGAauf3ZiijWlT6NI+W2r9y70HH9LI3k= github.com/bnb-chain/bnc-go-amino v0.14.1-binance.2/go.mod h1:LiCO7jev+3HwLGAiN9gpD0z+jTz95RqgSavbse55XOY= github.com/bnb-chain/bnc-tendermint v0.32.3-bc.10 h1:E4iSwEbJCLYchHiHE1gnOM3jjmJXLBxARhy/RCl8CpI= diff --git a/scripts/bep159_cli_integration_test.sh b/scripts/bep159_cli_integration_test.sh index 54e73c76c..06a132d40 100755 --- a/scripts/bep159_cli_integration_test.sh +++ b/scripts/bep159_cli_integration_test.sh @@ -45,7 +45,7 @@ function prepare_node() { $(cd "./${home}/config" && sed -i -e "s/BEP153Height = 9223372036854775807/BEP153Height = 2/g" app.toml) $(cd "./${home}/config" && sed -i -e "s/BEP159Height = 9223372036854775807/BEP159Height = 3/g" app.toml) $(cd "./${home}/config" && sed -i -e "s/BEP159Phase2Height = 9223372036854775807/BEP159Phase2Height = 11/g" app.toml) - $(cd "./${home}/config" && sed -i -e "s/breatheBlockInterval = 0/breatheBlockInterval = 5/g" app.toml) + $(cd "./${home}/config" && sed -i -e "s/breatheBlockInterval = 0/breatheBlockInterval = 3/g" app.toml) # stop and start node ps -ef | grep bnbchaind | grep testnoded | awk '{print $2}' | xargs kill -9 diff --git a/scripts/bep159_integration_test.sh b/scripts/bep159_integration_test.sh index 8496e9a8f..c72d9637c 100755 --- a/scripts/bep159_integration_test.sh +++ b/scripts/bep159_integration_test.sh @@ -46,7 +46,7 @@ function prepare_node() { $(cd "./${home}/config" && sed -i -e "s/BEP159Height = 9223372036854775807/BEP159Height = 3/g" app.toml) $(cd "./${home}/config" && sed -i -e "s/BEP159Phase2Height = 9223372036854775807/BEP159Phase2Height = 11/g" app.toml) $(cd "./${home}/config" && sed -i -e "s/LimitConsAddrUpdateIntervalHeight = 9223372036854775807/LimitConsAddrUpdateIntervalHeight = 11/g" app.toml) - $(cd "./${home}/config" && sed -i -e "s/breatheBlockInterval = 0/breatheBlockInterval = 5/g" app.toml) + $(cd "./${home}/config" && sed -i -e "s/breatheBlockInterval = 0/breatheBlockInterval = 3/g" app.toml) # $(cd "./${home}/config" && sed -i -e "s/publishStaking = false/publishStaking = true/g" app.toml) # $(cd "./${home}/config" && sed -i -e "s/publishKafka = false/publishKafka = true/g" app.toml) # $(cd "./${home}/config" && sed -i -e "s/publishLocal = false/publishLocal = true/g" app.toml) diff --git a/scripts/recon_integration_test.sh b/scripts/recon_integration_test.sh index d8978bf2a..f7e2f2a42 100644 --- a/scripts/recon_integration_test.sh +++ b/scripts/recon_integration_test.sh @@ -46,7 +46,7 @@ function prepare_node() { $(cd "./${home}/config" && sed -i -e "s/BEP159Height = 9223372036854775807/BEP159Height = 3/g" app.toml) $(cd "./${home}/config" && sed -i -e "s/BEP159Phase2Height = 9223372036854775807/BEP159Phase2Height = 11/g" app.toml) $(cd "./${home}/config" && sed -i -e "s/LimitConsAddrUpdateIntervalHeight = 9223372036854775807/LimitConsAddrUpdateIntervalHeight = 11/g" app.toml) - $(cd "./${home}/config" && sed -i -e "s/breatheBlockInterval = 0/breatheBlockInterval = 5/g" app.toml) + $(cd "./${home}/config" && sed -i -e "s/breatheBlockInterval = 0/breatheBlockInterval = 3/g" app.toml) $(cd "./${home}/config" && sed -i -e "s/BEP255Height = 9223372036854775807/BEP255Height = 3/g" app.toml) # stop and start node