Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 4878528

Browse files
authoredJun 4, 2024··
Merge branch 'main' into hoa/fix-lint
2 parents 62f4f60 + c267104 commit 4878528

File tree

12 files changed

+24
-16
lines changed

12 files changed

+24
-16
lines changed
 

‎docs/architecture/adr-008-app-caller-cbs.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,9 @@ type CallbacksCompatibleModule interface {
9494
// request the packet data to be unmarshaled by the base application.
9595
type PacketDataUnmarshaler interface {
9696
// UnmarshalPacketData unmarshals the packet data into a concrete type
97-
UnmarshalPacketData([]byte) (interface{}, error)
97+
// ctx, portID, channelID are provided as arguments, so that (if needed)
98+
// the packet data can be unmarshaled based on the channel version.
99+
UnmarshalPacketData(ctx sdk.Context, portID, channelID string, bz []byte) (interface{}, error)
98100
}
99101
```
100102

‎docs/docs/01-ibc/03-apps/02-ibcmodule.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -371,8 +371,10 @@ The `PacketDataUnmarshaler` interface is defined as follows:
371371
// PacketDataUnmarshaler defines an optional interface which allows a middleware to
372372
// request the packet data to be unmarshaled by the base application.
373373
type PacketDataUnmarshaler interface {
374-
// UnmarshalPacketData unmarshals the packet data into a concrete type
375-
UnmarshalPacketData([]byte) (interface{}, error)
374+
// UnmarshalPacketData unmarshals the packet data into a concrete type
375+
// ctx, portID, channelID are provided as arguments, so that (if needed)
376+
// the packet data can be unmarshaled based on the channel version.
377+
UnmarshalPacketData(ctx sdk.Context, portID, channelID string, bz []byte) (interface{}, error)
376378
}
377379
```
378380

‎docs/docs/04-middleware/02-callbacks/03-interfaces.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ The callbacks middleware requires certain interfaces to be implemented by the un
1818
// request the packet data to be unmarshaled by the base application.
1919
type PacketDataUnmarshaler interface {
2020
// UnmarshalPacketData unmarshals the packet data into a concrete type
21-
UnmarshalPacketData([]byte) (interface{}, error)
21+
// ctx, portID, channelID are provided as arguments, so that (if needed)
22+
// the packet data can be unmarshaled based on the channel version.
23+
UnmarshalPacketData(ctx sdk.Context, portID, channelID string, bz []byte) (interface{}, error)
2224
}
2325
```
2426

‎e2e/tests/transfer/base_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ type TransferTestSuite struct {
3333
testsuite.E2ETestSuite
3434
}
3535

36-
// QueryTransferSendEnabledParam queries the on-chain send enabled param for the transfer module
36+
// QueryTransferParams queries the on-chain send enabled param for the transfer module
3737
func (s *TransferTestSuite) QueryTransferParams(ctx context.Context, chain ibc.Chain) transfertypes.Params {
3838
res, err := query.GRPCQuery[transfertypes.QueryParamsResponse](ctx, chain, &transfertypes.QueryParamsRequest{})
3939
s.Require().NoError(err)

‎modules/apps/callbacks/ica_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ func (s *CallbacksTestSuite) ExecuteICATx(icaAddress, memo string) {
162162
s.Require().NoError(err)
163163
}
164164

165-
// ExecuteICATx sends and times out an ICA tx
165+
// ExecuteICATimeout sends and times out an ICA tx
166166
func (s *CallbacksTestSuite) ExecuteICATimeout(icaAddress, memo string) {
167167
relativeTimeout := uint64(1)
168168
icaOwner := s.chainA.SenderAccount.GetAddress().String()

‎modules/apps/callbacks/testing/simapp/app.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -949,7 +949,7 @@ func (app *SimApp) GetKey(storeKey string) *storetypes.KVStoreKey {
949949

950950
// GetStoreKeys returns all the stored store keys.
951951
func (app *SimApp) GetStoreKeys() []storetypes.StoreKey {
952-
keys := make([]storetypes.StoreKey, len(app.keys))
952+
keys := make([]storetypes.StoreKey, 0, len(app.keys))
953953
for _, key := range app.keys {
954954
keys = append(keys, key)
955955
}

‎modules/apps/callbacks/testing/simapp/contract_keeper.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ func (k ContractKeeper) GetStateEntryCounter(ctx sdk.Context) uint8 {
100100
return bz[0]
101101
}
102102

103-
// IncrementStatefulCounter increments the stateful callback counter in state.
103+
// IncrementStateEntryCounter increments the stateful callback counter in state.
104104
func (k ContractKeeper) IncrementStateEntryCounter(ctx sdk.Context) {
105105
count := k.GetStateEntryCounter(ctx)
106106
k.SetStateEntryCounter(ctx, count+1)

‎modules/apps/transfer/keeper/relay.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -322,15 +322,15 @@ func (k Keeper) OnRecvPacket(ctx sdk.Context, packet channeltypes.Packet, data t
322322
// OnAcknowledgementPacket responds to the success or failure of a packet
323323
// acknowledgement written on the receiving chain. If the acknowledgement
324324
// was a success then nothing occurs. If the acknowledgement failed, then
325-
// the sender is refunded their tokens using the refundPacketToken function.
325+
// the sender is refunded their tokens using the refundPacketTokens function.
326326
func (k Keeper) OnAcknowledgementPacket(ctx sdk.Context, packet channeltypes.Packet, data types.FungibleTokenPacketDataV2, ack channeltypes.Acknowledgement) error {
327327
switch ack.Response.(type) {
328328
case *channeltypes.Acknowledgement_Result:
329329
// the acknowledgement succeeded on the receiving chain so nothing
330330
// needs to be executed and no error needs to be returned
331331
return nil
332332
case *channeltypes.Acknowledgement_Error:
333-
return k.refundPacketToken(ctx, packet, data)
333+
return k.refundPacketTokens(ctx, packet, data)
334334
default:
335335
return errorsmod.Wrapf(ibcerrors.ErrInvalidType, "expected one of [%T, %T], got %T", channeltypes.Acknowledgement_Result{}, channeltypes.Acknowledgement_Error{}, ack.Response)
336336
}
@@ -339,14 +339,14 @@ func (k Keeper) OnAcknowledgementPacket(ctx sdk.Context, packet channeltypes.Pac
339339
// OnTimeoutPacket refunds the sender since the original packet sent was
340340
// never received and has been timed out.
341341
func (k Keeper) OnTimeoutPacket(ctx sdk.Context, packet channeltypes.Packet, data types.FungibleTokenPacketDataV2) error {
342-
return k.refundPacketToken(ctx, packet, data)
342+
return k.refundPacketTokens(ctx, packet, data)
343343
}
344344

345-
// refundPacketToken will unescrow and send back the tokens back to sender
345+
// refundPacketTokens will unescrow and send back the tokens back to sender
346346
// if the sending chain was the source chain. Otherwise, the sent tokens
347347
// were burnt in the original send so new tokens are minted and sent to
348348
// the sending address.
349-
func (k Keeper) refundPacketToken(ctx sdk.Context, packet channeltypes.Packet, data types.FungibleTokenPacketDataV2) error {
349+
func (k Keeper) refundPacketTokens(ctx sdk.Context, packet channeltypes.Packet, data types.FungibleTokenPacketDataV2) error {
350350
// NOTE: packet data type already checked in handler.go
351351

352352
for _, token := range data.Tokens {

‎modules/capability/simulation/genesis_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func TestRandomizedGenState(t *testing.T) {
4545
require.Len(t, capGenesis.Owners, 0)
4646
}
4747

48-
// TestRandomizedGenState tests abnormal scenarios of applying RandomizedGenState.
48+
// TestRandomizedGenState1 tests abnormal scenarios of applying RandomizedGenState.
4949
func TestRandomizedGenState1(t *testing.T) {
5050
interfaceRegistry := codectypes.NewInterfaceRegistry()
5151
cdc := codec.NewProtoCodec(interfaceRegistry)

‎modules/core/05-port/types/module.go

+2
Original file line numberDiff line numberDiff line change
@@ -194,5 +194,7 @@ type Middleware interface {
194194
// request the packet data to be unmarshaled by the base application.
195195
type PacketDataUnmarshaler interface {
196196
// UnmarshalPacketData unmarshals the packet data into a concrete type
197+
// ctx, portID, channelID are provided as arguments, so that (if needed)
198+
// the packet data can be unmarshaled based on the channel version.
197199
UnmarshalPacketData(ctx sdk.Context, portID, channelID string, bz []byte) (interface{}, error)
198200
}

‎modules/light-clients/08-wasm/testing/simapp/app.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -999,7 +999,7 @@ func (app *SimApp) GetKey(storeKey string) *storetypes.KVStoreKey {
999999

10001000
// GetStoreKeys returns all the stored store keys.
10011001
func (app *SimApp) GetStoreKeys() []storetypes.StoreKey {
1002-
keys := make([]storetypes.StoreKey, len(app.keys))
1002+
keys := make([]storetypes.StoreKey, 0, len(app.keys))
10031003
for _, key := range app.keys {
10041004
keys = append(keys, key)
10051005
}

‎testing/simapp/app.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -934,7 +934,7 @@ func (app *SimApp) GetKey(storeKey string) *storetypes.KVStoreKey {
934934

935935
// GetStoreKeys returns all the stored store keys.
936936
func (app *SimApp) GetStoreKeys() []storetypes.StoreKey {
937-
keys := make([]storetypes.StoreKey, len(app.keys))
937+
keys := make([]storetypes.StoreKey, 0, len(app.keys))
938938
for _, key := range app.keys {
939939
keys = append(keys, key)
940940
}

0 commit comments

Comments
 (0)
Please sign in to comment.