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

vsr: assert that view headers have correct command on the write path #1635

Merged
merged 1 commit into from
Mar 1, 2024

Conversation

matklad
Copy link
Member

@matklad matklad commented Mar 1, 2024

In the superblock, we do

pub fn vsr_headers(superblock: *const SuperBlockHeader) vsr.Headers.ViewChangeSlice {
    return vsr.Headers.ViewChangeSlice.init(
        if (superblock.vsr_state.log_view < superblock.vsr_state.view)
            .do_view_change
        else
            .start_view,
        superblock.vsr_headers_all[0..superblock.vsr_headers_count],
    );
}

Let's assert that this command-deducing logic is consistent with what we actually write.

In the superblock, we do

    pub fn vsr_headers(superblock: *const SuperBlockHeader) vsr.Headers.ViewChangeSlice {
        return vsr.Headers.ViewChangeSlice.init(
            if (superblock.vsr_state.log_view < superblock.vsr_state.view)
                .do_view_change
            else
                .start_view,
            superblock.vsr_headers_all[0..superblock.vsr_headers_count],
        );
    }

Let's assert that this command-deducing logic is consistent with what we
actually write.
@matklad matklad added this pull request to the merge queue Mar 1, 2024
Merged via the queue into main with commit fe956d2 Mar 1, 2024
27 checks passed
@matklad matklad deleted the matklad/assert-headers-command branch March 1, 2024 15:38
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.

None yet

2 participants