Skip to content

Commit

Permalink
Respect chain override in genesis system object generation (MystenLab…
Browse files Browse the repository at this point in the history
…s#15632)

## Description 

As in title

## Test Plan 

Will check against CI test

---
If your changes are not user-facing and do not break anything, you can
skip the following section. Otherwise, please briefly describe what has
changed under the Release Notes section.

### Type of Change (Check all that apply)

- [ ] protocol change
- [ ] user-visible impact
- [ ] breaking change for a client SDKs
- [ ] breaking change for FNs (FN binary must upgrade)
- [ ] breaking change for validators or node operators (must upgrade
binaries)
- [ ] breaking change for on-chain data layout
- [ ] necessitate either a data wipe or data migration

### Release notes
  • Loading branch information
williampsmith authored Jan 9, 2024
1 parent e419b46 commit 0c0a906
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
5 changes: 1 addition & 4 deletions crates/sui-genesis-builder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1013,12 +1013,9 @@ pub fn generate_genesis_system_object(
token_distribution_schedule: &TokenDistributionSchedule,
metrics: Arc<LimitsMetrics>,
) -> anyhow::Result<()> {
// We don't know the chain ID here since we haven't yet created the genesis checkpoint.
// However since we know there are no chain specific protocol config options in genesis,
// we use Chain::Unknown here.
let protocol_config = ProtocolConfig::get_for_version(
ProtocolVersion::new(genesis_chain_parameters.protocol_version),
sui_protocol_config::Chain::Unknown,
ChainIdentifier::default().chain(),
);

let pt = {
Expand Down
4 changes: 2 additions & 2 deletions crates/sui-types/src/digests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ pub struct ChainIdentifier(CheckpointDigest);
pub static MAINNET_CHAIN_IDENTIFIER: OnceCell<ChainIdentifier> = OnceCell::new();
pub static TESTNET_CHAIN_IDENTIFIER: OnceCell<ChainIdentifier> = OnceCell::new();

/// For testing purposes, you can set this environment variable to force protocol config to use
/// a specific Chain.
/// For testing purposes or bootstrapping regenesis chaing configuration, you can set
/// this environment variable to force protocol config to use a specific Chain.
const SUI_PROTOCOL_CONFIG_CHAIN_OVERRIDE_ENV_VAR_NAME: &str = "SUI_PROTOCOL_CONFIG_CHAIN_OVERRIDE";

static SUI_PROTOCOL_CONFIG_CHAIN_OVERRIDE: Lazy<Option<Chain>> = Lazy::new(|| {
Expand Down

0 comments on commit 0c0a906

Please sign in to comment.