Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
105ea4b
Change account store key in x/bank
amaury1093 Jan 18, 2021
54ddbce
Merge branch 'master' of ssh://github.com/cosmos/cosmos-sdk into am-8…
amaury1093 Jan 18, 2021
ade4a94
Fix pagination test
amaury1093 Jan 20, 2021
bb0cdaf
Merge branch 'master' of ssh://github.com/cosmos/cosmos-sdk into am-8…
amaury1093 Jan 20, 2021
64cfb46
Fix merge master
amaury1093 Jan 20, 2021
f7c4a00
Fix staking keys.go
amaury1093 Jan 22, 2021
47abd5a
Use bech32 in val state change map
amaury1093 Jan 22, 2021
d67029d
Fix sortNoLongerBonded
amaury1093 Jan 22, 2021
ba75256
Use length-prefix function
amaury1093 Jan 22, 2021
129680f
Use length prefix function
amaury1093 Jan 22, 2021
e627da3
Fix test accountStore
amaury1093 Jan 22, 2021
17d2678
Fix ExamplePaginate
amaury1093 Jan 22, 2021
bf16313
Fix staking keys
amaury1093 Jan 22, 2021
98d67f5
Use shorter balances prefix
amaury1093 Jan 22, 2021
045905d
Do slashing keys
amaury1093 Jan 25, 2021
18a2eb1
Fix gov keys
amaury1093 Jan 25, 2021
f0803fc
Fix x/gov tests
amaury1093 Jan 25, 2021
06780ae
Fix x/distrib
amaury1093 Jan 25, 2021
8c0c5b5
Address reviews
amaury1093 Jan 25, 2021
e0f7532
add change log entry
amaury1093 Jan 25, 2021
42cf5c8
Add changelog
amaury1093 Jan 25, 2021
b07a79b
Fix failing tests
amaury1093 Jan 25, 2021
dd432de
Fix sim tests
amaury1093 Jan 25, 2021
b6f001c
fix after-export sim
amaury1093 Jan 25, 2021
4e4408c
Merge branch 'master' into am-8345-store-keys
amaury1093 Jan 25, 2021
53e8298
Fix lint
amaury1093 Jan 25, 2021
3e0a7ca
Address review
amaury1093 Jan 26, 2021
9a1a68a
Merge branch 'master' into am-8345-store-keys
amaury1093 Jan 26, 2021
a0a851c
Fix x/authz
amaury1093 Jan 26, 2021
4a789a7
Fix global config in test
amaury1093 Jan 26, 2021
461758f
Update x/staking/keeper/val_state_change.go
amaury1093 Jan 26, 2021
45767e4
Address comments
amaury1093 Jan 26, 2021
85742b3
merge master
amaury1093 Jan 26, 2021
22cc126
Merge branch 'am-8345-store-keys' of ssh://github.com/cosmos/cosmos-s…
amaury1093 Jan 26, 2021
29a38d0
Fix comments
amaury1093 Jan 26, 2021
51eaa92
Address review
amaury1093 Jan 26, 2021
97376a9
Fix authz test
amaury1093 Jan 27, 2021
e4c222b
Update comment
amaury1093 Jan 27, 2021
9769555
Rename to LengthPrefixedAddressStoreKey
amaury1093 Jan 27, 2021
08ea670
Use variable
amaury1093 Jan 27, 2021
0fbde65
Merge branch 'master' of ssh://github.com/cosmos/cosmos-sdk into am-8…
amaury1093 Jan 28, 2021
b6cdc0a
Rename function
amaury1093 Jan 28, 2021
e1ba81c
Fix test build
amaury1093 Jan 28, 2021
55e5b92
chore: update rosetta CI (#8453)
fdymylja Jan 28, 2021
f27735a
Merge branch 'master' of ssh://github.com/cosmos/cosmos-sdk into am-8…
amaury1093 Jan 29, 2021
ccb7ad1
Rename again
amaury1093 Jan 29, 2021
9463f89
Merge branch 'am-8345-store-keys' of ssh://github.com/cosmos/cosmos-s…
amaury1093 Jan 29, 2021
5ecfffe
Rename yet again
amaury1093 Jan 29, 2021
d1a76cb
Merge branch 'master' into am-8345-store-keys
aaronc Jan 29, 2021
73c6b6b
Merge branch 'master' into am-8345-store-keys
amaury1093 Feb 1, 2021
aea577e
Update feegrant keys
amaury1093 Feb 1, 2021
b43189d
Add function to create prefix
amaury1093 Feb 1, 2021
d928b39
Merge branch 'master' into am-8345-store-keys
amaury1093 Feb 1, 2021
8be9c09
Merge branch 'master' into am-8345-store-keys
mergify[bot] Feb 1, 2021
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
Prev Previous commit
Next Next commit
Fix comments
  • Loading branch information
amaury1093 committed Jan 26, 2021
commit 29a38d0645a3db33e2c835e61a82df0061dc4e81
30 changes: 15 additions & 15 deletions x/staking/types/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,29 +48,29 @@ var (
HistoricalInfoKey = []byte{0x50} // prefix for the historical info
)

// GetValidatorKey gets the key for the validator with address
// GetValidatorKey creates the key for the validator with address
// VALUE: staking/Validator
func GetValidatorKey(operatorAddr sdk.ValAddress) []byte {
return append(ValidatorsKey, sdk.MustLengthPrefixedAddress(operatorAddr)...)
}

// GetValidatorByConsAddrKey gets the key for the validator with pubkey
// GetValidatorByConsAddrKey creates the key for the validator with pubkey
// VALUE: validator operator address ([]byte)
func GetValidatorByConsAddrKey(addr sdk.ConsAddress) []byte {
return append(ValidatorsByConsAddrKey, sdk.MustLengthPrefixedAddress(addr)...)
}

// AddressFromValidatorsKey gets the validator operator address from ValidatorsKey
// AddressFromValidatorsKey creates the validator operator address from ValidatorsKey
func AddressFromValidatorsKey(key []byte) []byte {
return key[2:] // remove prefix bytes and address length
}

// AddressFromLastValidatorPowerKey gets the validator operator address from LastValidatorPowerKey
// AddressFromLastValidatorPowerKey creates the validator operator address from LastValidatorPowerKey
func AddressFromLastValidatorPowerKey(key []byte) []byte {
return key[2:] // remove prefix bytes and address length
}

// GetValidatorsByPowerIndexKey gets the validator by power index.
// GetValidatorsByPowerIndexKey creates the validator by power index.
// Power index is the key used in the power-store, and represents the relative
// power ranking of the validator.
// VALUE: validator operator address ([]byte)
Expand Down Expand Up @@ -107,7 +107,7 @@ func GetValidatorsByPowerIndexKey(validator Validator) []byte {
return key
}

// GetLastValidatorPowerKey gets the bonded validator index key for an operator address
// GetLastValidatorPowerKey creates the bonded validator index key for an operator address
func GetLastValidatorPowerKey(operator sdk.ValAddress) []byte {
return append(LastValidatorPowerKey, sdk.MustLengthPrefixedAddress(operator)...)
}
Expand Down Expand Up @@ -170,24 +170,24 @@ func ParseValidatorQueueKey(bz []byte) (time.Time, int64, error) {
return ts, int64(height), nil
}

// GetDelegationKey gets the key for delegator bond with validator
// GetDelegationKey creates the key for delegator bond with validator
// VALUE: staking/Delegation
func GetDelegationKey(delAddr sdk.AccAddress, valAddr sdk.ValAddress) []byte {
return append(GetDelegationsKey(delAddr), sdk.MustLengthPrefixedAddress(valAddr)...)
}

// GetDelegationsKey gets the prefix for a delegator for all validators
// GetDelegationsKey creates the prefix for a delegator for all validators
func GetDelegationsKey(delAddr sdk.AccAddress) []byte {
return append(DelegationKey, sdk.MustLengthPrefixedAddress(delAddr)...)
}

// GetUBDKey gets the key for an unbonding delegation by delegator and validator addr
// GetUBDKey creates the key for an unbonding delegation by delegator and validator addr
// VALUE: staking/UnbondingDelegation
func GetUBDKey(delAddr sdk.AccAddress, valAddr sdk.ValAddress) []byte {
return append(GetUBDsKey(delAddr.Bytes()), sdk.MustLengthPrefixedAddress(valAddr)...)
}

// GetUBDByValIndexKey gets the index-key for an unbonding delegation, stored by validator-index
// GetUBDByValIndexKey creates the index-key for an unbonding delegation, stored by validator-index
// VALUE: none (key rearrangement used)
func GetUBDByValIndexKey(delAddr sdk.AccAddress, valAddr sdk.ValAddress) []byte {
return append(GetUBDsByValIndexKey(valAddr), sdk.MustLengthPrefixedAddress(delAddr)...)
Expand All @@ -204,17 +204,17 @@ func GetUBDKeyFromValIndexKey(indexKey []byte) []byte {
return GetUBDKey(delAddr, valAddr)
}

// GetUBDsKey gets the prefix for all unbonding delegations from a delegator
// GetUBDsKey creates the prefix for all unbonding delegations from a delegator
func GetUBDsKey(delAddr sdk.AccAddress) []byte {
return append(UnbondingDelegationKey, sdk.MustLengthPrefixedAddress(delAddr)...)
}

// GetUBDsByValIndexKey gets the prefix keyspace for the indexes of unbonding delegations for a validator
// GetUBDsByValIndexKey creates the prefix keyspace for the indexes of unbonding delegations for a validator
func GetUBDsByValIndexKey(valAddr sdk.ValAddress) []byte {
return append(UnbondingDelegationByValIndexKey, sdk.MustLengthPrefixedAddress(valAddr)...)
}

// GetUnbondingDelegationTimeKey gets the prefix for all unbonding delegations from a delegator
// GetUnbondingDelegationTimeKey creates the prefix for all unbonding delegations from a delegator
func GetUnbondingDelegationTimeKey(timestamp time.Time) []byte {
bz := sdk.FormatTimeBytes(timestamp)
return append(UnbondingQueueKey, bz...)
Expand All @@ -235,7 +235,7 @@ func GetREDKey(delAddr sdk.AccAddress, valSrcAddr, valDstAddr sdk.ValAddress) []
return key
}

// GetREDByValSrcIndexKey gets the index-key for a redelegation, stored by source-validator-index
// GetREDByValSrcIndexKey creates the index-key for a redelegation, stored by source-validator-index
// VALUE: none (key rearrangement used)
func GetREDByValSrcIndexKey(delAddr sdk.AccAddress, valSrcAddr, valDstAddr sdk.ValAddress) []byte {
REDSFromValsSrcKey := GetREDsFromValSrcIndexKey(valSrcAddr)
Expand All @@ -252,7 +252,7 @@ func GetREDByValSrcIndexKey(delAddr sdk.AccAddress, valSrcAddr, valDstAddr sdk.V
return key
}

// GetREDByValDstIndexKey gets the index-key for a redelegation, stored by destination-validator-index
// GetREDByValDstIndexKey creates the index-key for a redelegation, stored by destination-validator-index
// VALUE: none (key rearrangement used)
func GetREDByValDstIndexKey(delAddr sdk.AccAddress, valSrcAddr, valDstAddr sdk.ValAddress) []byte {
REDSToValsDstKey := GetREDsToValDstIndexKey(valDstAddr)
Expand Down