From 0d9910fc7ec62b29d4df05bdc050c087b574c8ac Mon Sep 17 00:00:00 2001 From: beer-1 <147697694+beer-1@users.noreply.github.com> Date: Tue, 12 Dec 2023 20:17:31 +0900 Subject: [PATCH 1/2] directly emit move hook error --- x/move/ibc-middleware/util.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/x/move/ibc-middleware/util.go b/x/move/ibc-middleware/util.go index 0ceb3820..76e05ef9 100644 --- a/x/move/ibc-middleware/util.go +++ b/x/move/ibc-middleware/util.go @@ -112,5 +112,9 @@ func newEmitErrorAcknowledgement(ctx sdk.Context, err error, errorContexts ...st ), }) - return channeltypes.NewErrorAcknowledgement(err) + return channeltypes.Acknowledgement{ + Response: &channeltypes.Acknowledgement_Error{ + Error: fmt.Sprintf("move hook error: %s", err.Error()), + }, + } } From 4b86d7a968c345ec9f21b06b5fcc8e7192624f88 Mon Sep 17 00:00:00 2001 From: beer-1 <147697694+beer-1@users.noreply.github.com> Date: Tue, 12 Dec 2023 20:19:54 +0900 Subject: [PATCH 2/2] clear error message --- x/move/ibc-middleware/util.go | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/x/move/ibc-middleware/util.go b/x/move/ibc-middleware/util.go index 76e05ef9..503dda87 100644 --- a/x/move/ibc-middleware/util.go +++ b/x/move/ibc-middleware/util.go @@ -98,23 +98,10 @@ func jsonStringHasKey(memo, key string) (found bool, jsonObject map[string]inter // newEmitErrorAcknowledgement creates a new error acknowledgement after having emitted an event with the // details of the error. -func newEmitErrorAcknowledgement(ctx sdk.Context, err error, errorContexts ...string) channeltypes.Acknowledgement { - attributes := make([]sdk.Attribute, len(errorContexts)+1) - attributes[0] = sdk.NewAttribute("error", err.Error()) - for i, s := range errorContexts { - attributes[i+1] = sdk.NewAttribute("error-context", s) - } - - ctx.EventManager().EmitEvents(sdk.Events{ - sdk.NewEvent( - "ibc-acknowledgement-error", - attributes..., - ), - }) - +func newEmitErrorAcknowledgement(ctx sdk.Context, err error) channeltypes.Acknowledgement { return channeltypes.Acknowledgement{ Response: &channeltypes.Acknowledgement_Error{ - Error: fmt.Sprintf("move hook error: %s", err.Error()), + Error: fmt.Sprintf("ibc move hook error: %s", err.Error()), }, } }