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

Feat/push object meta to contracts #3044

Merged
merged 13 commits into from
Dec 23, 2024
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Changelog for NeoFS Node
## [Unreleased]

### Added
- Initial support for meta-on-chain for objects (#2877)

### Fixed

Expand Down
2 changes: 2 additions & 0 deletions cmd/neofs-node/morph.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@
registerBlockHandler(lis, func(block *block.Block) {
c.log.Debug("new block", zap.Uint32("index", block.Index))

c.networkState.block.Store(block.Index)

Check warning on line 101 in cmd/neofs-node/morph.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-node/morph.go#L100-L101

Added lines #L100 - L101 were not covered by tests
err = c.persistate.SetUInt32(persistateFSChainLastBlockKey, block.Index)
if err != nil {
c.log.Warn("can't update persistent state",
Expand Down
12 changes: 11 additions & 1 deletion cmd/neofs-node/netmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@

// primary solution of local network state dump.
type networkState struct {
epoch atomic.Uint64
epoch atomic.Uint64
block atomic.Uint32
epochDuration atomic.Uint64

controlNetStatus atomic.Value // control.NetmapStatus

Expand All @@ -46,6 +48,14 @@
return s.epoch.Load()
}

func (s *networkState) CurrentBlock() uint32 {
return s.block.Load()

Check warning on line 52 in cmd/neofs-node/netmap.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-node/netmap.go#L51-L52

Added lines #L51 - L52 were not covered by tests
}

func (s *networkState) CurrentEpochDuration() uint64 {
return s.epochDuration.Load()

Check warning on line 56 in cmd/neofs-node/netmap.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-node/netmap.go#L55-L56

Added lines #L55 - L56 were not covered by tests
}

func (s *networkState) setCurrentEpoch(v uint64) {
s.epoch.Store(v)

Expand Down
3 changes: 2 additions & 1 deletion cmd/neofs-node/object.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@
putsvc.WithNetworkMagic(mNumber),
putsvc.WithKeyStorage(keyStorage),
putsvc.WithClientConstructor(putConstructor),
putsvc.WithContainerClient(c.cCli),

Check warning on line 264 in cmd/neofs-node/object.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-node/object.go#L264

Added line #L264 was not covered by tests
putsvc.WithMaxSizeSource(newCachedMaxObjectSizeSource(c)),
putsvc.WithObjectStorage(storageEngine{engine: ls}),
putsvc.WithContainerSource(c.cfgObject.cnrSource),
Expand Down Expand Up @@ -349,7 +350,7 @@

firstSvc := objectService.NewMetricCollector(signSvc, c.metricsCollector)

server := objectTransportGRPC.New(firstSvc, mNumber, objNode, neofsecdsa.SignerRFC6979(c.shared.basics.key.PrivateKey))
server := objectTransportGRPC.New(firstSvc, mNumber, objNode, neofsecdsa.SignerRFC6979(c.shared.basics.key.PrivateKey), c.cfgNetmap.state)

Check warning on line 353 in cmd/neofs-node/object.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-node/object.go#L353

Added line #L353 was not covered by tests

for _, srv := range c.cfgGRPC.servers {
objectGRPC.RegisterObjectServiceServer(srv, server)
Expand Down
2 changes: 2 additions & 0 deletions cmd/neofs-node/reputation.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,8 @@
return
}

c.networkState.epochDuration.Store(duration)

Check warning on line 234 in cmd/neofs-node/reputation.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-node/reputation.go#L233-L234

Added lines #L233 - L234 were not covered by tests
iterations, err := c.cfgNetmap.wrapper.EigenTrustIterations()
if err != nil {
log.Debug("could not fetch iteration number", zap.Error(err))
Expand Down
27 changes: 5 additions & 22 deletions cmd/neofs-node/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@
"fmt"

objectGRPC "github.com/nspcc-dev/neofs-api-go/v2/object/grpc"
"github.com/nspcc-dev/neofs-api-go/v2/refs"
rawclient "github.com/nspcc-dev/neofs-api-go/v2/rpc/client"
"github.com/nspcc-dev/neofs-api-go/v2/rpc/common"
"github.com/nspcc-dev/neofs-api-go/v2/rpc/grpc"
"github.com/nspcc-dev/neofs-api-go/v2/rpc/message"
"github.com/nspcc-dev/neofs-api-go/v2/status"
coreclient "github.com/nspcc-dev/neofs-node/pkg/core/client"
apistatus "github.com/nspcc-dev/neofs-sdk-go/client/status"
neofscrypto "github.com/nspcc-dev/neofs-sdk-go/crypto"
)

type transport struct {
Expand All @@ -22,7 +20,7 @@

// SendReplicationRequestToNode connects to described node and sends prepared
// replication request message to it.
func (x *transport) SendReplicationRequestToNode(ctx context.Context, req []byte, node coreclient.NodeInfo) (*neofscrypto.Signature, error) {
func (x *transport) SendReplicationRequestToNode(ctx context.Context, req []byte, node coreclient.NodeInfo) ([]byte, error) {

Check warning on line 23 in cmd/neofs-node/transport.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-node/transport.go#L23

Added line #L23 was not covered by tests
c, err := x.clients.Get(node)
if err != nil {
return nil, fmt.Errorf("connect to remote node: %w", err)
Expand All @@ -40,12 +38,12 @@
}
return resp.err
})
return resp.sig, err
return resp.sigs, err

Check warning on line 41 in cmd/neofs-node/transport.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-node/transport.go#L41

Added line #L41 was not covered by tests
}

type replicateResponse struct {
sig *neofscrypto.Signature
err error
sigs []byte
err error
}

func (x replicateResponse) ToGRPCMessage() grpc.Message { return new(objectGRPC.ReplicateResponse) }
Expand All @@ -70,22 +68,7 @@
return nil
}

sig := m.GetObjectSignature()
if sig == nil {
return nil
}

sigV2 := new(refs.Signature)
err := sigV2.Unmarshal(sig)
if err != nil {
return fmt.Errorf("decoding signature from proto message: %w", err)
}

x.sig = new(neofscrypto.Signature)
err = x.sig.ReadFromV2(*sigV2)
if err != nil {
return fmt.Errorf("invalid signature: %w", err)
}
x.sigs = m.GetObjectSignature()

Check warning on line 71 in cmd/neofs-node/transport.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-node/transport.go#L71

Added line #L71 was not covered by tests

return nil
}
12 changes: 6 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ require (
github.com/nspcc-dev/locode-db v0.6.0
github.com/nspcc-dev/neo-go v0.107.1
github.com/nspcc-dev/neofs-api-go/v2 v2.14.1-0.20240827150555-5ce597aa14ea
github.com/nspcc-dev/neofs-contract v0.20.0
github.com/nspcc-dev/neofs-contract v0.20.1-0.20241220193924-4da43dfb5a65
github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.12.0.20240809202351-256513c1b29b
github.com/nspcc-dev/tzhash v1.8.0
github.com/olekukonko/tablewriter v0.0.5
Expand All @@ -31,9 +31,9 @@ require (
go.etcd.io/bbolt v1.3.11
go.uber.org/zap v1.27.0
golang.org/x/net v0.28.0
golang.org/x/sync v0.8.0
golang.org/x/sys v0.24.0
golang.org/x/term v0.23.0
golang.org/x/sync v0.10.0
golang.org/x/sys v0.28.0
golang.org/x/term v0.27.0
google.golang.org/grpc v1.64.1
google.golang.org/protobuf v1.34.2
gopkg.in/yaml.v3 v3.0.1
Expand Down Expand Up @@ -92,9 +92,9 @@ require (
github.com/urfave/cli/v2 v2.27.4 // indirect
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.26.0 // indirect
golang.org/x/crypto v0.31.0 // indirect
golang.org/x/exp v0.0.0-20240823005443-9b4947da3948 // indirect
golang.org/x/text v0.17.0 // indirect
golang.org/x/text v0.21.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
lukechampine.com/blake3 v1.2.1 // indirect
Expand Down
24 changes: 12 additions & 12 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20240729160116-d8e3e57f88f2 h1:tv
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20240729160116-d8e3e57f88f2/go.mod h1:/vrbWSHc7YS1KSYhVOyyeucXW/e+1DkVBOgnBEXUCeY=
github.com/nspcc-dev/neofs-api-go/v2 v2.14.1-0.20240827150555-5ce597aa14ea h1:mK0EMGLvunXcFyq7fBURS/CsN4MH+4nlYiqn6pTwWAU=
github.com/nspcc-dev/neofs-api-go/v2 v2.14.1-0.20240827150555-5ce597aa14ea/go.mod h1:YzhD4EZmC9Z/PNyd7ysC7WXgIgURc9uCG1UWDeV027Y=
github.com/nspcc-dev/neofs-contract v0.20.0 h1:ARE/3mSN+P9qi/10NBsf7QyPiYrvnxeEgYUN13vHRlo=
github.com/nspcc-dev/neofs-contract v0.20.0/go.mod h1:YxtKYE/5cMNiqwWcQWzeizbB9jizauLni+p8wXxfhsQ=
github.com/nspcc-dev/neofs-contract v0.20.1-0.20241220193924-4da43dfb5a65 h1:SruyrmzfmaIK+rx3EyLsG3hb9Ooh+cTkObucl0yTVxY=
github.com/nspcc-dev/neofs-contract v0.20.1-0.20241220193924-4da43dfb5a65/go.mod h1:fwM6QoYPnsIuUQ4/GOwgzfQ9qoDKknqYgf4XWOqEdJw=
github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.12.0.20240809202351-256513c1b29b h1:/7jXQP5pf+M0kRFC1gg5GEdTPkvotpMHxjSXIbMZaGQ=
github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.12.0.20240809202351-256513c1b29b/go.mod h1:ewV84r1NACvoBfbKQKzRLUun+Xn5+z9JVqsuCVgv9xI=
github.com/nspcc-dev/rfc6979 v0.2.3 h1:QNVykGZ3XjFwM/88rGfV3oj4rKNBy+nYI6jM7q19hDI=
Expand Down Expand Up @@ -293,8 +293,8 @@ go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw=
golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54=
golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U=
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
golang.org/x/exp v0.0.0-20240823005443-9b4947da3948 h1:kx6Ds3MlpiUHKj7syVnbp57++8WpuKPcR5yjLBjvLEA=
golang.org/x/exp v0.0.0-20240823005443-9b4947da3948/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ=
golang.org/x/mod v0.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0=
Expand All @@ -310,8 +310,8 @@ golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ=
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
Expand All @@ -327,16 +327,16 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg=
golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU=
golang.org/x/term v0.23.0/go.mod h1:DgV24QBUrK6jhZXl+20l6UWznPlwAHm1Q1mGHtydmSk=
golang.org/x/term v0.27.0 h1:WP60Sv1nlK1T6SupCHbXzSaN0b9wUmsPoRS9b61A23Q=
golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc=
golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24=
golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ=
Expand Down
7 changes: 7 additions & 0 deletions pkg/core/netmap/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,10 @@ type State interface {
// CurrentEpoch returns the number of the current NeoFS epoch.
CurrentEpoch() uint64
}

// StateDetailed groups block, epoch and its duration information about FS chain.
type StateDetailed interface {
State
CurrentBlock() uint32
CurrentEpochDuration() uint64
}
9 changes: 4 additions & 5 deletions pkg/core/object/replicate.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ import (
)

const (
validInterval = 10 // in epochs
currentVersion = 7 // it is also a number of fields
currentVersion = 7 // it is also a number of fields
)

const (
Expand All @@ -34,19 +33,19 @@ const (
// "size": payload size
// "deleted": array of _raw_ object IDs
// "locked": array of _raw_ object IDs
// "validuntil": last valid epoch number for meta information
// "validuntil": last valid block number for meta information
//
// Last valid epoch is object's creation epoch + 10.
func EncodeReplicationMetaInfo(cID cid.ID, oID oid.ID, pSize uint64,
deleted, locked []oid.ID, createdAt uint64, magicNumber uint32) []byte {
deleted, locked []oid.ID, vub uint64, magicNumber uint32) []byte {
kvs := []stackitem.MapElement{
kv(networkMagicKey, magicNumber),
kv(cidKey, cID[:]),
kv(oidKey, oID[:]),
kv(sizeKey, pSize),
oidsKV(deletedKey, deleted),
oidsKV(lockedKey, locked),
kv(validUntilKey, createdAt+validInterval),
kv(validUntilKey, vub),
}

result, err := stackitem.Serialize(stackitem.NewMapWithValue(kvs))
Expand Down
2 changes: 1 addition & 1 deletion pkg/core/object/replicate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func TestMetaInfo(t *testing.T) {
require.Equal(t, locked, stackItemToOIDs(t, mm[5].Value))

require.Equal(t, validUntilKey, string(mm[6].Key.Value().([]byte)))
require.Equal(t, validUntil+validInterval, mm[6].Value.Value().(*big.Int).Uint64())
require.Equal(t, validUntil, mm[6].Value.Value().(*big.Int).Uint64())
}

func stackItemToOIDs(t *testing.T, value stackitem.Item) []oid.ID {
Expand Down
2 changes: 1 addition & 1 deletion pkg/innerring/processors/alphabet/process_emit.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
}

// there is no signature collecting, so we don't need extra fee
err := ap.morphClient.Invoke(contract, 0, emitMethod)
err := ap.morphClient.Invoke(contract, false, 0, emitMethod)

Check warning on line 30 in pkg/innerring/processors/alphabet/process_emit.go

View check run for this annotation

Codecov / codecov/patch

pkg/innerring/processors/alphabet/process_emit.go#L30

Added line #L30 was not covered by tests
if err != nil {
ap.log.Warn("can't invoke alphabet emit method", zap.Error(err))

Expand Down
53 changes: 36 additions & 17 deletions pkg/innerring/processors/container/process_container.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@
type putContainerContext struct {
e putEvent

d containerSDK.Domain
// must be filled when verifying raw data from e
cID cid.ID
cnr containerSDK.Container
d containerSDK.Domain
}

// Process a new container from the user by checking the container sanity
Expand Down Expand Up @@ -55,15 +58,15 @@

func (cp *Processor) checkPutContainer(ctx *putContainerContext) error {
binCnr := ctx.e.Container()
var cnr containerSDK.Container
ctx.cID = cid.NewFromMarshalledContainer(binCnr)

Check warning on line 61 in pkg/innerring/processors/container/process_container.go

View check run for this annotation

Codecov / codecov/patch

pkg/innerring/processors/container/process_container.go#L61

Added line #L61 was not covered by tests

err := cnr.Unmarshal(binCnr)
err := ctx.cnr.Unmarshal(binCnr)

Check warning on line 63 in pkg/innerring/processors/container/process_container.go

View check run for this annotation

Codecov / codecov/patch

pkg/innerring/processors/container/process_container.go#L63

Added line #L63 was not covered by tests
if err != nil {
return fmt.Errorf("invalid binary container: %w", err)
}

err = cp.verifySignature(signatureVerificationData{
ownerContainer: cnr.Owner(),
ownerContainer: ctx.cnr.Owner(),

Check warning on line 69 in pkg/innerring/processors/container/process_container.go

View check run for this annotation

Codecov / codecov/patch

pkg/innerring/processors/container/process_container.go#L69

Added line #L69 was not covered by tests
verb: session.VerbContainerPut,
binTokenSession: ctx.e.SessionToken(),
binPublicKey: ctx.e.PublicKey(),
Expand All @@ -75,13 +78,13 @@
}

// check homomorphic hashing setting
err = checkHomomorphicHashing(cp.netState, cnr)
err = checkHomomorphicHashing(cp.netState, ctx.cnr)

Check warning on line 81 in pkg/innerring/processors/container/process_container.go

View check run for this annotation

Codecov / codecov/patch

pkg/innerring/processors/container/process_container.go#L81

Added line #L81 was not covered by tests
if err != nil {
return fmt.Errorf("incorrect homomorphic hashing setting: %w", err)
}

// check native name and zone
err = checkNNS(ctx, cnr)
err = checkNNS(ctx, ctx.cnr)

Check warning on line 87 in pkg/innerring/processors/container/process_container.go

View check run for this annotation

Codecov / codecov/patch

pkg/innerring/processors/container/process_container.go#L87

Added line #L87 was not covered by tests
if err != nil {
return fmt.Errorf("NNS: %w", err)
}
Expand All @@ -94,22 +97,38 @@

var err error

prm := cntClient.PutPrm{}

prm.SetContainer(e.Container())
prm.SetKey(e.PublicKey())
prm.SetSignature(e.Signature())
prm.SetToken(e.SessionToken())
prm.SetName(ctx.d.Name())
prm.SetZone(ctx.d.Zone())

nr := e.NotaryRequest()
err = cp.cnrClient.Morph().NotarySignAndInvokeTX(nr.MainTransaction)
err = cp.cnrClient.Morph().NotarySignAndInvokeTX(nr.MainTransaction, true)

Check warning on line 101 in pkg/innerring/processors/container/process_container.go

View check run for this annotation

Codecov / codecov/patch

pkg/innerring/processors/container/process_container.go#L101

Added line #L101 was not covered by tests

if err != nil {
cp.log.Error("could not approve put container",
zap.Error(err),
)
return
}

Check warning on line 108 in pkg/innerring/processors/container/process_container.go

View check run for this annotation

Codecov / codecov/patch

pkg/innerring/processors/container/process_container.go#L107-L108

Added lines #L107 - L108 were not covered by tests

nm, err := cp.netState.NetMap()
if err != nil {
cp.log.Error("could not get netmap for Container contract update", zap.Stringer("cid", ctx.cID), zap.Error(err))
return
}

Check warning on line 114 in pkg/innerring/processors/container/process_container.go

View check run for this annotation

Codecov / codecov/patch

pkg/innerring/processors/container/process_container.go#L110-L114

Added lines #L110 - L114 were not covered by tests

policy := ctx.cnr.PlacementPolicy()
vectors, err := nm.ContainerNodes(policy, ctx.cID)
if err != nil {
cp.log.Error("could not build placement for Container contract update", zap.Stringer("cid", ctx.cID), zap.Error(err))
return
}

Check warning on line 121 in pkg/innerring/processors/container/process_container.go

View check run for this annotation

Codecov / codecov/patch

pkg/innerring/processors/container/process_container.go#L116-L121

Added lines #L116 - L121 were not covered by tests

replicas := make([]uint32, 0, policy.NumberOfReplicas())
for i := range vectors {
replicas = append(replicas, policy.ReplicaNumberByIndex(i))
}

Check warning on line 126 in pkg/innerring/processors/container/process_container.go

View check run for this annotation

Codecov / codecov/patch

pkg/innerring/processors/container/process_container.go#L123-L126

Added lines #L123 - L126 were not covered by tests

err = cp.cnrClient.UpdateContainerPlacement(ctx.cID, vectors, replicas)
if err != nil {
cp.log.Error("could not update Container contract", zap.Stringer("cid", ctx.cID), zap.Error(err))
return

Check warning on line 131 in pkg/innerring/processors/container/process_container.go

View check run for this annotation

Codecov / codecov/patch

pkg/innerring/processors/container/process_container.go#L128-L131

Added lines #L128 - L131 were not covered by tests
}
}

Expand Down Expand Up @@ -175,7 +194,7 @@
prm.SetToken(e.SessionToken())

nr := e.NotaryRequest()
err = cp.cnrClient.Morph().NotarySignAndInvokeTX(nr.MainTransaction)
err = cp.cnrClient.Morph().NotarySignAndInvokeTX(nr.MainTransaction, false)

Check warning on line 197 in pkg/innerring/processors/container/process_container.go

View check run for this annotation

Codecov / codecov/patch

pkg/innerring/processors/container/process_container.go#L197

Added line #L197 was not covered by tests

if err != nil {
cp.log.Error("could not approve delete container",
Expand Down
2 changes: 1 addition & 1 deletion pkg/innerring/processors/container/process_eacl.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
prm.SetToken(e.SessionToken())

nr := e.NotaryRequest()
err = cp.cnrClient.Morph().NotarySignAndInvokeTX(nr.MainTransaction)
err = cp.cnrClient.Morph().NotarySignAndInvokeTX(nr.MainTransaction, false)

Check warning on line 91 in pkg/innerring/processors/container/process_eacl.go

View check run for this annotation

Codecov / codecov/patch

pkg/innerring/processors/container/process_eacl.go#L91

Added line #L91 was not covered by tests

if err != nil {
cp.log.Error("could not approve set EACL",
Expand Down
Loading
Loading