diff --git a/consensus/pre_prepare_pool.go b/consensus/pre_prepare_pool.go index 0f0c1fb..ae241cb 100644 --- a/consensus/pre_prepare_pool.go +++ b/consensus/pre_prepare_pool.go @@ -8,6 +8,7 @@ import ( "github.com/Secured-Finance/dione/cache" "github.com/Secured-Finance/dione/consensus/validation" + _ "github.com/Secured-Finance/dione/consensus/validation/filecoin" // enable filecoin validation "github.com/filecoin-project/go-state-types/crypto" types2 "github.com/Secured-Finance/dione/consensus/types" diff --git a/consensus/validation/filecoin/filecoin.go b/consensus/validation/filecoin/filecoin.go index af9322d..271ce5a 100644 --- a/consensus/validation/filecoin/filecoin.go +++ b/consensus/validation/filecoin/filecoin.go @@ -21,7 +21,7 @@ func ValidateGetTransaction(payload []byte) error { } if msg.Type == ftypes.MessageTypeSecp256k1 { - if err := sigs.Verify(msg.Signature, msg.Message.From.Bytes(), msg.Message.Cid().Bytes()); err != nil { + if err := sigs.Verify(&msg.Signature, msg.Message.From.Bytes(), msg.Message.Cid().Bytes()); err != nil { logrus.Errorf("Couldn't verify transaction %v", err) return xerrors.Errorf("Couldn't verify transaction: %v") } diff --git a/rpc/filecoin/types/filecoin-message.go b/rpc/filecoin/types/filecoin-message.go index 6ea5005..ee6a7de 100644 --- a/rpc/filecoin/types/filecoin-message.go +++ b/rpc/filecoin/types/filecoin-message.go @@ -12,7 +12,7 @@ import ( type SignedMessage struct { Message ltypes.Message - Signature *types.Signature + Signature types.Signature Type MessageType } @@ -41,8 +41,6 @@ func (t MessageType) Name() (string, error) { // CBOR operations from lotus func (t *SignedMessage) UnmarshalCBOR(r io.Reader) error { - *t = SignedMessage{} - br := cbg.GetPeeker(r) scratch := make([]byte, 8) @@ -58,21 +56,14 @@ func (t *SignedMessage) UnmarshalCBOR(r io.Reader) error { return fmt.Errorf("cbor input had wrong number of fields") } - { - - if err := t.Message.UnmarshalCBOR(br); err != nil { - return fmt.Errorf("unmarshaling t.Message: %w", err) - } - + if err := t.Message.UnmarshalCBOR(br); err != nil { + return fmt.Errorf("unmarshaling t.Message: %w", err) } - { - - if err := t.Signature.UnmarshalCBOR(br); err != nil { - return fmt.Errorf("unmarshaling t.Signature: %w", err) - } - + if err := t.Signature.UnmarshalCBOR(br); err != nil { + return fmt.Errorf("unmarshaling t.Signature: %w", err) } + return nil }