-
Notifications
You must be signed in to change notification settings - Fork 48
Feature/reduce container creation delay #770
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
Feature/reduce container creation delay #770
Conversation
Codecov Report
@@ Coverage Diff @@
## master #770 +/- ##
==========================================
- Coverage 40.28% 40.03% -0.25%
==========================================
Files 223 224 +1
Lines 10900 11013 +113
==========================================
+ Hits 4391 4409 +18
- Misses 6158 6253 +95
Partials 351 351
Continue to review full report at Codecov.
|
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
`fallbackTime` is delta b/w `ValidUntilBlock` of the main transaction and block when `fallback` transaction is sent. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Prepare all listening structures for notary events: rename(add prefix/suffix 'notification') all notification specific handlers/parsers. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
| } | ||
|
|
||
| // NotaryTypeFromBytes converts bytes slice to NotaryType. | ||
| func NotaryTypeFromBytes(data []byte) NotaryType { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused, do we need that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did just the same as in notification.go(not used too). for future "potential" usage I guess
delete?
|
|
||
| func initContainerService(c *cfg) { | ||
| wrap, err := wrapper.NewFromMorph(c.cfgMorph.client, c.cfgContainer.scriptHash, 0) | ||
| wrap, err := wrapper.NewFromMorph(c.cfgMorph.client, c.cfgContainer.scriptHash, 0, wrapper.TryNotary()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check if it breaks container.Delete and container.SetEACL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, it breaks
|
@alexvanin, added resigning SN's notary request by IR instead of creating a new one key changes:
Questions:
|
|
@AnnaShaleva, can you, please, take a look at ce63109 and give us feedback about SN's notary request checking by alphabet node? |
|
|
||
| s.blockChan <- b | ||
| case response.NotaryRequestEventID: | ||
| notaryRequest, ok := notification.Value.(*response.NotaryRequestEvent) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're probably not interested in removed notary requests, only in those that have been added to the pool. So you may filter out removed ones right here:
if notaryRequest.Type == mempoolevent.TransactionRemoved {
continue
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that removed requests are being filtered later, but anyway, do we need them at all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be fair that's the question I'm asking myself in general (subscription API-wise), who needs them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just wanted to make base functionality in node listener: it can listen to, parse and handle any notary requests
but yes, there are no parsers and handlers for such(removes notary requests) events in the alphabet node now
/cc @alexvanin
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be fair that's the question I'm asking myself in general (subscription API-wise), who needs them?
I think it still can be a nice indicator of the case when neither main nor fallback transaction was completed. Other cases are covered by existing subscriptions API, e.g. subscriptions for transactions execution (main or fallback).
alexvanin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's rename IsAlphabet to AsAlphabet and call it a day for this PR.
In next PR I expect to see all container related notification with notary notification support, merged interfaces of NotaryContractProcessor and ContractProcessor and small processor event handling refactor.
pkg/morph/event/notary_preparator.go
Outdated
| } | ||
|
|
||
| func (p Preparator) validateExpiration(fbTX *transaction.Transaction) error { | ||
| if len(fbTX.Attributes) != 3 || fbTX.Attributes[1].Type != transaction.NotValidBeforeT { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The attributes order is undefined in general, so here you check the way neo-go RPC client constructs them. I suggest to keep attributes length check and use fbTX.GetAttributes(transation.NotValidBefore) instead of fetching attribute by index.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, added more general attribute check
Add preparator for notary requests. Is parses raw notary requests, checks if it should be handled by Alphabet node. If handling is required, returns `NotaryEvent` that contains information about contract scripthash, method name and arguments of the call. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Add handlers and parsers functionality for listener. Separate notification and notary events by files. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
`fallbackTime` is delta b/w `ValidUntilBlock` of the main transaction and block when `fallback` transaction is sent. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Prepare all listening structures for notary events: rename(add prefix/suffix 'notification') all notification specific handlers/parsers. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Add preparator for notary requests. Is parses raw notary requests, checks if it should be handled by Alphabet node. If handling is required, returns `NotaryEvent` that contains information about contract scripthash, method name and arguments of the call. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Add handlers and parsers functionality for listener. Separate notification and notary events by files. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Add `NotaryInvokeNotAlpha` to low-level client. It creates and sends notary request that must be signed by Alphabet nodes, but does not sign it by current node's private key. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Add `NotarySignAndInvokeTX` method to morph client. This function allows invoking notary request with passed main TX(not creating a new one). It signs passed main TX with client's key. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Implement `NotaryContractProcessor` by IR container processor. Add support for notary `put` container operation. Do not parse `put` non-notary notifications in notary enabled environment. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Storage Node needs to have notary deposit for successful notary request sending. Add notary deposit on startup(and wait for its acceptance). Add notary deposit timer, its config in `morph` section and env vars for its tuning. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Closes #519.
Implement notary requests subscription and handling mechanisms that can be also
reused for other
node->contract---*notification*--->alphabet->contractflows in the future.
Fix errors/typos in commentaries. Delete spaces in logs' keys.