This commit is contained in:
0xsatoshi 2024-06-16 17:23:29 +08:00
parent 32ca84c90b
commit 563d255930
4 changed files with 17 additions and 21 deletions

View File

@ -23,6 +23,7 @@ import (
authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" authtx "github.com/cosmos/cosmos-sdk/x/auth/tx"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/cosmos/cosmos-sdk/x/auth/vesting" "github.com/cosmos/cosmos-sdk/x/auth/vesting"
vestingkeeper "github.com/cosmos/cosmos-sdk/x/auth/vesting/keeper"
vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"
"github.com/cosmos/cosmos-sdk/x/authz" "github.com/cosmos/cosmos-sdk/x/authz"
authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper" authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper"
@ -248,6 +249,7 @@ type App struct {
bep3Keeper bep3keeper.Keeper bep3Keeper bep3keeper.Keeper
pricefeedKeeper pricefeedkeeper.Keeper pricefeedKeeper pricefeedkeeper.Keeper
committeeKeeper committeekeeper.Keeper committeeKeeper committeekeeper.Keeper
vestingKeeper vestingkeeper.VestingKeeper
mintKeeper mintkeeper.Keeper mintKeeper mintkeeper.Keeper
dasignersKeeper dasignerskeeper.Keeper dasignersKeeper dasignerskeeper.Keeper
@ -299,6 +301,7 @@ func NewApp(
minttypes.StoreKey, minttypes.StoreKey,
counciltypes.StoreKey, counciltypes.StoreKey,
dasignerstypes.StoreKey, dasignerstypes.StoreKey,
vestingtypes.StoreKey,
) )
tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey, evmtypes.TransientKey, feemarkettypes.TransientKey) tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey, evmtypes.TransientKey, feemarkettypes.TransientKey)
memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey) memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey)
@ -571,6 +574,8 @@ func NewApp(
keys[counciltypes.StoreKey], appCodec, app.stakingKeeper, keys[counciltypes.StoreKey], appCodec, app.stakingKeeper,
) )
app.vestingKeeper = vestingkeeper.NewVestingKeeper(app.accountKeeper, app.bankKeeper, keys[vestingtypes.StoreKey])
// create the module manager (Note: Any module instantiated in the module manager that is later modified // create the module manager (Note: Any module instantiated in the module manager that is later modified
// must be passed by reference here.) // must be passed by reference here.)
app.mm = module.NewManager( app.mm = module.NewManager(
@ -590,7 +595,7 @@ func NewApp(
upgrade.NewAppModule(app.upgradeKeeper), upgrade.NewAppModule(app.upgradeKeeper),
evidence.NewAppModule(app.evidenceKeeper), evidence.NewAppModule(app.evidenceKeeper),
transferModule, transferModule,
vesting.NewAppModule(app.accountKeeper, app.bankKeeper), vesting.NewAppModule(app.accountKeeper, app.vestingKeeper),
authzmodule.NewAppModule(appCodec, app.authzKeeper, app.accountKeeper, app.bankKeeper, app.interfaceRegistry), authzmodule.NewAppModule(appCodec, app.authzKeeper, app.accountKeeper, app.bankKeeper, app.interfaceRegistry),
issuance.NewAppModule(app.issuanceKeeper, app.accountKeeper, app.bankKeeper), issuance.NewAppModule(app.issuanceKeeper, app.accountKeeper, app.bankKeeper),
bep3.NewAppModule(app.bep3Keeper, app.accountKeeper, app.bankKeeper), bep3.NewAppModule(app.bep3Keeper, app.accountKeeper, app.bankKeeper),
@ -599,7 +604,7 @@ func NewApp(
committee.NewAppModule(app.committeeKeeper, app.accountKeeper), committee.NewAppModule(app.committeeKeeper, app.accountKeeper),
evmutil.NewAppModule(app.evmutilKeeper, app.bankKeeper, app.accountKeeper), evmutil.NewAppModule(app.evmutilKeeper, app.bankKeeper, app.accountKeeper),
// nil InflationCalculationFn, use SDK's default inflation function // nil InflationCalculationFn, use SDK's default inflation function
mint.NewAppModule(appCodec, app.mintKeeper, app.accountKeeper, chaincfg.CustomInflationCalculateFn), mint.NewAppModule(appCodec, app.mintKeeper, app.accountKeeper, chaincfg.NextInflationRate),
council.NewAppModule(app.CouncilKeeper, app.stakingKeeper), council.NewAppModule(app.CouncilKeeper, app.stakingKeeper),
dasigners.NewAppModule(app.dasignersKeeper, app.stakingKeeper), dasigners.NewAppModule(app.dasignersKeeper, app.stakingKeeper),
) )

View File

@ -1,21 +1,11 @@
package chaincfg package chaincfg
import ( import (
"github.com/tendermint/tendermint/libs/log"
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
) )
func CustomInflationCalculateFn(ctx sdk.Context, minter minttypes.Minter, params minttypes.Params, bondedRatio sdk.Dec) sdk.Dec { func NextInflationRate(ctx sdk.Context, minter minttypes.Minter, params minttypes.Params, bondedRatio sdk.Dec, circulatingRatio sdk.Dec) sdk.Dec {
logger := ctx.Logger()
if logger == nil {
panic("logger is nil")
}
return customInflationCalculateFn(logger, minter, params, bondedRatio)
}
func customInflationCalculateFn(logger log.Logger, minter minttypes.Minter, params minttypes.Params, bondedRatio sdk.Dec) sdk.Dec {
// The target annual inflation rate is recalculated for each previsions cycle. The // The target annual inflation rate is recalculated for each previsions cycle. The
// inflation is also subject to a rate change (positive or negative) depending on // inflation is also subject to a rate change (positive or negative) depending on
// the distance from the desired ratio (67%). The maximum rate change possible is // the distance from the desired ratio (67%). The maximum rate change possible is
@ -37,9 +27,10 @@ func customInflationCalculateFn(logger log.Logger, minter minttypes.Minter, para
inflation = params.InflationMin inflation = params.InflationMin
} }
logger.Info( ctx.Logger().Debug(
"calculated new annual inflation", "calculated new annual inflation",
"bondedRatio", bondedRatio, "bondedRatio", bondedRatio,
"circulatingRatio", circulatingRatio,
"inflation", inflation, "inflation", inflation,
"params", params, "params", params,
"minter", minter, "minter", minter,

4
go.mod
View File

@ -213,13 +213,13 @@ replace (
github.com/cometbft/cometbft-db => github.com/kava-labs/cometbft-db v0.7.0-rocksdb-v7.9.2-kava.1 github.com/cometbft/cometbft-db => github.com/kava-labs/cometbft-db v0.7.0-rocksdb-v7.9.2-kava.1
// Use cosmos-sdk fork with backported fix for unsafe-reset-all, staking transfer events, and custom tally handler support // Use cosmos-sdk fork with backported fix for unsafe-reset-all, staking transfer events, and custom tally handler support
// github.com/cosmos/cosmos-sdk => github.com/0glabs/cosmos-sdk v0.46.11-kava.3 // github.com/cosmos/cosmos-sdk => github.com/0glabs/cosmos-sdk v0.46.11-kava.3
github.com/cosmos/cosmos-sdk => github.com/0glabs/cosmos-sdk v0.46.11-0glabs.4 github.com/cosmos/cosmos-sdk => /home/dongz/projects/cosmos-sdk
// See https://github.com/cosmos/cosmos-sdk/pull/13093 // See https://github.com/cosmos/cosmos-sdk/pull/13093
github.com/dgrijalva/jwt-go => github.com/golang-jwt/jwt/v4 v4.4.2 github.com/dgrijalva/jwt-go => github.com/golang-jwt/jwt/v4 v4.4.2
// Use go-ethereum fork with precompiles // Use go-ethereum fork with precompiles
github.com/ethereum/go-ethereum => github.com/evmos/go-ethereum v1.10.26-evmos-rc2 github.com/ethereum/go-ethereum => github.com/evmos/go-ethereum v1.10.26-evmos-rc2
// Use ethermint fork that respects min-gas-price with NoBaseFee true and london enabled, and includes eip712 support // Use ethermint fork that respects min-gas-price with NoBaseFee true and london enabled, and includes eip712 support
github.com/evmos/ethermint => github.com/0glabs/ethermint v0.21.0-0g.v2.0.1 github.com/evmos/ethermint => /home/dongz/projects/ethermint
// See https://github.com/cosmos/cosmos-sdk/pull/10401, https://github.com/cosmos/cosmos-sdk/commit/0592ba6158cd0bf49d894be1cef4faeec59e8320 // See https://github.com/cosmos/cosmos-sdk/pull/10401, https://github.com/cosmos/cosmos-sdk/commit/0592ba6158cd0bf49d894be1cef4faeec59e8320
github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.7.0 github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.7.0
// Use the cosmos modified protobufs // Use the cosmos modified protobufs

View File

@ -16,7 +16,7 @@ userMnemonic="news tornado sponsor drastic dolphin awful plastic select true liz
# 0x7Bbf300890857b8c241b219C6a489431669b3aFA # 0x7Bbf300890857b8c241b219C6a489431669b3aFA
# kava10wlnqzyss4accfqmyxwx5jy5x9nfkwh6qm7n4t # kava10wlnqzyss4accfqmyxwx5jy5x9nfkwh6qm7n4t
relayerMnemonic="never reject sniff east arctic funny twin feed upper series stay shoot vivid adapt defense economy pledge fetch invite approve ceiling admit gloom exit" vestingMnemonic="never reject sniff east arctic funny twin feed upper series stay shoot vivid adapt defense economy pledge fetch invite approve ceiling admit gloom exit"
# 0xa2F728F997f62F47D4262a70947F6c36885dF9fa # 0xa2F728F997f62F47D4262a70947F6c36885dF9fa
# kava15tmj37vh7ch504px9fcfglmvx6y9m70646ev8t # kava15tmj37vh7ch504px9fcfglmvx6y9m70646ev8t
@ -64,11 +64,11 @@ $BINARY add-genesis-account $evmFaucetKeyName 1000000000000000000000ua0gi
userKeyName="user" userKeyName="user"
printf "$userMnemonic\n" | $BINARY keys add $userKeyName --eth --recover printf "$userMnemonic\n" | $BINARY keys add $userKeyName --eth --recover
$BINARY add-genesis-account $userKeyName 1000000000000000000000ua0gi,1000000000usdx $BINARY add-genesis-account $userKeyName 1000000000000000000000ua0gi
relayerKeyName="relayer" vestingKeyName="vesting"
printf "$relayerMnemonic\n" | $BINARY keys add $relayerKeyName --eth --recover printf "$vestingMnemonic\n" | $BINARY keys add $vestingKeyName --eth --recover
$BINARY add-genesis-account $relayerKeyName 1000000000000000000000ua0gi $BINARY add-genesis-account $vestingKeyName 1000000000000000000000ua0gi --vesting-amount 1000000000000000000000ua0gi --vesting-start-time 1717200000 --vesting-end-time 1719791999
storageContractAcc="0g1vsjpjgw8p5f4x0nwp8ernl9lkszewcqqss7r5d" storageContractAcc="0g1vsjpjgw8p5f4x0nwp8ernl9lkszewcqqss7r5d"
$BINARY add-genesis-account $storageContractAcc 1000000000000000000000ua0gi $BINARY add-genesis-account $storageContractAcc 1000000000000000000000ua0gi