Skip to content

fix(init): reject negative shard indexes - #519

Open
zakazaka95 wants to merge 1 commit into
ethstorage:mainfrom
zakazaka95:fix/reject-negative-shard-index
Open

fix(init): reject negative shard indexes#519
zakazaka95 wants to merge 1 commit into
ethstorage:mainfrom
zakazaka95:fix/reject-negative-shard-index

Conversation

@zakazaka95

Copy link
Copy Markdown

Summary

  • reject negative --shard_index values before connecting to L1
  • add a CLI regression test for the invalid input

Why

--shard_index is parsed as a signed 64-bit value, but initialization later converts each index to uint64. A value such as -1 could therefore wrap to 18446744073709551615 instead of being rejected as invalid input. Validating immediately also avoids unnecessary RPC and configuration work.

The regression failed before the fix because initialization proceeded to the invalid RPC endpoint; after the fix it returns the exact non-negative validation error before any RPC work.

Testing

  • go build -v ./cmd/...
  • go test -v ./... -tags ci
  • go vet -tags=ci ./...
  • gofmt and git diff --check

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.

1 participant