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

Fix bug where amino is not supported in fswap and fbridge #1378

Merged
merged 5 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (x/server) [\#1337](https://github.com/Finschia/finschia-sdk/pull/1337) fix panic when defining minimum gas config as `100stake;100uatom`. Use a `,` delimiter instead of `;`. Fixes the server config getter to use the correct delimiter (backport cosmos/cosmos-sdk#18537)
* (x/fbridge) [\#1361](https://github.com/Finschia/finschia-sdk/pull/1361) Fixes fbridge auth checking bug
* (x/fswap) [\#1365](https://github.com/Finschia/finschia-sdk/pull/1365) fix update swap keys for possibly overlapped keys(`(hello,world) should be different to (hel,loworld)`)
* (x/fswap, x/fbridge) [\#1378](https://github.com/Finschia/finschia-sdk/pull/1378) Fix bug where amino is not supported in fswap and fbridge

### Removed

Expand Down
15 changes: 15 additions & 0 deletions client/docs/swagger-ui/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29943,6 +29943,11 @@ paths:
type: string
format: uint64
title: default period of the proposal to update the role
target_denom:
type: string
description: >-
target denom of the bridge module. This is the base denom
of Finschia normally.
default:
description: An unexpected error response
schema:
Expand Down Expand Up @@ -50463,6 +50468,11 @@ definitions:
type: string
format: uint64
title: default period of the proposal to update the role
target_denom:
type: string
description: >-
target denom of the bridge module. This is the base denom of Finschia
normally.
lbm.fbridge.v1.ProvisionData:
type: object
properties:
Expand Down Expand Up @@ -50661,6 +50671,11 @@ definitions:
type: string
format: uint64
title: default period of the proposal to update the role
target_denom:
type: string
description: >-
target denom of the bridge module. This is the base denom of
Finschia normally.
lbm.fbridge.v1.QueryProposalResponse:
type: object
properties:
Expand Down
4 changes: 2 additions & 2 deletions x/fbridge/module/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,10 @@ func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) {
}

// Deprecated: Route does nothing.
func (am AppModule) Route() sdk.Route { return sdk.NewRoute("", nil) }
func (am AppModule) Route() sdk.Route { return sdk.NewRoute(types.RouterKey, nil) }

// Deprecated: QuerierRoute does nothing.
func (am AppModule) QuerierRoute() string { return "" }
func (am AppModule) QuerierRoute() string { return types.QuerierRoute }

// Deprecated: LegacyQuerierHandler does nothing.
func (am AppModule) LegacyQuerierHandler(*codec.LegacyAmino) sdk.Querier { return nil }
Expand Down
1 change: 1 addition & 0 deletions x/fbridge/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ var (
)

func init() {
RegisterLegacyAminoCodec(Amino)
cryptocodec.RegisterCrypto(Amino)
codec.RegisterEvidences(Amino)
sdk.RegisterLegacyAminoCodec(Amino)
Expand Down
6 changes: 6 additions & 0 deletions x/fbridge/types/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ const (
// StoreKey is the store key string for fbridge
StoreKey = ModuleName

// RouterKey is the message route for fbridge
RouterKey = ModuleName

// QuerierRoute defines the module's query routing key
QuerierRoute = ModuleName

// MemStoreKey is the in-memory store key string for fbridge
MemStoreKey = "mem_" + StoreKey
)
Expand Down
120 changes: 120 additions & 0 deletions x/fbridge/types/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,102 +26,222 @@ func (m MsgUpdateParams) GetSignBytes() []byte {
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m))
}

// Type implements the LegacyMsg.Type method.
func (m MsgUpdateParams) Type() string {
return sdk.MsgTypeURL(&m)
}

// Route implements the LegacyMsg.Route method.
func (m MsgUpdateParams) Route() string {
return RouterKey
}

func (m MsgTransfer) ValidateBasic() error { return nil }

func (m MsgTransfer) GetSigners() []sdk.AccAddress {
return []sdk.AccAddress{sdk.MustAccAddressFromBech32(m.Sender)}
}

// GetSignBytes implements the LegacyMsg.GetSignBytes method.
func (m MsgTransfer) GetSignBytes() []byte {
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m))
}

// Type implements the LegacyMsg.Type method.
func (m MsgTransfer) Type() string {
return sdk.MsgTypeURL(&m)
}

// Route implements the LegacyMsg.Route method.
func (m MsgTransfer) Route() string {
return RouterKey
}

func (m MsgProvision) ValidateBasic() error { return nil }

func (m MsgProvision) GetSigners() []sdk.AccAddress {
return []sdk.AccAddress{sdk.MustAccAddressFromBech32(m.From)}
}

// GetSignBytes implements the LegacyMsg.GetSignBytes method.
func (m MsgProvision) GetSignBytes() []byte {
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m))
}

// Type implements the LegacyMsg.Type method.
func (m MsgProvision) Type() string {
return sdk.MsgTypeURL(&m)
}

// Route implements the LegacyMsg.Route method.
func (m MsgProvision) Route() string {
return RouterKey
}

func (m MsgHoldTransfer) ValidateBasic() error { return nil }

func (m MsgHoldTransfer) GetSigners() []sdk.AccAddress {
return []sdk.AccAddress{sdk.MustAccAddressFromBech32(m.From)}
}

// GetSignBytes implements the LegacyMsg.GetSignBytes method.
func (m MsgHoldTransfer) GetSignBytes() []byte {
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m))
}

// Type implements the LegacyMsg.Type method.
func (m MsgHoldTransfer) Type() string {
return sdk.MsgTypeURL(&m)
}

// Route implements the LegacyMsg.Route method.
func (m MsgHoldTransfer) Route() string {
return RouterKey
}

func (m MsgReleaseTransfer) ValidateBasic() error { return nil }

func (m MsgReleaseTransfer) GetSigners() []sdk.AccAddress {
return []sdk.AccAddress{sdk.MustAccAddressFromBech32(m.From)}
}

// GetSignBytes implements the LegacyMsg.GetSignBytes method.
func (m MsgReleaseTransfer) GetSignBytes() []byte {
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m))
}

// Type implements the LegacyMsg.Type method.
func (m MsgReleaseTransfer) Type() string {
return sdk.MsgTypeURL(&m)
}

// Route implements the LegacyMsg.Route method.
func (m MsgReleaseTransfer) Route() string {
return RouterKey
}

func (m MsgRemoveProvision) ValidateBasic() error { return nil }

func (m MsgRemoveProvision) GetSigners() []sdk.AccAddress {
return []sdk.AccAddress{sdk.MustAccAddressFromBech32(m.From)}
}

// GetSignBytes implements the LegacyMsg.GetSignBytes method.
func (m MsgRemoveProvision) GetSignBytes() []byte {
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m))
}

// Type implements the LegacyMsg.Type method.
func (m MsgRemoveProvision) Type() string {
return sdk.MsgTypeURL(&m)
}

// Route implements the LegacyMsg.Route method.
func (m MsgRemoveProvision) Route() string {
return RouterKey
}

func (m MsgClaimBatch) ValidateBasic() error { return nil }

func (m MsgClaimBatch) GetSigners() []sdk.AccAddress {
return []sdk.AccAddress{sdk.MustAccAddressFromBech32(m.From)}
}

// GetSignBytes implements the LegacyMsg.GetSignBytes method.
func (m MsgClaimBatch) GetSignBytes() []byte {
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m))
}

// Type implements the LegacyMsg.Type method.
func (m MsgClaimBatch) Type() string {
return sdk.MsgTypeURL(&m)
}

// Route implements the LegacyMsg.Route method.
func (m MsgClaimBatch) Route() string {
return RouterKey
}

func (m MsgClaim) ValidateBasic() error { return nil }

func (m MsgClaim) GetSigners() []sdk.AccAddress {
return []sdk.AccAddress{sdk.MustAccAddressFromBech32(m.From)}
}

// GetSignBytes implements the LegacyMsg.GetSignBytes method.
func (m MsgClaim) GetSignBytes() []byte {
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m))
}

// Type implements the LegacyMsg.Type method.
func (m MsgClaim) Type() string {
return sdk.MsgTypeURL(&m)
}

// Route implements the LegacyMsg.Route method.
func (m MsgClaim) Route() string {
return RouterKey
}

func (m MsgSuggestRole) ValidateBasic() error { return nil }

func (m MsgSuggestRole) GetSigners() []sdk.AccAddress {
return []sdk.AccAddress{sdk.MustAccAddressFromBech32(m.From)}
}

// GetSignBytes implements the LegacyMsg.GetSignBytes method.
func (m MsgSuggestRole) GetSignBytes() []byte {
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m))
}

// Type implements the LegacyMsg.Type method.
func (m MsgSuggestRole) Type() string {
return sdk.MsgTypeURL(&m)
}

// Route implements the LegacyMsg.Route method.
func (m MsgSuggestRole) Route() string {
return RouterKey
}

func (m MsgAddVoteForRole) ValidateBasic() error { return nil }

func (m MsgAddVoteForRole) GetSigners() []sdk.AccAddress {
return []sdk.AccAddress{sdk.MustAccAddressFromBech32(m.From)}
}

// GetSignBytes implements the LegacyMsg.GetSignBytes method.
func (m MsgAddVoteForRole) GetSignBytes() []byte {
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m))
}

// Type implements the LegacyMsg.Type method.
func (m MsgAddVoteForRole) Type() string {
return sdk.MsgTypeURL(&m)
}

// Route implements the LegacyMsg.Route method.
func (m MsgAddVoteForRole) Route() string {
return RouterKey
}

func (m MsgSetBridgeStatus) ValidateBasic() error { return nil }

func (m MsgSetBridgeStatus) GetSigners() []sdk.AccAddress {
return []sdk.AccAddress{sdk.MustAccAddressFromBech32(m.Guardian)}
}

// GetSignBytes implements the LegacyMsg.GetSignBytes method.
func (m MsgSetBridgeStatus) GetSignBytes() []byte {
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m))
}

// Type implements the LegacyMsg.Type method.
func (m MsgSetBridgeStatus) Type() string {
return sdk.MsgTypeURL(&m)
}

// Route implements the LegacyMsg.Route method.
func (m MsgSetBridgeStatus) Route() string {
return RouterKey
}
Loading
Loading