-
Notifications
You must be signed in to change notification settings - Fork 143
Feat: tf pull upstream #913
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
Changes from 4 commits
6d62891
a1fbf12
94019c1
46066f3
84aab20
3b16da0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,7 @@ import ( | |
| "context" | ||
| "encoding/json" | ||
|
|
||
| types2 "cosmossdk.io/store/types" | ||
| storetypes "cosmossdk.io/store/types" | ||
| sdk "github.com/cosmos/cosmos-sdk/types" | ||
|
|
||
| "github.com/neutron-org/neutron/v7/x/tokenfactory/types" | ||
|
|
@@ -108,7 +108,7 @@ func (k Keeper) callBeforeSendListener(ctx context.Context, from, to sdk.AccAddr | |
|
|
||
| defer func() { | ||
| if r := recover(); r != nil { | ||
| err = types.ErrTrackBeforeSendOutOfGas | ||
| err = errorsmod.Wrapf(types.ErrBeforeSendHookOutOfGas, "%v", r) | ||
| } | ||
| }() | ||
|
|
||
|
|
@@ -163,22 +163,16 @@ func (k Keeper) callBeforeSendListener(ctx context.Context, from, to sdk.AccAddr | |
| return err | ||
| } | ||
|
|
||
| // if its track before send, apply gas meter to prevent infinite loop | ||
| if blockBeforeSend { | ||
| _, err = k.contractKeeper.Sudo(c, cwAddr, msgBz) | ||
| if err != nil { | ||
| return errorsmod.Wrapf(err, "failed to call before send hook for denom %s", coin.Denom) | ||
| } | ||
| } else { | ||
| childCtx := c.WithGasMeter(types2.NewGasMeter(types.TrackBeforeSendGasLimit)) | ||
| _, err = k.contractKeeper.Sudo(childCtx, cwAddr, msgBz) | ||
| if err != nil { | ||
| return errorsmod.Wrapf(err, "failed to call before send hook for denom %s", coin.Denom) | ||
| } | ||
| em := sdk.NewEventManager() | ||
|
|
||
| // consume gas used for calling contract to the parent ctx | ||
| c.GasMeter().ConsumeGas(childCtx.GasMeter().GasConsumed(), "track before send gas") | ||
| childCtx := c.WithGasMeter(storetypes.NewGasMeter(types.BeforeSendHookGasLimit)) | ||
| _, err = k.contractKeeper.Sudo(childCtx.WithEventManager(em), cwAddr, msgBz) | ||
|
||
| if err != nil { | ||
| return errorsmod.Wrapf(err, "failed to call before send hook for denom %s", coin.Denom) | ||
| } | ||
|
|
||
| // consume gas used for calling contract to the parent ctx | ||
| c.GasMeter().ConsumeGas(childCtx.GasMeter().GasConsumed(), "track before send gas") | ||
NeverHappened marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
| } | ||
| return nil | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.