-
Notifications
You must be signed in to change notification settings - Fork 37
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: CUDOS Extract address info cmd [1] #397
Conversation
app/upgrade_cudos.go
Outdated
} else { | ||
// Store delegation to delegated map | ||
resolvedDelegatorMap, _ := unbondingDelegatedBalanceMap.GetOrSetDefault(resolvedDelegatorAddress, NewOrderedMap[string, sdk.Int]()) | ||
resolvedDelegator, _ := resolvedDelegatorMap.GetOrSetDefault(validatorOperatorAddress, sdk.NewInt(0)) | ||
resolvedDelegatorMap.Set(validatorOperatorAddress, resolvedDelegator.Add(delegatorTokens)) | ||
unbondingDelegatedBalanceMap.Set(resolvedDelegatorAddress, resolvedDelegatorMap) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we have another if-else branch + map for handling unbonded (BOND_STATUS_UNBONDED
) delegations.
👉 I understand that we consider BOND_STATUS_UNBONDED
delegations as liquid balance, just wondering if it would make sense to have them stored in dedicated map, so we could potentially save them as list (per delegator account) in to the manifest file.
👉 Potentiall the same could apply for more esoteric BOND_STATUS_UNSPECIFIED
delegation state (though I'm not entirely sure, whether this bond state actualy applies exclusivelly for validator state, though something tells me that if validator is in the BOND_STATUS_UNSPECIFIED
state, all delegations on that validator will be in that state as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Each delegator has list of Delegations
and UnbondingDelegations
but also each validator can have state bonded, unboned, etc.
Right now we split GenesisData.Validators.Delegations
to Bonded GenesisData.Delegations
, and GenesisData.UnbondedDelegations
And GenesisData.Validators.UnbondingDelegations
map is used for GenesisData.UnbondingDelegations
There can actually be multiple different combinations like:
bonded delegation to bonded validator
unbonding delegation to bonded validator
bonded delegation to unbonding validator
...
I am not sure how to handle this.
What we currently do is that we withdraw all delegations and we recreate only bonded delegations to bonded validators.
OperatorAddress string | ||
ConsensusPubkey cryptotypes.PubKey | ||
Delegations *OrderedMap[string, *DelegationInfo] | ||
UnbondingDelegations *OrderedMap[string, *UnbondingDelegationInfo] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It feels like that ValidatorInfo
struct should contain also the UndondedDelegations
and Rewards
maps.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This map mimics the structure of genesis json.
I've moved rewards to distibution info where they are calculated.
…t/extract_address_info
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Proposed Changes
[describe the changes here...]
Linked Issues
[if applicable, add links to issues resolved by this PR]
Types of changes
What type of change does this pull request make (put an
x
in the boxes that apply)?Checklist
Put an
x
in the boxes that apply:If applicable
Further comments
[if this is a relatively large or complex change, kick off a discussion by explaining why you chose the solution you did, what alternatives you considered, etc...]