|
commit 84caa89137fe524e270b2288365db0ea90f12e39 |
|
Author: Roman <[email protected]> |
|
Date: Fri Jun 21 20:26:18 2024 -0400 |
|
|
|
feat: DexScreener (main) (#8411) |
|
|
|
* feat: Indexer service wiring (#8385) |
|
|
|
* feat: Indexer service wiring |
|
|
|
* wire supply listener |
|
|
|
* working version |
|
|
|
* progress |
|
|
|
* go sum |
|
|
|
* Added some boilerplate items to be integrated with the core ingestion logic |
|
|
|
* feat: Indexer service wiring (#8385) |
|
|
|
* feat: Indexer service wiring |
|
|
|
* wire supply listener |
|
|
|
* working version |
|
|
|
* progress |
|
|
|
* feat: Indexer service wiring (#8385) |
|
|
|
* feat: Indexer service wiring |
|
|
|
* wire supply listener |
|
|
|
* working version |
|
|
|
* progress |
|
|
|
* feat(indexer): proper supply offset handling (#8404) |
|
|
|
* feat(indexer): proper supply offset handling |
|
|
|
* lint |
|
|
|
* test: token supply write listener (#8405) |
|
|
|
* test: token supply write listener |
|
|
|
* updates |
|
|
|
* lint |
|
|
|
* sqs config |
|
|
|
* updates |
|
|
|
* Cherry-pick commit from v25.x ea0f637845d48f4ca92d55db13bc78b69661f77f |
|
|
|
* Removed unused func |
|
|
|
* Added DefaultConfig with is_enabled = false and empty string for topic ids |
|
|
|
* Fixed wrong attr assigned to new pubsub client |
|
|
|
--------- |
|
|
|
Co-authored-by: Calvin <[email protected]> |
|
Co-authored-by: Calvin <[email protected]> |
|
|
|
diff --git a/app/app.go b/app/app.go |
|
--- a/app/app.go |
|
+++ b/app/app.go |
|
@@ -637,284 +689,285 @@ |
|
func InitOsmosisAppForTestnet(app *OsmosisApp, newValAddr bytes.HexBytes, newValPubKey crypto.PubKey, newOperatorAddress, upgradeToTrigger string) *OsmosisApp { |
|
// |
|
// Required Changes: |
|
// |
|
|
|
ctx := app.BaseApp.NewUncachedContext(true, tmproto.Header{}) |
|
pubkey := &ed25519.PubKey{Key: newValPubKey.Bytes()} |
|
pubkeyAny, err := types.NewAnyWithValue(pubkey) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
|
|
// STAKING |
|
// |
|
|
|
// Create Validator struct for our new validator. |
|
_, bz, err := bech32.DecodeAndConvert(newOperatorAddress) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
bech32Addr, err := bech32.ConvertAndEncode("osmovaloper", bz) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
newVal := stakingtypes.Validator{ |
|
OperatorAddress: bech32Addr, |
|
ConsensusPubkey: pubkeyAny, |
|
Jailed: false, |
|
Status: stakingtypes.Bonded, |
|
Tokens: osmomath.NewInt(900000000000000), |
|
DelegatorShares: osmomath.MustNewDecFromStr("10000000"), |
|
Description: stakingtypes.Description{ |
|
Moniker: "Testnet Validator", |
|
}, |
|
Commission: stakingtypes.Commission{ |
|
CommissionRates: stakingtypes.CommissionRates{ |
|
Rate: osmomath.MustNewDecFromStr("0.05"), |
|
MaxRate: osmomath.MustNewDecFromStr("0.1"), |
|
MaxChangeRate: osmomath.MustNewDecFromStr("0.05"), |
|
}, |
|
}, |
|
MinSelfDelegation: osmomath.OneInt(), |
|
} |
|
|
|
// Remove all validators from power store |
|
stakingKey := app.GetKey(stakingtypes.ModuleName) |
|
stakingStore := ctx.KVStore(stakingKey) |
|
iterator, err := app.StakingKeeper.ValidatorsPowerStoreIterator(ctx) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
for ; iterator.Valid(); iterator.Next() { |
|
stakingStore.Delete(iterator.Key()) |
|
} |
|
iterator.Close() |
|
|
|
// Remove all valdiators from last validators store |
|
iterator, err = app.StakingKeeper.LastValidatorsIterator(ctx) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
for ; iterator.Valid(); iterator.Next() { |
|
stakingStore.Delete(iterator.Key()) |
|
} |
|
iterator.Close() |
|
|
|
// Remove all validators from validators store |
|
iterator = storetypes.KVStorePrefixIterator(stakingStore, stakingtypes.ValidatorsKey) |
|
for ; iterator.Valid(); iterator.Next() { |
|
stakingStore.Delete(iterator.Key()) |
|
} |
|
iterator.Close() |
|
|
|
// Remove all validators from unbonding queue |
|
iterator = storetypes.KVStorePrefixIterator(stakingStore, stakingtypes.ValidatorQueueKey) |
|
for ; iterator.Valid(); iterator.Next() { |
|
stakingStore.Delete(iterator.Key()) |
|
} |
|
iterator.Close() |
|
|
|
// Add our validator to power and last validators store |
|
err = app.StakingKeeper.SetValidator(ctx, newVal) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
err = app.StakingKeeper.SetValidatorByConsAddr(ctx, newVal) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
err = app.StakingKeeper.SetValidatorByPowerIndex(ctx, newVal) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
valAddr, err := sdk.ValAddressFromBech32(newVal.GetOperator()) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
err = app.StakingKeeper.SetLastValidatorPower(ctx, valAddr, 0) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
if err := app.StakingKeeper.Hooks().AfterValidatorCreated(ctx, valAddr); err != nil { |
|
panic(err) |
|
} |
|
|
|
// DISTRIBUTION |
|
// |
|
|
|
// Initialize records for this validator across all distribution stores |
|
valAddr, err = sdk.ValAddressFromBech32(newVal.GetOperator()) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
err = app.DistrKeeper.SetValidatorHistoricalRewards(ctx, valAddr, 0, distrtypes.NewValidatorHistoricalRewards(sdk.DecCoins{}, 1)) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
err = app.DistrKeeper.SetValidatorCurrentRewards(ctx, valAddr, distrtypes.NewValidatorCurrentRewards(sdk.DecCoins{}, 1)) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
err = app.DistrKeeper.SetValidatorAccumulatedCommission(ctx, valAddr, distrtypes.InitialValidatorAccumulatedCommission()) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
err = app.DistrKeeper.SetValidatorOutstandingRewards(ctx, valAddr, distrtypes.ValidatorOutstandingRewards{Rewards: sdk.DecCoins{}}) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
|
|
// SLASHING |
|
// |
|
|
|
// Set validator signing info for our new validator. |
|
newConsAddr := sdk.ConsAddress(newValAddr.Bytes()) |
|
newValidatorSigningInfo := slashingtypes.ValidatorSigningInfo{ |
|
Address: newConsAddr.String(), |
|
StartHeight: app.LastBlockHeight() - 1, |
|
Tombstoned: false, |
|
} |
|
err = app.SlashingKeeper.SetValidatorSigningInfo(ctx, newConsAddr, newValidatorSigningInfo) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
|
|
// |
|
// Optional Changes: |
|
// |
|
|
|
// GOV |
|
// |
|
|
|
newExpeditedVotingPeriod := time.Minute |
|
newVotingPeriod := time.Minute * 2 |
|
|
|
govParams, err := app.GovKeeper.Params.Get(ctx) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
govParams.ExpeditedVotingPeriod = &newExpeditedVotingPeriod |
|
govParams.VotingPeriod = &newVotingPeriod |
|
govParams.MinDeposit = sdk.NewCoins(sdk.NewInt64Coin(appparams.BaseCoinUnit, 100000000)) |
|
govParams.ExpeditedMinDeposit = sdk.NewCoins(sdk.NewInt64Coin(appparams.BaseCoinUnit, 150000000)) |
|
|
|
err = app.GovKeeper.Params.Set(ctx, govParams) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
|
|
// EPOCHS |
|
// |
|
|
|
dayEpochInfo := app.EpochsKeeper.GetEpochInfo(ctx, "day") |
|
dayEpochInfo.Duration = time.Hour * 6 |
|
// Prevents epochs from running back to back |
|
dayEpochInfo.CurrentEpochStartTime = time.Now().UTC() |
|
// If you want epoch to run a minute after starting the chain, uncomment the line below and comment the line above |
|
// dayEpochInfo.CurrentEpochStartTime = time.Now().UTC().Add(-dayEpochInfo.Duration).Add(time.Minute) |
|
dayEpochInfo.CurrentEpochStartHeight = app.LastBlockHeight() |
|
app.EpochsKeeper.DeleteEpochInfo(ctx, "day") |
|
err = app.EpochsKeeper.AddEpochInfo(ctx, dayEpochInfo) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
|
|
weekEpochInfo := app.EpochsKeeper.GetEpochInfo(ctx, "week") |
|
weekEpochInfo.Duration = time.Hour * 12 |
|
// Prevents epochs from running back to back |
|
weekEpochInfo.CurrentEpochStartTime = time.Now().UTC() |
|
weekEpochInfo.CurrentEpochStartHeight = app.LastBlockHeight() |
|
app.EpochsKeeper.DeleteEpochInfo(ctx, "week") |
|
err = app.EpochsKeeper.AddEpochInfo(ctx, weekEpochInfo) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
|
|
// BANK |
|
// |
|
|
|
defaultCoins := sdk.NewCoins( |
|
sdk.NewInt64Coin("ibc/0CD3A0285E1341859B5E86B6AB7682F023D03E97607CCC1DC95706411D866DF7", 1000000000000), // DAI |
|
sdk.NewInt64Coin("ibc/498A0751C798A0D9A389AA3691123DADA57DAA4FE165D5C75894505B876BA6E4", 1000000000000), // USDC, for pool creation fee |
|
sdk.NewInt64Coin(appparams.BaseCoinUnit, 1000000000000), |
|
sdk.NewInt64Coin("uion", 1000000000)) |
|
|
|
localOsmosisAccounts := []sdk.AccAddress{ |
|
sdk.MustAccAddressFromBech32("osmo12smx2wdlyttvyzvzg54y2vnqwq2qjateuf7thj"), |
|
sdk.MustAccAddressFromBech32("osmo1cyyzpxplxdzkeea7kwsydadg87357qnahakaks"), |
|
sdk.MustAccAddressFromBech32("osmo18s5lynnmx37hq4wlrw9gdn68sg2uxp5rgk26vv"), |
|
sdk.MustAccAddressFromBech32("osmo1qwexv7c6sm95lwhzn9027vyu2ccneaqad4w8ka"), |
|
sdk.MustAccAddressFromBech32("osmo14hcxlnwlqtq75ttaxf674vk6mafspg8xwgnn53"), |
|
sdk.MustAccAddressFromBech32("osmo12rr534cer5c0vj53eq4y32lcwguyy7nndt0u2t"), |
|
sdk.MustAccAddressFromBech32("osmo1nt33cjd5auzh36syym6azgc8tve0jlvklnq7jq"), |
|
sdk.MustAccAddressFromBech32("osmo10qfrpash5g2vk3hppvu45x0g860czur8ff5yx0"), |
|
sdk.MustAccAddressFromBech32("osmo1f4tvsdukfwh6s9swrc24gkuz23tp8pd3e9r5fa"), |
|
sdk.MustAccAddressFromBech32("osmo1myv43sqgnj5sm4zl98ftl45af9cfzk7nhjxjqh"), |
|
sdk.MustAccAddressFromBech32("osmo14gs9zqh8m49yy9kscjqu9h72exyf295afg6kgk"), |
|
- sdk.MustAccAddressFromBech32("osmo1jllfytsz4dryxhz5tl7u73v29exsf80vz52ucc")} |
|
+ sdk.MustAccAddressFromBech32("osmo1jllfytsz4dryxhz5tl7u73v29exsf80vz52ucc"), |
|
+ } |
|
|
|
// Fund localosmosis accounts |
|
for _, account := range localOsmosisAccounts { |
|
err := app.BankKeeper.MintCoins(ctx, minttypes.ModuleName, defaultCoins) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
err = app.BankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, account, defaultCoins) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
} |
|
|
|
// Fund edgenet faucet |
|
faucetCoins := sdk.NewCoins( |
|
sdk.NewInt64Coin("ibc/0CD3A0285E1341859B5E86B6AB7682F023D03E97607CCC1DC95706411D866DF7", 1000000000000000), // DAI |
|
sdk.NewInt64Coin(appparams.BaseCoinUnit, 1000000000000000), |
|
sdk.NewInt64Coin("uion", 1000000000000)) |
|
err = app.BankKeeper.MintCoins(ctx, minttypes.ModuleName, faucetCoins) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
err = app.BankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, sdk.MustAccAddressFromBech32("osmo1rqgf207csps822qwmd3k2n6k6k4e99w502e79t"), faucetCoins) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
|
|
// Mars bank account |
|
marsCoins := sdk.NewCoins( |
|
sdk.NewInt64Coin(appparams.BaseCoinUnit, 10000000000000), |
|
sdk.NewInt64Coin("ibc/903A61A498756EA560B85A85132D3AEE21B5DEDD41213725D22ABF276EA6945E", 400000000000), |
|
sdk.NewInt64Coin("ibc/D189335C6E4A68B513C10AB227BF1C1D38C746766278BA3EEB4FB14124F1D858", 3000000000000), |
|
sdk.NewInt64Coin("ibc/C140AFD542AE77BD7DCC83F13FDD8C5E5BB8C4929785E6EC2F4C636F98F17901", 200000000000), |
|
sdk.NewInt64Coin("ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2", 700000000000), |
|
sdk.NewInt64Coin("ibc/D1542AA8762DB13087D8364F3EA6509FD6F009A34F00426AF9E4F9FA85CBBF1F", 2000000000), |
|
sdk.NewInt64Coin("ibc/EA1D43981D5C9A1C4AAEA9C23BB1D4FA126BA9BC7020A25E0AE4AA841EA25DC5", 3000000000000000000)) |
|
err = app.BankKeeper.MintCoins(ctx, minttypes.ModuleName, marsCoins) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
err = app.BankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, sdk.MustAccAddressFromBech32("osmo1ev02crc36675xd8s029qh7wg3wjtfk37jr004z"), marsCoins) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
|
|
// UPGRADE |
|
// |
|
|
|
if upgradeToTrigger != "" { |
|
upgradePlan := upgradetypes.Plan{ |
|
Name: upgradeToTrigger, |
|
Height: app.LastBlockHeight() + 10, |
|
} |
|
err = app.UpgradeKeeper.ScheduleUpgrade(ctx, upgradePlan) |
|
if err != nil { |
|
panic(err) |
|
} |
|
} |
|
|
|
return app |
|
} |
|
|
|
// CheckTx will check the transaction with the provided checkTxHandler. We override the default |
|
// handler so that we can verify bid transactions before they are inserted into the mempool. |
|
// With the BlockSDK CheckTx, we can verify the bid transaction and all of the bundled transactions |
|
// before inserting the bid transaction into the mempool. |
|
|
|
commit 5bff2163b81a0ef5d7ef99adaaab5ebe8dae013d |
|
Author: Adam Tucker <[email protected]> |
|
Date: Fri May 24 14:16:37 2024 -0600 |
|
|
|
feat: sdk v0.50.x upgrade (#8274) |
|
|
|
* initial push |
|
|
|
* delete |
|
|
|
* tidy |
|
|
|
* add replace |
|
|
|
* proto |
|
|
|
* excludes |
|
|
|
* update go mods |
|
|
|
* fix |
|
|
|
* initial pass through modules |
|
|
|
* checkpoint |
|
|
|
* checkpoint |
|
|
|
* another round |
|
|
|
* fork update with fixes |
|
|
|
* fork bumps |
|
|
|
* more fixes |
|
|
|
* move to cosmosdb |
|
|
|
* signModeHandler fix |
|
|
|
* more fixes |
|
|
|
* store fixes |
|
|
|
* checkpoint |
|
|
|
* checkpoint |
|
|
|
* more event fixes |
|
|
|
* GetSigners fix for tests |
|
|
|
* get signers fixes |
|
|
|
* smart account fixes |
|
|
|
* fixes |
|
|
|
* checkpoint |
|
|
|
* txfees completion |
|
|
|
* more errors |
|
|
|
* rosetta import |
|
|
|
* address simulation |
|
|
|
* smart account get sign bytes |
|
|
|
* disable streaming service |
|
|
|
* some test fixes |
|
|
|
* as signer proto |
|
|
|
* fix some tests |
|
|
|
* fix superfluid test |
|
|
|
* more fixes |
|
|
|
* fix gamm keeper test with note |
|
|
|
* fix authz serialization |
|
|
|
* fix validate basic test |
|
|
|
* incentives test fix |
|
|
|
* fix lockup test |
|
|
|
* begin and end block fixes |
|
|
|
* fix epochs tests |
|
|
|
* fix all upgrade tests |
|
|
|
* fix txfees test |
|
|
|
* fix e2e init test |
|
|
|
* more fixes |
|
|
|
* updated ibctesting overrides. Removed unnecessary receiver length check test (now checked on ibc sends). Rate limit tests pass |
|
|
|
* smart account integration test fixes |
|
|
|
* SetAccount no longer needed. Done internally. |
|
|
|
* more set account issues |
|
|
|
* gas checks are not needed when using selected authenticators. That was a legacy check |
|
|
|
* fix accounts and codec |
|
|
|
* using codec with proper "osmo" prefix. The default test codec uses "cosmos" and there's no way to override it |
|
|
|
* fix ibc-hooks tests |
|
|
|
* streaming fixes |
|
|
|
* upgrade handler |
|
|
|
* tidy |
|
|
|
* golang bump 1.22 |
|
|
|
* prevent circular dep |
|
|
|
* update osmoutils |
|
|
|
* tidy |
|
|
|
* remove local replaces for testing |
|
|
|
* set up module.go |
|
|
|
* fix dockerfile for local work |
|
|
|
* module changes |
|
|
|
* fix e2e |
|
|
|
* more ci fixes |
|
|
|
* fix simulator |
|
|
|
* lints |
|
|
|
* remove wrap |
|
|
|
* lints |
|
|
|
* lints |
|
|
|
* clean up the TODOs |
|
|
|
* more todo clean ups |
|
|
|
* comments |
|
|
|
* comments |
|
|
|
* move test outside of osmoutils |
|
|
|
* clean up go mods |
|
|
|
* fix errors for GetDelegation |
|
|
|
* return error instead of panic |
|
|
|
* chore: fix build |
|
|
|
* fix weird error check |
|
|
|
* ignore words |
|
|
|
* more spelling fixes |
|
|
|
* final spelling errors |
|
|
|
* Revert "more spelling fixes" |
|
|
|
This reverts commit 5c8698ba6d82978a0ea0d33fe443cfb5d9a01dc1. |
|
|
|
* redo spelling check |
|
|
|
--------- |
|
|
|
Co-authored-by: Nicolas Lara <[email protected]> |
|
Co-authored-by: PaddyMc <[email protected]> |
|
|
|
diff --git a/app/app.go b/app/app.go |
|
--- a/app/app.go |
|
+++ b/app/app.go |
|
@@ -569,243 +636,284 @@ |
|
func InitOsmosisAppForTestnet(app *OsmosisApp, newValAddr bytes.HexBytes, newValPubKey crypto.PubKey, newOperatorAddress, upgradeToTrigger string) *OsmosisApp { |
|
// |
|
// Required Changes: |
|
// |
|
|
|
ctx := app.BaseApp.NewUncachedContext(true, tmproto.Header{}) |
|
pubkey := &ed25519.PubKey{Key: newValPubKey.Bytes()} |
|
pubkeyAny, err := types.NewAnyWithValue(pubkey) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
|
|
// STAKING |
|
// |
|
|
|
// Create Validator struct for our new validator. |
|
_, bz, err := bech32.DecodeAndConvert(newOperatorAddress) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
bech32Addr, err := bech32.ConvertAndEncode("osmovaloper", bz) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
newVal := stakingtypes.Validator{ |
|
OperatorAddress: bech32Addr, |
|
ConsensusPubkey: pubkeyAny, |
|
Jailed: false, |
|
Status: stakingtypes.Bonded, |
|
- Tokens: sdk.NewInt(900000000000000), |
|
- DelegatorShares: sdk.MustNewDecFromStr("10000000"), |
|
+ Tokens: osmomath.NewInt(900000000000000), |
|
+ DelegatorShares: osmomath.MustNewDecFromStr("10000000"), |
|
Description: stakingtypes.Description{ |
|
Moniker: "Testnet Validator", |
|
}, |
|
Commission: stakingtypes.Commission{ |
|
CommissionRates: stakingtypes.CommissionRates{ |
|
- Rate: sdk.MustNewDecFromStr("0.05"), |
|
- MaxRate: sdk.MustNewDecFromStr("0.1"), |
|
- MaxChangeRate: sdk.MustNewDecFromStr("0.05"), |
|
+ Rate: osmomath.MustNewDecFromStr("0.05"), |
|
+ MaxRate: osmomath.MustNewDecFromStr("0.1"), |
|
+ MaxChangeRate: osmomath.MustNewDecFromStr("0.05"), |
|
}, |
|
}, |
|
- MinSelfDelegation: sdk.OneInt(), |
|
+ MinSelfDelegation: osmomath.OneInt(), |
|
} |
|
|
|
// Remove all validators from power store |
|
stakingKey := app.GetKey(stakingtypes.ModuleName) |
|
stakingStore := ctx.KVStore(stakingKey) |
|
- iterator := app.StakingKeeper.ValidatorsPowerStoreIterator(ctx) |
|
+ iterator, err := app.StakingKeeper.ValidatorsPowerStoreIterator(ctx) |
|
+ if err != nil { |
|
+ tmos.Exit(err.Error()) |
|
+ } |
|
for ; iterator.Valid(); iterator.Next() { |
|
stakingStore.Delete(iterator.Key()) |
|
} |
|
iterator.Close() |
|
|
|
// Remove all valdiators from last validators store |
|
- iterator = app.StakingKeeper.LastValidatorsIterator(ctx) |
|
+ iterator, err = app.StakingKeeper.LastValidatorsIterator(ctx) |
|
+ if err != nil { |
|
+ tmos.Exit(err.Error()) |
|
+ } |
|
for ; iterator.Valid(); iterator.Next() { |
|
stakingStore.Delete(iterator.Key()) |
|
} |
|
iterator.Close() |
|
|
|
// Remove all validators from validators store |
|
- iterator = sdk.KVStorePrefixIterator(stakingStore, stakingtypes.ValidatorsKey) |
|
+ iterator = storetypes.KVStorePrefixIterator(stakingStore, stakingtypes.ValidatorsKey) |
|
for ; iterator.Valid(); iterator.Next() { |
|
stakingStore.Delete(iterator.Key()) |
|
} |
|
iterator.Close() |
|
|
|
// Remove all validators from unbonding queue |
|
- iterator = sdk.KVStorePrefixIterator(stakingStore, stakingtypes.ValidatorQueueKey) |
|
+ iterator = storetypes.KVStorePrefixIterator(stakingStore, stakingtypes.ValidatorQueueKey) |
|
for ; iterator.Valid(); iterator.Next() { |
|
stakingStore.Delete(iterator.Key()) |
|
} |
|
iterator.Close() |
|
|
|
// Add our validator to power and last validators store |
|
- app.StakingKeeper.SetValidator(ctx, newVal) |
|
+ err = app.StakingKeeper.SetValidator(ctx, newVal) |
|
+ if err != nil { |
|
+ tmos.Exit(err.Error()) |
|
+ } |
|
err = app.StakingKeeper.SetValidatorByConsAddr(ctx, newVal) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
- app.StakingKeeper.SetValidatorByPowerIndex(ctx, newVal) |
|
- app.StakingKeeper.SetLastValidatorPower(ctx, newVal.GetOperator(), 0) |
|
- if err := app.StakingKeeper.Hooks().AfterValidatorCreated(ctx, newVal.GetOperator()); err != nil { |
|
+ err = app.StakingKeeper.SetValidatorByPowerIndex(ctx, newVal) |
|
+ if err != nil { |
|
+ tmos.Exit(err.Error()) |
|
+ } |
|
+ valAddr, err := sdk.ValAddressFromBech32(newVal.GetOperator()) |
|
+ if err != nil { |
|
+ tmos.Exit(err.Error()) |
|
+ } |
|
+ err = app.StakingKeeper.SetLastValidatorPower(ctx, valAddr, 0) |
|
+ if err != nil { |
|
+ tmos.Exit(err.Error()) |
|
+ } |
|
+ if err := app.StakingKeeper.Hooks().AfterValidatorCreated(ctx, valAddr); err != nil { |
|
panic(err) |
|
} |
|
|
|
// DISTRIBUTION |
|
// |
|
|
|
// Initialize records for this validator across all distribution stores |
|
- app.DistrKeeper.SetValidatorHistoricalRewards(ctx, newVal.GetOperator(), 0, distrtypes.NewValidatorHistoricalRewards(sdk.DecCoins{}, 1)) |
|
- app.DistrKeeper.SetValidatorCurrentRewards(ctx, newVal.GetOperator(), distrtypes.NewValidatorCurrentRewards(sdk.DecCoins{}, 1)) |
|
- app.DistrKeeper.SetValidatorAccumulatedCommission(ctx, newVal.GetOperator(), distrtypes.InitialValidatorAccumulatedCommission()) |
|
- app.DistrKeeper.SetValidatorOutstandingRewards(ctx, newVal.GetOperator(), distrtypes.ValidatorOutstandingRewards{Rewards: sdk.DecCoins{}}) |
|
+ valAddr, err = sdk.ValAddressFromBech32(newVal.GetOperator()) |
|
+ if err != nil { |
|
+ tmos.Exit(err.Error()) |
|
+ } |
|
+ err = app.DistrKeeper.SetValidatorHistoricalRewards(ctx, valAddr, 0, distrtypes.NewValidatorHistoricalRewards(sdk.DecCoins{}, 1)) |
|
+ if err != nil { |
|
+ tmos.Exit(err.Error()) |
|
+ } |
|
+ err = app.DistrKeeper.SetValidatorCurrentRewards(ctx, valAddr, distrtypes.NewValidatorCurrentRewards(sdk.DecCoins{}, 1)) |
|
+ if err != nil { |
|
+ tmos.Exit(err.Error()) |
|
+ } |
|
+ err = app.DistrKeeper.SetValidatorAccumulatedCommission(ctx, valAddr, distrtypes.InitialValidatorAccumulatedCommission()) |
|
+ if err != nil { |
|
+ tmos.Exit(err.Error()) |
|
+ } |
|
+ err = app.DistrKeeper.SetValidatorOutstandingRewards(ctx, valAddr, distrtypes.ValidatorOutstandingRewards{Rewards: sdk.DecCoins{}}) |
|
+ if err != nil { |
|
+ tmos.Exit(err.Error()) |
|
+ } |
|
|
|
// SLASHING |
|
// |
|
|
|
// Set validator signing info for our new validator. |
|
newConsAddr := sdk.ConsAddress(newValAddr.Bytes()) |
|
newValidatorSigningInfo := slashingtypes.ValidatorSigningInfo{ |
|
Address: newConsAddr.String(), |
|
StartHeight: app.LastBlockHeight() - 1, |
|
Tombstoned: false, |
|
} |
|
- app.SlashingKeeper.SetValidatorSigningInfo(ctx, newConsAddr, newValidatorSigningInfo) |
|
+ err = app.SlashingKeeper.SetValidatorSigningInfo(ctx, newConsAddr, newValidatorSigningInfo) |
|
+ if err != nil { |
|
+ tmos.Exit(err.Error()) |
|
+ } |
|
|
|
// |
|
// Optional Changes: |
|
// |
|
|
|
// GOV |
|
// |
|
|
|
newExpeditedVotingPeriod := time.Minute |
|
newVotingPeriod := time.Minute * 2 |
|
|
|
- govParams := app.GovKeeper.GetParams(ctx) |
|
+ govParams, err := app.GovKeeper.Params.Get(ctx) |
|
+ if err != nil { |
|
+ tmos.Exit(err.Error()) |
|
+ } |
|
govParams.ExpeditedVotingPeriod = &newExpeditedVotingPeriod |
|
govParams.VotingPeriod = &newVotingPeriod |
|
govParams.MinDeposit = sdk.NewCoins(sdk.NewInt64Coin(appparams.BaseCoinUnit, 100000000)) |
|
govParams.ExpeditedMinDeposit = sdk.NewCoins(sdk.NewInt64Coin(appparams.BaseCoinUnit, 150000000)) |
|
|
|
- err = app.GovKeeper.SetParams(ctx, govParams) |
|
+ err = app.GovKeeper.Params.Set(ctx, govParams) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
|
|
// EPOCHS |
|
// |
|
|
|
dayEpochInfo := app.EpochsKeeper.GetEpochInfo(ctx, "day") |
|
dayEpochInfo.Duration = time.Hour * 6 |
|
// Prevents epochs from running back to back |
|
dayEpochInfo.CurrentEpochStartTime = time.Now().UTC() |
|
// If you want epoch to run a minute after starting the chain, uncomment the line below and comment the line above |
|
// dayEpochInfo.CurrentEpochStartTime = time.Now().UTC().Add(-dayEpochInfo.Duration).Add(time.Minute) |
|
dayEpochInfo.CurrentEpochStartHeight = app.LastBlockHeight() |
|
app.EpochsKeeper.DeleteEpochInfo(ctx, "day") |
|
err = app.EpochsKeeper.AddEpochInfo(ctx, dayEpochInfo) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
|
|
weekEpochInfo := app.EpochsKeeper.GetEpochInfo(ctx, "week") |
|
weekEpochInfo.Duration = time.Hour * 12 |
|
// Prevents epochs from running back to back |
|
weekEpochInfo.CurrentEpochStartTime = time.Now().UTC() |
|
weekEpochInfo.CurrentEpochStartHeight = app.LastBlockHeight() |
|
app.EpochsKeeper.DeleteEpochInfo(ctx, "week") |
|
err = app.EpochsKeeper.AddEpochInfo(ctx, weekEpochInfo) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
|
|
// BANK |
|
// |
|
|
|
defaultCoins := sdk.NewCoins( |
|
sdk.NewInt64Coin("ibc/0CD3A0285E1341859B5E86B6AB7682F023D03E97607CCC1DC95706411D866DF7", 1000000000000), // DAI |
|
sdk.NewInt64Coin("ibc/498A0751C798A0D9A389AA3691123DADA57DAA4FE165D5C75894505B876BA6E4", 1000000000000), // USDC, for pool creation fee |
|
sdk.NewInt64Coin(appparams.BaseCoinUnit, 1000000000000), |
|
sdk.NewInt64Coin("uion", 1000000000)) |
|
|
|
localOsmosisAccounts := []sdk.AccAddress{ |
|
sdk.MustAccAddressFromBech32("osmo12smx2wdlyttvyzvzg54y2vnqwq2qjateuf7thj"), |
|
sdk.MustAccAddressFromBech32("osmo1cyyzpxplxdzkeea7kwsydadg87357qnahakaks"), |
|
sdk.MustAccAddressFromBech32("osmo18s5lynnmx37hq4wlrw9gdn68sg2uxp5rgk26vv"), |
|
sdk.MustAccAddressFromBech32("osmo1qwexv7c6sm95lwhzn9027vyu2ccneaqad4w8ka"), |
|
sdk.MustAccAddressFromBech32("osmo14hcxlnwlqtq75ttaxf674vk6mafspg8xwgnn53"), |
|
sdk.MustAccAddressFromBech32("osmo12rr534cer5c0vj53eq4y32lcwguyy7nndt0u2t"), |
|
sdk.MustAccAddressFromBech32("osmo1nt33cjd5auzh36syym6azgc8tve0jlvklnq7jq"), |
|
sdk.MustAccAddressFromBech32("osmo10qfrpash5g2vk3hppvu45x0g860czur8ff5yx0"), |
|
sdk.MustAccAddressFromBech32("osmo1f4tvsdukfwh6s9swrc24gkuz23tp8pd3e9r5fa"), |
|
sdk.MustAccAddressFromBech32("osmo1myv43sqgnj5sm4zl98ftl45af9cfzk7nhjxjqh"), |
|
sdk.MustAccAddressFromBech32("osmo14gs9zqh8m49yy9kscjqu9h72exyf295afg6kgk"), |
|
sdk.MustAccAddressFromBech32("osmo1jllfytsz4dryxhz5tl7u73v29exsf80vz52ucc")} |
|
|
|
// Fund localosmosis accounts |
|
for _, account := range localOsmosisAccounts { |
|
err := app.BankKeeper.MintCoins(ctx, minttypes.ModuleName, defaultCoins) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
err = app.BankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, account, defaultCoins) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
} |
|
|
|
// Fund edgenet faucet |
|
faucetCoins := sdk.NewCoins( |
|
sdk.NewInt64Coin("ibc/0CD3A0285E1341859B5E86B6AB7682F023D03E97607CCC1DC95706411D866DF7", 1000000000000000), // DAI |
|
sdk.NewInt64Coin(appparams.BaseCoinUnit, 1000000000000000), |
|
sdk.NewInt64Coin("uion", 1000000000000)) |
|
err = app.BankKeeper.MintCoins(ctx, minttypes.ModuleName, faucetCoins) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
err = app.BankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, sdk.MustAccAddressFromBech32("osmo1rqgf207csps822qwmd3k2n6k6k4e99w502e79t"), faucetCoins) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
|
|
// Mars bank account |
|
marsCoins := sdk.NewCoins( |
|
sdk.NewInt64Coin(appparams.BaseCoinUnit, 10000000000000), |
|
sdk.NewInt64Coin("ibc/903A61A498756EA560B85A85132D3AEE21B5DEDD41213725D22ABF276EA6945E", 400000000000), |
|
sdk.NewInt64Coin("ibc/D189335C6E4A68B513C10AB227BF1C1D38C746766278BA3EEB4FB14124F1D858", 3000000000000), |
|
sdk.NewInt64Coin("ibc/C140AFD542AE77BD7DCC83F13FDD8C5E5BB8C4929785E6EC2F4C636F98F17901", 200000000000), |
|
sdk.NewInt64Coin("ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2", 700000000000), |
|
sdk.NewInt64Coin("ibc/D1542AA8762DB13087D8364F3EA6509FD6F009A34F00426AF9E4F9FA85CBBF1F", 2000000000), |
|
sdk.NewInt64Coin("ibc/EA1D43981D5C9A1C4AAEA9C23BB1D4FA126BA9BC7020A25E0AE4AA841EA25DC5", 3000000000000000000)) |
|
err = app.BankKeeper.MintCoins(ctx, minttypes.ModuleName, marsCoins) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
err = app.BankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, sdk.MustAccAddressFromBech32("osmo1ev02crc36675xd8s029qh7wg3wjtfk37jr004z"), marsCoins) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
|
|
// UPGRADE |
|
// |
|
|
|
if upgradeToTrigger != "" { |
|
upgradePlan := upgradetypes.Plan{ |
|
Name: upgradeToTrigger, |
|
Height: app.LastBlockHeight() + 10, |
|
} |
|
err = app.UpgradeKeeper.ScheduleUpgrade(ctx, upgradePlan) |
|
if err != nil { |
|
panic(err) |
|
} |
|
} |
|
|
|
return app |
|
} |
|
|
|
// CheckTx will check the transaction with the provided checkTxHandler. We override the default |
|
// handler so that we can verify bid transactions before they are inserted into the mempool. |
|
// With the BlockSDK CheckTx, we can verify the bid transaction and all of the bundled transactions |
|
// before inserting the bid transaction into the mempool. |
|
|
|
commit 77c22c00911a4a3538683d8cb01d6755569134b6 |
|
Author: Adam Tucker <[email protected]> |
|
Date: Tue Apr 30 22:27:57 2024 -0600 |
|
|
|
chore: don't use hardcoded "uosmo" string (#8145) |
|
|
|
* check denoms for gauge creation |
|
|
|
* changelog |
|
|
|
* extract logic |
|
|
|
* use uosmo var |
|
|
|
* initial push of test fixes |
|
|
|
* fix lint |
|
|
|
* tidy |
|
|
|
* tidy |
|
|
|
* add comments |
|
|
|
* add test cases |
|
|
|
diff --git a/app/app.go b/app/app.go |
|
--- a/app/app.go |
|
+++ b/app/app.go |
|
@@ -566,243 +568,243 @@ |
|
func InitOsmosisAppForTestnet(app *OsmosisApp, newValAddr bytes.HexBytes, newValPubKey crypto.PubKey, newOperatorAddress, upgradeToTrigger string) *OsmosisApp { |
|
// |
|
// Required Changes: |
|
// |
|
|
|
ctx := app.BaseApp.NewUncachedContext(true, tmproto.Header{}) |
|
pubkey := &ed25519.PubKey{Key: newValPubKey.Bytes()} |
|
pubkeyAny, err := types.NewAnyWithValue(pubkey) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
|
|
// STAKING |
|
// |
|
|
|
// Create Validator struct for our new validator. |
|
_, bz, err := bech32.DecodeAndConvert(newOperatorAddress) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
bech32Addr, err := bech32.ConvertAndEncode("osmovaloper", bz) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
newVal := stakingtypes.Validator{ |
|
OperatorAddress: bech32Addr, |
|
ConsensusPubkey: pubkeyAny, |
|
Jailed: false, |
|
Status: stakingtypes.Bonded, |
|
Tokens: sdk.NewInt(900000000000000), |
|
DelegatorShares: sdk.MustNewDecFromStr("10000000"), |
|
Description: stakingtypes.Description{ |
|
Moniker: "Testnet Validator", |
|
}, |
|
Commission: stakingtypes.Commission{ |
|
CommissionRates: stakingtypes.CommissionRates{ |
|
Rate: sdk.MustNewDecFromStr("0.05"), |
|
MaxRate: sdk.MustNewDecFromStr("0.1"), |
|
MaxChangeRate: sdk.MustNewDecFromStr("0.05"), |
|
}, |
|
}, |
|
MinSelfDelegation: sdk.OneInt(), |
|
} |
|
|
|
// Remove all validators from power store |
|
stakingKey := app.GetKey(stakingtypes.ModuleName) |
|
stakingStore := ctx.KVStore(stakingKey) |
|
iterator := app.StakingKeeper.ValidatorsPowerStoreIterator(ctx) |
|
for ; iterator.Valid(); iterator.Next() { |
|
stakingStore.Delete(iterator.Key()) |
|
} |
|
iterator.Close() |
|
|
|
// Remove all valdiators from last validators store |
|
iterator = app.StakingKeeper.LastValidatorsIterator(ctx) |
|
for ; iterator.Valid(); iterator.Next() { |
|
stakingStore.Delete(iterator.Key()) |
|
} |
|
iterator.Close() |
|
|
|
// Remove all validators from validators store |
|
iterator = sdk.KVStorePrefixIterator(stakingStore, stakingtypes.ValidatorsKey) |
|
for ; iterator.Valid(); iterator.Next() { |
|
stakingStore.Delete(iterator.Key()) |
|
} |
|
iterator.Close() |
|
|
|
// Remove all validators from unbonding queue |
|
iterator = sdk.KVStorePrefixIterator(stakingStore, stakingtypes.ValidatorQueueKey) |
|
for ; iterator.Valid(); iterator.Next() { |
|
stakingStore.Delete(iterator.Key()) |
|
} |
|
iterator.Close() |
|
|
|
// Add our validator to power and last validators store |
|
app.StakingKeeper.SetValidator(ctx, newVal) |
|
err = app.StakingKeeper.SetValidatorByConsAddr(ctx, newVal) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
app.StakingKeeper.SetValidatorByPowerIndex(ctx, newVal) |
|
app.StakingKeeper.SetLastValidatorPower(ctx, newVal.GetOperator(), 0) |
|
if err := app.StakingKeeper.Hooks().AfterValidatorCreated(ctx, newVal.GetOperator()); err != nil { |
|
panic(err) |
|
} |
|
|
|
// DISTRIBUTION |
|
// |
|
|
|
// Initialize records for this validator across all distribution stores |
|
app.DistrKeeper.SetValidatorHistoricalRewards(ctx, newVal.GetOperator(), 0, distrtypes.NewValidatorHistoricalRewards(sdk.DecCoins{}, 1)) |
|
app.DistrKeeper.SetValidatorCurrentRewards(ctx, newVal.GetOperator(), distrtypes.NewValidatorCurrentRewards(sdk.DecCoins{}, 1)) |
|
app.DistrKeeper.SetValidatorAccumulatedCommission(ctx, newVal.GetOperator(), distrtypes.InitialValidatorAccumulatedCommission()) |
|
app.DistrKeeper.SetValidatorOutstandingRewards(ctx, newVal.GetOperator(), distrtypes.ValidatorOutstandingRewards{Rewards: sdk.DecCoins{}}) |
|
|
|
// SLASHING |
|
// |
|
|
|
// Set validator signing info for our new validator. |
|
newConsAddr := sdk.ConsAddress(newValAddr.Bytes()) |
|
newValidatorSigningInfo := slashingtypes.ValidatorSigningInfo{ |
|
Address: newConsAddr.String(), |
|
StartHeight: app.LastBlockHeight() - 1, |
|
Tombstoned: false, |
|
} |
|
app.SlashingKeeper.SetValidatorSigningInfo(ctx, newConsAddr, newValidatorSigningInfo) |
|
|
|
// |
|
// Optional Changes: |
|
// |
|
|
|
// GOV |
|
// |
|
|
|
newExpeditedVotingPeriod := time.Minute |
|
newVotingPeriod := time.Minute * 2 |
|
|
|
govParams := app.GovKeeper.GetParams(ctx) |
|
govParams.ExpeditedVotingPeriod = &newExpeditedVotingPeriod |
|
govParams.VotingPeriod = &newVotingPeriod |
|
- govParams.MinDeposit = sdk.NewCoins(sdk.NewInt64Coin("uosmo", 100000000)) |
|
- govParams.ExpeditedMinDeposit = sdk.NewCoins(sdk.NewInt64Coin("uosmo", 150000000)) |
|
+ govParams.MinDeposit = sdk.NewCoins(sdk.NewInt64Coin(appparams.BaseCoinUnit, 100000000)) |
|
+ govParams.ExpeditedMinDeposit = sdk.NewCoins(sdk.NewInt64Coin(appparams.BaseCoinUnit, 150000000)) |
|
|
|
err = app.GovKeeper.SetParams(ctx, govParams) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
|
|
// EPOCHS |
|
// |
|
|
|
dayEpochInfo := app.EpochsKeeper.GetEpochInfo(ctx, "day") |
|
dayEpochInfo.Duration = time.Hour * 6 |
|
// Prevents epochs from running back to back |
|
dayEpochInfo.CurrentEpochStartTime = time.Now().UTC() |
|
// If you want epoch to run a minute after starting the chain, uncomment the line below and comment the line above |
|
// dayEpochInfo.CurrentEpochStartTime = time.Now().UTC().Add(-dayEpochInfo.Duration).Add(time.Minute) |
|
dayEpochInfo.CurrentEpochStartHeight = app.LastBlockHeight() |
|
app.EpochsKeeper.DeleteEpochInfo(ctx, "day") |
|
err = app.EpochsKeeper.AddEpochInfo(ctx, dayEpochInfo) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
|
|
weekEpochInfo := app.EpochsKeeper.GetEpochInfo(ctx, "week") |
|
weekEpochInfo.Duration = time.Hour * 12 |
|
// Prevents epochs from running back to back |
|
weekEpochInfo.CurrentEpochStartTime = time.Now().UTC() |
|
weekEpochInfo.CurrentEpochStartHeight = app.LastBlockHeight() |
|
app.EpochsKeeper.DeleteEpochInfo(ctx, "week") |
|
err = app.EpochsKeeper.AddEpochInfo(ctx, weekEpochInfo) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
|
|
// BANK |
|
// |
|
|
|
defaultCoins := sdk.NewCoins( |
|
sdk.NewInt64Coin("ibc/0CD3A0285E1341859B5E86B6AB7682F023D03E97607CCC1DC95706411D866DF7", 1000000000000), // DAI |
|
sdk.NewInt64Coin("ibc/498A0751C798A0D9A389AA3691123DADA57DAA4FE165D5C75894505B876BA6E4", 1000000000000), // USDC, for pool creation fee |
|
- sdk.NewInt64Coin("uosmo", 1000000000000), |
|
+ sdk.NewInt64Coin(appparams.BaseCoinUnit, 1000000000000), |
|
sdk.NewInt64Coin("uion", 1000000000)) |
|
|
|
localOsmosisAccounts := []sdk.AccAddress{ |
|
sdk.MustAccAddressFromBech32("osmo12smx2wdlyttvyzvzg54y2vnqwq2qjateuf7thj"), |
|
sdk.MustAccAddressFromBech32("osmo1cyyzpxplxdzkeea7kwsydadg87357qnahakaks"), |
|
sdk.MustAccAddressFromBech32("osmo18s5lynnmx37hq4wlrw9gdn68sg2uxp5rgk26vv"), |
|
sdk.MustAccAddressFromBech32("osmo1qwexv7c6sm95lwhzn9027vyu2ccneaqad4w8ka"), |
|
sdk.MustAccAddressFromBech32("osmo14hcxlnwlqtq75ttaxf674vk6mafspg8xwgnn53"), |
|
sdk.MustAccAddressFromBech32("osmo12rr534cer5c0vj53eq4y32lcwguyy7nndt0u2t"), |
|
sdk.MustAccAddressFromBech32("osmo1nt33cjd5auzh36syym6azgc8tve0jlvklnq7jq"), |
|
sdk.MustAccAddressFromBech32("osmo10qfrpash5g2vk3hppvu45x0g860czur8ff5yx0"), |
|
sdk.MustAccAddressFromBech32("osmo1f4tvsdukfwh6s9swrc24gkuz23tp8pd3e9r5fa"), |
|
sdk.MustAccAddressFromBech32("osmo1myv43sqgnj5sm4zl98ftl45af9cfzk7nhjxjqh"), |
|
sdk.MustAccAddressFromBech32("osmo14gs9zqh8m49yy9kscjqu9h72exyf295afg6kgk"), |
|
sdk.MustAccAddressFromBech32("osmo1jllfytsz4dryxhz5tl7u73v29exsf80vz52ucc")} |
|
|
|
// Fund localosmosis accounts |
|
for _, account := range localOsmosisAccounts { |
|
err := app.BankKeeper.MintCoins(ctx, minttypes.ModuleName, defaultCoins) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
err = app.BankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, account, defaultCoins) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
} |
|
|
|
// Fund edgenet faucet |
|
faucetCoins := sdk.NewCoins( |
|
sdk.NewInt64Coin("ibc/0CD3A0285E1341859B5E86B6AB7682F023D03E97607CCC1DC95706411D866DF7", 1000000000000000), // DAI |
|
- sdk.NewInt64Coin("uosmo", 1000000000000000), |
|
+ sdk.NewInt64Coin(appparams.BaseCoinUnit, 1000000000000000), |
|
sdk.NewInt64Coin("uion", 1000000000000)) |
|
err = app.BankKeeper.MintCoins(ctx, minttypes.ModuleName, faucetCoins) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
err = app.BankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, sdk.MustAccAddressFromBech32("osmo1rqgf207csps822qwmd3k2n6k6k4e99w502e79t"), faucetCoins) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
|
|
// Mars bank account |
|
marsCoins := sdk.NewCoins( |
|
- sdk.NewInt64Coin("uosmo", 10000000000000), |
|
+ sdk.NewInt64Coin(appparams.BaseCoinUnit, 10000000000000), |
|
sdk.NewInt64Coin("ibc/903A61A498756EA560B85A85132D3AEE21B5DEDD41213725D22ABF276EA6945E", 400000000000), |
|
sdk.NewInt64Coin("ibc/D189335C6E4A68B513C10AB227BF1C1D38C746766278BA3EEB4FB14124F1D858", 3000000000000), |
|
sdk.NewInt64Coin("ibc/C140AFD542AE77BD7DCC83F13FDD8C5E5BB8C4929785E6EC2F4C636F98F17901", 200000000000), |
|
sdk.NewInt64Coin("ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2", 700000000000), |
|
sdk.NewInt64Coin("ibc/D1542AA8762DB13087D8364F3EA6509FD6F009A34F00426AF9E4F9FA85CBBF1F", 2000000000), |
|
sdk.NewInt64Coin("ibc/EA1D43981D5C9A1C4AAEA9C23BB1D4FA126BA9BC7020A25E0AE4AA841EA25DC5", 3000000000000000000)) |
|
err = app.BankKeeper.MintCoins(ctx, minttypes.ModuleName, marsCoins) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
err = app.BankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, sdk.MustAccAddressFromBech32("osmo1ev02crc36675xd8s029qh7wg3wjtfk37jr004z"), marsCoins) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
|
|
// UPGRADE |
|
// |
|
|
|
if upgradeToTrigger != "" { |
|
upgradePlan := upgradetypes.Plan{ |
|
Name: upgradeToTrigger, |
|
Height: app.LastBlockHeight() + 10, |
|
} |
|
err = app.UpgradeKeeper.ScheduleUpgrade(ctx, upgradePlan) |
|
if err != nil { |
|
panic(err) |
|
} |
|
} |
|
|
|
return app |
|
} |
|
|
|
// CheckTx will check the transaction with the provided checkTxHandler. We override the default |
|
// handler so that we can verify bid transactions before they are inserted into the mempool. |
|
// With the BlockSDK CheckTx, we can verify the bid transaction and all of the bundled transactions |
|
// before inserting the bid transaction into the mempool. |
|
|
|
commit 473da26969274a650797a3999dfb00ba54b93b0b |
|
Author: PaddyMc <[email protected]> |
|
Date: Fri Apr 26 22:04:49 2024 +0100 |
|
|
|
feat: top of block auction and block-sdk integration (#8058) |
|
|
|
* feat: add top of block auction and block-sdk from skip-mev |
|
|
|
* fix: update params and remove free lane |
|
|
|
* chore: temp replace for osmomath |
|
|
|
* chore: update bundle size to 5 txns |
|
|
|
* chore: update from USDC.axl to noble USDC |
|
|
|
* chore: update mev lane to 10% of block space |
|
|
|
* chore: remove increase seq ante decorator from test ante handler |
|
|
|
* chore: remove left over merge tags in CHANGELOG.md |
|
|
|
* chore: add changes based on review |
|
|
|
* chore: bump block sdk to v1.4.2 |
|
|
|
* chore: update merge conflicts |
|
|
|
diff --git a/app/app.go b/app/app.go |
|
--- a/app/app.go |
|
+++ b/app/app.go |
|
@@ -496,239 +566,243 @@ |
|
func InitOsmosisAppForTestnet(app *OsmosisApp, newValAddr bytes.HexBytes, newValPubKey crypto.PubKey, newOperatorAddress, upgradeToTrigger string) *OsmosisApp { |
|
// |
|
// Required Changes: |
|
// |
|
|
|
ctx := app.BaseApp.NewUncachedContext(true, tmproto.Header{}) |
|
pubkey := &ed25519.PubKey{Key: newValPubKey.Bytes()} |
|
pubkeyAny, err := types.NewAnyWithValue(pubkey) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
|
|
// STAKING |
|
// |
|
|
|
// Create Validator struct for our new validator. |
|
_, bz, err := bech32.DecodeAndConvert(newOperatorAddress) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
bech32Addr, err := bech32.ConvertAndEncode("osmovaloper", bz) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
newVal := stakingtypes.Validator{ |
|
OperatorAddress: bech32Addr, |
|
ConsensusPubkey: pubkeyAny, |
|
Jailed: false, |
|
Status: stakingtypes.Bonded, |
|
Tokens: sdk.NewInt(900000000000000), |
|
DelegatorShares: sdk.MustNewDecFromStr("10000000"), |
|
Description: stakingtypes.Description{ |
|
Moniker: "Testnet Validator", |
|
}, |
|
Commission: stakingtypes.Commission{ |
|
CommissionRates: stakingtypes.CommissionRates{ |
|
Rate: sdk.MustNewDecFromStr("0.05"), |
|
MaxRate: sdk.MustNewDecFromStr("0.1"), |
|
MaxChangeRate: sdk.MustNewDecFromStr("0.05"), |
|
}, |
|
}, |
|
MinSelfDelegation: sdk.OneInt(), |
|
} |
|
|
|
// Remove all validators from power store |
|
stakingKey := app.GetKey(stakingtypes.ModuleName) |
|
stakingStore := ctx.KVStore(stakingKey) |
|
iterator := app.StakingKeeper.ValidatorsPowerStoreIterator(ctx) |
|
for ; iterator.Valid(); iterator.Next() { |
|
stakingStore.Delete(iterator.Key()) |
|
} |
|
iterator.Close() |
|
|
|
// Remove all valdiators from last validators store |
|
iterator = app.StakingKeeper.LastValidatorsIterator(ctx) |
|
for ; iterator.Valid(); iterator.Next() { |
|
stakingStore.Delete(iterator.Key()) |
|
} |
|
iterator.Close() |
|
|
|
// Remove all validators from validators store |
|
iterator = sdk.KVStorePrefixIterator(stakingStore, stakingtypes.ValidatorsKey) |
|
for ; iterator.Valid(); iterator.Next() { |
|
stakingStore.Delete(iterator.Key()) |
|
} |
|
iterator.Close() |
|
|
|
// Remove all validators from unbonding queue |
|
iterator = sdk.KVStorePrefixIterator(stakingStore, stakingtypes.ValidatorQueueKey) |
|
for ; iterator.Valid(); iterator.Next() { |
|
stakingStore.Delete(iterator.Key()) |
|
} |
|
iterator.Close() |
|
|
|
// Add our validator to power and last validators store |
|
app.StakingKeeper.SetValidator(ctx, newVal) |
|
err = app.StakingKeeper.SetValidatorByConsAddr(ctx, newVal) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
app.StakingKeeper.SetValidatorByPowerIndex(ctx, newVal) |
|
app.StakingKeeper.SetLastValidatorPower(ctx, newVal.GetOperator(), 0) |
|
if err := app.StakingKeeper.Hooks().AfterValidatorCreated(ctx, newVal.GetOperator()); err != nil { |
|
panic(err) |
|
} |
|
|
|
// DISTRIBUTION |
|
// |
|
|
|
// Initialize records for this validator across all distribution stores |
|
app.DistrKeeper.SetValidatorHistoricalRewards(ctx, newVal.GetOperator(), 0, distrtypes.NewValidatorHistoricalRewards(sdk.DecCoins{}, 1)) |
|
app.DistrKeeper.SetValidatorCurrentRewards(ctx, newVal.GetOperator(), distrtypes.NewValidatorCurrentRewards(sdk.DecCoins{}, 1)) |
|
app.DistrKeeper.SetValidatorAccumulatedCommission(ctx, newVal.GetOperator(), distrtypes.InitialValidatorAccumulatedCommission()) |
|
app.DistrKeeper.SetValidatorOutstandingRewards(ctx, newVal.GetOperator(), distrtypes.ValidatorOutstandingRewards{Rewards: sdk.DecCoins{}}) |
|
|
|
// SLASHING |
|
// |
|
|
|
// Set validator signing info for our new validator. |
|
newConsAddr := sdk.ConsAddress(newValAddr.Bytes()) |
|
newValidatorSigningInfo := slashingtypes.ValidatorSigningInfo{ |
|
Address: newConsAddr.String(), |
|
StartHeight: app.LastBlockHeight() - 1, |
|
Tombstoned: false, |
|
} |
|
app.SlashingKeeper.SetValidatorSigningInfo(ctx, newConsAddr, newValidatorSigningInfo) |
|
|
|
// |
|
// Optional Changes: |
|
// |
|
|
|
// GOV |
|
// |
|
|
|
newExpeditedVotingPeriod := time.Minute |
|
newVotingPeriod := time.Minute * 2 |
|
|
|
govParams := app.GovKeeper.GetParams(ctx) |
|
govParams.ExpeditedVotingPeriod = &newExpeditedVotingPeriod |
|
govParams.VotingPeriod = &newVotingPeriod |
|
govParams.MinDeposit = sdk.NewCoins(sdk.NewInt64Coin("uosmo", 100000000)) |
|
govParams.ExpeditedMinDeposit = sdk.NewCoins(sdk.NewInt64Coin("uosmo", 150000000)) |
|
|
|
err = app.GovKeeper.SetParams(ctx, govParams) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
|
|
// EPOCHS |
|
// |
|
|
|
dayEpochInfo := app.EpochsKeeper.GetEpochInfo(ctx, "day") |
|
dayEpochInfo.Duration = time.Hour * 6 |
|
// Prevents epochs from running back to back |
|
dayEpochInfo.CurrentEpochStartTime = time.Now().UTC() |
|
// If you want epoch to run a minute after starting the chain, uncomment the line below and comment the line above |
|
// dayEpochInfo.CurrentEpochStartTime = time.Now().UTC().Add(-dayEpochInfo.Duration).Add(time.Minute) |
|
dayEpochInfo.CurrentEpochStartHeight = app.LastBlockHeight() |
|
app.EpochsKeeper.DeleteEpochInfo(ctx, "day") |
|
err = app.EpochsKeeper.AddEpochInfo(ctx, dayEpochInfo) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
|
|
weekEpochInfo := app.EpochsKeeper.GetEpochInfo(ctx, "week") |
|
weekEpochInfo.Duration = time.Hour * 12 |
|
// Prevents epochs from running back to back |
|
weekEpochInfo.CurrentEpochStartTime = time.Now().UTC() |
|
weekEpochInfo.CurrentEpochStartHeight = app.LastBlockHeight() |
|
app.EpochsKeeper.DeleteEpochInfo(ctx, "week") |
|
err = app.EpochsKeeper.AddEpochInfo(ctx, weekEpochInfo) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
|
|
// BANK |
|
// |
|
|
|
defaultCoins := sdk.NewCoins( |
|
sdk.NewInt64Coin("ibc/0CD3A0285E1341859B5E86B6AB7682F023D03E97607CCC1DC95706411D866DF7", 1000000000000), // DAI |
|
sdk.NewInt64Coin("ibc/498A0751C798A0D9A389AA3691123DADA57DAA4FE165D5C75894505B876BA6E4", 1000000000000), // USDC, for pool creation fee |
|
sdk.NewInt64Coin("uosmo", 1000000000000), |
|
sdk.NewInt64Coin("uion", 1000000000)) |
|
|
|
localOsmosisAccounts := []sdk.AccAddress{ |
|
sdk.MustAccAddressFromBech32("osmo12smx2wdlyttvyzvzg54y2vnqwq2qjateuf7thj"), |
|
sdk.MustAccAddressFromBech32("osmo1cyyzpxplxdzkeea7kwsydadg87357qnahakaks"), |
|
sdk.MustAccAddressFromBech32("osmo18s5lynnmx37hq4wlrw9gdn68sg2uxp5rgk26vv"), |
|
sdk.MustAccAddressFromBech32("osmo1qwexv7c6sm95lwhzn9027vyu2ccneaqad4w8ka"), |
|
sdk.MustAccAddressFromBech32("osmo14hcxlnwlqtq75ttaxf674vk6mafspg8xwgnn53"), |
|
sdk.MustAccAddressFromBech32("osmo12rr534cer5c0vj53eq4y32lcwguyy7nndt0u2t"), |
|
sdk.MustAccAddressFromBech32("osmo1nt33cjd5auzh36syym6azgc8tve0jlvklnq7jq"), |
|
sdk.MustAccAddressFromBech32("osmo10qfrpash5g2vk3hppvu45x0g860czur8ff5yx0"), |
|
sdk.MustAccAddressFromBech32("osmo1f4tvsdukfwh6s9swrc24gkuz23tp8pd3e9r5fa"), |
|
sdk.MustAccAddressFromBech32("osmo1myv43sqgnj5sm4zl98ftl45af9cfzk7nhjxjqh"), |
|
sdk.MustAccAddressFromBech32("osmo14gs9zqh8m49yy9kscjqu9h72exyf295afg6kgk"), |
|
sdk.MustAccAddressFromBech32("osmo1jllfytsz4dryxhz5tl7u73v29exsf80vz52ucc")} |
|
|
|
// Fund localosmosis accounts |
|
for _, account := range localOsmosisAccounts { |
|
err := app.BankKeeper.MintCoins(ctx, minttypes.ModuleName, defaultCoins) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
err = app.BankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, account, defaultCoins) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
} |
|
|
|
// Fund edgenet faucet |
|
faucetCoins := sdk.NewCoins( |
|
sdk.NewInt64Coin("ibc/0CD3A0285E1341859B5E86B6AB7682F023D03E97607CCC1DC95706411D866DF7", 1000000000000000), // DAI |
|
sdk.NewInt64Coin("uosmo", 1000000000000000), |
|
sdk.NewInt64Coin("uion", 1000000000000)) |
|
err = app.BankKeeper.MintCoins(ctx, minttypes.ModuleName, faucetCoins) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
err = app.BankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, sdk.MustAccAddressFromBech32("osmo1rqgf207csps822qwmd3k2n6k6k4e99w502e79t"), faucetCoins) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
|
|
// Mars bank account |
|
marsCoins := sdk.NewCoins( |
|
sdk.NewInt64Coin("uosmo", 10000000000000), |
|
sdk.NewInt64Coin("ibc/903A61A498756EA560B85A85132D3AEE21B5DEDD41213725D22ABF276EA6945E", 400000000000), |
|
sdk.NewInt64Coin("ibc/D189335C6E4A68B513C10AB227BF1C1D38C746766278BA3EEB4FB14124F1D858", 3000000000000), |
|
sdk.NewInt64Coin("ibc/C140AFD542AE77BD7DCC83F13FDD8C5E5BB8C4929785E6EC2F4C636F98F17901", 200000000000), |
|
sdk.NewInt64Coin("ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2", 700000000000), |
|
sdk.NewInt64Coin("ibc/D1542AA8762DB13087D8364F3EA6509FD6F009A34F00426AF9E4F9FA85CBBF1F", 2000000000), |
|
sdk.NewInt64Coin("ibc/EA1D43981D5C9A1C4AAEA9C23BB1D4FA126BA9BC7020A25E0AE4AA841EA25DC5", 3000000000000000000)) |
|
err = app.BankKeeper.MintCoins(ctx, minttypes.ModuleName, marsCoins) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
err = app.BankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, sdk.MustAccAddressFromBech32("osmo1ev02crc36675xd8s029qh7wg3wjtfk37jr004z"), marsCoins) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
|
|
// UPGRADE |
|
// |
|
|
|
if upgradeToTrigger != "" { |
|
upgradePlan := upgradetypes.Plan{ |
|
Name: upgradeToTrigger, |
|
Height: app.LastBlockHeight() + 10, |
|
} |
|
err = app.UpgradeKeeper.ScheduleUpgrade(ctx, upgradePlan) |
|
if err != nil { |
|
panic(err) |
|
} |
|
} |
|
|
|
return app |
|
} |
|
|
|
+// CheckTx will check the transaction with the provided checkTxHandler. We override the default |
|
+// handler so that we can verify bid transactions before they are inserted into the mempool. |
|
+// With the BlockSDK CheckTx, we can verify the bid transaction and all of the bundled transactions |
|
+// before inserting the bid transaction into the mempool. |
|
|
|
commit 43a0d01102f8216324b5ffc8532c3ed9af51377f |
|
Author: Adam Tucker <[email protected]> |
|
Date: Sun Mar 24 21:18:58 2024 -0500 |
|
|
|
add usdc to accounts for in place testnet (#7820) |
|
|
|
diff --git a/app/app.go b/app/app.go |
|
--- a/app/app.go |
|
+++ b/app/app.go |
|
@@ -437,238 +437,239 @@ |
|
func InitOsmosisAppForTestnet(app *OsmosisApp, newValAddr bytes.HexBytes, newValPubKey crypto.PubKey, newOperatorAddress, upgradeToTrigger string) *OsmosisApp { |
|
// |
|
// Required Changes: |
|
// |
|
|
|
ctx := app.BaseApp.NewUncachedContext(true, tmproto.Header{}) |
|
pubkey := &ed25519.PubKey{Key: newValPubKey.Bytes()} |
|
pubkeyAny, err := types.NewAnyWithValue(pubkey) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
|
|
// STAKING |
|
// |
|
|
|
// Create Validator struct for our new validator. |
|
_, bz, err := bech32.DecodeAndConvert(newOperatorAddress) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
bech32Addr, err := bech32.ConvertAndEncode("osmovaloper", bz) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
newVal := stakingtypes.Validator{ |
|
OperatorAddress: bech32Addr, |
|
ConsensusPubkey: pubkeyAny, |
|
Jailed: false, |
|
Status: stakingtypes.Bonded, |
|
Tokens: sdk.NewInt(900000000000000), |
|
DelegatorShares: sdk.MustNewDecFromStr("10000000"), |
|
Description: stakingtypes.Description{ |
|
Moniker: "Testnet Validator", |
|
}, |
|
Commission: stakingtypes.Commission{ |
|
CommissionRates: stakingtypes.CommissionRates{ |
|
Rate: sdk.MustNewDecFromStr("0.05"), |
|
MaxRate: sdk.MustNewDecFromStr("0.1"), |
|
MaxChangeRate: sdk.MustNewDecFromStr("0.05"), |
|
}, |
|
}, |
|
MinSelfDelegation: sdk.OneInt(), |
|
} |
|
|
|
// Remove all validators from power store |
|
stakingKey := app.GetKey(stakingtypes.ModuleName) |
|
stakingStore := ctx.KVStore(stakingKey) |
|
iterator := app.StakingKeeper.ValidatorsPowerStoreIterator(ctx) |
|
for ; iterator.Valid(); iterator.Next() { |
|
stakingStore.Delete(iterator.Key()) |
|
} |
|
iterator.Close() |
|
|
|
// Remove all valdiators from last validators store |
|
iterator = app.StakingKeeper.LastValidatorsIterator(ctx) |
|
for ; iterator.Valid(); iterator.Next() { |
|
stakingStore.Delete(iterator.Key()) |
|
} |
|
iterator.Close() |
|
|
|
// Remove all validators from validators store |
|
iterator = sdk.KVStorePrefixIterator(stakingStore, stakingtypes.ValidatorsKey) |
|
for ; iterator.Valid(); iterator.Next() { |
|
stakingStore.Delete(iterator.Key()) |
|
} |
|
iterator.Close() |
|
|
|
// Remove all validators from unbonding queue |
|
iterator = sdk.KVStorePrefixIterator(stakingStore, stakingtypes.ValidatorQueueKey) |
|
for ; iterator.Valid(); iterator.Next() { |
|
stakingStore.Delete(iterator.Key()) |
|
} |
|
iterator.Close() |
|
|
|
// Add our validator to power and last validators store |
|
app.StakingKeeper.SetValidator(ctx, newVal) |
|
err = app.StakingKeeper.SetValidatorByConsAddr(ctx, newVal) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
app.StakingKeeper.SetValidatorByPowerIndex(ctx, newVal) |
|
app.StakingKeeper.SetLastValidatorPower(ctx, newVal.GetOperator(), 0) |
|
if err := app.StakingKeeper.Hooks().AfterValidatorCreated(ctx, newVal.GetOperator()); err != nil { |
|
panic(err) |
|
} |
|
|
|
// DISTRIBUTION |
|
// |
|
|
|
// Initialize records for this validator across all distribution stores |
|
app.DistrKeeper.SetValidatorHistoricalRewards(ctx, newVal.GetOperator(), 0, distrtypes.NewValidatorHistoricalRewards(sdk.DecCoins{}, 1)) |
|
app.DistrKeeper.SetValidatorCurrentRewards(ctx, newVal.GetOperator(), distrtypes.NewValidatorCurrentRewards(sdk.DecCoins{}, 1)) |
|
app.DistrKeeper.SetValidatorAccumulatedCommission(ctx, newVal.GetOperator(), distrtypes.InitialValidatorAccumulatedCommission()) |
|
app.DistrKeeper.SetValidatorOutstandingRewards(ctx, newVal.GetOperator(), distrtypes.ValidatorOutstandingRewards{Rewards: sdk.DecCoins{}}) |
|
|
|
// SLASHING |
|
// |
|
|
|
// Set validator signing info for our new validator. |
|
newConsAddr := sdk.ConsAddress(newValAddr.Bytes()) |
|
newValidatorSigningInfo := slashingtypes.ValidatorSigningInfo{ |
|
Address: newConsAddr.String(), |
|
StartHeight: app.LastBlockHeight() - 1, |
|
Tombstoned: false, |
|
} |
|
app.SlashingKeeper.SetValidatorSigningInfo(ctx, newConsAddr, newValidatorSigningInfo) |
|
|
|
// |
|
// Optional Changes: |
|
// |
|
|
|
// GOV |
|
// |
|
|
|
newExpeditedVotingPeriod := time.Minute |
|
newVotingPeriod := time.Minute * 2 |
|
|
|
govParams := app.GovKeeper.GetParams(ctx) |
|
govParams.ExpeditedVotingPeriod = &newExpeditedVotingPeriod |
|
govParams.VotingPeriod = &newVotingPeriod |
|
govParams.MinDeposit = sdk.NewCoins(sdk.NewInt64Coin("uosmo", 100000000)) |
|
govParams.ExpeditedMinDeposit = sdk.NewCoins(sdk.NewInt64Coin("uosmo", 150000000)) |
|
|
|
err = app.GovKeeper.SetParams(ctx, govParams) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
|
|
// EPOCHS |
|
// |
|
|
|
dayEpochInfo := app.EpochsKeeper.GetEpochInfo(ctx, "day") |
|
dayEpochInfo.Duration = time.Hour * 6 |
|
// Prevents epochs from running back to back |
|
dayEpochInfo.CurrentEpochStartTime = time.Now().UTC() |
|
// If you want epoch to run a minute after starting the chain, uncomment the line below and comment the line above |
|
// dayEpochInfo.CurrentEpochStartTime = time.Now().UTC().Add(-dayEpochInfo.Duration).Add(time.Minute) |
|
dayEpochInfo.CurrentEpochStartHeight = app.LastBlockHeight() |
|
app.EpochsKeeper.DeleteEpochInfo(ctx, "day") |
|
err = app.EpochsKeeper.AddEpochInfo(ctx, dayEpochInfo) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
|
|
weekEpochInfo := app.EpochsKeeper.GetEpochInfo(ctx, "week") |
|
weekEpochInfo.Duration = time.Hour * 12 |
|
// Prevents epochs from running back to back |
|
weekEpochInfo.CurrentEpochStartTime = time.Now().UTC() |
|
weekEpochInfo.CurrentEpochStartHeight = app.LastBlockHeight() |
|
app.EpochsKeeper.DeleteEpochInfo(ctx, "week") |
|
err = app.EpochsKeeper.AddEpochInfo(ctx, weekEpochInfo) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
|
|
// BANK |
|
// |
|
|
|
defaultCoins := sdk.NewCoins( |
|
sdk.NewInt64Coin("ibc/0CD3A0285E1341859B5E86B6AB7682F023D03E97607CCC1DC95706411D866DF7", 1000000000000), // DAI |
|
+ sdk.NewInt64Coin("ibc/498A0751C798A0D9A389AA3691123DADA57DAA4FE165D5C75894505B876BA6E4", 1000000000000), // USDC, for pool creation fee |
|
sdk.NewInt64Coin("uosmo", 1000000000000), |
|
sdk.NewInt64Coin("uion", 1000000000)) |
|
|
|
localOsmosisAccounts := []sdk.AccAddress{ |
|
sdk.MustAccAddressFromBech32("osmo12smx2wdlyttvyzvzg54y2vnqwq2qjateuf7thj"), |
|
sdk.MustAccAddressFromBech32("osmo1cyyzpxplxdzkeea7kwsydadg87357qnahakaks"), |
|
sdk.MustAccAddressFromBech32("osmo18s5lynnmx37hq4wlrw9gdn68sg2uxp5rgk26vv"), |
|
sdk.MustAccAddressFromBech32("osmo1qwexv7c6sm95lwhzn9027vyu2ccneaqad4w8ka"), |
|
sdk.MustAccAddressFromBech32("osmo14hcxlnwlqtq75ttaxf674vk6mafspg8xwgnn53"), |
|
sdk.MustAccAddressFromBech32("osmo12rr534cer5c0vj53eq4y32lcwguyy7nndt0u2t"), |
|
sdk.MustAccAddressFromBech32("osmo1nt33cjd5auzh36syym6azgc8tve0jlvklnq7jq"), |
|
sdk.MustAccAddressFromBech32("osmo10qfrpash5g2vk3hppvu45x0g860czur8ff5yx0"), |
|
sdk.MustAccAddressFromBech32("osmo1f4tvsdukfwh6s9swrc24gkuz23tp8pd3e9r5fa"), |
|
sdk.MustAccAddressFromBech32("osmo1myv43sqgnj5sm4zl98ftl45af9cfzk7nhjxjqh"), |
|
sdk.MustAccAddressFromBech32("osmo14gs9zqh8m49yy9kscjqu9h72exyf295afg6kgk"), |
|
sdk.MustAccAddressFromBech32("osmo1jllfytsz4dryxhz5tl7u73v29exsf80vz52ucc")} |
|
|
|
// Fund localosmosis accounts |
|
for _, account := range localOsmosisAccounts { |
|
err := app.BankKeeper.MintCoins(ctx, minttypes.ModuleName, defaultCoins) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
err = app.BankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, account, defaultCoins) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
} |
|
|
|
// Fund edgenet faucet |
|
faucetCoins := sdk.NewCoins( |
|
sdk.NewInt64Coin("ibc/0CD3A0285E1341859B5E86B6AB7682F023D03E97607CCC1DC95706411D866DF7", 1000000000000000), // DAI |
|
sdk.NewInt64Coin("uosmo", 1000000000000000), |
|
sdk.NewInt64Coin("uion", 1000000000000)) |
|
err = app.BankKeeper.MintCoins(ctx, minttypes.ModuleName, faucetCoins) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
err = app.BankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, sdk.MustAccAddressFromBech32("osmo1rqgf207csps822qwmd3k2n6k6k4e99w502e79t"), faucetCoins) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
|
|
// Mars bank account |
|
marsCoins := sdk.NewCoins( |
|
sdk.NewInt64Coin("uosmo", 10000000000000), |
|
sdk.NewInt64Coin("ibc/903A61A498756EA560B85A85132D3AEE21B5DEDD41213725D22ABF276EA6945E", 400000000000), |
|
sdk.NewInt64Coin("ibc/D189335C6E4A68B513C10AB227BF1C1D38C746766278BA3EEB4FB14124F1D858", 3000000000000), |
|
sdk.NewInt64Coin("ibc/C140AFD542AE77BD7DCC83F13FDD8C5E5BB8C4929785E6EC2F4C636F98F17901", 200000000000), |
|
sdk.NewInt64Coin("ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2", 700000000000), |
|
sdk.NewInt64Coin("ibc/D1542AA8762DB13087D8364F3EA6509FD6F009A34F00426AF9E4F9FA85CBBF1F", 2000000000), |
|
sdk.NewInt64Coin("ibc/EA1D43981D5C9A1C4AAEA9C23BB1D4FA126BA9BC7020A25E0AE4AA841EA25DC5", 3000000000000000000)) |
|
err = app.BankKeeper.MintCoins(ctx, minttypes.ModuleName, marsCoins) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
err = app.BankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, sdk.MustAccAddressFromBech32("osmo1ev02crc36675xd8s029qh7wg3wjtfk37jr004z"), marsCoins) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
|
|
// UPGRADE |
|
// |
|
|
|
if upgradeToTrigger != "" { |
|
upgradePlan := upgradetypes.Plan{ |
|
Name: upgradeToTrigger, |
|
Height: app.LastBlockHeight() + 10, |
|
} |
|
err = app.UpgradeKeeper.ScheduleUpgrade(ctx, upgradePlan) |
|
if err != nil { |
|
panic(err) |
|
} |
|
} |
|
|
|
return app |
|
} |
|
|
|
|
|
commit 1757ca751544d5a0ae2bbc80a301ad5dc0831c54 |
|
Author: Roman <[email protected]> |
|
Date: Wed Feb 14 16:38:35 2024 -0700 |
|
|
|
fix: upgrades for in-place testnet (#7487) |
|
|
|
diff --git a/app/app.go b/app/app.go |
|
--- a/app/app.go |
|
+++ b/app/app.go |
|
@@ -417,238 +417,238 @@ |
|
func InitOsmosisAppForTestnet(app *OsmosisApp, newValAddr bytes.HexBytes, newValPubKey crypto.PubKey, newOperatorAddress, upgradeToTrigger string) *OsmosisApp { |
|
// |
|
// Required Changes: |
|
// |
|
|
|
ctx := app.BaseApp.NewUncachedContext(true, tmproto.Header{}) |
|
pubkey := &ed25519.PubKey{Key: newValPubKey.Bytes()} |
|
pubkeyAny, err := types.NewAnyWithValue(pubkey) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
|
|
// STAKING |
|
// |
|
|
|
// Create Validator struct for our new validator. |
|
_, bz, err := bech32.DecodeAndConvert(newOperatorAddress) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
bech32Addr, err := bech32.ConvertAndEncode("osmovaloper", bz) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
newVal := stakingtypes.Validator{ |
|
OperatorAddress: bech32Addr, |
|
ConsensusPubkey: pubkeyAny, |
|
Jailed: false, |
|
Status: stakingtypes.Bonded, |
|
Tokens: sdk.NewInt(900000000000000), |
|
DelegatorShares: sdk.MustNewDecFromStr("10000000"), |
|
Description: stakingtypes.Description{ |
|
Moniker: "Testnet Validator", |
|
}, |
|
Commission: stakingtypes.Commission{ |
|
CommissionRates: stakingtypes.CommissionRates{ |
|
Rate: sdk.MustNewDecFromStr("0.05"), |
|
MaxRate: sdk.MustNewDecFromStr("0.1"), |
|
MaxChangeRate: sdk.MustNewDecFromStr("0.05"), |
|
}, |
|
}, |
|
MinSelfDelegation: sdk.OneInt(), |
|
} |
|
|
|
// Remove all validators from power store |
|
stakingKey := app.GetKey(stakingtypes.ModuleName) |
|
stakingStore := ctx.KVStore(stakingKey) |
|
iterator := app.StakingKeeper.ValidatorsPowerStoreIterator(ctx) |
|
for ; iterator.Valid(); iterator.Next() { |
|
stakingStore.Delete(iterator.Key()) |
|
} |
|
iterator.Close() |
|
|
|
// Remove all valdiators from last validators store |
|
iterator = app.StakingKeeper.LastValidatorsIterator(ctx) |
|
for ; iterator.Valid(); iterator.Next() { |
|
stakingStore.Delete(iterator.Key()) |
|
} |
|
iterator.Close() |
|
|
|
// Remove all validators from validators store |
|
iterator = sdk.KVStorePrefixIterator(stakingStore, stakingtypes.ValidatorsKey) |
|
for ; iterator.Valid(); iterator.Next() { |
|
stakingStore.Delete(iterator.Key()) |
|
} |
|
iterator.Close() |
|
|
|
// Remove all validators from unbonding queue |
|
iterator = sdk.KVStorePrefixIterator(stakingStore, stakingtypes.ValidatorQueueKey) |
|
for ; iterator.Valid(); iterator.Next() { |
|
stakingStore.Delete(iterator.Key()) |
|
} |
|
iterator.Close() |
|
|
|
// Add our validator to power and last validators store |
|
app.StakingKeeper.SetValidator(ctx, newVal) |
|
err = app.StakingKeeper.SetValidatorByConsAddr(ctx, newVal) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
app.StakingKeeper.SetValidatorByPowerIndex(ctx, newVal) |
|
app.StakingKeeper.SetLastValidatorPower(ctx, newVal.GetOperator(), 0) |
|
if err := app.StakingKeeper.Hooks().AfterValidatorCreated(ctx, newVal.GetOperator()); err != nil { |
|
panic(err) |
|
} |
|
|
|
// DISTRIBUTION |
|
// |
|
|
|
// Initialize records for this validator across all distribution stores |
|
app.DistrKeeper.SetValidatorHistoricalRewards(ctx, newVal.GetOperator(), 0, distrtypes.NewValidatorHistoricalRewards(sdk.DecCoins{}, 1)) |
|
app.DistrKeeper.SetValidatorCurrentRewards(ctx, newVal.GetOperator(), distrtypes.NewValidatorCurrentRewards(sdk.DecCoins{}, 1)) |
|
app.DistrKeeper.SetValidatorAccumulatedCommission(ctx, newVal.GetOperator(), distrtypes.InitialValidatorAccumulatedCommission()) |
|
app.DistrKeeper.SetValidatorOutstandingRewards(ctx, newVal.GetOperator(), distrtypes.ValidatorOutstandingRewards{Rewards: sdk.DecCoins{}}) |
|
|
|
// SLASHING |
|
// |
|
|
|
// Set validator signing info for our new validator. |
|
newConsAddr := sdk.ConsAddress(newValAddr.Bytes()) |
|
newValidatorSigningInfo := slashingtypes.ValidatorSigningInfo{ |
|
Address: newConsAddr.String(), |
|
StartHeight: app.LastBlockHeight() - 1, |
|
Tombstoned: false, |
|
} |
|
app.SlashingKeeper.SetValidatorSigningInfo(ctx, newConsAddr, newValidatorSigningInfo) |
|
|
|
// |
|
// Optional Changes: |
|
// |
|
|
|
// GOV |
|
// |
|
|
|
newExpeditedVotingPeriod := time.Minute |
|
newVotingPeriod := time.Minute * 2 |
|
|
|
govParams := app.GovKeeper.GetParams(ctx) |
|
govParams.ExpeditedVotingPeriod = &newExpeditedVotingPeriod |
|
govParams.VotingPeriod = &newVotingPeriod |
|
govParams.MinDeposit = sdk.NewCoins(sdk.NewInt64Coin("uosmo", 100000000)) |
|
govParams.ExpeditedMinDeposit = sdk.NewCoins(sdk.NewInt64Coin("uosmo", 150000000)) |
|
|
|
err = app.GovKeeper.SetParams(ctx, govParams) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
|
|
// EPOCHS |
|
// |
|
|
|
dayEpochInfo := app.EpochsKeeper.GetEpochInfo(ctx, "day") |
|
dayEpochInfo.Duration = time.Hour * 6 |
|
// Prevents epochs from running back to back |
|
dayEpochInfo.CurrentEpochStartTime = time.Now().UTC() |
|
// If you want epoch to run a minute after starting the chain, uncomment the line below and comment the line above |
|
// dayEpochInfo.CurrentEpochStartTime = time.Now().UTC().Add(-dayEpochInfo.Duration).Add(time.Minute) |
|
dayEpochInfo.CurrentEpochStartHeight = app.LastBlockHeight() |
|
app.EpochsKeeper.DeleteEpochInfo(ctx, "day") |
|
err = app.EpochsKeeper.AddEpochInfo(ctx, dayEpochInfo) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
|
|
weekEpochInfo := app.EpochsKeeper.GetEpochInfo(ctx, "week") |
|
weekEpochInfo.Duration = time.Hour * 12 |
|
// Prevents epochs from running back to back |
|
weekEpochInfo.CurrentEpochStartTime = time.Now().UTC() |
|
weekEpochInfo.CurrentEpochStartHeight = app.LastBlockHeight() |
|
app.EpochsKeeper.DeleteEpochInfo(ctx, "week") |
|
err = app.EpochsKeeper.AddEpochInfo(ctx, weekEpochInfo) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
|
|
// BANK |
|
// |
|
|
|
defaultCoins := sdk.NewCoins( |
|
sdk.NewInt64Coin("ibc/0CD3A0285E1341859B5E86B6AB7682F023D03E97607CCC1DC95706411D866DF7", 1000000000000), // DAI |
|
sdk.NewInt64Coin("uosmo", 1000000000000), |
|
sdk.NewInt64Coin("uion", 1000000000)) |
|
|
|
localOsmosisAccounts := []sdk.AccAddress{ |
|
sdk.MustAccAddressFromBech32("osmo12smx2wdlyttvyzvzg54y2vnqwq2qjateuf7thj"), |
|
sdk.MustAccAddressFromBech32("osmo1cyyzpxplxdzkeea7kwsydadg87357qnahakaks"), |
|
sdk.MustAccAddressFromBech32("osmo18s5lynnmx37hq4wlrw9gdn68sg2uxp5rgk26vv"), |
|
sdk.MustAccAddressFromBech32("osmo1qwexv7c6sm95lwhzn9027vyu2ccneaqad4w8ka"), |
|
sdk.MustAccAddressFromBech32("osmo14hcxlnwlqtq75ttaxf674vk6mafspg8xwgnn53"), |
|
sdk.MustAccAddressFromBech32("osmo12rr534cer5c0vj53eq4y32lcwguyy7nndt0u2t"), |
|
sdk.MustAccAddressFromBech32("osmo1nt33cjd5auzh36syym6azgc8tve0jlvklnq7jq"), |
|
sdk.MustAccAddressFromBech32("osmo10qfrpash5g2vk3hppvu45x0g860czur8ff5yx0"), |
|
sdk.MustAccAddressFromBech32("osmo1f4tvsdukfwh6s9swrc24gkuz23tp8pd3e9r5fa"), |
|
sdk.MustAccAddressFromBech32("osmo1myv43sqgnj5sm4zl98ftl45af9cfzk7nhjxjqh"), |
|
sdk.MustAccAddressFromBech32("osmo14gs9zqh8m49yy9kscjqu9h72exyf295afg6kgk"), |
|
sdk.MustAccAddressFromBech32("osmo1jllfytsz4dryxhz5tl7u73v29exsf80vz52ucc")} |
|
|
|
// Fund localosmosis accounts |
|
for _, account := range localOsmosisAccounts { |
|
err := app.BankKeeper.MintCoins(ctx, minttypes.ModuleName, defaultCoins) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
err = app.BankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, account, defaultCoins) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
} |
|
|
|
// Fund edgenet faucet |
|
faucetCoins := sdk.NewCoins( |
|
sdk.NewInt64Coin("ibc/0CD3A0285E1341859B5E86B6AB7682F023D03E97607CCC1DC95706411D866DF7", 1000000000000000), // DAI |
|
sdk.NewInt64Coin("uosmo", 1000000000000000), |
|
sdk.NewInt64Coin("uion", 1000000000000)) |
|
err = app.BankKeeper.MintCoins(ctx, minttypes.ModuleName, faucetCoins) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
err = app.BankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, sdk.MustAccAddressFromBech32("osmo1rqgf207csps822qwmd3k2n6k6k4e99w502e79t"), faucetCoins) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
|
|
// Mars bank account |
|
marsCoins := sdk.NewCoins( |
|
sdk.NewInt64Coin("uosmo", 10000000000000), |
|
sdk.NewInt64Coin("ibc/903A61A498756EA560B85A85132D3AEE21B5DEDD41213725D22ABF276EA6945E", 400000000000), |
|
sdk.NewInt64Coin("ibc/D189335C6E4A68B513C10AB227BF1C1D38C746766278BA3EEB4FB14124F1D858", 3000000000000), |
|
sdk.NewInt64Coin("ibc/C140AFD542AE77BD7DCC83F13FDD8C5E5BB8C4929785E6EC2F4C636F98F17901", 200000000000), |
|
sdk.NewInt64Coin("ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2", 700000000000), |
|
sdk.NewInt64Coin("ibc/D1542AA8762DB13087D8364F3EA6509FD6F009A34F00426AF9E4F9FA85CBBF1F", 2000000000), |
|
sdk.NewInt64Coin("ibc/EA1D43981D5C9A1C4AAEA9C23BB1D4FA126BA9BC7020A25E0AE4AA841EA25DC5", 3000000000000000000)) |
|
err = app.BankKeeper.MintCoins(ctx, minttypes.ModuleName, marsCoins) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
err = app.BankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, sdk.MustAccAddressFromBech32("osmo1ev02crc36675xd8s029qh7wg3wjtfk37jr004z"), marsCoins) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
|
|
// UPGRADE |
|
// |
|
|
|
if upgradeToTrigger != "" { |
|
upgradePlan := upgradetypes.Plan{ |
|
Name: upgradeToTrigger, |
|
- Height: app.LastBlockHeight(), |
|
+ Height: app.LastBlockHeight() + 10, |
|
} |
|
err = app.UpgradeKeeper.ScheduleUpgrade(ctx, upgradePlan) |
|
if err != nil { |
|
panic(err) |
|
} |
|
} |
|
|
|
return app |
|
} |
|
|
|
|
|
commit 236d7f733f5914431863a1df9a023bdf38de84ba |
|
Author: Adam Tucker <[email protected]> |
|
Date: Mon Feb 12 10:30:16 2024 -0600 |
|
|
|
remove all vals from testnet state (#7454) |
|
|
|
diff --git a/app/app.go b/app/app.go |
|
--- a/app/app.go |
|
+++ b/app/app.go |
|
@@ -416,222 +416,238 @@ |
|
func InitOsmosisAppForTestnet(app *OsmosisApp, newValAddr bytes.HexBytes, newValPubKey crypto.PubKey, newOperatorAddress, upgradeToTrigger string) *OsmosisApp { |
|
// |
|
// Required Changes: |
|
// |
|
|
|
ctx := app.BaseApp.NewUncachedContext(true, tmproto.Header{}) |
|
pubkey := &ed25519.PubKey{Key: newValPubKey.Bytes()} |
|
pubkeyAny, err := types.NewAnyWithValue(pubkey) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
|
|
// STAKING |
|
// |
|
|
|
// Create Validator struct for our new validator. |
|
_, bz, err := bech32.DecodeAndConvert(newOperatorAddress) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
bech32Addr, err := bech32.ConvertAndEncode("osmovaloper", bz) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
newVal := stakingtypes.Validator{ |
|
OperatorAddress: bech32Addr, |
|
ConsensusPubkey: pubkeyAny, |
|
Jailed: false, |
|
Status: stakingtypes.Bonded, |
|
Tokens: sdk.NewInt(900000000000000), |
|
DelegatorShares: sdk.MustNewDecFromStr("10000000"), |
|
Description: stakingtypes.Description{ |
|
Moniker: "Testnet Validator", |
|
}, |
|
Commission: stakingtypes.Commission{ |
|
CommissionRates: stakingtypes.CommissionRates{ |
|
Rate: sdk.MustNewDecFromStr("0.05"), |
|
MaxRate: sdk.MustNewDecFromStr("0.1"), |
|
MaxChangeRate: sdk.MustNewDecFromStr("0.05"), |
|
}, |
|
}, |
|
MinSelfDelegation: sdk.OneInt(), |
|
} |
|
|
|
// Remove all validators from power store |
|
stakingKey := app.GetKey(stakingtypes.ModuleName) |
|
stakingStore := ctx.KVStore(stakingKey) |
|
iterator := app.StakingKeeper.ValidatorsPowerStoreIterator(ctx) |
|
for ; iterator.Valid(); iterator.Next() { |
|
stakingStore.Delete(iterator.Key()) |
|
} |
|
iterator.Close() |
|
|
|
// Remove all valdiators from last validators store |
|
iterator = app.StakingKeeper.LastValidatorsIterator(ctx) |
|
for ; iterator.Valid(); iterator.Next() { |
|
stakingStore.Delete(iterator.Key()) |
|
} |
|
iterator.Close() |
|
|
|
+ // Remove all validators from validators store |
|
+ iterator = sdk.KVStorePrefixIterator(stakingStore, stakingtypes.ValidatorsKey) |
|
+ for ; iterator.Valid(); iterator.Next() { |
|
+ stakingStore.Delete(iterator.Key()) |
|
+ } |
|
+ iterator.Close() |
|
+ |
|
+ // Remove all validators from unbonding queue |
|
+ iterator = sdk.KVStorePrefixIterator(stakingStore, stakingtypes.ValidatorQueueKey) |
|
+ for ; iterator.Valid(); iterator.Next() { |
|
+ stakingStore.Delete(iterator.Key()) |
|
+ } |
|
+ iterator.Close() |
|
+ |
|
// Add our validator to power and last validators store |
|
app.StakingKeeper.SetValidator(ctx, newVal) |
|
err = app.StakingKeeper.SetValidatorByConsAddr(ctx, newVal) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
app.StakingKeeper.SetValidatorByPowerIndex(ctx, newVal) |
|
app.StakingKeeper.SetLastValidatorPower(ctx, newVal.GetOperator(), 0) |
|
if err := app.StakingKeeper.Hooks().AfterValidatorCreated(ctx, newVal.GetOperator()); err != nil { |
|
panic(err) |
|
} |
|
|
|
// DISTRIBUTION |
|
// |
|
|
|
// Initialize records for this validator across all distribution stores |
|
app.DistrKeeper.SetValidatorHistoricalRewards(ctx, newVal.GetOperator(), 0, distrtypes.NewValidatorHistoricalRewards(sdk.DecCoins{}, 1)) |
|
app.DistrKeeper.SetValidatorCurrentRewards(ctx, newVal.GetOperator(), distrtypes.NewValidatorCurrentRewards(sdk.DecCoins{}, 1)) |
|
app.DistrKeeper.SetValidatorAccumulatedCommission(ctx, newVal.GetOperator(), distrtypes.InitialValidatorAccumulatedCommission()) |
|
app.DistrKeeper.SetValidatorOutstandingRewards(ctx, newVal.GetOperator(), distrtypes.ValidatorOutstandingRewards{Rewards: sdk.DecCoins{}}) |
|
|
|
// SLASHING |
|
// |
|
|
|
// Set validator signing info for our new validator. |
|
newConsAddr := sdk.ConsAddress(newValAddr.Bytes()) |
|
newValidatorSigningInfo := slashingtypes.ValidatorSigningInfo{ |
|
Address: newConsAddr.String(), |
|
StartHeight: app.LastBlockHeight() - 1, |
|
Tombstoned: false, |
|
} |
|
app.SlashingKeeper.SetValidatorSigningInfo(ctx, newConsAddr, newValidatorSigningInfo) |
|
|
|
// |
|
// Optional Changes: |
|
// |
|
|
|
// GOV |
|
// |
|
|
|
newExpeditedVotingPeriod := time.Minute |
|
newVotingPeriod := time.Minute * 2 |
|
|
|
govParams := app.GovKeeper.GetParams(ctx) |
|
govParams.ExpeditedVotingPeriod = &newExpeditedVotingPeriod |
|
govParams.VotingPeriod = &newVotingPeriod |
|
govParams.MinDeposit = sdk.NewCoins(sdk.NewInt64Coin("uosmo", 100000000)) |
|
govParams.ExpeditedMinDeposit = sdk.NewCoins(sdk.NewInt64Coin("uosmo", 150000000)) |
|
|
|
err = app.GovKeeper.SetParams(ctx, govParams) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
|
|
// EPOCHS |
|
// |
|
|
|
dayEpochInfo := app.EpochsKeeper.GetEpochInfo(ctx, "day") |
|
dayEpochInfo.Duration = time.Hour * 6 |
|
// Prevents epochs from running back to back |
|
dayEpochInfo.CurrentEpochStartTime = time.Now().UTC() |
|
+ // If you want epoch to run a minute after starting the chain, uncomment the line below and comment the line above |
|
+ // dayEpochInfo.CurrentEpochStartTime = time.Now().UTC().Add(-dayEpochInfo.Duration).Add(time.Minute) |
|
dayEpochInfo.CurrentEpochStartHeight = app.LastBlockHeight() |
|
app.EpochsKeeper.DeleteEpochInfo(ctx, "day") |
|
err = app.EpochsKeeper.AddEpochInfo(ctx, dayEpochInfo) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
|
|
weekEpochInfo := app.EpochsKeeper.GetEpochInfo(ctx, "week") |
|
weekEpochInfo.Duration = time.Hour * 12 |
|
// Prevents epochs from running back to back |
|
weekEpochInfo.CurrentEpochStartTime = time.Now().UTC() |
|
weekEpochInfo.CurrentEpochStartHeight = app.LastBlockHeight() |
|
app.EpochsKeeper.DeleteEpochInfo(ctx, "week") |
|
err = app.EpochsKeeper.AddEpochInfo(ctx, weekEpochInfo) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
|
|
// BANK |
|
// |
|
|
|
defaultCoins := sdk.NewCoins( |
|
sdk.NewInt64Coin("ibc/0CD3A0285E1341859B5E86B6AB7682F023D03E97607CCC1DC95706411D866DF7", 1000000000000), // DAI |
|
sdk.NewInt64Coin("uosmo", 1000000000000), |
|
sdk.NewInt64Coin("uion", 1000000000)) |
|
|
|
localOsmosisAccounts := []sdk.AccAddress{ |
|
sdk.MustAccAddressFromBech32("osmo12smx2wdlyttvyzvzg54y2vnqwq2qjateuf7thj"), |
|
sdk.MustAccAddressFromBech32("osmo1cyyzpxplxdzkeea7kwsydadg87357qnahakaks"), |
|
sdk.MustAccAddressFromBech32("osmo18s5lynnmx37hq4wlrw9gdn68sg2uxp5rgk26vv"), |
|
sdk.MustAccAddressFromBech32("osmo1qwexv7c6sm95lwhzn9027vyu2ccneaqad4w8ka"), |
|
sdk.MustAccAddressFromBech32("osmo14hcxlnwlqtq75ttaxf674vk6mafspg8xwgnn53"), |
|
sdk.MustAccAddressFromBech32("osmo12rr534cer5c0vj53eq4y32lcwguyy7nndt0u2t"), |
|
sdk.MustAccAddressFromBech32("osmo1nt33cjd5auzh36syym6azgc8tve0jlvklnq7jq"), |
|
sdk.MustAccAddressFromBech32("osmo10qfrpash5g2vk3hppvu45x0g860czur8ff5yx0"), |
|
sdk.MustAccAddressFromBech32("osmo1f4tvsdukfwh6s9swrc24gkuz23tp8pd3e9r5fa"), |
|
sdk.MustAccAddressFromBech32("osmo1myv43sqgnj5sm4zl98ftl45af9cfzk7nhjxjqh"), |
|
sdk.MustAccAddressFromBech32("osmo14gs9zqh8m49yy9kscjqu9h72exyf295afg6kgk"), |
|
sdk.MustAccAddressFromBech32("osmo1jllfytsz4dryxhz5tl7u73v29exsf80vz52ucc")} |
|
|
|
// Fund localosmosis accounts |
|
for _, account := range localOsmosisAccounts { |
|
err := app.BankKeeper.MintCoins(ctx, minttypes.ModuleName, defaultCoins) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
err = app.BankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, account, defaultCoins) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
} |
|
|
|
// Fund edgenet faucet |
|
faucetCoins := sdk.NewCoins( |
|
sdk.NewInt64Coin("ibc/0CD3A0285E1341859B5E86B6AB7682F023D03E97607CCC1DC95706411D866DF7", 1000000000000000), // DAI |
|
sdk.NewInt64Coin("uosmo", 1000000000000000), |
|
sdk.NewInt64Coin("uion", 1000000000000)) |
|
err = app.BankKeeper.MintCoins(ctx, minttypes.ModuleName, faucetCoins) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
err = app.BankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, sdk.MustAccAddressFromBech32("osmo1rqgf207csps822qwmd3k2n6k6k4e99w502e79t"), faucetCoins) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
|
|
// Mars bank account |
|
marsCoins := sdk.NewCoins( |
|
sdk.NewInt64Coin("uosmo", 10000000000000), |
|
sdk.NewInt64Coin("ibc/903A61A498756EA560B85A85132D3AEE21B5DEDD41213725D22ABF276EA6945E", 400000000000), |
|
sdk.NewInt64Coin("ibc/D189335C6E4A68B513C10AB227BF1C1D38C746766278BA3EEB4FB14124F1D858", 3000000000000), |
|
sdk.NewInt64Coin("ibc/C140AFD542AE77BD7DCC83F13FDD8C5E5BB8C4929785E6EC2F4C636F98F17901", 200000000000), |
|
sdk.NewInt64Coin("ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2", 700000000000), |
|
sdk.NewInt64Coin("ibc/D1542AA8762DB13087D8364F3EA6509FD6F009A34F00426AF9E4F9FA85CBBF1F", 2000000000), |
|
sdk.NewInt64Coin("ibc/EA1D43981D5C9A1C4AAEA9C23BB1D4FA126BA9BC7020A25E0AE4AA841EA25DC5", 3000000000000000000)) |
|
err = app.BankKeeper.MintCoins(ctx, minttypes.ModuleName, marsCoins) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
err = app.BankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, sdk.MustAccAddressFromBech32("osmo1ev02crc36675xd8s029qh7wg3wjtfk37jr004z"), marsCoins) |
|
if err != nil { |
|
tmos.Exit(err.Error()) |
|
} |
|
|
|
// UPGRADE |
|
// |
|
|
|
if upgradeToTrigger != "" { |
|
upgradePlan := upgradetypes.Plan{ |
|
Name: upgradeToTrigger, |
|
Height: app.LastBlockHeight(), |
|
} |
|
err = app.UpgradeKeeper.ScheduleUpgrade(ctx, upgradePlan) |
|
if err != nil { |
|
panic(err) |
|
} |
|
} |
|
|
|
return app |
|
} |
|
|
|
|
|
commit 0b326547e1205cde1fd0ece9d51722a1b960166b |
|
Author: Adam Tucker <[email protected]> |
|
Date: Tue Feb 6 14:07:02 2024 -0600 |
|
|
|
feat: in-place testnet creator (#7374) |
|
|
|
* plug in testnetify |
|
|
|
* fix import |
|
|
|
* utilize appOpts |
|
|
|
* add upgrade trigger |
|
|
|
* update sdk fork tag |
|
|
|
* add changelog |
|
|
|
diff --git a/app/app.go b/app/app.go |
|
--- a/app/app.go |
|
+++ b/app/app.go |
|
@@ -407,0 +416,222 @@ |
|
+func InitOsmosisAppForTestnet(app *OsmosisApp, newValAddr bytes.HexBytes, newValPubKey crypto.PubKey, newOperatorAddress, upgradeToTrigger string) *OsmosisApp { |
|
+ // |
|
+ // Required Changes: |
|
+ // |
|
+ |
|
+ ctx := app.BaseApp.NewUncachedContext(true, tmproto.Header{}) |
|
+ pubkey := &ed25519.PubKey{Key: newValPubKey.Bytes()} |
|
+ pubkeyAny, err := types.NewAnyWithValue(pubkey) |
|
+ if err != nil { |
|
+ tmos.Exit(err.Error()) |
|
+ } |
|
+ |
|
+ // STAKING |
|
+ // |
|
+ |
|
+ // Create Validator struct for our new validator. |
|
+ _, bz, err := bech32.DecodeAndConvert(newOperatorAddress) |
|
+ if err != nil { |
|
+ tmos.Exit(err.Error()) |
|
+ } |
|
+ bech32Addr, err := bech32.ConvertAndEncode("osmovaloper", bz) |
|
+ if err != nil { |
|
+ tmos.Exit(err.Error()) |
|
+ } |
|
+ newVal := stakingtypes.Validator{ |
|
+ OperatorAddress: bech32Addr, |
|
+ ConsensusPubkey: pubkeyAny, |
|
+ Jailed: false, |
|
+ Status: stakingtypes.Bonded, |
|
+ Tokens: sdk.NewInt(900000000000000), |
|
+ DelegatorShares: sdk.MustNewDecFromStr("10000000"), |
|
+ Description: stakingtypes.Description{ |
|
+ Moniker: "Testnet Validator", |
|
+ }, |
|
+ Commission: stakingtypes.Commission{ |
|
+ CommissionRates: stakingtypes.CommissionRates{ |
|
+ Rate: sdk.MustNewDecFromStr("0.05"), |
|
+ MaxRate: sdk.MustNewDecFromStr("0.1"), |
|
+ MaxChangeRate: sdk.MustNewDecFromStr("0.05"), |
|
+ }, |
|
+ }, |
|
+ MinSelfDelegation: sdk.OneInt(), |
|
+ } |
|
+ |
|
+ // Remove all validators from power store |
|
+ stakingKey := app.GetKey(stakingtypes.ModuleName) |
|
+ stakingStore := ctx.KVStore(stakingKey) |
|
+ iterator := app.StakingKeeper.ValidatorsPowerStoreIterator(ctx) |
|
+ for ; iterator.Valid(); iterator.Next() { |
|
+ stakingStore.Delete(iterator.Key()) |
|
+ } |
|
+ iterator.Close() |
|
+ |
|
+ // Remove all valdiators from last validators store |
|
+ iterator = app.StakingKeeper.LastValidatorsIterator(ctx) |
|
+ for ; iterator.Valid(); iterator.Next() { |
|
+ stakingStore.Delete(iterator.Key()) |
|
+ } |
|
+ iterator.Close() |
|
+ |
|
+ // Add our validator to power and last validators store |
|
+ app.StakingKeeper.SetValidator(ctx, newVal) |
|
+ err = app.StakingKeeper.SetValidatorByConsAddr(ctx, newVal) |
|
+ if err != nil { |
|
+ tmos.Exit(err.Error()) |
|
+ } |
|
+ app.StakingKeeper.SetValidatorByPowerIndex(ctx, newVal) |
|
+ app.StakingKeeper.SetLastValidatorPower(ctx, newVal.GetOperator(), 0) |
|
+ if err := app.StakingKeeper.Hooks().AfterValidatorCreated(ctx, newVal.GetOperator()); err != nil { |
|
+ panic(err) |
|
+ } |
|
+ |
|
+ // DISTRIBUTION |
|
+ // |
|
+ |
|
+ // Initialize records for this validator across all distribution stores |
|
+ app.DistrKeeper.SetValidatorHistoricalRewards(ctx, newVal.GetOperator(), 0, distrtypes.NewValidatorHistoricalRewards(sdk.DecCoins{}, 1)) |
|
+ app.DistrKeeper.SetValidatorCurrentRewards(ctx, newVal.GetOperator(), distrtypes.NewValidatorCurrentRewards(sdk.DecCoins{}, 1)) |
|
+ app.DistrKeeper.SetValidatorAccumulatedCommission(ctx, newVal.GetOperator(), distrtypes.InitialValidatorAccumulatedCommission()) |
|
+ app.DistrKeeper.SetValidatorOutstandingRewards(ctx, newVal.GetOperator(), distrtypes.ValidatorOutstandingRewards{Rewards: sdk.DecCoins{}}) |
|
+ |
|
+ // SLASHING |
|
+ // |
|
+ |
|
+ // Set validator signing info for our new validator. |
|
+ newConsAddr := sdk.ConsAddress(newValAddr.Bytes()) |
|
+ newValidatorSigningInfo := slashingtypes.ValidatorSigningInfo{ |
|
+ Address: newConsAddr.String(), |
|
+ StartHeight: app.LastBlockHeight() - 1, |
|
+ Tombstoned: false, |
|
+ } |
|
+ app.SlashingKeeper.SetValidatorSigningInfo(ctx, newConsAddr, newValidatorSigningInfo) |
|
+ |
|
+ // |
|
+ // Optional Changes: |
|
+ // |
|
+ |
|
+ // GOV |
|
+ // |
|
+ |
|
+ newExpeditedVotingPeriod := time.Minute |
|
+ newVotingPeriod := time.Minute * 2 |
|
+ |
|
+ govParams := app.GovKeeper.GetParams(ctx) |
|
+ govParams.ExpeditedVotingPeriod = &newExpeditedVotingPeriod |
|
+ govParams.VotingPeriod = &newVotingPeriod |
|
+ govParams.MinDeposit = sdk.NewCoins(sdk.NewInt64Coin("uosmo", 100000000)) |
|
+ govParams.ExpeditedMinDeposit = sdk.NewCoins(sdk.NewInt64Coin("uosmo", 150000000)) |
|
+ |
|
+ err = app.GovKeeper.SetParams(ctx, govParams) |
|
+ if err != nil { |
|
+ tmos.Exit(err.Error()) |
|
+ } |
|
+ |
|
+ // EPOCHS |
|
+ // |
|
+ |
|
+ dayEpochInfo := app.EpochsKeeper.GetEpochInfo(ctx, "day") |
|
+ dayEpochInfo.Duration = time.Hour * 6 |
|
+ // Prevents epochs from running back to back |
|
+ dayEpochInfo.CurrentEpochStartTime = time.Now().UTC() |
|
+ dayEpochInfo.CurrentEpochStartHeight = app.LastBlockHeight() |
|
+ app.EpochsKeeper.DeleteEpochInfo(ctx, "day") |
|
+ err = app.EpochsKeeper.AddEpochInfo(ctx, dayEpochInfo) |
|
+ if err != nil { |
|
+ tmos.Exit(err.Error()) |
|
+ } |
|
+ |
|
+ weekEpochInfo := app.EpochsKeeper.GetEpochInfo(ctx, "week") |
|
+ weekEpochInfo.Duration = time.Hour * 12 |
|
+ // Prevents epochs from running back to back |
|
+ weekEpochInfo.CurrentEpochStartTime = time.Now().UTC() |
|
+ weekEpochInfo.CurrentEpochStartHeight = app.LastBlockHeight() |
|
+ app.EpochsKeeper.DeleteEpochInfo(ctx, "week") |
|
+ err = app.EpochsKeeper.AddEpochInfo(ctx, weekEpochInfo) |
|
+ if err != nil { |
|
+ tmos.Exit(err.Error()) |
|
+ } |
|
+ |
|
+ // BANK |
|
+ // |
|
+ |
|
+ defaultCoins := sdk.NewCoins( |
|
+ sdk.NewInt64Coin("ibc/0CD3A0285E1341859B5E86B6AB7682F023D03E97607CCC1DC95706411D866DF7", 1000000000000), // DAI |
|
+ sdk.NewInt64Coin("uosmo", 1000000000000), |
|
+ sdk.NewInt64Coin("uion", 1000000000)) |
|
+ |
|
+ localOsmosisAccounts := []sdk.AccAddress{ |
|
+ sdk.MustAccAddressFromBech32("osmo12smx2wdlyttvyzvzg54y2vnqwq2qjateuf7thj"), |
|
+ sdk.MustAccAddressFromBech32("osmo1cyyzpxplxdzkeea7kwsydadg87357qnahakaks"), |
|
+ sdk.MustAccAddressFromBech32("osmo18s5lynnmx37hq4wlrw9gdn68sg2uxp5rgk26vv"), |
|
+ sdk.MustAccAddressFromBech32("osmo1qwexv7c6sm95lwhzn9027vyu2ccneaqad4w8ka"), |
|
+ sdk.MustAccAddressFromBech32("osmo14hcxlnwlqtq75ttaxf674vk6mafspg8xwgnn53"), |
|
+ sdk.MustAccAddressFromBech32("osmo12rr534cer5c0vj53eq4y32lcwguyy7nndt0u2t"), |
|
+ sdk.MustAccAddressFromBech32("osmo1nt33cjd5auzh36syym6azgc8tve0jlvklnq7jq"), |
|
+ sdk.MustAccAddressFromBech32("osmo10qfrpash5g2vk3hppvu45x0g860czur8ff5yx0"), |
|
+ sdk.MustAccAddressFromBech32("osmo1f4tvsdukfwh6s9swrc24gkuz23tp8pd3e9r5fa"), |
|
+ sdk.MustAccAddressFromBech32("osmo1myv43sqgnj5sm4zl98ftl45af9cfzk7nhjxjqh"), |
|
+ sdk.MustAccAddressFromBech32("osmo14gs9zqh8m49yy9kscjqu9h72exyf295afg6kgk"), |
|
+ sdk.MustAccAddressFromBech32("osmo1jllfytsz4dryxhz5tl7u73v29exsf80vz52ucc")} |
|
+ |
|
+ // Fund localosmosis accounts |
|
+ for _, account := range localOsmosisAccounts { |
|
+ err := app.BankKeeper.MintCoins(ctx, minttypes.ModuleName, defaultCoins) |
|
+ if err != nil { |
|
+ tmos.Exit(err.Error()) |
|
+ } |
|
+ err = app.BankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, account, defaultCoins) |
|
+ if err != nil { |
|
+ tmos.Exit(err.Error()) |
|
+ } |
|
+ } |
|
+ |
|
+ // Fund edgenet faucet |
|
+ faucetCoins := sdk.NewCoins( |
|
+ sdk.NewInt64Coin("ibc/0CD3A0285E1341859B5E86B6AB7682F023D03E97607CCC1DC95706411D866DF7", 1000000000000000), // DAI |
|
+ sdk.NewInt64Coin("uosmo", 1000000000000000), |
|
+ sdk.NewInt64Coin("uion", 1000000000000)) |
|
+ err = app.BankKeeper.MintCoins(ctx, minttypes.ModuleName, faucetCoins) |
|
+ if err != nil { |
|
+ tmos.Exit(err.Error()) |
|
+ } |
|
+ err = app.BankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, sdk.MustAccAddressFromBech32("osmo1rqgf207csps822qwmd3k2n6k6k4e99w502e79t"), faucetCoins) |
|
+ if err != nil { |
|
+ tmos.Exit(err.Error()) |
|
+ } |
|
+ |
|
+ // Mars bank account |
|
+ marsCoins := sdk.NewCoins( |
|
+ sdk.NewInt64Coin("uosmo", 10000000000000), |
|
+ sdk.NewInt64Coin("ibc/903A61A498756EA560B85A85132D3AEE21B5DEDD41213725D22ABF276EA6945E", 400000000000), |
|
+ sdk.NewInt64Coin("ibc/D189335C6E4A68B513C10AB227BF1C1D38C746766278BA3EEB4FB14124F1D858", 3000000000000), |
|
+ sdk.NewInt64Coin("ibc/C140AFD542AE77BD7DCC83F13FDD8C5E5BB8C4929785E6EC2F4C636F98F17901", 200000000000), |
|
+ sdk.NewInt64Coin("ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2", 700000000000), |
|
+ sdk.NewInt64Coin("ibc/D1542AA8762DB13087D8364F3EA6509FD6F009A34F00426AF9E4F9FA85CBBF1F", 2000000000), |
|
+ sdk.NewInt64Coin("ibc/EA1D43981D5C9A1C4AAEA9C23BB1D4FA126BA9BC7020A25E0AE4AA841EA25DC5", 3000000000000000000)) |
|
+ err = app.BankKeeper.MintCoins(ctx, minttypes.ModuleName, marsCoins) |
|
+ if err != nil { |
|
+ tmos.Exit(err.Error()) |
|
+ } |
|
+ err = app.BankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, sdk.MustAccAddressFromBech32("osmo1ev02crc36675xd8s029qh7wg3wjtfk37jr004z"), marsCoins) |
|
+ if err != nil { |
|
+ tmos.Exit(err.Error()) |
|
+ } |
|
+ |
|
+ // UPGRADE |
|
+ // |
|
+ |
|
+ if upgradeToTrigger != "" { |
|
+ upgradePlan := upgradetypes.Plan{ |
|
+ Name: upgradeToTrigger, |
|
+ Height: app.LastBlockHeight(), |
|
+ } |
|
+ err = app.UpgradeKeeper.ScheduleUpgrade(ctx, upgradePlan) |
|
+ if err != nil { |
|
+ panic(err) |
|
+ } |
|
+ } |
|
+ |
|
+ return app |
|
+} |
|
+ |