-
Notifications
You must be signed in to change notification settings - Fork 341
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
Danwt/research 441 sketch genesis simulation tx #1549
base: main
Are you sure you want to change the base?
Conversation
type validator struct { | ||
rollapp GenesisBridgeData // what the rollapp sent over IBC | ||
hub types.GenesisInfo // what the rollapp thinks is correct | ||
channelID string // can use "channel-0" in simulation | ||
rollappID string // the actual rollapp ID | ||
} |
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 will do as much validation as I think is practical
err = w.ValidateGenesisBridge(ra, genesisBridgeData.GenesisInfo) | ||
actionItems, err := v.validateAndGetActionItems() | ||
if err != nil { | ||
l.Error("Validate genesis info.", "err", err) | ||
return uevent.NewErrorAcknowledgement(ctx, errorsmod.Wrap(err, "validate genesis info")) | ||
return uevent.NewErrorAcknowledgement(ctx, errorsmod.Wrap(err, "validate and get actionable data")) | ||
} |
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 does the bulk of validation
w.transferKeeper.SetDenomTrace(ctx, actionItems.trace) | ||
if err := w.denomKeeper.CreateDenomMetadata(ctx, actionItems.bankMeta); err != nil { | ||
return uevent.NewErrorAcknowledgement(ctx, errorsmod.Wrap(err, "create denom metadata")) | ||
} | ||
|
||
// validate and handle the genesis transfer | ||
err = w.handleGenesisTransfer(ctx, *ra, packet, genesisBridgeData.GenesisTransfer) | ||
if err != nil { | ||
l.Error("Handle genesis transfer.", "err", err) | ||
if err := w.transferKeeper.OnRecvPacket(ctx, packet, actionItems.fungiDatas[0]); err != nil { | ||
return uevent.NewErrorAcknowledgement(ctx, errorsmod.Wrap(err, "handle genesis transfer")) | ||
} | ||
for _, data := range actionItems.fungiDatas { | ||
if err := w.transferKeeper.OnRecvPacket(ctx, packet, data); err != nil { | ||
return uevent.NewErrorAcknowledgement(ctx, errorsmod.Wrap(err, "handle genesis transfer")) | ||
} | ||
} |
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.
Here, we still have three points of failure, even after validation
- Set denom trace in transfer keeper
- Recv the packet(s) downstream
- Create the metadata in denom keeper
It would be hard to simulate these because they need the real channel and packet. But given that we do so much validation beforehand, it might be a good practical solution
} | ||
|
||
// validate genesis info against the expected data set on the rollapp | ||
err = w.ValidateGenesisBridge(ra, genesisBridgeData.GenesisInfo) | ||
actionItems, err := v.validateAndGetActionItems() |
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.
We call this in two places
- In a query that dymint will call
- here
Description
Closes #XXX
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: