Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/go_modules/golang.org/x/text-0.11.0
Browse files Browse the repository at this point in the history
  • Loading branch information
iramiller committed Jul 13, 2023
2 parents 947efee + cf2b2c2 commit 4814626
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 39 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
### Improvements

* Update ibcnet ports so they don't conflict with host machine. [#1622](https://github.com/provenance-io/provenance/issues/1622)
* Replace custom ibc-go v6.1.1 fork with official module. [#1616](https://github.com/provenance-io/provenance/issues/1616)

### Bug Fixes

Expand Down
2 changes: 1 addition & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ func New(
)

app.MarkerKeeper = markerkeeper.NewKeeper(
appCodec, keys[markertypes.StoreKey], app.GetSubspace(markertypes.ModuleName), app.AccountKeeper, app.BankKeeper, app.AuthzKeeper, app.FeeGrantKeeper, app.TransferKeeper, app.AttributeKeeper, app.NameKeeper,
appCodec, keys[markertypes.StoreKey], app.GetSubspace(markertypes.ModuleName), app.AccountKeeper, app.BankKeeper, app.AuthzKeeper, app.FeeGrantKeeper, app.AttributeKeeper, app.NameKeeper, app.TransferKeeper,
)

pioMessageRouter := MessageRouterFunc(func(msg sdk.Msg) baseapp.MsgServiceHandler {
Expand Down
3 changes: 0 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,3 @@ replace github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.7.0

// TODO: This is also required for https://github.com/provenance-io/provenance/issues/1414
replace github.com/CosmWasm/wasmd => github.com/provenance-io/wasmd v0.30.0-pio-5

// TODO: Required for IBC Transfer Module. Remove this when they patch it to include our changes. https://github.com/provenance-io/provenance/issues/1100
replace github.com/cosmos/ibc-go/v6 => github.com/provenance-io/ibc-go/v6 v6.1.1-pio-1
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,8 @@ github.com/cosmos/gorocksdb v1.2.0 h1:d0l3jJG8M4hBouIZq0mDUHZ+zjOx044J3nGRskwTb4
github.com/cosmos/gorocksdb v1.2.0/go.mod h1:aaKvKItm514hKfNJpUJXnnOWeBnk2GL4+Qw9NHizILw=
github.com/cosmos/iavl v0.19.6 h1:XY78yEeNPrEYyNCKlqr9chrwoeSDJ0bV2VjocTk//OU=
github.com/cosmos/iavl v0.19.6/go.mod h1:X9PKD3J0iFxdmgNLa7b2LYWdsGd90ToV5cAONApkEPw=
github.com/cosmos/ibc-go/v6 v6.1.1 h1:oqqMNyjj6SLQF8rvgCaDGwfdITEIsbhs8F77/8xvRIo=
github.com/cosmos/ibc-go/v6 v6.1.1/go.mod h1:NL17FpFAaWjRFVb1T7LUKuOoMSsATPpu+Icc4zL5/Ik=
github.com/cosmos/interchain-accounts v0.4.2 h1:BxdzY22uouwe9wGK7h/HbzPNIH89JJ/4+V6n02l3cG4=
github.com/cosmos/keyring v1.2.0 h1:8C1lBP9xhImmIabyXW4c3vFjjLiBdGCmfLUfeZlV1Yo=
github.com/cosmos/keyring v1.2.0/go.mod h1:fc+wB5KTk9wQ9sDx0kFXB3A0MaeGHM9AwRStKOQ5vOA=
Expand Down Expand Up @@ -1005,8 +1007,6 @@ github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
github.com/provenance-io/cosmos-sdk v0.46.13-pio-1 h1:kkF1cRulmJS6uAbILsoZSb2qaUnPgBg8yR6cr9rk9YY=
github.com/provenance-io/cosmos-sdk v0.46.13-pio-1/go.mod h1:H7JTxq/UEPvM/LSs5bNYvMwmZlVl2NBT5UlqNe8tjEU=
github.com/provenance-io/ibc-go/v6 v6.1.1-pio-1 h1:jeNhAAkH7wxi0jnVo/vLtlaURU9ghCITiGF0Jzqjf7o=
github.com/provenance-io/ibc-go/v6 v6.1.1-pio-1/go.mod h1:NL17FpFAaWjRFVb1T7LUKuOoMSsATPpu+Icc4zL5/Ik=
github.com/provenance-io/wasmd v0.30.0-pio-5 h1:SNEZDiCC4LJdcLpINhhz5Jf0zddIQ76QIwScy4uxebM=
github.com/provenance-io/wasmd v0.30.0-pio-5/go.mod h1:z03r/MHY9N+sO95lxNPiOlg4XMqE/rdeyBjYX54CT8o=
github.com/rakyll/statik v0.1.7 h1:OF3QCZUuyPxuGEP7B4ypUa7sB/iHtqOTDYZXGM8KOdQ=
Expand Down
10 changes: 5 additions & 5 deletions x/marker/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
ibckeeper "github.com/cosmos/ibc-go/v6/modules/apps/transfer/keeper"
ibctypes "github.com/cosmos/ibc-go/v6/modules/apps/transfer/types"

"github.com/provenance-io/provenance/x/marker/types"
Expand Down Expand Up @@ -58,8 +57,6 @@ type Keeper struct {
// To pass through grant creation for callers with admin access on a marker.
feegrantKeeper types.FeeGrantKeeper

ibcKeeper ibckeeper.Keeper

// To access attributes for addresses
attrKeeper types.AttrKeeper
// To access names and normalize required attributes
Expand All @@ -77,6 +74,9 @@ type Keeper struct {
markerModuleAddr sdk.AccAddress

ibcTransferModuleAddr sdk.AccAddress

// Used to transfer the ibc marker
ibcTransferServer types.IbcTransferMsgServer
}

// NewKeeper returns a marker keeper. It handles:
Expand All @@ -92,9 +92,9 @@ func NewKeeper(
bankKeeper types.BankKeeper,
authzKeeper types.AuthzKeeper,
feegrantKeeper types.FeeGrantKeeper,
ibcKeeper ibckeeper.Keeper,
attrKeeper types.AttrKeeper,
nameKeeper types.NameKeeper,
ibcTransferServer types.IbcTransferMsgServer,
) Keeper {
if !paramSpace.HasKeyTable() {
paramSpace = paramSpace.WithKeyTable(types.ParamKeyTable())
Expand All @@ -106,14 +106,14 @@ func NewKeeper(
authzKeeper: authzKeeper,
bankKeeper: bankKeeper,
feegrantKeeper: feegrantKeeper,
ibcKeeper: ibcKeeper,
attrKeeper: attrKeeper,
nameKeeper: nameKeeper,
storeKey: key,
cdc: cdc,
authority: authtypes.NewModuleAddress(govtypes.ModuleName).String(),
markerModuleAddr: authtypes.NewModuleAddress(types.CoinPoolName),
ibcTransferModuleAddr: authtypes.NewModuleAddress(ibctypes.ModuleName),
ibcTransferServer: ibcTransferServer,
}
bankKeeper.AppendSendRestriction(rv.SendRestrictionFn)
return rv
Expand Down
19 changes: 6 additions & 13 deletions x/marker/keeper/marker.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"github.com/cosmos/cosmos-sdk/telemetry"
sdk "github.com/cosmos/cosmos-sdk/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
ibckeeper "github.com/cosmos/ibc-go/v6/modules/apps/transfer/keeper"
ibctypes "github.com/cosmos/ibc-go/v6/modules/apps/transfer/types"
clienttypes "github.com/cosmos/ibc-go/v6/modules/core/02-client/types"

Expand Down Expand Up @@ -672,7 +671,6 @@ func (k Keeper) IbcTransferCoin(
timeoutHeight clienttypes.Height,
timeoutTimestamp uint64,
memo string,
checkRestrictionsHandler ibckeeper.CheckRestrictionsHandler,
) error {
m, err := k.GetMarkerByDenom(ctx, token.Denom)
if err != nil {
Expand Down Expand Up @@ -705,18 +703,13 @@ func (k Keeper) IbcTransferCoin(
k.SetMarker(ctx, m)
}

_, err = k.ibcKeeper.SendTransfer(
types.WithBypass(ctx),
sourcePort,
sourceChannel,
token,
sender,
receiver,
timeoutHeight,
timeoutTimestamp,
memo,
checkRestrictionsHandler,
msg := ibctypes.NewMsgTransfer(
sourcePort, sourceChannel, token, sender.String(), receiver, timeoutHeight, timeoutTimestamp, memo,
)
if validationErr := msg.ValidateBasic(); validationErr != nil {
return validationErr
}
_, err = k.ibcTransferServer.Transfer(types.WithBypass(ctx), msg)
if err != nil {
return err
}
Expand Down
14 changes: 1 addition & 13 deletions x/marker/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ import (
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
ibckeeper "github.com/cosmos/ibc-go/v6/modules/apps/transfer/keeper"
ibctypes "github.com/cosmos/ibc-go/v6/modules/apps/transfer/types"

"github.com/provenance-io/provenance/x/marker/types"
)
Expand Down Expand Up @@ -485,17 +483,7 @@ func (k msgServer) IbcTransfer(goCtx context.Context, msg *types.MsgIbcTransferR
return nil, err
}

err = k.IbcTransferCoin(ctx, msg.Transfer.SourcePort, msg.Transfer.SourceChannel, msg.Transfer.Token, from, admin, msg.Transfer.Receiver, msg.Transfer.TimeoutHeight, msg.Transfer.TimeoutTimestamp, msg.Transfer.Memo, func(ctx sdk.Context, ibcKeeper ibckeeper.Keeper, sender sdk.AccAddress, token sdk.Coin) (canTransfer bool, err error) {
if !ibcKeeper.GetSendEnabled(ctx) {
return false, ibctypes.ErrSendDisabled
}

if ibcKeeper.BankKeeper.BlockedAddr(sender) {
return false, sdkerrors.ErrUnauthorized.Wrapf("%s is not allowed to send funds", sender)
}

return true, nil
})
err = k.IbcTransferCoin(ctx, msg.Transfer.SourcePort, msg.Transfer.SourceChannel, msg.Transfer.Token, from, admin, msg.Transfer.Receiver, msg.Transfer.TimeoutHeight, msg.Transfer.TimeoutTimestamp, msg.Transfer.Memo)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion x/marker/keeper/proposal_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type IntegrationTestSuite struct {
func (s *IntegrationTestSuite) SetupSuite() {
s.app = provenance.Setup(s.T())
s.ctx = s.app.BaseApp.NewContext(false, tmproto.Header{})
s.k = markerkeeper.NewKeeper(s.app.AppCodec(), s.app.GetKey(markertypes.ModuleName), s.app.GetSubspace(markertypes.ModuleName), s.app.AccountKeeper, s.app.BankKeeper, s.app.AuthzKeeper, s.app.FeeGrantKeeper, s.app.TransferKeeper, s.app.AttributeKeeper, s.app.NameKeeper)
s.k = markerkeeper.NewKeeper(s.app.AppCodec(), s.app.GetKey(markertypes.ModuleName), s.app.GetSubspace(markertypes.ModuleName), s.app.AccountKeeper, s.app.BankKeeper, s.app.AuthzKeeper, s.app.FeeGrantKeeper, s.app.AttributeKeeper, s.app.NameKeeper, s.app.TransferKeeper)
s.accountAddr = sdk.AccAddress(secp256k1.GenPrivKey().PubKey().Address())
}

Expand Down
2 changes: 1 addition & 1 deletion x/marker/simulation/proposals_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ func TestProposalContents(t *testing.T) {
app.BankKeeper,
app.AuthzKeeper,
app.FeeGrantKeeper,
app.TransferKeeper,
app.AttributeKeeper,
app.NameKeeper,
app.TransferKeeper,
),
)
require.Len(t, weightedProposalContent, 6)
Expand Down
6 changes: 6 additions & 0 deletions x/marker/types/expected_keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/cosmos/cosmos-sdk/x/feegrant"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
transfertypes "github.com/cosmos/ibc-go/v6/modules/apps/transfer/types"

attrtypes "github.com/provenance-io/provenance/x/attribute/types"
)
Expand Down Expand Up @@ -91,3 +92,8 @@ type GovKeeper interface {
GetVotingParams(ctx sdk.Context) govtypes.VotingParams
GetProposalID(ctx sdk.Context) (uint64, error)
}

// IbcTransferMsgServer defines the message server functionality needed by the marker module.
type IbcTransferMsgServer interface {
Transfer(goCtx context.Context, msg *transfertypes.MsgTransfer) (*transfertypes.MsgTransferResponse, error)
}

0 comments on commit 4814626

Please sign in to comment.