-
Notifications
You must be signed in to change notification settings - Fork 9
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
Conversation
Hello, I have two questions.
|
From this pr (#118 ), custom querier has been disabled.
This pr looks like only filter fswap/fbridge in submessage not all messages. Is it correct?
@da1suk8 But we haven't opened our original modules' Stargate Querier yet. If we remove this PR, can the tests still pass? |
This PR prevents the use of fbridge and fswap within submessages, not in all messages. |
Sorry I didn't quite understand, please explain it again. |
thank you for your reply. The querier's Custom has been changed to not handle, but what I'm wondering about is the submessage's Custom. |
I'm worried about whether this is the right place to implement it. |
To clarify my understanding, in the context of a Submessage, Does this mean that |
This is my opinion. But it doesn't seem to be a problem at the moment, so you can skip it. |
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.
wasmd/x/wasm/keeper/handler_plugin.go
Lines 84 to 107 in a348dc5
func (h SDKMessageHandler) handleSdkMessage(ctx sdk.Context, contractAddr sdk.Address, msg sdk.Msg) (*sdk.Result, error) { | |
if err := msg.ValidateBasic(); err != nil { | |
return nil, err | |
} | |
// make sure this account can send it | |
for _, acct := range msg.GetSigners() { | |
if !acct.Equals(contractAddr) { | |
return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "contract doesn't have permission") | |
} | |
} | |
// find the handler and execute it | |
if handler := h.router.Handler(msg); handler != nil { | |
// ADR 031 request type routing | |
msgResult, err := handler(ctx, msg) | |
return msgResult, err | |
} | |
// legacy sdk.Msg routing | |
// Assuming that the app developer has migrated all their Msgs to | |
// proto messages and has registered all `Msg services`, then this | |
// path should never be called, because all those Msgs should be | |
// registered within the `msgServiceRouter` already. | |
return nil, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "can't route message %+v", msg) | |
} |
Is there any case where it's executed through here?
I will handle another PR |
The relevant functions are executed in the order of 1, 2, 3, as shown below. Therefore, this PR is sufficient.
|
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 changes is not need, I added another PR to do same feature in finschia witouth this wasmd change. Finschia/finschia#352
Closed via Finschia/finschia#352 |
Description
This PR implements a filtering mechanism for specific message types within Submessages.
Specifically, messages related to
fswap
andfbridge
are targeted by this filter, and any attempts to execute operations based on these message types will result in an error.FYI: Finschia/finschia-sdk#1336, Finschia/finschia-sdk#1340
Motivation and context
How has this been tested?
Screenshots (if appropriate):
Checklist:
CHANGELOG.md
client/docs/swagger-ui/swagger.yaml