Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(genesis export): genesis exporting for assets, delegation and operator modules. #108

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
643a0ea
detail the return error for operator info
TimmyExogenous Sep 5, 2024
50ed377
Merge remote-tracking branch 'upstream/develop' into develop
TimmyExogenous Sep 6, 2024
eb69bbd
Merge remote-tracking branch 'upstream/develop' into develop
TimmyExogenous Sep 10, 2024
b75ee4d
Merge remote-tracking branch 'upstream/develop' into develop
TimmyExogenous Sep 10, 2024
ae24f6b
Merge remote-tracking branch 'upstream/develop' into develop
TimmyExogenous Sep 11, 2024
ff65b01
Merge remote-tracking branch 'upstream/develop' into develop
TimmyExogenous Sep 17, 2024
d5660be
Merge remote-tracking branch 'upstream/develop' into develop
TimmyExogenous Sep 19, 2024
063417a
Merge remote-tracking branch 'upstream/develop' into develop
TimmyExogenous Sep 20, 2024
05a34cf
refine the genesis validation and add implement the genesis exporting…
TimmyExogenous Jun 14, 2024
8fa5ce8
add genesis exporting for the delegation module
TimmyExogenous Jun 16, 2024
c57702e
move the isGeneralInit flag to the commandline of starting node
TimmyExogenous Jun 17, 2024
76b80d1
add genesis exporting for operator module
TimmyExogenous Jun 18, 2024
78cfeab
finish genesis exporting for operator module
TimmyExogenous Jun 18, 2024
1d74438
Remove the isGeneralInit flag that indicates whether the launch is fr…
TimmyExogenous Jun 25, 2024
d259c12
remove the opt in when init dogfood genesis
TimmyExogenous Aug 9, 2024
794a34b
use panic to address the error when exporting genesis
TimmyExogenous Sep 12, 2024
5233e0b
add a constant ByteLengthForUint64 and fix the issue identified by co…
TimmyExogenous Sep 18, 2024
f41460e
fix the issue regarding starting a local node
TimmyExogenous Sep 19, 2024
d4b5950
stop the iteration if the operator address isn't found when exporting…
TimmyExogenous Sep 19, 2024
6fe680e
rebase and correct the invalid log printing
TimmyExogenous Sep 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,6 @@ func NewExocoreApp(
// to determine whether an AVS is registered or not.
app.OperatorKeeper = operatorKeeper.NewKeeper(
keys[operatorTypes.StoreKey], appCodec,
bApp.CreateQueryContext,
app.AssetsKeeper,
&app.DelegationKeeper, // intentionally a pointer, since not yet initialized.
&app.OracleKeeper,
Expand Down
52 changes: 27 additions & 25 deletions app/ethtest_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,10 @@ func genesisStateWithValSet(codec codec.Codec, genesisState simapp.GenesisState,
assetstypes.DefaultParams(),
clientChains, []assetstypes.StakingAssetInfo{
{
AssetBasicInfo: &assets[0],
// required to be 0, since deposits are handled after token init.
StakingTotalAmount: sdk.ZeroInt(),
AssetBasicInfo: assets[0],
StakingTotalAmount: depositAmount,
},
}, depositsByStaker,
}, depositsByStaker, nil,
)
genesisState[assetstypes.ModuleName] = codec.MustMarshalJSON(assetsGenesis)

Expand All @@ -200,31 +199,26 @@ func genesisStateWithValSet(codec codec.Codec, genesisState simapp.GenesisState,
genesisState[oracletypes.ModuleName] = codec.MustMarshalJSON(oracleGenesis)

// operator registration
operatorInfos := []operatortypes.OperatorInfo{
operatorInfos := []operatortypes.OperatorDetail{
{
EarningsAddr: operator.String(),
OperatorMetaInfo: "operator1",
Commission: stakingtypes.NewCommission(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()),
OperatorAddress: operator.String(),
OperatorInfo: operatortypes.OperatorInfo{
EarningsAddr: operator.String(),
OperatorMetaInfo: "operator1",
TimmyExogenous marked this conversation as resolved.
Show resolved Hide resolved
Commission: stakingtypes.NewCommission(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()),
},
},
}
operatorGenesis := operatortypes.NewGenesisState(operatorInfos)
operatorGenesis := operatortypes.NewGenesisState(operatorInfos, nil, nil, nil, nil, nil, nil, nil)
genesisState[operatortypes.ModuleName] = codec.MustMarshalJSON(operatorGenesis)
// x/delegation
delegationsByStaker := []delegationtypes.DelegationsByStaker{
singleStateKey := assetstypes.GetJoinedStoreKey(stakerID, assetID, operator.String())
delegationStates := []delegationtypes.DelegationStates{
{
StakerID: stakerID,
Delegations: []delegationtypes.DelegatedSingleAssetInfo{
{
AssetID: assetID,
PerOperatorAmounts: []delegationtypes.KeyValue{
{
Key: operator.String(),
Value: &delegationtypes.ValueField{
Amount: depositAmount,
},
},
},
},
Key: string(singleStateKey),
States: delegationtypes.DelegationAmounts{
WaitUndelegationAmount: math.NewInt(0),
UndelegatableShare: math.LegacyNewDecFromBigInt(depositAmount.BigInt()),
},
},
TimmyExogenous marked this conversation as resolved.
Show resolved Hide resolved
}
Expand All @@ -234,7 +228,15 @@ func genesisStateWithValSet(codec codec.Codec, genesisState simapp.GenesisState,
StakerID: stakerID,
},
}
delegationGenesis := delegationtypes.NewGenesis(delegationsByStaker, associations)
stakersByOperator := []delegationtypes.StakersByOperator{
{
Key: string(assetstypes.GetJoinedStoreKey(operator.String(), assetID)),
Stakers: []string{
stakerID,
},
},
}
delegationGenesis := delegationtypes.NewGenesis(associations, delegationStates, stakersByOperator, nil)
genesisState[delegationtypes.ModuleName] = codec.MustMarshalJSON(delegationGenesis)

dogfoodGenesis := dogfoodtypes.NewGenesis(
Expand All @@ -243,7 +245,7 @@ func genesisStateWithValSet(codec codec.Codec, genesisState simapp.GenesisState,
// PublicKey: consensusKeyRecords[0].Chains[0].ConsensusKey,
Power: 1,
PublicKey: hexutil.Encode(valSet.Validators[0].PubKey.Bytes()),
OperatorAccAddr: operatorInfos[0].EarningsAddr,
OperatorAccAddr: operatorInfos[0].OperatorAddress,
},
},
[]dogfoodtypes.EpochToOperatorAddrs{}, []dogfoodtypes.EpochToConsensusAddrs{},
Expand Down
63 changes: 41 additions & 22 deletions app/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,39 +216,50 @@ func GenesisStateWithValSet(app *ExocoreApp, genesisState simapp.GenesisState,
assetstypes.DefaultParams(),
clientChains, []assetstypes.StakingAssetInfo{
{
AssetBasicInfo: &assets[0],
AssetBasicInfo: assets[0],
// required to be 0, since deposits are handled after token init.
StakingTotalAmount: sdk.ZeroInt(),
},
}, depositsByStaker,
[]assetstypes.AssetsByOperator{
{
Operator: operator.String(),
AssetsState: []assetstypes.AssetByID{
{
AssetID: assetID,
Info: assetstypes.OperatorAssetInfo{
TotalAmount: depositAmount,
PendingUndelegationAmount: math.NewInt(0),
TotalShare: math.LegacyNewDecFromBigInt(depositAmount.BigInt()),
OperatorShare: math.LegacyNewDec(0),
},
},
},
},
},
)
genesisState[assetstypes.ModuleName] = app.AppCodec().MustMarshalJSON(assetsGenesis)
// operator registration
operatorInfos := []operatortypes.OperatorInfo{
operatorInfos := []operatortypes.OperatorDetail{
{
EarningsAddr: operator.String(),
OperatorMetaInfo: "operator1",
Commission: stakingtypes.NewCommission(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()),
OperatorAddress: operator.String(),
OperatorInfo: operatortypes.OperatorInfo{
EarningsAddr: operator.String(),
OperatorMetaInfo: "operator1",
Commission: stakingtypes.NewCommission(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()),
},
},
}
operatorGenesis := operatortypes.NewGenesisState(operatorInfos)
operatorGenesis := operatortypes.NewGenesisState(operatorInfos, nil, nil, nil, nil, nil, nil, nil)
genesisState[operatortypes.ModuleName] = app.AppCodec().MustMarshalJSON(operatorGenesis)
// x/delegation
delegationsByStaker := []delegationtypes.DelegationsByStaker{
singleStateKey := assetstypes.GetJoinedStoreKey(stakerID, assetID, operator.String())
delegationStates := []delegationtypes.DelegationStates{
{
StakerID: stakerID,
Delegations: []delegationtypes.DelegatedSingleAssetInfo{
{
AssetID: assetID,
PerOperatorAmounts: []delegationtypes.KeyValue{
{
Key: operator.String(),
Value: &delegationtypes.ValueField{
Amount: depositAmount,
},
},
},
},
Key: string(singleStateKey),
States: delegationtypes.DelegationAmounts{
WaitUndelegationAmount: math.NewInt(0),
UndelegatableShare: math.LegacyNewDecFromBigInt(depositAmount.BigInt()),
},
},
}
Expand All @@ -258,7 +269,15 @@ func GenesisStateWithValSet(app *ExocoreApp, genesisState simapp.GenesisState,
StakerID: stakerID,
},
}
delegationGenesis := delegationtypes.NewGenesis(delegationsByStaker, associations)
stakersByOperator := []delegationtypes.StakersByOperator{
{
Key: string(assetstypes.GetJoinedStoreKey(operator.String(), assetID)),
Stakers: []string{
stakerID,
},
},
}
delegationGenesis := delegationtypes.NewGenesis(associations, delegationStates, stakersByOperator, nil)
genesisState[delegationtypes.ModuleName] = app.AppCodec().MustMarshalJSON(delegationGenesis)

// create a dogfood genesis with just the validator set, that is, the bare
Expand All @@ -268,7 +287,7 @@ func GenesisStateWithValSet(app *ExocoreApp, genesisState simapp.GenesisState,
{
Power: 1,
PublicKey: hexutil.Encode(valSet.Validators[0].PubKey.Bytes()),
OperatorAccAddr: operatorInfos[0].EarningsAddr,
OperatorAccAddr: operatorInfos[0].OperatorAddress,
},
},
[]dogfoodtypes.EpochToOperatorAddrs{}, []dogfoodtypes.EpochToConsensusAddrs{},
Expand Down
14 changes: 7 additions & 7 deletions cmd/exocored/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ func (a appCreator) newApp(logger log.Logger, db dbm.DB, traceStore io.Writer, a

chainID := getChainID(appOpts, home)

evmosApp := app.NewExocoreApp(
exocoreApp := app.NewExocoreApp(
logger, db, traceStore, true, skipUpgradeHeights,
cast.ToString(appOpts.Get(flags.FlagHome)),
cast.ToUint(appOpts.Get(sdkserver.FlagInvCheckPeriod)),
Expand All @@ -313,7 +313,7 @@ func (a appCreator) newApp(logger log.Logger, db dbm.DB, traceStore io.Writer, a
baseapp.SetChainID(chainID),
)

return evmosApp
return exocoreApp
}

// appExport creates a new simapp (optionally at a given height)
Expand All @@ -328,7 +328,7 @@ func (a appCreator) appExport(
appOpts servertypes.AppOptions,
modulesToExport []string,
) (servertypes.ExportedApp, error) {
var evmosApp *app.ExocoreApp
var exocoreApp *app.ExocoreApp
homePath, ok := appOpts.Get(flags.FlagHome).(string)
if !ok || homePath == "" {
return servertypes.ExportedApp{}, errors.New("application home not set")
Expand All @@ -337,24 +337,24 @@ func (a appCreator) appExport(
chainID := getChainID(appOpts, homePath)

if height != -1 {
evmosApp = app.NewExocoreApp(
exocoreApp = app.NewExocoreApp(
logger, db, traceStore, false,
map[int64]bool{}, "", uint(1), a.encCfg, appOpts,
baseapp.SetChainID(chainID),
)

if err := evmosApp.LoadHeight(height); err != nil {
if err := exocoreApp.LoadHeight(height); err != nil {
return servertypes.ExportedApp{}, err
}
} else {
evmosApp = app.NewExocoreApp(
exocoreApp = app.NewExocoreApp(
logger, db, traceStore, true,
map[int64]bool{}, "", uint(1), a.encCfg, appOpts,
baseapp.SetChainID(chainID),
)
}

return evmosApp.ExportAppStateAndValidators(
return exocoreApp.ExportAppStateAndValidators(
forZeroHeight,
jailAllowedAddrs,
modulesToExport,
Expand Down
61 changes: 33 additions & 28 deletions cmd/exocored/testnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -391,8 +391,10 @@ func getTestExocoreGenesis(
power := int64(300)
depositAmount := sdk.TokensFromConsensusPower(power, evmostypes.PowerReduction)
depositsByStaker := []assetstypes.DepositsByStaker{}
operatorInfos := []operatortypes.OperatorInfo{}
delegationsByStaker := []delegationtypes.DelegationsByStaker{}
operatorInfos := []operatortypes.OperatorDetail{}
TimmyExogenous marked this conversation as resolved.
Show resolved Hide resolved
delegationStates := []delegationtypes.DelegationStates{}
associations := []delegationtypes.StakerToOperator{}
stakersByOperator := []delegationtypes.StakersByOperator{}
validators := []dogfoodtypes.GenesisValidator{}
for i := range operatorAddrs {
operator := operatorAddrs[i]
Expand All @@ -414,27 +416,33 @@ func getTestExocoreGenesis(
},
},
})
operatorInfos = append(operatorInfos, operatortypes.OperatorInfo{
EarningsAddr: operator.String(),
OperatorMetaInfo: "operator1",
Commission: stakingtypes.NewCommission(
sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec(),
),
operatorInfos = append(operatorInfos, operatortypes.OperatorDetail{
OperatorAddress: operator.String(),
OperatorInfo: operatortypes.OperatorInfo{
EarningsAddr: operator.String(),
OperatorMetaInfo: "operator1",
Commission: stakingtypes.NewCommission(
sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec(),
),
},
})
delegationsByStaker = append(delegationsByStaker, delegationtypes.DelegationsByStaker{
singleStateKey := assetstypes.GetJoinedStoreKey(stakerID, assetID, operator.String())
delegationStates = append(delegationStates, delegationtypes.DelegationStates{
Key: string(singleStateKey),
States: delegationtypes.DelegationAmounts{
WaitUndelegationAmount: math.NewInt(0),
UndelegatableShare: math.LegacyNewDecFromBigInt(depositAmount.BigInt()),
},
},
)
associations = append(associations, delegationtypes.StakerToOperator{
Operator: operator.String(),
StakerID: stakerID,
Delegations: []delegationtypes.DelegatedSingleAssetInfo{
{
AssetID: assetID,
PerOperatorAmounts: []delegationtypes.KeyValue{
{
Key: operator.String(),
Value: &delegationtypes.ValueField{
Amount: depositAmount,
},
},
},
},
})
stakersByOperator = append(stakersByOperator, delegationtypes.StakersByOperator{
Key: string(assetstypes.GetJoinedStoreKey(operator.String(), assetID)),
Stakers: []string{
stakerID,
},
})
validators = append(validators, dogfoodtypes.GenesisValidator{
Expand All @@ -447,17 +455,14 @@ func getTestExocoreGenesis(
assetstypes.DefaultParams(),
clientChains, []assetstypes.StakingAssetInfo{
{
AssetBasicInfo: &assets[0],
AssetBasicInfo: assets[0],
// required to be 0, since deposits are handled after token init.
StakingTotalAmount: sdk.ZeroInt(),
},
}, depositsByStaker,
}, depositsByStaker, nil,
), operatortypes.NewGenesisState(
operatorInfos,
), delegationtypes.NewGenesis(
delegationsByStaker,
nil,
), dogfoodtypes.NewGenesis(
operatorInfos, nil, nil, nil, nil, nil, nil, nil,
), delegationtypes.NewGenesis(associations, delegationStates, stakersByOperator, nil), dogfoodtypes.NewGenesis(
dogfoodtypes.NewParams(
dogfoodtypes.DefaultEpochsUntilUnbonded,
dogfoodtypes.DefaultEpochIdentifier,
Expand Down
30 changes: 19 additions & 11 deletions local_node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,33 +95,41 @@ if [[ $overwrite == "y" || $overwrite == "Y" ]]; then
jq '.app_state["assets"]["client_chains"][0]["address_length"]="20"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
jq '.app_state["assets"]["tokens"][0]["asset_basic_info"]["name"]="Tether USD"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
jq '.app_state["assets"]["tokens"][0]["asset_basic_info"]["meta_info"]="Tether USD token"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
jq '.app_state["assets"]["tokens"][0]["asset_basic_info"]["address"]="0xdAC17F958D2ee523a2206206994597C13D831ec7"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
jq '.app_state["assets"]["tokens"][0]["asset_basic_info"]["address"]="0xdac17f958d2ee523a2206206994597c13d831ec7"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
jq '.app_state["assets"]["tokens"][0]["asset_basic_info"]["layer_zero_chain_id"]="101"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
jq '.app_state["assets"]["tokens"][0]["staking_total_amount"]="0"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
jq '.app_state["assets"]["tokens"][0]["staking_total_amount"]="5000"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
jq '.app_state["assets"]["deposits"][0]["staker"]="0x3e108c058e8066da635321dc3018294ca82ddedf_0x65"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
jq '.app_state["assets"]["deposits"][0]["deposits"][0]["asset_id"]="0xdac17f958d2ee523a2206206994597c13d831ec7_0x65"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
jq '.app_state["assets"]["deposits"][0]["deposits"][0]["info"]["total_deposit_amount"]="5000"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
jq '.app_state["assets"]["deposits"][0]["deposits"][0]["info"]["withdrawable_amount"]="5000"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
jq '.app_state["assets"]["deposits"][0]["deposits"][0]["info"]["pending_undelegation_amount"]="0"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
jq '.app_state["assets"]["operator_assets"][0]["operator"]="exo18cggcpvwspnd5c6ny8wrqxpffj5zmhklprtnph"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
jq '.app_state["assets"]["operator_assets"][0]["assets_state"][0]["asset_id"]="0xdac17f958d2ee523a2206206994597c13d831ec7_0x65"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
jq '.app_state["assets"]["operator_assets"][0]["assets_state"][0]["info"]["total_amount"]="5000"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
jq '.app_state["assets"]["operator_assets"][0]["assets_state"][0]["info"]["pending_undelegation_amount"]="0"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
jq '.app_state["assets"]["operator_assets"][0]["assets_state"][0]["info"]["total_share"]="5000"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
jq '.app_state["assets"]["operator_assets"][0]["assets_state"][0]["info"]["operator_share"]="5000"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"

# x/oracle
jq '.app_state["oracle"]["params"]["tokens"][1]["asset_id"]="0xdac17f958d2ee523a2206206994597c13d831ec7_0x65"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
jq '.app_state["oracle"]["params"]["token_feeders"][1]["start_base_block"]="20"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"

# x/operator
jq '.app_state["operator"]["operators"][0]["earnings_addr"]="exo18cggcpvwspnd5c6ny8wrqxpffj5zmhklprtnph"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
jq '.app_state["operator"]["operators"][0]["operator_meta_info"]="operator1"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
jq '.app_state["operator"]["operators"][0]["commission"]["commission_rates"]["rate"]="0.0"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
jq '.app_state["operator"]["operators"][0]["commission"]["commission_rates"]["max_rate"]="0.0"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
jq '.app_state["operator"]["operators"][0]["commission"]["commission_rates"]["max_change_rate"]="0.0"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
jq '.app_state["operator"]["operators"][0]["operator_address"]="exo18cggcpvwspnd5c6ny8wrqxpffj5zmhklprtnph"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
jq '.app_state["operator"]["operators"][0]["operator_info"]["earnings_addr"]="exo18cggcpvwspnd5c6ny8wrqxpffj5zmhklprtnph"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
jq '.app_state["operator"]["operators"][0]["operator_info"]["operator_meta_info"]="operator1"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
jq '.app_state["operator"]["operators"][0]["operator_info"]["commission"]["commission_rates"]["rate"]="0.0"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
jq '.app_state["operator"]["operators"][0]["operator_info"]["commission"]["commission_rates"]["max_rate"]="0.0"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
jq '.app_state["operator"]["operators"][0]["operator_info"]["commission"]["commission_rates"]["max_change_rate"]="0.0"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"

# x/delegation
jq '.app_state["delegation"]["delegations"][0]["staker_id"]="0x3e108c058e8066da635321dc3018294ca82ddedf_0x65"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
jq '.app_state["delegation"]["delegations"][0]["delegations"][0]["asset_id"]="0xdac17f958d2ee523a2206206994597c13d831ec7_0x65"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
jq '.app_state["delegation"]["delegations"][0]["delegations"][0]["per_operator_amounts"][0]["key"]="exo18cggcpvwspnd5c6ny8wrqxpffj5zmhklprtnph"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
jq '.app_state["delegation"]["delegations"][0]["delegations"][0]["per_operator_amounts"][0]["value"]["amount"]="5000"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
jq '.app_state["delegation"]["delegation_states"][0]["key"]="0x3e108c058e8066da635321dc3018294ca82ddedf_0x65/0xdac17f958d2ee523a2206206994597c13d831ec7_0x65/exo18cggcpvwspnd5c6ny8wrqxpffj5zmhklprtnph"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
jq '.app_state["delegation"]["delegation_states"][0]["states"]["undelegatable_share"]="5000"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
jq '.app_state["delegation"]["delegation_states"][0]["states"]["wait_undelegation_amount"]="0"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
jq '.app_state["delegation"]["associations"][0]["staker_id"]="0x3e108c058e8066da635321dc3018294ca82ddedf_0x65"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
jq '.app_state["delegation"]["associations"][0]["operator"]="exo18cggcpvwspnd5c6ny8wrqxpffj5zmhklprtnph"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
jq '.app_state["delegation"]["stakers_by_operator"][0]["key"]="exo18cggcpvwspnd5c6ny8wrqxpffj5zmhklprtnph/0xdac17f958d2ee523a2206206994597c13d831ec7_0x65"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
jq '.app_state["delegation"]["stakers_by_operator"][0]["stakers"][0]="0x3e108c058e8066da635321dc3018294ca82ddedf_0x65"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"

# x/dogfood
# for easy testing, use an epoch of 1 minute and 5 epochs until unbonded.
Expand Down
2 changes: 1 addition & 1 deletion precompiles/assets/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func (p Precompile) RegisterToken(
}

stakingAsset := &assetstypes.StakingAssetInfo{
AssetBasicInfo: &asset,
AssetBasicInfo: asset,
StakingTotalAmount: sdkmath.NewInt(0),
}

Expand Down
Loading
Loading