-
Notifications
You must be signed in to change notification settings - Fork 37
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
control: add network settings management via ir control #3059
control: add network settings management via ir control #3059
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3059 +/- ##
==========================================
- Coverage 22.43% 21.95% -0.48%
==========================================
Files 792 797 +5
Lines 58538 59823 +1285
==========================================
+ Hits 13132 13135 +3
- Misses 44506 45787 +1281
- Partials 900 901 +1 ☔ View full report in Codecov by Sentry. |
f8477d6
to
9a98964
Compare
I have implemented the following methods: When calling the |
* [neofs-cli control](neofs-cli_control.md) - Operations with storage node | ||
* [neofs-cli control notary list](neofs-cli_control_notary_list.md) - Get list of all notary requests in network | ||
* [neofs-cli control notary request](neofs-cli_control_notary_request.md) - Create and send a notary request | ||
* [neofs-cli control notary sign](neofs-cli_control_notary_sign.md) - Sign notary request with it hash |
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.
* [neofs-cli control notary sign](neofs-cli_control_notary_sign.md) - Sign notary request with it hash | |
* [neofs-cli control notary sign](neofs-cli_control_notary_sign.md) - Sign notary request by its hash |
?
pkg/innerring/network.go
Outdated
func (s *Server) RequestNotary(method string, args ...string) (string, error) { | ||
if !s.IsAlphabet() { | ||
s.log.Info("non alphabet mode, ignore request") | ||
return "", nil |
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.
we can return the error, otherwise, it is not clear for the client what happened
pkg/innerring/network.go
Outdated
nonce uint32 = 1 | ||
vubP *uint32 |
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.
could be dropped (ok, nonce
can be a const if needed). this code does have its meaning in the morph
client code, but is useless here
pkg/innerring/network.go
Outdated
|
||
hash, err = s.netmapClient.Morph().NotaryInvoke(s.netmapClient.ContractAddress(), 0, nonce, vubP, method, epoch+1) | ||
if err != nil { | ||
s.log.Warn("can't invoke newEpoch method in alphabet contract", |
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.
this is not the alphabet contract here and below. alphabet contract is smth different. just netmap
. also, i would add info that it is an external request to understand logs better
err error | ||
) | ||
|
||
switch method { |
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.
what do we do in default
? it is also an error if we are requested to do things we cannot do. can be returned to client too
message NotaryRequestRequest { | ||
// Request body structure. | ||
message Body { | ||
string method = 1; |
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.
maybe it would be better to have a more generic contractHash, method, args
or maybe not @roman-khimov, @cthulhu-rider
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.
but then admin needs to know contract hash of course
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 keep it simple for now, can be extended in future.
// Request body structure. | ||
message Body { | ||
// Hash of transaction that need to be signed. | ||
string hash = 1; |
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 think raw representation would be better as we usually prefer in our protobuf protocol cc @roman-khimov
pkg/services/control/ir/types.proto
Outdated
|
||
// Hash of transaction. | ||
string hash = 2; | ||
} |
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.
add empty line before EOF, please
pkg/services/control/ir/types.proto
Outdated
// Info about transaction. | ||
message TransactionInfo { | ||
// Script that contains in the transaction. | ||
bytes script = 1; |
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.
it is not used now, right? do we need it?
pkg/services/control/ir/types.proto
Outdated
bytes script = 1; | ||
|
||
// Hash of transaction. | ||
string hash = 2; |
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 would also prefer raw hash here
I think it will be useful in the future, we may leave an issue or do this now. notaryPreparator can simplify it significantly. |
9a98964
to
742d111
Compare
message NotaryRequestRequest { | ||
// Request body structure. | ||
message Body { | ||
string method = 1; |
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 keep it simple for now, can be extended in future.
742d111
to
9e19c9e
Compare
New `neofs-cli control notary` with `list`, `request` and `sign` commands. - `list` - get list of all notary requests from notary pool. - `request` - send a notary request with one of the following methods: `newEpoch`, `setConfig` and `removeNode`. - `sign` - sign the notary request using a hash. Closes #2088, #1866. Signed-off-by: Andrey Butusov <[email protected]>
9e19c9e
to
3f32aae
Compare
Closes #2088, #1866.