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

[5/N][multi quorum ejection] Compute num batches per quorum and block range #327

Merged
merged 4 commits into from
Mar 14, 2024

Conversation

jianoaix
Copy link
Contributor

@jianoaix jianoaix commented Mar 7, 2024

Why are these changes needed?

This is part of the work to compute operator nonsigning rate for ejection in multi quorum.

Roughly, this is the first 50% of step 4 in https://docs.google.com/document/d/13nxDXTAxRhT18qZrEkTtS2F7CxjlM0qA-2EGim1bu1k/edit (compute num batches a <operator, quorum> is responsible for)

Checks

  • I've made sure the lint is passing in this PR.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, in that case, please comment that they are not relevant.
  • Testing Strategy
    • Unit tests
    • Integration tests
    • This PR is not tested :(


// Representing an interval [StartBlock, EndBlock] (inclusive).
// NumBatchesAtBlock represents the number of batches at current block, as well as
// accumulated number of batches from a start block to the current block.
Copy link
Contributor

Choose a reason for hiding this comment

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

How is the start block represented in this struct?
Is it always the very beginning (ever since operator joined) or can it start at any given block?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The user can decide the beginning per use case

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, I have an idea to restructure it with more clarity

Comment on lines 423 to 424
assert.Equal(t, 4, dataapi.ComputeNumBatches(intervals, 5, 10))
assert.Equal(t, 2, dataapi.ComputeNumBatches(intervals, 6, 10))
Copy link
Contributor

Choose a reason for hiding this comment

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

so ComputeNumBatches(intervals, 6, 10)) returns 2 because that's the number of batches produced between 6 and 10.
Then should ComputeNumBatches(intervals, 5, 10)) be also 2? The first interval doesn't have the NumBatches field which implies that the 2 batches were produced earlier than block 5. Am i misunderstanding this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The block 5 is the first block in this list, so its NumBatches and AccuBatches are the same. The AccuBatches is computed with the first element as starting point.

}

func TestCreatQuorumBatches(t *testing.T) {
batchNonSigningInfo := []*dataapi.BatchNonSigningInfo{
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we comment that each element represents a batch?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added

@jianoaix jianoaix merged commit 9261e21 into Layr-Labs:master Mar 14, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants