[#352] Add explicit max number of alphabet nodes #354

Merged
fyrchik merged 1 commit from ale64bit/frostfs-node:fix/352-clarify-too-many-alpha-nodes into master 2023-05-17 15:01:28 +00:00
Member

Signed-off-by: Alejandro Lopez a.lopez@yadro.com

Signed-off-by: Alejandro Lopez <a.lopez@yadro.com>
ale64bit requested review from storage-core-committers 2023-05-16 08:24:21 +00:00
ale64bit requested review from storage-core-developers 2023-05-16 08:24:22 +00:00
acid-ant approved these changes 2023-05-16 08:32:57 +00:00
fyrchik reviewed 2023-05-16 12:42:52 +00:00
@ -26,0 +26,4 @@
const (
// maxAlphabetNodes is the maximum number of candidates allowed, which is currently limited by the size
// of the verification script.
// See: https://github.com/nspcc-dev/neo-go/blob/740488f7f35e367eaa99a71c0a609c315fe2b0fc/pkg/core/transaction/witness.go#L10
Owner

I believe, it is invocation script, not verification.

I believe, it is invocation script, not verification.
Author
Member

done

done
fyrchik marked this conversation as resolved
@ -52,6 +61,10 @@ func initializeSideChainCmd(cmd *cobra.Command, _ []string) error {
}
defer initCtx.close()
if len(initCtx.Accounts) > maxAlphabetNodes {
Owner

What about failing inside newInitializeContext? This way we won't enter 23 passwords just to receive an error.

What about failing inside `newInitializeContext`? This way we won't enter 23 passwords just to receive an error.
Author
Member

done

done
fyrchik marked this conversation as resolved
@ -18,8 +18,8 @@ import (
"github.com/nspcc-dev/neo-go/pkg/vm/opcode"
)
// initialAlphabetNEOAmount represents the total amount of GAS distributed between alphabet nodes.
Owner

unrelated to the commit.

unrelated to the commit.
Author
Member

it's not unrelated. A new constant was added and this one was moved into a const block, so the comment needs to be nested as well since it refers to the specific constant and not to the whole block.

it's not unrelated. A new constant was added and this one was moved into a const block, so the comment needs to be nested as well since it refers to the specific constant and not to the whole block.
Owner

I mean the change is valid, but new constant was added not in this PR, can we just move this change (comment move) to another commit?

All such minor things in combination make diffs bigger and harder to read.

I mean the change is valid, but new constant was added not in this PR, can we just move this change (comment move) to another commit? All such minor things in combination make diffs bigger and harder to read.
Author
Member

done

done
fyrchik marked this conversation as resolved
@ -46,3 +50,3 @@
}
func testInitialize(t *testing.T, committeeSize int) {
func testInitialize(t *testing.T, committeeSize int, wantErr error) {
Owner

Can we just explicitly call generateTestData in the test instead of adding a parameter here?

Can we just explicitly call `generateTestData` in the test instead of adding a parameter here?
Author
Member

we can. But what's the benefit?

we can. But what's the benefit?
Owner

testInitialize tests initialization and checks all errors. It is not obvious, what error is expected here (for generation, initialization or sth else) and we use it only once.

`testInitialize` tests initialization and checks all errors. It is not obvious, what error is expected here (for generation, initialization or sth else) and we use it only once.
Author
Member

done

done
fyrchik marked this conversation as resolved
@ -82,2 +91,3 @@
func generateTestData(t *testing.T, dir string, size int) {
func generateTestData(t *testing.T, dir string, size int) error {
t.Helper()
Owner

Why do we need this line?

Why do we need this line?
Author
Member

Since this file is initialize_test.go and it tests initialization, I don't think this function should be calling test assertions since it's just a helper. This function marks it as such, so that it's skipped in the log to avoid verbose output.
We already have separate generate_test.go for testing generation specifically.

Since this file is `initialize_test.go` and it tests initialization, I don't think this function should be calling test assertions since it's just a helper. This function marks it as such, so that it's skipped in the log to avoid verbose output. We already have separate `generate_test.go` for testing generation specifically.
Author
Member

Actually, I apologize. I had this call in an earlier version but in current form ofc it's not necessary. I removed it.

Actually, I apologize. I had this call in an earlier version but in current form ofc it's not necessary. I removed it.
fyrchik marked this conversation as resolved
ale64bit force-pushed fix/352-clarify-too-many-alpha-nodes from 7a9743272c to 20661a0bc7 2023-05-16 12:59:51 +00:00 Compare
ale64bit force-pushed fix/352-clarify-too-many-alpha-nodes from 20661a0bc7 to 52fd548060 2023-05-16 13:22:10 +00:00 Compare
dstepanov-yadro approved these changes 2023-05-16 14:31:43 +00:00
aarifullin approved these changes 2023-05-16 14:56:37 +00:00
ale64bit force-pushed fix/352-clarify-too-many-alpha-nodes from 52fd548060 to 99b4464674 2023-05-17 07:35:39 +00:00 Compare
fyrchik merged commit df9e099fa7 into master 2023-05-17 15:01:27 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
5 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: TrueCloudLab/frostfs-node#354
No description provided.