Refactor user.ID.ScriptHash() usage #1618

Merged
fyrchik merged 2 commits from elebedeva/frostfs-node:fix/sdk-user-id-scripthash into master 2025-01-30 13:18:38 +00:00
Member

Related to TrueCloudLab/frostfs-sdk-go#302

user.ID.ScriptHash() does not return an error anymore.

Signed-off-by: Ekaterina Lebedeva ekaterina.lebedeva@yadro.com

Related to TrueCloudLab/frostfs-sdk-go#302 `user.ID.ScriptHash()` does not return an error anymore. Signed-off-by: Ekaterina Lebedeva <ekaterina.lebedeva@yadro.com>
elebedeva added 2 commits 2025-01-28 15:57:48 +00:00
Constant string `testOwnerID` for these tests has an invalid
format. It has 11 bytes instead of required 25 for `user.ID`.
It worked because:
  1. `user.ID` was a byte slice and didn't check length
     and format of byte slices decoded from strings.
  2. in these tests `testOwnerID` was used only to decode
     container owner id and to compare it with owner id encoded
     back to string.
Since `user.ID implementation has changed`, the problem arised.
Now `testOwnerID` is valid.

Signed-off-by: Ekaterina Lebedeva <ekaterina.lebedeva@yadro.com>
[#XXXX] pkg: Refactor user.ID.ScriptHash() usage
Some checks failed
DCO action / DCO (pull_request) Failing after 41s
Tests and linters / Run gofumpt (pull_request) Successful in 34s
Vulncheck / Vulncheck (pull_request) Failing after 56s
Build / Build Components (pull_request) Failing after 1m5s
Tests and linters / Staticcheck (pull_request) Failing after 1m14s
Pre-commit hooks / Pre-commit (pull_request) Successful in 1m30s
Tests and linters / Tests (pull_request) Failing after 1m28s
Tests and linters / Lint (pull_request) Failing after 1m53s
Tests and linters / gopls check (pull_request) Failing after 2m28s
Tests and linters / Tests with -race (pull_request) Failing after 2m35s
f0e603785c
`user.ID.ScriptHash()` does not return an error anymore.

Signed-off-by: Ekaterina Lebedeva <ekaterina.lebedeva@yadro.com>
requested reviews from storage-core-committers, storage-core-developers 2025-01-28 15:57:49 +00:00
elebedeva added the
refactoring
internal
labels 2025-01-28 15:59:02 +00:00
elebedeva changed title from Refactor user.ID.ScriptHash() usage to WIP: Refactor user.ID.ScriptHash() usage 2025-01-28 16:01:41 +00:00
elebedeva force-pushed fix/sdk-user-id-scripthash from f0e603785c to ec83958eb5 2025-01-28 16:02:42 +00:00 Compare
elebedeva force-pushed fix/sdk-user-id-scripthash from ec83958eb5 to 85f336466a 2025-01-29 14:33:20 +00:00 Compare
elebedeva changed title from WIP: Refactor user.ID.ScriptHash() usage to Refactor user.ID.ScriptHash() usage 2025-01-29 14:33:47 +00:00
dstepanov-yadro approved these changes 2025-01-29 14:48:51 +00:00
a-savchuk approved these changes 2025-01-29 14:52:12 +00:00
fyrchik approved these changes 2025-01-29 15:29:00 +00:00
@ -20,3 +20,3 @@
const (
testOwnerID = "FPPtmAi9TCX329"
testOwnerID = "NURFM8PWbLA2aLt2vrD8q4FyfAdgESwM8y"
Owner

Hm, why didn't our decoding function catch this earlier?

Hm, why didn't our decoding function catch this earlier?
Author
Member

user.ID was a byte slice and user.ID.DecodeString() didn't check length and format of byte slices decoded from strings.Also, in these tests testOwnerID was used only to decode container owner id and to compare it with owner id encoded back to string.

`user.ID` was a byte slice and `user.ID.DecodeString()` didn't check length and format of byte slices decoded from strings.Also, in these tests `testOwnerID` was used only to decode container owner id and to compare it with owner id encoded back to string.
fyrchik marked this conversation as resolved
elebedeva force-pushed fix/sdk-user-id-scripthash from 85f336466a to ae851b3922 2025-01-30 11:56:04 +00:00 Compare
fyrchik merged commit 24054cf6f4 into master 2025-01-30 13:18:38 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
4 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#1618
No description provided.