-
Notifications
You must be signed in to change notification settings - Fork 54
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: only allow whitelisted relayer account to send IBC relayer messages #614
fix: only allow whitelisted relayer account to send IBC relayer messages #614
Conversation
@omritoptix we wanted whitelisted to allow client creation |
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.
as discussed we should reject mixed messages which contains IBC messages
yea true but don't think it's worth extra effort. mostly thought it's gonna reduce work. |
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.
great job!
small nits.
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.
Couple small code things.
Biggest question is if this breaks actual IBC gov props. Does it?
msgs, err = n.getAllFinalMsgs(ctx, msgs, 0) | ||
if err != nil { | ||
// This error is not critical; just log and fall into the default fee handling | ||
ctx.Logger().With("module", "BypassIBCFeeDecorator", "err", err). | ||
Error("Failed to check if the tx is from the whitelisted relayer") | ||
return ctx, err | ||
} | ||
if whitelisted { | ||
// The tx is from the whitelisted relayer, so it's eligible for the fee exemption | ||
return next(ctx, tx, simulate) | ||
|
||
totalMsgs := len(msgs) | ||
ibcCount := countIBCMsgs(msgs) | ||
|
||
if ibcCount == totalMsgs { | ||
// all are IBC messages | ||
ibcWhitelisted, err := n.isIBCWhitelistedRelayer(ctx, msgs) | ||
if err != nil { | ||
return ctx, err | ||
} | ||
if ibcWhitelisted { | ||
return next(ctx, tx, simulate) | ||
} | ||
return ctx, fmt.Errorf("not all signers whitelisted") | ||
} else if ibcCount > 0 { | ||
// mixed: some IBC and some non-IBC | ||
return ctx, fmt.Errorf("mixed IBC and non-IBC messages in the same transaction not allowed") | ||
} |
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.
Are you sure this is gonna let IBC gov proposals work as normal?
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.
if a governance proposal includes IBC messages and the signer is not whitelisted, the code will reject the transaction
…telisted-accs-from-creating-ibc-client
Description
Closes #615
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow-up issues.
PR review checkboxes:
I have...
Unreleased
section inCHANGELOG.md
godoc
commentsSDK Checklist
map
time.Now()
sendCoin
and notSendCoins
Full security checklist here
For Reviewer:
After reviewer approval: