From 5d445059b11f3c5e71e415e9f032372e3102b955 Mon Sep 17 00:00:00 2001 From: tsachiherman <24438559+tsachiherman@users.noreply.github.com> Date: Tue, 17 Dec 2024 15:31:15 -0500 Subject: [PATCH 1/3] update interface --- warp/verifier_backend.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/warp/verifier_backend.go b/warp/verifier_backend.go index c70563c585..ae9a09feb7 100644 --- a/warp/verifier_backend.go +++ b/warp/verifier_backend.go @@ -7,6 +7,7 @@ import ( "context" "fmt" + "github.com/ava-labs/avalanchego/ids" "github.com/ava-labs/avalanchego/snow/engine/common" avalancheWarp "github.com/ava-labs/avalanchego/vms/platformvm/warp" "github.com/ava-labs/avalanchego/vms/platformvm/warp/payload" @@ -19,7 +20,7 @@ const ( // Verify verifies the signature of the message // It also implements the acp118.Verifier interface -func (b *backend) Verify(ctx context.Context, unsignedMessage *avalancheWarp.UnsignedMessage, _ []byte) *common.AppError { +func (b *backend) Verify(ctx context.Context, unsignedMessage *avalancheWarp.UnsignedMessage, _ []byte, _ ids.NodeID) *common.AppError { messageID := unsignedMessage.ID() // Known on-chain messages should be signed if _, err := b.GetMessage(messageID); err == nil { From 45518a773ce792d3bc5979110d570a62918a6d98 Mon Sep 17 00:00:00 2001 From: tsachiherman <24438559+tsachiherman@users.noreply.github.com> Date: Tue, 17 Dec 2024 15:45:20 -0500 Subject: [PATCH 2/3] update --- warp/backend.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/warp/backend.go b/warp/backend.go index 6e1f6a9553..d952a2b405 100644 --- a/warp/backend.go +++ b/warp/backend.go @@ -136,7 +136,7 @@ func (b *backend) GetMessageSignature(ctx context.Context, unsignedMessage *aval return sig, nil } - if err := b.Verify(ctx, unsignedMessage, nil); err != nil { + if err := b.Verify(ctx, unsignedMessage, nil, ids.EmptyNodeID); err != nil { return nil, fmt.Errorf("failed to validate warp message: %w", err) } return b.signMessage(unsignedMessage) From 11ae93968f7b4a06da31e9eca705d6d9246a5a16 Mon Sep 17 00:00:00 2001 From: tsachiherman <24438559+tsachiherman@users.noreply.github.com> Date: Wed, 18 Dec 2024 12:21:20 -0500 Subject: [PATCH 3/3] reorder --- warp/backend.go | 2 +- warp/verifier_backend.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/warp/backend.go b/warp/backend.go index d952a2b405..6cd56897e2 100644 --- a/warp/backend.go +++ b/warp/backend.go @@ -136,7 +136,7 @@ func (b *backend) GetMessageSignature(ctx context.Context, unsignedMessage *aval return sig, nil } - if err := b.Verify(ctx, unsignedMessage, nil, ids.EmptyNodeID); err != nil { + if err := b.Verify(ctx, ids.EmptyNodeID, unsignedMessage, nil); err != nil { return nil, fmt.Errorf("failed to validate warp message: %w", err) } return b.signMessage(unsignedMessage) diff --git a/warp/verifier_backend.go b/warp/verifier_backend.go index ae9a09feb7..a6a5ab9fef 100644 --- a/warp/verifier_backend.go +++ b/warp/verifier_backend.go @@ -20,7 +20,7 @@ const ( // Verify verifies the signature of the message // It also implements the acp118.Verifier interface -func (b *backend) Verify(ctx context.Context, unsignedMessage *avalancheWarp.UnsignedMessage, _ []byte, _ ids.NodeID) *common.AppError { +func (b *backend) Verify(ctx context.Context, _ ids.NodeID, unsignedMessage *avalancheWarp.UnsignedMessage, _ []byte) *common.AppError { messageID := unsignedMessage.ID() // Known on-chain messages should be signed if _, err := b.GetMessage(messageID); err == nil {