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

feat: prevent fswap and fbridge module in Submessages #123

Closed
wants to merge 5 commits into from
Closed
Changes from 1 commit
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
10 changes: 7 additions & 3 deletions x/wasm/keeper/msg_dispatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,13 @@ func (d MessageDispatcher) DispatchSubmessages(ctx sdk.Context, contractAddr sdk

// Prevent the use of fswap and fbridge module in Submessages
// https://github.com/Finschia/finschia-sdk/pull/1336, https://github.com/Finschia/finschia-sdk/pull/1340
if stargateMsg := msg.Msg.Stargate; stargateMsg != nil &&
(strings.Contains(stargateMsg.TypeURL, "lbm.fswap.v1") || strings.Contains(stargateMsg.TypeURL, "lbm.fbridge.v1")) {
return nil, sdkerrors.Wrap(types.ErrUnsupportedForContract, "fswap and fbridge not supported of Stargate")
if stargateMsg := msg.Msg.Stargate; stargateMsg != nil {
if strings.HasPrefix(stargateMsg.TypeURL, "/lbm.fswap.v1") {
return nil, sdkerrors.Wrap(types.ErrUnsupportedForContract, "fswap not supported of Stargate")
}
if strings.HasPrefix(stargateMsg.TypeURL, "/lbm.fbridge.v1") {
return nil, sdkerrors.Wrap(types.ErrUnsupportedForContract, "fbridge not supported of Stargate")
loloicci marked this conversation as resolved.
Show resolved Hide resolved
}
}

switch msg.ReplyOn {
Expand Down
Loading