-
Notifications
You must be signed in to change notification settings - Fork 168
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
Download segment data only once for verification #1393
Conversation
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.
We'll need to make sure params.Renditions
is populated as mentioned in #1382
0bb3a78
to
08842a3
Compare
Dismissing my own review because the latest changes I pushed resolves the request.
server/broadcast.go
Outdated
renditionData := make([][]byte, len(segData)) | ||
for i := range segData { | ||
renditionData[i] = make([]byte, len(segData[i])) | ||
copy(renditionData[i], segData[i]) |
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.
Can't we just do renditionData[i] = segData[i]
?
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 originally copied the data in segData[i]
because changes to segData[i]
would result in changes to params.Renditions[i]
since they would point to the same slice header. But, segData
is not used anywhere in server/broadcast.go
besides in verify()
so it should be safe to set params.Renditions
to segData
. In 75f9d11, I updated a few tests to allocate a new slice for segData
whenever passing it as an argument to verify()
(otherwise, some tests would fail because mutations to the same slice for segData
would mutate the values for params.Renditions
).
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.
Ahh I see, I would be okay with not mutating as a good practice here as well. I'll leave it up to you.
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.
Going to keep this change as avoiding the copy of segment data (which can be largeish) is nice.
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.
Ah yes didn't think about the size, good point.
Changes look good. I'll leave that one decision up to you whether you want to drop 75f9d11 or not. Can we rebase and resolve conflicts? |
Download the segment data if a verification policy is set or if the data needs to be uploaded to the broadcaster's own OS.
75f9d11
to
edde06d
Compare
Rebased. |
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.
LGTM 👍
Broadcaster nodes should download segment data once for both sig verification and pixel count verification
closes #1382