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

sdk: evict genesis config #4076

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

buffalojoec
Copy link

The next SDK eviction before being able to evict RentCollector! (See #3932)

@buffalojoec buffalojoec force-pushed the sdk-evict-genesis-config branch 2 times, most recently from 63f64dc to ad01b72 Compare December 18, 2024 06:55
@buffalojoec buffalojoec marked this pull request as ready for review December 18, 2024 06:56
Copy link

@joncinque joncinque left a comment

Choose a reason for hiding this comment

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

Looks great overall! Just tiny things

sdk/genesis-config/Cargo.toml Outdated Show resolved Hide resolved
sdk/src/lib.rs Outdated Show resolved Hide resolved
sdk/src/lib.rs Outdated Show resolved Hide resolved
sdk/genesis-config/Cargo.toml Outdated Show resolved Hide resolved
@buffalojoec buffalojoec force-pushed the sdk-evict-genesis-config branch from 7c1f579 to 8543d52 Compare January 7, 2025 06:42
@buffalojoec
Copy link
Author

@kevinheavey can you transfer the crate to anza-team if you haven't already?
cc @yihau

Copy link

@joncinque joncinque left a comment

Choose a reason for hiding this comment

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

It looks good to me, but there are some test failures that need to be resolved

@buffalojoec
Copy link
Author

buffalojoec commented Jan 7, 2025

It looks good to me, but there are some test failures that need to be resolved

Ahh nuts. One of the errors is an easy fix for solana_pubkey::new_rand(), but the other is because of the write method on GenesisConfig. It depends on the type's serde implementation, and since it's a public method, we have to either:

  • Break the crate and either put write behind the serde flag or move it as a free function to solana-ledger.
  • Don't break the crate and don't offer a serde feature for solana-genesis-config, also requiring the serde feature for all dependent crates in the GenesisConfig type.

EDIT: Acually I just made the serde feature default. Let me know if that works.

@kevinheavey
Copy link

Why does the serde feature need to be default?

@buffalojoec
Copy link
Author

Why does the serde feature need to be default?

write is a public method, which depends on serde. It won't work without the serde feature enabled, therefore it would need to be tucked under the serde feature as well, which is a breaking change.

@buffalojoec buffalojoec force-pushed the sdk-evict-genesis-config branch from 800385f to 36f3b24 Compare January 8, 2025 02:57
@kevinheavey
Copy link

But it would be a breaking change to the genesis-config crate which doesn't exist yet? We could just enable the genesis-config serde feature in solana-sdk

@buffalojoec buffalojoec force-pushed the sdk-evict-genesis-config branch from 36f3b24 to 95b00e1 Compare January 8, 2025 03:55
@buffalojoec
Copy link
Author

buffalojoec commented Jan 8, 2025

But it would be a breaking change to the genesis-config crate which doesn't exist yet?

It's a breaking change to the public API solana_sdk::genesis_config::GenesisConfig::write.

We could just enable the genesis-config serde feature in solana-sdk

Unfortunately the problem isn't in the SDK, but rather tha solana-genesis-config crate itself. The write method uses bincode on itself (GenesisConfig) and therefore depends on the serde implementation of itself. There are a few methods like this actually.

We probably need to just enable serde traits all the time for this type if we don't want to break the API for GenesisConfig. Alternatively, we can define a newGenesisConfig in this new crate, and leave the old one in-tact in the SDK, deprecating it in-place.

@kevinheavey
Copy link

Am I understanding correctly that the "breaking change" here is that if someone wants to import GenesisConfig from the new crate and use all the methods as before, they need to activate the serde feature?

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.

3 participants