Skip to content

Commit

Permalink
Removed state transition bytecode from the local testnet (#2215)
Browse files Browse the repository at this point in the history
Closes #2200

## Checklist
- [x] New behavior is reflected in tests

---------

Co-authored-by: acerone85 <andrea.cerone@gmail.com>
  • Loading branch information
xgreenx and acerone85 committed Sep 18, 2024
1 parent 9f6f982 commit 408c468
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ benches/benches-outputs/src/test_gas_costs_output.rs
node_modules/
package-lock.json
package.json
bin/fuel-core/chainspec/local-testnet/state_transition_bytecode.wasm

Binary file not shown.
18 changes: 11 additions & 7 deletions crates/chain-config/src/config/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ impl Default for ChainConfig {
fuel_core_types::blockchain::header::LATEST_STATE_TRANSITION_VERSION,
),
// Note: It is invalid bytecode.
state_transition_bytecode: vec![123; 1024],
state_transition_bytecode: vec![],
consensus: ConsensusConfig::default_poa(),
}
}
Expand All @@ -78,13 +78,17 @@ impl ChainConfig {
})?;

let bytecode_path = path.with_file_name(BYTECODE_NAME);
let bytecode = std::fs::read(bytecode_path).map_err(|e| {
anyhow::Error::new(e).context(format!(
"an error occurred while loading the state transition bytecode: {:?}",
path.to_str()
))
})?;

let bytecode = if bytecode_path.exists() {
std::fs::read(bytecode_path).map_err(|e| {
anyhow::Error::new(e).context(format!(
"an error occurred while loading the state transition bytecode: {:?}",
path.to_str()
))
})?
} else {
Vec::new()
};
chain_config.state_transition_bytecode = bytecode;

Ok(chain_config)
Expand Down
2 changes: 0 additions & 2 deletions tests/tests/local_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use fuel_core_types::{
blockchain::header::LATEST_STATE_TRANSITION_VERSION,
fuel_tx::GasCosts,
};
use fuel_core_upgradable_executor::WASM_BYTECODE;
use test_helpers::fuel_core_driver::FuelCoreDriver;

#[test]
Expand All @@ -29,7 +28,6 @@ fn local_chainconfig_validity() -> anyhow::Result<()> {
.set_gas_costs(benchmark_gas_costs);

if env::var_os("OVERRIDE_CHAIN_CONFIGS").is_some() {
chain_config.state_transition_bytecode = WASM_BYTECODE.to_vec();
chain_config.genesis_state_transition_version =
Some(LATEST_STATE_TRANSITION_VERSION);
std::fs::remove_file(&stored_snapshot.chain_config)?;
Expand Down

0 comments on commit 408c468

Please sign in to comment.