Skip to content

Commit

Permalink
Handle ReplySuccess + ReplyError properly
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanfrey committed Apr 12, 2021
1 parent 1bec925 commit 42ca87d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions x/wasm/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,15 @@ func (k Keeper) dispatchSubmessages(ctx sdk.Context, contractAddr sdk.AccAddress
}
// on failure, revert state from sandbox, and ignore events (just skip doing the above)

// we only callback if requested. Short-circuit here the two cases we don't want to
if msg.ReplyOn == wasmvmtypes.ReplySuccess && err != nil {
return err
}
if msg.ReplyOn == wasmvmtypes.ReplyError && err == nil {
return nil
}

// otherwise, we create a SubcallResult and pass it into the calling contract
var result wasmvmtypes.SubcallResult
if err == nil {
// just take the first one for now if there are multiple sub-sdk messages
Expand Down

0 comments on commit 42ca87d

Please sign in to comment.