Conversation
| dependency.ImmediateYoungerSibling = "" | ||
| found := false | ||
| for _, contractInfo := range allContractInfo { | ||
| if contractInfo.ContractAddr == newContract.ContractAddr { |
There was a problem hiding this comment.
this was not order agnostic previously @codchen and it updated the newContract to its dependency in a wrong order
x/dex/types/keys.go
Outdated
| func ContractKeyPrefix(p string, contractAddr string) []byte { | ||
| return append([]byte(p), []byte(contractAddr)...) | ||
| address, _ := sdk.AccAddressFromBech32(contractAddr) | ||
| return append([]byte(p), address.Bytes()...) |
There was a problem hiding this comment.
cosmos SDK uses address.MustLengthPrefix to pad the bytes so we probably want to do the same too https://github.com/sei-protocol/sei-cosmos/blob/main/x/bank/types/key.go#L58
There was a problem hiding this comment.
think only bank module uses that, other modules use plain accAddress bytes: https://github.com/sei-protocol/sei-cosmos/blob/main/x/auth/types/keys.go#L30-L37
actually err: other modules use MustLengthPrefix, only the auth module uses the plain accAddress as the prefix, I'll change this to MustLengthPrefix in this case
|
philipsu522
left a comment
There was a problem hiding this comment.
lgtm, thanks for this! Do you mind updating the title (i think there are typos)
| if err != nil { | ||
| return nil, err | ||
| } | ||
| creatorAddr, _ := sdk.AccAddressFromBech32(contract.Creator) |
There was a problem hiding this comment.
should we still handle err?
There was a problem hiding this comment.
no we can assume the creatorAddr must be a valid bech32 address (as all msgserver has validated any request's address). This is also aligned with how other cosmos native modules convert bech32 address
## Describe your changes and provide context This PR add latency and retries to occ scheduler log ## Testing performed to validate your change
## Describe your changes and provide context This PR add latency and retries to occ scheduler log ## Testing performed to validate your change
Describe your changes and provide context
Current x/dex module uses plain bech32 string instead of sdk.AccAddress bytes as the KVStore key, which is inconsistent with other cosmos native modules. This issue causes the parallelization access operators unable to identify dex module KVStore resource correctly and blocks users from defining the correct dex resource dependency.
This PR adds the following changes:
ValidateBasicin the message_ files to gate bech32 incompatible addressesTesting performed to validate your change
Unit test, e2e test
Next Steps
Discussed with @philipsu522 and @codchen, we would like to change all bech32 string used in any sei-chain custom module to sdk.AccAddress to be consistent: