-
Notifications
You must be signed in to change notification settings - Fork 69
Node api finality #1897
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
Open
esuwu
wants to merge
25
commits into
add-network-messages
Choose a base branch
from
node-api-finality
base: add-network-messages
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Node api finality #1897
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
d5bcb7d
Drafted endpoints for API
esuwu 4be1b1e
Updated protobuf structures
esuwu 52af168
Merge branch 'add-network-messages' into node-api-finality
esuwu d033dc9
Added finalization storage
esuwu 402ef6f
Fixed errors
esuwu 1caf2a1
Fixed old code
esuwu 82a7a2e
SignCommitGeneration draft
esuwu aac66f8
Merged from finality network messages
esuwu 350e93d
Finished signCommitToGeneration
esuwu 9b96f0f
Merged from add network messages
esuwu 20bf1d8
Added validation of finalization
esuwu 282bf9f
Added finalization validation
esuwu cd82ba3
Added a finalization processor for tx appender
esuwu 51f714d
Merged from add-network-messages
esuwu 44ad778
Merged from add-network-messages
esuwu 40c3d02
Merged again
esuwu 5dce8da
Added clients methods
esuwu b77abc1
Added http client itests
esuwu 6e83e89
Fixed an error
esuwu 2bfd983
Updated protobuf version
esuwu d17d321
Merge branch 'add-network-messages' into node-api-finality
esuwu a504094
Merge branch 'add-network-messages' into node-api-finality
esuwu 1258e13
Implemented nickeskov's suggestions
esuwu 8b80e20
Implemented some AI suggestions
esuwu 57f2cf6
Made the tx signing handle all tx types
esuwu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,20 +18,6 @@ var ( | |
| notFound = errors.New("not found") | ||
| ) | ||
|
|
||
| // BadRequestError represents a bad request error. | ||
| // Deprecated: don't use this error type in new code. Create a new error type or value in 'pkg/api/errors' package. | ||
| type BadRequestError struct { | ||
| inner error | ||
| } | ||
|
|
||
| func wrapToBadRequestError(err error) *BadRequestError { | ||
| return &BadRequestError{inner: err} | ||
| } | ||
|
|
||
| func (e *BadRequestError) Error() string { | ||
| return e.inner.Error() | ||
| } | ||
|
|
||
| // AuthError represents an authentication error or problem. | ||
| // Deprecated: don't use this error type in new code. Create a new error type or value in 'pkg/api/errors' package. | ||
| type AuthError struct { | ||
|
|
@@ -62,17 +48,18 @@ func (eh *ErrorHandler) Handle(w http.ResponseWriter, r *http.Request, err error | |
| } | ||
| // target errors | ||
| var ( | ||
| badRequestError *BadRequestError | ||
| authError *AuthError | ||
| unknownError *apiErrs.UnknownError | ||
| apiError apiErrs.ApiError | ||
| badRequestError *apiErrs.BadRequestError | ||
| authError *AuthError | ||
| unknownError *apiErrs.UnknownError | ||
| apiError apiErrs.ApiError | ||
| unavailableError *apiErrs.UnavailableError | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. New error should implement
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. They already do |
||
| // check that all targets implement the error interface | ||
| _, _, _, _ = error(badRequestError), error(authError), error(unknownError), error(apiError) | ||
| _, _, _, _, _ = error(badRequestError), error(authError), error(unknownError), | ||
| error(apiError), error(unavailableError) | ||
| ) | ||
| switch { | ||
| case errors.As(err, &badRequestError): | ||
| // nickeskov: this error type will be removed in future | ||
| http.Error(w, fmt.Sprintf("Failed to complete request: %s", badRequestError.Error()), http.StatusBadRequest) | ||
| eh.sendApiErrJSON(w, r, badRequestError) | ||
| case errors.As(err, &authError): | ||
| // nickeskov: this error type will be removed in future | ||
| http.Error(w, fmt.Sprintf("Failed to complete request: %s", authError.Error()), http.StatusForbidden) | ||
|
|
@@ -86,6 +73,8 @@ func (eh *ErrorHandler) Handle(w http.ResponseWriter, r *http.Request, err error | |
| eh.sendApiErrJSON(w, r, unknownError) | ||
| case errors.As(err, &apiError): | ||
| eh.sendApiErrJSON(w, r, apiError) | ||
| case errors.As(err, &unavailableError): | ||
| eh.sendApiErrJSON(w, r, unavailableError) | ||
| default: | ||
| eh.logger.Error("InternalServerError", | ||
| slog.String("proto", r.Proto), | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.