-
Notifications
You must be signed in to change notification settings - Fork 165
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
Keep chunk length less than blob length #702
base: master
Are you sure you want to change the base?
Changes from 6 commits
a7e4907
3ede773
0da1963
98874c2
5f44a1d
757a4ae
67dc1c6
6656d8a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -206,10 +206,16 @@ func (c *StdAssignmentCoordinator) ValidateChunkLength(state *OperatorState, blo | |
denom := new(big.Int).Mul(big.NewInt(int64(info.ConfirmationThreshold-info.AdversaryThreshold)), totalStake) | ||
maxChunkLength := uint(roundUpDivideBig(num, denom).Uint64()) | ||
|
||
maxChunkLength2 := roundUpDivide(2*blobLength*percentMultiplier, MaxRequiredNumChunks*uint(info.ConfirmationThreshold-info.AdversaryThreshold)) | ||
// Ensure that the max chunk length is not greater than the blob length | ||
if maxChunkLength > blobLength { | ||
maxChunkLength = blobLength | ||
} | ||
|
||
chunkLengthForMaxRequiredNumChunks := roundUpDivide(2*blobLength*percentMultiplier, MaxRequiredNumChunks*uint(info.ConfirmationThreshold-info.AdversaryThreshold)) | ||
|
||
if maxChunkLength < maxChunkLength2 { | ||
maxChunkLength = maxChunkLength2 | ||
// We should not require the chunk length to be so small that the number of chunks is greater than the max required | ||
if maxChunkLength < chunkLengthForMaxRequiredNumChunks { | ||
maxChunkLength = chunkLengthForMaxRequiredNumChunks | ||
} | ||
|
||
maxChunkLength = uint(nextPowerOf2(uint64(maxChunkLength))) | ||
|
@@ -230,10 +236,18 @@ func (c *StdAssignmentCoordinator) ValidateChunkLength(state *OperatorState, blo | |
// too large for the constraint in ValidateChunkLength | ||
func (c *StdAssignmentCoordinator) CalculateChunkLength(state *OperatorState, blobLength, targetNumChunks uint, param *SecurityParam) (uint, error) { | ||
|
||
if targetNumChunks != 0 { | ||
return 0, errors.New("not supported") | ||
} | ||
|
||
chunkLength := uint(MinChunkLength) * 2 | ||
|
||
for { | ||
|
||
if chunkLength > blobLength { | ||
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. would it make sense to place this check as a condition in 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. I don't think it's essential, but it probably makes sense. I'll add it. 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. oh I was thinking if we moved this to 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. Makes sense. Changed it. |
||
return chunkLength / 2, nil | ||
} | ||
|
||
quorumInfo := &BlobQuorumInfo{ | ||
SecurityParam: *param, | ||
ChunkLength: chunkLength, | ||
|
@@ -244,16 +258,8 @@ func (c *StdAssignmentCoordinator) CalculateChunkLength(state *OperatorState, bl | |
return chunkLength / 2, nil | ||
} | ||
|
||
if targetNumChunks != 0 { | ||
|
||
_, info, err := c.GetAssignments(state, blobLength, quorumInfo) | ||
if err != nil { | ||
return 0, err | ||
} | ||
|
||
if info.TotalChunks <= targetNumChunks { | ||
return chunkLength, nil | ||
} | ||
if chunkLength == blobLength { | ||
return chunkLength, nil | ||
} | ||
|
||
chunkLength *= 2 | ||
|
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.
Why target num chunks has to be zero? Actually it's not used below.
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 we should deprecate this feature:
New design here: https://www.notion.so/eigen-labs/Data-Allocation-v3-a75080bd7d334365809bbb2cfcaae538