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

fix: add challenge v2 api to avoid piece hash http header too large #1189

Merged
merged 1 commit into from
Oct 23, 2023

Conversation

will-2012
Copy link
Collaborator

@will-2012 will-2012 commented Oct 17, 2023

Description

Add challenge v2 API to avoid piece hash HTTP header too large.

Rationale

Components such as nginx can disconnect because the response header is too large, and users receive a 502 HTTP status code.

Example

N/A.

Changes

Notable changes:

  • Gateway add new challenge API v2.

@will-2012 will-2012 added the wip Working in process label Oct 17, 2023
@will-2012 will-2012 marked this pull request as draft October 17, 2023 13:40
@@ -377,6 +378,169 @@ func (g *GateModular) getChallengeInfoHandler(w http.ResponseWriter, r *http.Req
log.CtxDebug(reqCtx.Context(), "succeed to get challenge info")
}

// getChallengeInfoV2Handler handles get challenge piece info request. Current only greenfield
// validator can challenge piece is store correctly. The challenge piece info includes:
Copy link
Collaborator

@sysvm sysvm Oct 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, only greenfield validator can challenge piece whether is stored correctly. is better.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

// validator can challenge piece is store correctly. The challenge piece info includes:
// the challenged piece data, all piece hashes and the integrity hash. The challenger
// can verify the info whether are correct by comparing with the greenfield info.
// The difference between the v2 interface and the old interface is the format of the returned results,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the old interface(v1) is better.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@will-2012 will-2012 added r4r Ready for review and removed wip Working in process labels Oct 23, 2023
@will-2012 will-2012 marked this pull request as ready for review October 23, 2023 01:21
Copy link
Collaborator

@sysvm sysvm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@will-2012 will-2012 merged commit 6cd2a28 into master Oct 23, 2023
11 checks passed
@will-2012 will-2012 deleted the fix-challenge-502 branch October 23, 2023 02:15
ruojunm pushed a commit that referenced this pull request Oct 23, 2023
…1189)

Co-authored-by: will@2012 <xibaow2020@qq.com>
(cherry picked from commit 6cd2a28)
constwz pushed a commit that referenced this pull request Oct 31, 2023
…1189)

Co-authored-by: will@2012 <xibaow2020@qq.com>
(cherry picked from commit 6cd2a28)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
r4r Ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants