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

Add nodeID to acp118 requests #710

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion warp/backend.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// (c) 2023, Ava Labs, Inc. All rights reserved.

Check failure on line 1 in warp/backend.go

View workflow job for this annotation

GitHub Actions / Lint

: # github.com/ava-labs/coreth/warp [github.com/ava-labs/coreth/warp.test]
// See the file LICENSE for licensing terms.

package warp
Expand All @@ -19,7 +19,7 @@
)

var (
_ Backend = &backend{}

Check failure on line 22 in warp/backend.go

View workflow job for this annotation

GitHub Actions / Golang Unit Tests (macos-latest)

cannot use &backend{} (value of type *backend) as Backend value in variable declaration: *backend does not implement Backend (wrong type for method Verify)

Check failure on line 22 in warp/backend.go

View workflow job for this annotation

GitHub Actions / Lint

cannot use &backend{} (value of type *backend) as Backend value in variable declaration: *backend does not implement Backend (wrong type for method Verify)

Check failure on line 22 in warp/backend.go

View workflow job for this annotation

GitHub Actions / Lint

cannot use &backend{} (value of type *backend) as Backend value in variable declaration: *backend does not implement Backend (wrong type for method Verify)

Check failure on line 22 in warp/backend.go

View workflow job for this annotation

GitHub Actions / Golang Unit Tests (ubuntu-20.04)

cannot use &backend{} (value of type *backend) as Backend value in variable declaration: *backend does not implement Backend (wrong type for method Verify)

Check failure on line 22 in warp/backend.go

View workflow job for this annotation

GitHub Actions / Golang Unit Tests (ubuntu-latest)

cannot use &backend{} (value of type *backend) as Backend value in variable declaration: *backend does not implement Backend (wrong type for method Verify)

Check failure on line 22 in warp/backend.go

View workflow job for this annotation

GitHub Actions / Golang Unit Tests (windows-latest)

cannot use &backend{} (value of type *backend) as Backend value in variable declaration: *backend does not implement Backend (wrong type for method Verify)
errParsingOffChainMessage = errors.New("failed to parse off-chain message")

messageCacheSize = 500
Expand Down Expand Up @@ -83,7 +83,7 @@
stats: newVerifierStats(),
offchainAddressedCallMsgs: make(map[ids.ID]*avalancheWarp.UnsignedMessage),
}
return b, b.initOffChainMessages(offchainMessages)

Check failure on line 86 in warp/backend.go

View workflow job for this annotation

GitHub Actions / Golang Unit Tests (macos-latest)

cannot use b (variable of type *backend) as Backend value in return statement: *backend does not implement Backend (wrong type for method Verify)

Check failure on line 86 in warp/backend.go

View workflow job for this annotation

GitHub Actions / Lint

cannot use b (variable of type *backend) as Backend value in return statement: *backend does not implement Backend (wrong type for method Verify)

Check failure on line 86 in warp/backend.go

View workflow job for this annotation

GitHub Actions / Lint

cannot use b (variable of type *backend) as Backend value in return statement: *backend does not implement Backend (wrong type for method Verify)

Check failure on line 86 in warp/backend.go

View workflow job for this annotation

GitHub Actions / Golang Unit Tests (ubuntu-20.04)

cannot use b (variable of type *backend) as Backend value in return statement: *backend does not implement Backend (wrong type for method Verify)

Check failure on line 86 in warp/backend.go

View workflow job for this annotation

GitHub Actions / Golang Unit Tests (ubuntu-latest)

cannot use b (variable of type *backend) as Backend value in return statement: *backend does not implement Backend (wrong type for method Verify)

Check failure on line 86 in warp/backend.go

View workflow job for this annotation

GitHub Actions / Golang Unit Tests (windows-latest)

cannot use b (variable of type *backend) as Backend value in return statement: *backend does not implement Backend (wrong type for method Verify)
}

func (b *backend) initOffChainMessages(offchainMessages [][]byte) error {
Expand Down Expand Up @@ -136,7 +136,7 @@
return sig, nil
}

if err := b.Verify(ctx, unsignedMessage, nil); 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)
Expand Down
3 changes: 2 additions & 1 deletion warp/verifier_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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, _ 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 {
Expand Down
Loading