-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
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.
good start! we should be able to cover this method comprehensively with a few changes
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); |
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.
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
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're still using create_header
here, would recommend removing the method and creating the headers manually in tests
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(())); |
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.
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
Ty for your help ! Appreciate lot! |
check_gas_limit
function
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.
have some comments remaining from the previous review, also other small things
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); |
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're still using create_header
here, would recommend removing the method and creating the headers manually in tests
} | ||
|
||
#[test] | ||
#[ignore] |
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 is this ignored? should probably not be ignored
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.
this looks good to me, ty!
No description provided.