-
Notifications
You must be signed in to change notification settings - Fork 923
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
feat(shwap): Integrate shrex into shwap #3554
Conversation
f266624
to
e014d0a
Compare
bfc59c9
to
788e26b
Compare
// ResetContextOnError returns a fresh context if the given context has an error. | ||
func ResetContextOnError(ctx context.Context) context.Context { | ||
if ctx.Err() != nil { | ||
ctx = context.Background() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know that this is an old func, but should we change to something 'safer' ? context.WithTimeout(time.Second)
by example. WDYT ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it makes sense, but not in this PR. Perhaps time.Second should be passed to function in. Like
NewContextOnContextErr(ctx, newTimeout time.Time)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nd review
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- ctxOnError and utils moves feel competely unnecessary and could be avoided
- general comment is to extract read(with validate)/write helpers to shwap pkg
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
srv.metrics.ObserveRequests(ctx, 1, shrex.StatusSuccess) | ||
if err = s.Close(); err != nil { | ||
log.Debugw("server: closing stream", "err", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
error
return | ||
} | ||
if err = s.Close(); err != nil { | ||
log.Debugw("server: closing stream", "err", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
error
} | ||
} | ||
|
||
func readEds(ctx context.Context, stream network.Stream, root *share.AxisRoots) (*rsmt2d.ExtendedDataSquare, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This whole helper should move to new_eds
as ReadAccessor
This PR add shrex integration with shwap. Key changes:
This PR is meant to be broken on lint and test CI. It will be fixed in subsequent PR, that will integrate shrex into nodebuilder.