Skip to content

Commit

Permalink
add todo for dogfood to support gov-tx-proposal
Browse files Browse the repository at this point in the history
  • Loading branch information
leonz789 committed Nov 10, 2024
1 parent b4a331e commit f85271b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions local_node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ if [[ $overwrite == "y" || $overwrite == "Y" ]]; then
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"


jq '.app_state["feemarket"]["params"]["base_fee"]="10"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
# x/operator
jq '.app_state["operator"]["operators"][0]["operator_address"]="'"$LOCAL_ADDRESS_EXO"'"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
jq '.app_state["operator"]["operators"][0]["operator_info"]["earnings_addr"]="'"$LOCAL_ADDRESS_EXO"'"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
Expand Down
5 changes: 5 additions & 0 deletions x/dogfood/keeper/impl_sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ func (k Keeper) Unjail(ctx sdk.Context, addr sdk.ConsAddress) {
// module. The slashing module uses it to obtain the delegation information of a validator
// before unjailing it. If the slashing module's unjail function is never called, this
// function will never be called either.
// NOTE: this is not a universal function, it not actually get delegation for {delegator, validator}, but only returns {validator}'s self delegation, only suites for special invoke
func (k Keeper) Delegation(
ctx sdk.Context, delegator sdk.AccAddress, validator sdk.ValAddress,
) stakingtypes.DelegationI {
Expand Down Expand Up @@ -216,6 +217,7 @@ func (k Keeper) IterateBondedValidatorsByPower(
// the voting power is fetched from this module and not the operator module
// because it is applied at the end of an epoch, whereas that from the operator
// module is more recent.
// the 'Tokens' is actually usd value including different types of assets * sdk.DefaultPowerReduction
val.Tokens = sdk.TokensFromConsensusPower(v.Power, sdk.DefaultPowerReduction)
// since the validator object was fetched from this module, we should set it to bonded.
val.Status = stakingtypes.Bonded
Expand All @@ -231,6 +233,7 @@ func (k Keeper) IterateBondedValidatorsByPower(
// gov module. This is not implemented intentionally, since the tokens securing this chain
// are many and span across multiple chains and assets.
func (k Keeper) TotalBondedTokens(sdk.Context) math.Int {
// TODO: return totalBondedPower(virtual tokens from power) compatible with multi-assets staking
panic("unimplemented on this keeper")
}

Expand All @@ -240,5 +243,7 @@ func (k Keeper) IterateDelegations(
sdk.Context, sdk.AccAddress,
func(int64, stakingtypes.DelegationI) bool,
) {
// TODO: for the usage from gov, the shares for one delegation should be the usd-power hold by that delegation, also convert with sdk.DefaultPowerReduction, then gov module should have the expected result
// in this way, the calculation: votingPower := delegation.GetShares().MulInt(val.BondedTokens).Quo(val.DelegatorShares) will just equals to votingpower := delegation.GetShares() = delegation.usd-power
panic("unimplemented on this keeper")
}
3 changes: 2 additions & 1 deletion x/feedistribution/types/genesis.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f85271b

Please sign in to comment.