Use bytes in control service proto definition for chainID #885

Merged
fyrchik merged 2 commits from dkirillov/frostfs-node:feature/control_api_make_chain_id_bytes into master 2024-01-11 07:24:27 +00:00
Member
  • Make chainID as bytes in grpc proto (in control service)
  • Support providing chainID in hex format in frostfs-cli
* Make chainID as bytes in grpc proto (in control service) * Support providing chainID in hex format in `frostfs-cli`
dkirillov force-pushed feature/control_api_make_chain_id_bytes from e88f7a009b to bd70ea3d17 2023-12-21 13:05:07 +00:00 Compare
dkirillov changed title from WIP: feature/control_api_make_chain_id_bytes to feature/control_api_make_chain_id_bytes 2023-12-21 13:05:40 +00:00
dkirillov requested review from storage-core-committers 2023-12-21 13:05:45 +00:00
dkirillov requested review from storage-core-developers 2023-12-21 13:05:46 +00:00
dstepanov-yadro reviewed 2023-12-21 15:46:55 +00:00
@ -33,1 +34,4 @@
chainID, _ := cmd.Flags().GetString(chainIDFlag)
hexEncoded, _ := cmd.Flags().GetBool(chainIDHexFlag)
if hexEncoded {

Is chain ID user-defined string? If so, then hex looks redundant

Is chain ID user-defined string? If so, then hex looks redundant
Author
Member

Yes, it's can be user-defined. But in case when we add local overrides from IAM service ids can be not-printable so we need some way to provide such id using frostfs-cli

Yes, it's can be user-defined. But in case when we add local overrides from IAM service ids can be not-printable so we need some way to provide such id using `frostfs-cli`
dstepanov-yadro marked this conversation as resolved
dstepanov-yadro approved these changes 2023-12-22 07:31:23 +00:00
fyrchik reviewed 2023-12-22 10:50:41 +00:00
@ -64,3 +64,3 @@
var chain apechain.Chain
commonCmd.ExitOnErr(cmd, "decode error: %w", chain.DecodeBytes(c))
cmd.Println("Parsed chain:\n" + prettyJSONFormat(cmd, chain.Bytes()))
cmd.Printf("Parsed chain (chain id hex: '%x'):\n%s\n", chain.ID, prettyJSONFormat(cmd, chain.Bytes()))
Owner

Can we use utf8.IsValid and do not output string on false?

Can we use `utf8.IsValid` and do not output string on false?
Author
Member

Do you mean not output json chain or which one string?

Do you mean not output json chain or which one string?
Owner

Oh, sorry, thought it was a name.

Oh, sorry, thought it was a name.
fyrchik marked this conversation as resolved
@ -15,2 +16,3 @@
const (
chainIDFlag = "chain-id"
chainIDFlag = "chain-id"
chainIDHexFlag = "chain-id-hex"
Owner

Hex is not needed for cli, cli is for user.

Hex is not needed for cli, cli is for user.
Author
Member

Yes, but we can set overrides via IAM #885 (comment)

Yes, but we can set overrides via IAM https://git.frostfs.info/TrueCloudLab/frostfs-node/pulls/885#issuecomment-29780
Owner

We need this in control service, but hex-encoding is a purely CLI thing.

We need this in control service, but hex-encoding is a purely CLI thing.
Author
Member

Let's consider the use-case:

  1. Someone (e.g. IAM) set non-utf8 id
  2. User using cli lists all policies and see policy from step 1
  3. User want to delete/get policy from step 1. He needs somehow pass non-utf8 id via CLI

If this isn't a case, I can keep only this commit

Let's consider the use-case: 1. Someone (e.g. IAM) set non-utf8 id 2. User using cli lists all policies and see policy from step 1 3. User want to delete/get policy from step 1. He needs somehow pass non-utf8 id via CLI If this isn't a case, I can keep only [this commit](https://git.frostfs.info/TrueCloudLab/frostfs-node/commit/2a1d79a37dc45c723c9edf49d2ee46084d10f5fb)
Owner

Control service lists only local overrides, IAM uses contract.

Control service lists only local overrides, IAM uses contract.
Author
Member

IAM uses not only contract. It sets local overrides in s3/node too

IAM uses not only contract. It sets local overrides in s3/node too
@ -507,3 +507,3 @@
// Chain ID assigned for the added rule chain.
string chain_id = 2;
bytes chain_id = 2;
Owner

If we agree to use hash of the serialized chain as the key in contract, do we need this?

If we agree to use hash of the serialized chain as the key in contract, do we need this?
Author
Member

No, we don't need this. But then I would renane chain_id to something else? Probably even here

No, we don't need this. But then I would renane `chain_id` to something else? Probably even [here](https://git.frostfs.info/TrueCloudLab/policy-engine/src/commit/ed93bb5cc57465c1b9b5caa4c8e3b62cdf5357e1/pkg/chain/chain.go#L14)
dkirillov force-pushed feature/control_api_make_chain_id_bytes from bd70ea3d17 to c1cbab092e 2024-01-09 08:22:59 +00:00 Compare
acid-ant approved these changes 2024-01-09 11:22:25 +00:00
fyrchik approved these changes 2024-01-10 08:26:32 +00:00
fyrchik removed review request for storage-core-developers 2024-01-10 08:26:37 +00:00
fyrchik requested review from storage-core-developers 2024-01-10 08:26:55 +00:00
aarifullin approved these changes 2024-01-10 08:29:38 +00:00
fyrchik changed title from feature/control_api_make_chain_id_bytes to Use bytes in control service proto definition for chainID 2024-01-10 08:35:44 +00:00
fyrchik added the
frostfs-cli
frostfs-node
labels 2024-01-10 08:35:59 +00:00
dkirillov force-pushed feature/control_api_make_chain_id_bytes from c1cbab092e to 474aff315c 2024-01-11 06:36:44 +00:00 Compare
fyrchik approved these changes 2024-01-11 07:24:13 +00:00
fyrchik merged commit 4a4c790ec1 into master 2024-01-11 07:24:27 +00:00
dkirillov deleted branch feature/control_api_make_chain_id_bytes 2024-01-11 07:30:20 +00:00
fyrchik referenced this pull request from a commit 2024-01-12 15:38:43 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
5 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#885
No description provided.