Skip to content

Commit d8cb1a7

Browse files
apollo_gateway: insert optional versioned constant overrides to gateway
1 parent 31e1d1b commit d8cb1a7

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

crates/apollo_gateway/src/stateful_transaction_validator.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ impl StatefulTransactionValidatorFactoryTrait for StatefulTransactionValidatorFa
8989
);
9090

9191
let state = CachedState::new(state_reader_and_contract_manager);
92-
let mut versioned_constants = VersionedConstants::get_versioned_constants(Some(
92+
let mut versioned_constants = VersionedConstants::get_versioned_constants(
9393
self.config.versioned_constants_overrides.clone(),
94-
));
94+
);
9595
// The validation of a transaction is not affected by the casm hash migration.
9696
versioned_constants.enable_casm_hash_migration = false;
9797

crates/apollo_gateway_config/src/config.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ pub struct StatefulTransactionValidatorConfig {
231231
pub max_allowed_nonce_gap: u32,
232232
pub reject_future_declare_txs: bool,
233233
pub max_nonce_for_validation_skip: Nonce,
234-
pub versioned_constants_overrides: VersionedConstantsOverrides,
234+
pub versioned_constants_overrides: Option<VersionedConstantsOverrides>,
235235
// Minimum gas price as percentage of threshold to accept transactions.
236236
pub min_gas_price_percentage: u8, // E.g., 80 to require 80% of threshold.
237237
}
@@ -244,7 +244,9 @@ impl Default for StatefulTransactionValidatorConfig {
244244
reject_future_declare_txs: true,
245245
max_nonce_for_validation_skip: Nonce(Felt::ONE),
246246
min_gas_price_percentage: 100,
247-
versioned_constants_overrides: VersionedConstantsOverrides::default(),
247+
// TODO(Itamar): Change to None once the versioned constants overrides are optional in
248+
// the config schema.
249+
versioned_constants_overrides: Some(VersionedConstantsOverrides::default()),
248250
}
249251
}
250252
}
@@ -285,7 +287,7 @@ impl SerializeConfig for StatefulTransactionValidatorConfig {
285287
),
286288
]);
287289
dump.append(&mut prepend_sub_config_name(
288-
self.versioned_constants_overrides.dump(),
290+
self.versioned_constants_overrides.clone().unwrap_or_default().dump(),
289291
"versioned_constants_overrides",
290292
));
291293
dump

0 commit comments

Comments
 (0)