Skip to content
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

feat: add runtime Env to icacontroller and fix v0.52 e2e tests #7587

Merged
merged 34 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
346d83d
feat: adding runtime Environment
damiannolan Nov 21, 2024
29ce5f2
chore: run make lint-fix
damiannolan Nov 21, 2024
7e7d17d
chore: remove duplicate import
damiannolan Nov 21, 2024
7e2f699
chore: rm duplicate import
damiannolan Nov 22, 2024
7cb2468
chore: migrate to env KVStoreService in icacontroller
damiannolan Nov 25, 2024
cb93c24
chore: fix duplicate import
damiannolan Nov 25, 2024
f828f09
chore: rm kv store service
damiannolan Nov 25, 2024
d488054
chore: refactor events to use environment
damiannolan Nov 25, 2024
92ecec1
chore: make lint-fix
damiannolan Nov 25, 2024
4660322
chore: make tidy-all
damiannolan Nov 25, 2024
e267e42
chore: rm msg service router from icacontroller
damiannolan Nov 25, 2024
ab1f3f3
fix: remove 32 bit arm arch from callbacks ci builds
damiannolan Nov 25, 2024
8b67d8d
test: try cache false for callbacks linter
damiannolan Nov 25, 2024
e27966b
chore: pin to updated interchaintest fork
chatton Nov 26, 2024
b6fba89
chore: revert relayer count to 10
chatton Nov 26, 2024
c23234d
chore: continued work on upgrading e2e tests to 0.52
chatton Nov 26, 2024
d83116d
chore: transfer e2e passing
chatton Nov 27, 2024
82c5a66
chore: fix upgrade build errors
chatton Nov 27, 2024
06d40e4
chore: bump interchaintest
chatton Nov 27, 2024
a128c03
chore: update sample config
chatton Nov 27, 2024
55b4fbe
chore: reconfigure protoany to use gogoproto any in favour of codec t…
damiannolan Nov 27, 2024
b92bc67
chore: tidy imports in e2e
damiannolan Nov 27, 2024
f9b7314
fix: address failure in module safe query ica e2e test
damiannolan Dec 2, 2024
94a4685
bump golangci version to 1.60
Dec 2, 2024
4f37cf6
lint: remove duplicate import
damiannolan Dec 2, 2024
e24c60f
chore: use gogoprotoany in favour of codec types any. rm ProtoCodecMa…
damiannolan Dec 4, 2024
d70f0c4
chore: bump go version in Dockerfile
damiannolan Dec 4, 2024
5b89030
chore: add todo
damiannolan Dec 4, 2024
5ea5802
lint: fix unnecessary cast
damiannolan Dec 4, 2024
0e64412
deps: upgrade sdk to head of release/v0.52.x, upgrade store to latest…
damiannolan Dec 4, 2024
a0f28fc
deps: bump to head of release/v0.52
damiannolan Dec 4, 2024
785dc47
fix: add unit test to reproduce e2e test failure for ScheduleIBCUpgra…
damiannolan Dec 5, 2024
9057fcb
fix: error in tests
damiannolan Dec 5, 2024
6ad08d9
chore: address comments from pr
damiannolan Dec 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: refactor events to use environment
  • Loading branch information
damiannolan committed Nov 25, 2024
commit d48805438034ea985daf9330e9930bb2ec25dac6
Original file line number Diff line number Diff line change
Expand Up @@ -174,15 +174,15 @@ func (im IBCMiddleware) OnChanCloseConfirm(
}

// OnRecvPacket implements the IBCMiddleware interface
func (IBCMiddleware) OnRecvPacket(
func (im IBCMiddleware) OnRecvPacket(
ctx context.Context,
_ string,
packet channeltypes.Packet,
_ sdk.AccAddress,
) ibcexported.Acknowledgement {
err := errorsmod.Wrapf(icatypes.ErrInvalidChannelFlow, "cannot receive packet on controller chain")
ack := channeltypes.NewErrorAcknowledgement(err)
keeper.EmitAcknowledgementEvent(ctx, packet, ack, err)
im.keeper.EmitAcknowledgementEvent(ctx, packet, ack, err)
return ack
}

Expand Down
24 changes: 11 additions & 13 deletions modules/apps/27-interchain-accounts/controller/keeper/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import (
"context"
"strconv"

"cosmossdk.io/core/event"

sdk "github.com/cosmos/cosmos-sdk/types"

icatypes "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/types"
Expand All @@ -13,22 +15,18 @@ import (

// EmitAcknowledgementEvent emits an event signalling a successful or failed acknowledgement and including the error
// details if any.
func EmitAcknowledgementEvent(ctx context.Context, packet channeltypes.Packet, ack exported.Acknowledgement, err error) {
sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917
attributes := []sdk.Attribute{
sdk.NewAttribute(sdk.AttributeKeyModule, icatypes.ModuleName),
sdk.NewAttribute(icatypes.AttributeKeyControllerChannelID, packet.GetDestChannel()),
sdk.NewAttribute(icatypes.AttributeKeyAckSuccess, strconv.FormatBool(ack.Success())),
func (k *Keeper) EmitAcknowledgementEvent(ctx context.Context, packet channeltypes.Packet, ack exported.Acknowledgement, err error) {
attributes := []event.Attribute{
event.NewAttribute(sdk.AttributeKeyModule, icatypes.ModuleName),
event.NewAttribute(icatypes.AttributeKeyControllerChannelID, packet.GetDestChannel()),
event.NewAttribute(icatypes.AttributeKeyAckSuccess, strconv.FormatBool(ack.Success())),
}

if err != nil {
attributes = append(attributes, sdk.NewAttribute(icatypes.AttributeKeyAckError, err.Error()))
attributes = append(attributes, event.NewAttribute(icatypes.AttributeKeyAckError, err.Error()))
}

sdkCtx.EventManager().EmitEvent(
sdk.NewEvent(
icatypes.EventTypePacket,
attributes...,
),
)
if err := k.EventService.EventManager(ctx).EmitKV(icatypes.EventTypePacket, attributes...); err != nil {
panic(err)
}
Comment on lines +29 to +31
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This error should be propagated and returned from this func.

The likelihood of these errors surfacing from EventManager are pretty much zero, but at some point in a future far away it may be possible for it to error - given a different impl of event service.

None the less, its good practise to actually return the errors and not panic and rely on grpc recovery interceptor

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it have a todo comment for that, then?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}
Loading