Add method to read owner's subject hash from container #198

Closed
opened 2024-01-16 12:58:34 +00:00 by vdomnich-yadro · 1 comment

It is not really a problem, but rather mere inconvenience. In order to obtain subject hash (in frostfs-id contract) of container's owner, I need to do the following:

ownerAddress := container.Owner().EncodeToString()
ownerSubjectHash, err := address.StringToUint160(ownerAddress)

It works, but requires knowledge of how internally encoding to string works. Ideally I would want a method that would encapsulate this knowledge.

Describe the solution you'd like

I would like Container structure to have method like: OwnerSubjectHash() that would return me util.UInt160 representing subject hash of container owner. With this value I would be able to easily read subject from frostfs-id contract.

## Is your feature request related to a problem? Please describe. It is not really a problem, but rather mere inconvenience. In order to obtain subject hash (in frostfs-id contract) of container's owner, I need to do the following: ```go ownerAddress := container.Owner().EncodeToString() ownerSubjectHash, err := address.StringToUint160(ownerAddress) ``` It works, but requires knowledge of how internally encoding to string works. Ideally I would want a method that would encapsulate this knowledge. ## Describe the solution you'd like I would like [Container](https://git.frostfs.info/TrueCloudLab/frostfs-sdk-go/src/commit/56debcfa569e69c16e4a7be57d24f95ce2e46ffc/container/container.go#L42) structure to have method like: `OwnerSubjectHash()` that would return me `util.UInt160` representing subject hash of container owner. With this value I would be able to easily read subject from frostfs-id contract.
achuprov was assigned by fyrchik 2024-01-16 13:43:57 +00:00

We have SetScriptHash(), lets add ScriptHash() which returns w[1:21] as util.Uint160

We have `SetScriptHash()`, lets add `ScriptHash()` which returns `w[1:21]` as `util.Uint160`
Sign in to join this conversation.
No Milestone
No Assignees
2 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-sdk-go#198
There is no content yet.