Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor upload-bin handler to reuse more of SDK built-in functionality #3714

Closed
AnnaShaleva opened this issue Dec 2, 2024 · 2 comments · Fixed by #3749
Closed

Refactor upload-bin handler to reuse more of SDK built-in functionality #3714

AnnaShaleva opened this issue Dec 2, 2024 · 2 comments · Fixed by #3749
Labels
cli Command line interface feature Completely new functionality I4 No visible changes S4 Routine U3 Regular
Milestone

Comments

@AnnaShaleva
Copy link
Member

Is your feature request related to a problem? Please describe.

upload-bin has code that manually constructs object before uploading it to NeoFS:

ownerID.SetScriptHash(owner)
hdr.SetPayload(objData)
hdr.SetPayloadSize(uint64(len(objData)))
hdr.SetContainerID(containerID)
hdr.SetOwnerID(&ownerID)
hdr.SetAttributes(attrs...)
hdr.SetCreationEpoch(1)
v.SetMajor(1)
hdr.SetVersion(v)
if !homomorphicHashingDisabled {
checksum.Calculate(&chHomomorphic, checksum.TZ, objData)
hdr.SetPayloadHomomorphicHash(chHomomorphic)
}
checksum.Calculate(&chSHA256, checksum.SHA256, objData)
hdr.SetPayloadChecksum(chSHA256)
err := hdr.SetIDWithSignature(signer)
if err != nil {
return resOID, err
}
err = hdr.CheckHeaderVerificationFields()
if err != nil {
return resOID, err
}

Describe the solution you'd like

NeoFS SDK already has a proper object construction code, we need to reuse it.

Describe alternatives you've considered

Keep it as is, depends on the result of #3652.

@AnnaShaleva AnnaShaleva added feature Completely new functionality U3 Regular cli Command line interface S4 Routine I4 No visible changes labels Dec 2, 2024
@AliceInHunterland
Copy link
Contributor

Only after nspcc-dev/neofs-node#2721 (comment) and resolved nspcc-dev/neofs-node#2990, because such "improper" usage of NeoFS is intended to prevent duplicates. Currently, we can only have duplicates because of partially completed search results. Such object creation reduces the likelihood of duplicates with the current search version.

@AnnaShaleva
Copy link
Member Author

Ref. #3654 (comment).

@AnnaShaleva AnnaShaleva added this to the v0.108.0 milestone Dec 13, 2024
AliceInHunterland added a commit that referenced this issue Dec 13, 2024
AliceInHunterland added a commit that referenced this issue Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli Command line interface feature Completely new functionality I4 No visible changes S4 Routine U3 Regular
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants