forked from TrueCloudLab/frostfs-node
[#505] morph/container: Do not parse public key in Put event parser
Morph event structures defined in `pkg/morph/event` should only carry notification values without any additional interpretation. All logical work should be concentrated on app-side. Change data type of `Put.PublicKey` return to byte slice. `ParsePut` doesn't unmarshal public key from now. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
a306eb9ce7
commit
a3ac294902
3 changed files with 7 additions and 21 deletions
|
@ -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)
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue