Skip to content

Feat/meta/sn#3991

Open
carpawell wants to merge 7 commits into
masterfrom
feat/meta/sn
Open

Feat/meta/sn#3991
carpawell wants to merge 7 commits into
masterfrom
feat/meta/sn

Conversation

@carpawell

Copy link
Copy Markdown
Member

No description provided.

@codecov

codecov Bot commented May 26, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 17.58794% with 492 lines in your changes missing coverage. Please review.
✅ Project coverage is 27.09%. Comparing base (6241c4c) to head (19291f2).

Files with missing lines Patch % Lines
cmd/neofs-node/meta.go 5.63% 134 Missing ⚠️
pkg/services/meta/meta.go 25.43% 81 Missing and 4 partials ⚠️
pkg/services/sidechain/sidechain.go 0.00% 80 Missing ⚠️
pkg/services/object/put/distributed.go 14.03% 48 Missing and 1 partial ⚠️
pkg/services/meta/blocks.go 0.00% 36 Missing ⚠️
pkg/core/object/replicate.go 13.15% 33 Missing ⚠️
pkg/services/meta/storage.go 7.69% 24 Missing ⚠️
pkg/services/object/put/streamer.go 31.81% 14 Missing and 1 partial ⚠️
pkg/services/meta/notifications.go 0.00% 14 Missing ⚠️
pkg/network/address.go 0.00% 8 Missing ⚠️
... and 6 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3991      +/-   ##
==========================================
- Coverage   27.79%   27.09%   -0.71%     
==========================================
  Files         681      683       +2     
  Lines       46797    46280     -517     
==========================================
- Hits        13006    12538     -468     
- Misses      32553    32564      +11     
+ Partials     1238     1178      -60     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cthulhu-rider cthulhu-rider left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not finished

Comment thread pkg/core/metachain/meta/meta_test.go
Comment thread cmd/neofs-node/meta_new.go Outdated
Comment thread cmd/neofs-node/meta_new.go Outdated
Comment thread cmd/neofs-node/meta_new.go Outdated
Comment thread cmd/neofs-node/meta_new.go Outdated
Comment thread pkg/services/meta_new/blocks.go Outdated

func (m *Meta) blockHandler(ctx context.Context, buff <-chan *block.Header) {
for {
if len(buff) >= blockBuffSize-1 {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doubt it can be >

btw is it possible to do by channel writer(s). Would be more natural to me

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doubt it can be >

why? we read an item, do some magic that may take time, and then check again what size we have now, a new item may have come

btw is it possible to do by channel writer(s). Would be more natural to me

writer does not belong to this repo, it is sent to neo-go code

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and then check again

buff can initially have blockBuffSize-1 which is a capacity. This does not mean queue is full. Wouldnt be a big problem, but still

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but there is len, not cap. not sure i understand you

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this check is useful, you can't separate overflow from normally filled queue on the reader side, only writer can do this on attempt to write.

Comment thread pkg/services/meta_new/blocks.go Outdated
Comment thread pkg/services/meta_new/blocks.go Outdated
Comment thread pkg/services/meta_new/blocks.go Outdated
Comment thread pkg/services/meta_new/meta.go Outdated
Comment thread pkg/services/meta_new/meta.go Outdated
Comment thread pkg/services/meta_new/meta.go Outdated
Comment thread pkg/services/meta_new/blocks.go Outdated
Comment thread pkg/services/meta_new/blocks.go Outdated

@cthulhu-rider cthulhu-rider left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

finished. Lets fix everything and merge

@AnnaShaleva may u pls check chain configuration?

Comment thread pkg/services/meta/meta.go Outdated
Comment thread pkg/services/meta/meta.go Outdated
Comment thread pkg/services/meta/storage.go Outdated
Comment thread pkg/services/meta/storage.go Outdated
Comment thread pkg/services/meta/storage.go Outdated
Comment thread pkg/services/meta/storage.go
Comment thread pkg/services/object/put/distributed.go Outdated
Comment thread pkg/services/object/put/distributed.go
Comment thread cmd/neofs-node/meta.go Outdated
Comment thread cmd/neofs-node/meta.go
Comment thread cmd/neofs-node/meta.go Outdated
Comment thread cmd/neofs-node/meta.go
Comment thread cmd/neofs-node/meta.go
Comment thread pkg/services/meta/meta.go
// notification work; it is required to always read notifications without
// any blocking or making additional RPC.
notificationBuffSize = 100
notificationBuffSize = 10000

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it approved by @roman-khimov?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is an address + pointer buff channel, what cons may we have? ~703KB of memory

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i can change it to any value. do you have a suggestion? i just had an experience with deadlock with neo-go subscription, so this is why this big value was chosen

@AnnaShaleva AnnaShaleva Jun 4, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's why I'm asking. Increasing buffer size is not a solution to the deadlock problem. It will make the problem more hidden, that's it.

If there's a deadlock, it should be fixed in some other (explicit) way.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Increasing buffer size is not a solution to the deadlock problem

we are balancing b/w notification handling speed and storage speed. i guess it is another thing for exploring in load testing (yet not answered)

Comment thread pkg/services/object/put/streamer.go
Comment thread pkg/services/sidechain/sidechain.go

// Height returns current side chaih block height.
func (s *SideChain) Height() uint32 {
return s.core.HeaderHeight()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Header height differs from block height. What exactly do you need here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Header height differs from block height

in which way? you mean a 1-block difference in values? i need it for async, but the same VUB calculation

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you mean a 1-block difference in values?

Not only. It can be large difference if, e.g. the node is in the process of syncing or stale. Headers synchronisation is a separate process, different from blocks synchronisation.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the only thing i can suggest is to block any operation before the node is in sync

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The decision is up to you, I'm just warning. Either way, you should either adjust the documentation and method name or adjust the return value.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I see it's used in meta signing only where header is more appropriate as "the last known current height network it operating with", suggest renaming the method or fixing the comment.

Comment thread pkg/services/sidechain/sidechain.go Outdated

@AnnaShaleva AnnaShaleva left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests are failing. Other than that looks legit as a prototype.

Comment thread cmd/neofs-node/meta.go Outdated
config.HFCockatrice.String(): 0,
config.HFDomovoi.String(): 0,
config.HFEchidna.String(): 0,
config.HFFaun.String(): 0,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a compatibility unit-test: check that hardforks starting from Aspid ending with config.HFLatestStable are enabled in the resulting chainCfg. On subsequent NeoGo update if latest stable hardfork is changed, you'll know about it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment thread pkg/innerring/innerring.go Outdated
configneogo.HFCockatrice.String(): 0,
configneogo.HFDomovoi.String(): 0,
configneogo.HFEchidna.String(): 0,
configneogo.HFFaun.String(): 0,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto for this config.

Comment thread pkg/util/network.go Outdated
@@ -0,0 +1,21 @@
package util

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

util is always a bad name, think about a better one. CC @roman-khimov

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not the package i created, i just extended it. but agree, moved to another network package

@carpawell

Copy link
Copy Markdown
Member Author

Tests are failing. Other than that looks legit as a prototype.

They should be adopted, yes. And there are other problems. Config check and changelog are not accepted to the experimental things.

@cthulhu-rider cthulhu-rider left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems good to me overall

10_000_000 meant nothing, GAS factor is 1_0000_0000. Also, new value means
something at least.

Signed-off-by: Pavel Karpy <carpawell@nspcc.io>
Signed-off-by: Pavel Karpy <carpawell@nspcc.io>
Signed-off-by: Pavel Karpy <carpawell@nspcc.io>
Signed-off-by: Pavel Karpy <carpawell@nspcc.io>
It is available starting from v0.119.0. This should speed broadcast up, which is
critical for metadata chain.

Signed-off-by: Pavel Karpy <carpawell@nspcc.io>
Signed-off-by: Pavel Karpy <carpawell@nspcc.io>
Just drop the old one, use new instead, no functional changed in the new one.

Signed-off-by: Pavel Karpy <carpawell@nspcc.io>
Comment thread cmd/neofs-node/meta_new.go Outdated
TimePerBlock: 50 * time.Millisecond,
},
Magic: fsChainProtocol.Network + 1,
MemPoolSize: 0,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow.

Comment thread cmd/neofs-node/meta_new.go Outdated
Comment thread pkg/services/meta_new/blocks.go Outdated

func (m *Meta) blockHandler(ctx context.Context, buff <-chan *block.Header) {
for {
if len(buff) >= blockBuffSize-1 {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this check is useful, you can't separate overflow from normally filled queue on the reader side, only writer can do this on attempt to write.

Comment thread pkg/services/meta_new/blocks.go Outdated

func (m *Meta) notificationHandler(ctx context.Context, buff <-chan *state.ContainedNotificationEvent) {
for {
if len(buff) >= notificationBuffSize-1 {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

Comment thread pkg/services/meta_new/meta.go Outdated
on.m.Unlock()

if ok {
on.metaSvc.taskQueue <- storageTask{addr: addr, o: &sub.objHeader}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make any difference? Local HEAD should be pretty fast.

Comment thread pkg/services/meta_new/meta.go Outdated
wg.Go(func() { m.storager(ctx, m.taskQueue) })

m.chain.SubscribeForBlocks(m.bCh)
m.chain.SubscribeForNotifications(m.evsCh)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like this can be done via JSON-RPC as well. Can we have this mode (non-local chain) for nodes with IR nearby?


// PutObject forces [Meta] to index provided object.
func (m *Meta) PutObject(o *object.Object) error {
return m.metabase.Put(o)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per-object transaction?

if len(pubKeyBytes) != compressedECDSAPublicKeyLen {
panic(fmt.Sprintf("wrong public key len: expected %d, got %d", compressedECDSAPublicKeyLen, len(pubKeyBytes)))
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👀


// Height returns current side chaih block height.
func (s *SideChain) Height() uint32 {
return s.core.HeaderHeight()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I see it's used in meta signing only where header is more appropriate as "the last known current height network it operating with", suggest renaming the method or fixing the comment.

Comment thread cmd/neofs-node/meta_new.go Outdated
}))
}

func metadataChainHardforks() map[string]uint32 {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should follow FS chain HF config (heights can be different, but just enabling it like this can be problematic as well). At least for 0-height ones.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants