Skip to content
Merged
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
5 changes: 5 additions & 0 deletions protocol/core/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,3 +314,8 @@ type PackData struct {
}

func (PackData) SignRequestKind() string { return "pack" }

// Validator interface may be implemented by some operations to allow pre-flight validation before signing/injection
type Validator interface {
Validate() error
}
10 changes: 10 additions & 0 deletions protocol/proto_023_PtSeouLo/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package proto_023_PtSeouLo
//go:generate go run ../../cmd/genmarshaller.go

import (
"errors"
"strconv"

tz "github.com/ecadlabs/gotez/v2"
Expand Down Expand Up @@ -125,6 +126,15 @@ type UpdateCompanionKey UpdateConsensusKey

func (*UpdateCompanionKey) OperationKind() string { return "update_companion_key" }

func (u *UpdateCompanionKey) Validate() error {
if _, ok := u.PublicKey.(*tz.BLSPublicKey); !ok {
return errors.New("companion key is not a BLS key")
}
return nil
}

var _ core.Validator = (*UpdateCompanionKey)(nil)

//json:kind=OperationKind()
type Attestation proto_022_PsRiotum.Attestation

Expand Down
Loading