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

feat(consensus): support test for check_gas_limit function #5329

Merged
merged 9 commits into from
Nov 14, 2023

Conversation

DoTheBestToGetTheBest
Copy link
Contributor

No description provided.

@mattsse mattsse requested a review from Rjected November 6, 2023 17:18
@mattsse mattsse added the C-test A change that impacts how or what we test label Nov 6, 2023
Copy link
Member

@Rjected Rjected left a comment

Choose a reason for hiding this comment

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

good start! we should be able to cover this method comprehensively with a few changes

Comment on lines 883 to 889
fn create_header(gas_limit: u64) -> SealedHeader {
SealedHeader { header: Header { gas_limit, ..Default::default() }, ..Default::default() }
}

#[test]
fn test_invalid_gas_limit_increase_exceeding_limit() {
let parent = create_header(1024 * 10);
Copy link
Member

Choose a reason for hiding this comment

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

not sure we need a method just for this, we can probably create the headers directly with the specified gas limits, like with the first few tests

Copy link
Member

Choose a reason for hiding this comment

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

we're still using create_header here, would recommend removing the method and creating the headers manually in tests

Comment on lines 877 to 880
let mut chain_spec = ChainSpec::default();
chain_spec.hardforks.insert(Hardfork::London, ForkCondition::Block(1));

assert_eq!(check_gas_limit(&parent, &child, &chain_spec), Ok(()));
Copy link
Member

Choose a reason for hiding this comment

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

this probably won't test anything related to london since parent and child both have block number zero in this case, I would set the block number of the parent, and have London fork at block zero when testing block number edge cases

@DoTheBestToGetTheBest
Copy link
Contributor Author

good start! we should be able to cover this method comprehensively with a few changes

Ty for your help ! Appreciate lot!

@rkrasiuk rkrasiuk changed the title feat(consensus) support test for check_gas_limit function feat(consensus): support test for check_gas_limit function Nov 8, 2023
Copy link
Member

@Rjected Rjected left a comment

Choose a reason for hiding this comment

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

have some comments remaining from the previous review, also other small things

Comment on lines 883 to 889
fn create_header(gas_limit: u64) -> SealedHeader {
SealedHeader { header: Header { gas_limit, ..Default::default() }, ..Default::default() }
}

#[test]
fn test_invalid_gas_limit_increase_exceeding_limit() {
let parent = create_header(1024 * 10);
Copy link
Member

Choose a reason for hiding this comment

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

we're still using create_header here, would recommend removing the method and creating the headers manually in tests

}

#[test]
#[ignore]
Copy link
Member

@Rjected Rjected Nov 8, 2023

Choose a reason for hiding this comment

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

why is this ignored? should probably not be ignored

Copy link
Member

@Rjected Rjected left a comment

Choose a reason for hiding this comment

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

this looks good to me, ty!

@Rjected Rjected added this pull request to the merge queue Nov 14, 2023
Merged via the queue into paradigmxyz:main with commit 8ecd90b Nov 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-test A change that impacts how or what we test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants