Move struct parsers to separate file #97

Merged
fyrchik merged 1 commit from achuprov/frostfs-contract:frostfsid/move_service_functions into master 2024-06-21 12:37:46 +00:00
Member

Ref: #93

Make frostfsid struct parsers public to enable their use in other components.

Ref: TrueCloudLab/frostfs-node#1117 TrueCloudLab/frostfs-node#1179

Signed-off-by: Alexander Chuprov a.chuprov@yadro.com

Ref: #93 Make `frostfsid` struct parsers public to enable their use in other components. Ref: https://git.frostfs.info/TrueCloudLab/frostfs-node/pulls/1117 https://git.frostfs.info/TrueCloudLab/frostfs-node/pulls/1179 Signed-off-by: Alexander Chuprov <a.chuprov@yadro.com>
achuprov force-pushed frostfsid/move_service_functions from 02981ea7c6 to 6b76e11a93 2024-06-18 15:32:13 +00:00 Compare
achuprov requested review from storage-core-committers 2024-06-18 16:13:45 +00:00
achuprov requested review from storage-core-developers 2024-06-18 16:13:46 +00:00
achuprov requested review from storage-services-committers 2024-06-18 16:13:52 +00:00
achuprov requested review from storage-services-developers 2024-06-18 16:13:53 +00:00
fyrchik requested changes 2024-06-19 08:38:46 +00:00
@ -0,0 +12,4 @@
"github.com/nspcc-dev/neo-go/pkg/vm/vmstate"
)
func UnwrapArrayOfUint160(items []stackitem.Item, err error) ([]util.Uint160, error) {
Owner

Please, remove closes #93 from the PR description, that task was to properly integrate these to rpcclient/ package (that means unwrap should accept *result.Invoke and no makeValidRes nonsense).

Please, remove `closes #93` from the PR description, that task was to properly integrate these to `rpcclient/` package (that means unwrap should accept `*result.Invoke` and no `makeValidRes` nonsense).
@ -0,0 +20,4 @@
return unwrap.ArrayOfUint160(MakeValidRes(stackitem.NewArray(items)))
}
func MakeValidRes(item stackitem.Item) (*result.Invoke, error) {
Owner

This function shouldn't be public, it is too generic in scope.

This function shouldn't be public, it is too generic in scope.
Author
Member

fixed

fixed
@ -0,0 +27,4 @@
}, nil
}
func MakeResFromAppExec(res *state.AppExecResult) (*result.Invoke, error) {
Owner

Same for this one. If it is used multiple times, it is ok to copy.

Same for this one. If it is used multiple times, it is ok to copy.
aarifullin reviewed 2024-06-19 10:46:42 +00:00
@ -0,0 +34,4 @@
}, nil
}
func ParseSubject(structArr []stackitem.Item) (*Subject, error) {
Member

I agree with such a move of util functions to the separate file, but we need to remember that client/client.go is not regenerated that surely will cause errors if a refactor/introduction occurs.

Didn't you consider to keep utils.go but remove client.go?
My point is to use client from rpcclient that also allows to use anonymous invoker (doesn't require to sign txs). Then the contract's client (like frostfs-node, frostfs-s3-gw) can parse received results with util.go. WDYT?

I agree with such a move of util functions to the separate file, but we need to remember that `client/client.go` is not regenerated that surely will cause errors if a refactor/introduction occurs. Didn't you consider to keep `utils.go` but remove `client.go`? My point is to use client from `rpcclient` that **also** allows to use *anonymous* invoker (doesn't require to sign txs). Then the contract's client (like `frostfs-node`, `frostfs-s3-gw`) can parse received results with `util.go`. WDYT?
Owner

Didn't you consider to keep utils.go but remove client.go?

This is another task. s3-gw uses structs from the client.go, so we cannot just remove it.

>Didn't you consider to keep utils.go but remove client.go? This is another task. s3-gw uses structs from the `client.go`, so we cannot just remove it.
aarifullin marked this conversation as resolved
achuprov force-pushed frostfsid/move_service_functions from 6b76e11a93 to 2aba66806c 2024-06-21 11:34:59 +00:00 Compare
fyrchik approved these changes 2024-06-21 12:23:22 +00:00
aarifullin approved these changes 2024-06-21 12:28:36 +00:00
elebedeva approved these changes 2024-06-21 12:34:00 +00:00
fyrchik merged commit 2aba66806c into master 2024-06-21 12:37:46 +00:00
Sign in to join this conversation.
No reviewers
TrueCloudLab/storage-services-committers
TrueCloudLab/storage-services-developers
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-contract#97
No description provided.