Skip to content

Conversation

@Wodann
Copy link
Contributor

@Wodann Wodann commented Mar 3, 2025

Introduces an API that allows construction of a CfgEnv with a SpecId. This is useful when using a SpecId type that doesn't implement Default.

The changes avoid duplication of default parameters by calling with_spec from fn default.

@codspeed-hq
Copy link

codspeed-hq bot commented Mar 3, 2025

CodSpeed Performance Report

Merging #2135 will not alter performance

Comparing NomicFoundation:refactor/with-chain (6d8ed5a) with main (55a3e8f)

Summary

✅ 8 untouched benchmarks

CfgEnv {
chain_id: self.chain_id,
limit_contract_code_size: self.limit_contract_code_size,
pub fn with_spec(spec: SPEC) -> Self {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
pub fn with_spec(spec: SPEC) -> Self {
pub fn new_with_spec(spec: SPEC) -> Self {

Functions that create the object are more obvious if they start with new_

and would be good to leave previous functions

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Resolved by 6d8ed5a

FYI, I chose the with_* function name as this naming convention is commonplace for constructors in the STL. E.g. Vec::with_capacity.

@rakita rakita merged commit 60ead3a into bluealloy:main Mar 4, 2025
27 of 28 checks passed
This was referenced Mar 4, 2025
@Wodann Wodann deleted the refactor/with-chain branch March 4, 2025 17:22
@github-actions github-actions bot mentioned this pull request Mar 10, 2025
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