Skip to content

Commit

Permalink
container: support metadata with for "big" objects
Browse files Browse the repository at this point in the history
Follows nspcc-dev/neofs-node#3063.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
  • Loading branch information
carpawell committed Dec 23, 2024
1 parent 4da43df commit b840e16
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions contracts/container/contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,10 @@ func SubmitObjectPut(metaInformation []byte, sigs [][]interop.Signature) {
if len(oID) != interop.Hash256Len {
panic("incorrect object ID")
}
firstPart := getFromMap(metaMap, "firstPart").(interop.Hash256)
if len(firstPart) != interop.Hash256Len && len(firstPart) != 0 {
panic("incorrect first part object ID")
}
magic := getFromMap(metaMap, "network").(int)
if magic != runtime.GetNetwork() {
panic("incorrect network magic")
Expand Down
3 changes: 3 additions & 0 deletions tests/container_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,7 @@ func TestPutMeta(t *testing.T) {

testFunc("cid")
testFunc("oid")
testFunc("firstPart")
testFunc("network")
testFunc("size")
testFunc("deleted")
Expand All @@ -890,6 +891,7 @@ func TestPutMeta(t *testing.T) {

testFunc("cid", []byte{1})
testFunc("oid", []byte{1})
testFunc("firstPart", []byte{1})
testFunc("network", netmode.UnitTestNet+1)
testFunc("deleted", []any{[]byte{1}})
testFunc("locked", []any{[]byte{1}})
Expand All @@ -904,6 +906,7 @@ func testMeta(cid, oid []byte) *stackitem.Map {
{Key: stackitem.Make("network"), Value: stackitem.Make(netmode.UnitTestNet)},
{Key: stackitem.Make("cid"), Value: stackitem.Make(cid)},
{Key: stackitem.Make("oid"), Value: stackitem.Make(oid)},
{Key: stackitem.Make("firstPart"), Value: stackitem.Make(oid)},
{Key: stackitem.Make("size"), Value: stackitem.Make(123)},
{Key: stackitem.Make("deleted"), Value: stackitem.Make([]any{randomBytes(sha256.Size)})},
{Key: stackitem.Make("locked"), Value: stackitem.Make([]any{randomBytes(sha256.Size)})},
Expand Down

0 comments on commit b840e16

Please sign in to comment.