Move SignMessage away from control/server package #1092

Closed
opened 2024-04-12 08:45:59 +00:00 by fyrchik · 3 comments
Owner

This makes it necessary to import server package in client code just to sign the message.

func SignMessage(key *ecdsa.PrivateKey, msg SignedMessage) error {

cc @alexvanin

This makes it necessary to import server package in client code just to sign the message. https://git.frostfs.info/TrueCloudLab/frostfs-node/src/commit/40781b3a20240185b2b76e6fc676196ded1d9395/pkg/services/control/server/sign.go#L73 cc @alexvanin
fyrchik added the
frostfs-node
label 2024-04-12 08:45:59 +00:00
fyrchik added this to the v0.39.0 milestone 2024-04-12 08:46:03 +00:00
achuprov was assigned by fyrchik 2024-04-22 08:03:23 +00:00
Author
Owner

It could be in the control package itself, which is imported in control/server anyway.

It could be in the `control` package itself, which is imported in `control/server` anyway.
achuprov added the
internal
label 2024-04-22 09:49:00 +00:00
Member

Moving SignMessage to the control package would cause a cyclic import of packages. It might then be necessary to create a separate package.
@alexvanin Can you describe the issue in more detail?

Moving `SignMessage` to the control package would cause a cyclic import of packages. It might then be necessary to create a separate package. @alexvanin Can you describe the issue in more detail?
Owner

@alexvanin Can you describe the issue in more detail?

Sure. In my project I import two dependencies.

Dependency Reason
git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/control/server Use SignMessage to sign Control API requests to update policy chains
git.frostfs.info/TrueCloudLab/frostfs-sdk-go/pool/tree Use tree pool to send requests to Tree Service

Those dependencies also use these packages:

  • git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/tree
  • git.frostfs.info/TrueCloudLab/frostfs-sdk-go/pool/tree/service

And those packages contain init function to initializae gRPC structure which leads to runtime error in the application

panic: proto: file "pkg/services/tree/types.proto" is already registered
        previously from: "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/pool/tree/service"
        currently from:  "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/tree"
See https://protobuf.dev/reference/go/faq#namespace-conflict

My fix was to copy sign.go file to my repo and avoid package import.

> @alexvanin Can you describe the issue in more detail? Sure. In my project I import two dependencies. | Dependency | Reason | | -- | -- | | git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/control/server | Use `SignMessage` to sign Control API requests to update policy chains | | git.frostfs.info/TrueCloudLab/frostfs-sdk-go/pool/tree | Use tree pool to send requests to Tree Service | Those dependencies also use these packages: - git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/tree - git.frostfs.info/TrueCloudLab/frostfs-sdk-go/pool/tree/service And those packages contain `init` function to initializae gRPC structure which leads to runtime error in the application ``` panic: proto: file "pkg/services/tree/types.proto" is already registered previously from: "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/pool/tree/service" currently from: "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/tree" See https://protobuf.dev/reference/go/faq#namespace-conflict ``` My fix was to copy `sign.go` file to my repo and avoid package import.
fyrchik modified the milestone from v0.39.0 to vNext 2024-05-14 14:03:42 +00:00
fyrchik modified the milestone from vNext to v0.40.0 2024-05-14 14:29:30 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
3 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#1092
No description provided.