diff --git a/pkg/innerring/processors/container/process_container.go b/pkg/innerring/processors/container/process_container.go index 03c7c1b5..0b929589 100644 --- a/pkg/innerring/processors/container/process_container.go +++ b/pkg/innerring/processors/container/process_container.go @@ -44,7 +44,7 @@ func (cp *Processor) processContainerPut(put *containerEvent.Put) { err := cp.morphClient.NotaryInvoke(cp.containerContract, cp.feeProvider.SideChainFee(), putContainerMethod, cnrData, put.Signature(), - put.PublicKey().Bytes()) + put.PublicKey()) if err != nil { cp.log.Error("can't invoke new container", zap.Error(err)) } diff --git a/pkg/morph/event/container/put.go b/pkg/morph/event/container/put.go index 094dc77a..9bf7ee35 100644 --- a/pkg/morph/event/container/put.go +++ b/pkg/morph/event/container/put.go @@ -1,10 +1,8 @@ package container import ( - "crypto/elliptic" "fmt" - "github.com/nspcc-dev/neo-go/pkg/crypto/keys" "github.com/nspcc-dev/neo-go/pkg/vm/stackitem" "github.com/nspcc-dev/neofs-node/pkg/morph/client" "github.com/nspcc-dev/neofs-node/pkg/morph/event" @@ -14,7 +12,7 @@ import ( type Put struct { rawContainer []byte signature []byte - publicKey *keys.PublicKey + publicKey []byte } // MorphEvent implements Neo:Morph Event interface. @@ -27,7 +25,7 @@ func (p Put) Container() []byte { return p.rawContainer } func (p Put) Signature() []byte { return p.signature } // PublicKey of container owner. -func (p Put) PublicKey() *keys.PublicKey { return p.publicKey } +func (p Put) PublicKey() []byte { return p.publicKey } // ParsePut from notification into container event structure. func ParsePut(params []stackitem.Item) (event.Event, error) { @@ -53,15 +51,10 @@ func ParsePut(params []stackitem.Item) (event.Event, error) { } // parse public key - key, err := client.BytesFromStackItem(params[2]) + ev.publicKey, err = client.BytesFromStackItem(params[2]) if err != nil { return nil, fmt.Errorf("could not get public key: %w", err) } - ev.publicKey, err = keys.NewPublicKeyFromBytes(key, elliptic.P256()) - if err != nil { - return nil, fmt.Errorf("could not parse public key: %w", err) - } - return ev, nil } diff --git a/pkg/morph/event/container/put_test.go b/pkg/morph/event/container/put_test.go index 5f363850..75bce11e 100644 --- a/pkg/morph/event/container/put_test.go +++ b/pkg/morph/event/container/put_test.go @@ -1,14 +1,10 @@ package container import ( - "crypto/elliptic" "testing" - "github.com/nspcc-dev/neo-go/pkg/crypto/keys" "github.com/nspcc-dev/neo-go/pkg/vm/stackitem" - crypto "github.com/nspcc-dev/neofs-crypto" "github.com/nspcc-dev/neofs-node/pkg/morph/event" - "github.com/nspcc-dev/neofs-node/pkg/util/test" "github.com/stretchr/testify/require" ) @@ -16,7 +12,7 @@ func TestParsePut(t *testing.T) { var ( containerData = []byte("containerData") signature = []byte("signature") - publicKey = &test.DecodeKey(-1).PublicKey + publicKey = []byte("pubkey") ) t.Run("wrong number of parameters", func(t *testing.T) { @@ -60,17 +56,14 @@ func TestParsePut(t *testing.T) { ev, err := ParsePut([]stackitem.Item{ stackitem.NewByteArray(containerData), stackitem.NewByteArray(signature), - stackitem.NewByteArray(crypto.MarshalPublicKey(publicKey)), + stackitem.NewByteArray(publicKey), }) require.NoError(t, err) - expectedKey, err := keys.NewPublicKeyFromBytes(crypto.MarshalPublicKey(publicKey), elliptic.P256()) - require.NoError(t, err) - require.Equal(t, Put{ rawContainer: containerData, signature: signature, - publicKey: expectedKey, + publicKey: publicKey, }, ev) }) }