Skip to content

Commit

Permalink
chore: rename alphanet to odyssey
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse committed Dec 4, 2024
1 parent 3784cd8 commit 1bd7e71
Show file tree
Hide file tree
Showing 24 changed files with 115 additions and 123 deletions.
12 changes: 6 additions & 6 deletions crates/anvil/src/cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ pub struct NodeArgs {
pub slots_in_an_epoch: u64,

/// Writes output of `anvil` as json to user-specified file.
#[arg(long, value_name = "FILE", value_hint = clap::ValueHint::FilePath)]
pub config_out: Option<PathBuf>,
#[arg(long, value_name = "OUT_FILE")]
pub config_out: Option<String>,

/// Disable auto and interval mining, and mine on demand instead.
#[arg(long, visible_alias = "no-mine", conflicts_with = "block_time")]
Expand Down Expand Up @@ -275,7 +275,7 @@ impl NodeArgs {
.with_transaction_block_keeper(self.transaction_block_keeper)
.with_max_persisted_states(self.max_persisted_states)
.with_optimism(self.evm_opts.optimism)
.with_alphanet(self.evm_opts.alphanet)
.with_odyssey(self.evm_opts.odyssey)
.with_disable_default_create2_deployer(self.evm_opts.disable_default_create2_deployer)
.with_slots_in_an_epoch(self.slots_in_an_epoch)
.with_memory_limit(self.evm_opts.memory_limit)
Expand Down Expand Up @@ -583,9 +583,9 @@ pub struct AnvilEvmArgs {
#[arg(long)]
pub memory_limit: Option<u64>,

/// Enable Alphanet features
#[arg(long, visible_alias = "odyssey")]
pub alphanet: bool,
/// Enable Odyssey features
#[arg(long, visible_alias = "alphanet")]
pub odyssey: bool,
}

/// Resolves an alias passed as fork-url to the matching url defined in the rpc_endpoints section
Expand Down
16 changes: 8 additions & 8 deletions crates/anvil/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ pub struct NodeConfig {
pub memory_limit: Option<u64>,
/// Factory used by `anvil` to extend the EVM's precompiles.
pub precompile_factory: Option<Arc<dyn PrecompileFactory>>,
/// Enable Alphanet features.
pub alphanet: bool,
/// Enable Odyssey features.
pub odyssey: bool,
/// Do not print log messages.
pub silent: bool,
/// The path where states are cached.
Expand Down Expand Up @@ -467,7 +467,7 @@ impl Default for NodeConfig {
slots_in_an_epoch: 32,
memory_limit: None,
precompile_factory: None,
alphanet: false,
odyssey: false,
silent: false,
cache_path: None,
}
Expand Down Expand Up @@ -507,7 +507,7 @@ impl NodeConfig {

/// Returns the hardfork to use
pub fn get_hardfork(&self) -> ChainHardfork {
if self.alphanet {
if self.odyssey {
return ChainHardfork::Ethereum(EthereumHardfork::PragueEOF);
}
if let Some(hardfork) = self.hardfork {
Expand Down Expand Up @@ -952,10 +952,10 @@ impl NodeConfig {
self
}

/// Sets whether to enable Alphanet support
/// Sets whether to enable Odyssey support
#[must_use]
pub fn with_alphanet(mut self, alphanet: bool) -> Self {
self.alphanet = alphanet;
pub fn with_odyssey(mut self, odyssey: bool) -> Self {
self.odyssey = odyssey;
self
}

Expand Down Expand Up @@ -1055,7 +1055,7 @@ impl NodeConfig {
Arc::new(RwLock::new(fork)),
self.enable_steps_tracing,
self.print_logs,
self.alphanet,
self.odyssey,
self.prune_history,
self.max_persisted_states,
self.transaction_block_keeper,
Expand Down
18 changes: 9 additions & 9 deletions crates/anvil/src/eth/backend/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use foundry_evm::{
},
},
traces::CallTraceNode,
utils::alphanet_handler_register,
utils::odyssey_handler_register,
};
use revm::{db::WrapDatabaseRef, primitives::MAX_BLOB_GAS_PER_BLOCK};
use std::sync::Arc;
Expand Down Expand Up @@ -106,7 +106,7 @@ pub struct TransactionExecutor<'a, Db: ?Sized, V: TransactionValidator> {
/// Cumulative blob gas used by all executed transactions
pub blob_gas_used: u64,
pub enable_steps_tracing: bool,
pub alphanet: bool,
pub odyssey: bool,
pub print_logs: bool,
/// Precompiles to inject to the EVM.
pub precompile_factory: Option<Arc<dyn PrecompileFactory>>,
Expand Down Expand Up @@ -314,7 +314,7 @@ impl<DB: Db + ?Sized, V: TransactionValidator> Iterator for &mut TransactionExec
}

let exec_result = {
let mut evm = new_evm_with_inspector(&mut *self.db, env, &mut inspector, self.alphanet);
let mut evm = new_evm_with_inspector(&mut *self.db, env, &mut inspector, self.odyssey);
if let Some(factory) = &self.precompile_factory {
inject_precompiles(&mut evm, factory.precompiles());
}
Expand Down Expand Up @@ -398,20 +398,20 @@ fn build_logs_bloom(logs: Vec<Log>, bloom: &mut Bloom) {
}
}

/// Creates a database with given database and inspector, optionally enabling alphanet features.
/// Creates a database with given database and inspector, optionally enabling odyssey features.
pub fn new_evm_with_inspector<DB: revm::Database>(
db: DB,
env: EnvWithHandlerCfg,
inspector: &mut dyn revm::Inspector<DB>,
alphanet: bool,
odyssey: bool,
) -> revm::Evm<'_, &mut dyn revm::Inspector<DB>, DB> {
let EnvWithHandlerCfg { env, handler_cfg } = env;

let mut handler = revm::Handler::new(handler_cfg);

handler.append_handler_register_plain(revm::inspector_handle_register);
if alphanet {
handler.append_handler_register_plain(alphanet_handler_register);
if odyssey {
handler.append_handler_register_plain(odyssey_handler_register);
}

let context = revm::Context::new(revm::EvmContext::new_with_env(db, env), inspector);
Expand All @@ -424,10 +424,10 @@ pub fn new_evm_with_inspector_ref<'a, DB>(
db: DB,
env: EnvWithHandlerCfg,
inspector: &mut dyn revm::Inspector<WrapDatabaseRef<DB>>,
alphanet: bool,
odyssey: bool,
) -> revm::Evm<'a, &mut dyn revm::Inspector<WrapDatabaseRef<DB>>, WrapDatabaseRef<DB>>
where
DB: revm::DatabaseRef,
{
new_evm_with_inspector(WrapDatabaseRef(db), env, inspector, alphanet)
new_evm_with_inspector(WrapDatabaseRef(db), env, inspector, odyssey)
}
14 changes: 7 additions & 7 deletions crates/anvil/src/eth/backend/mem/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ pub struct Backend {
active_state_snapshots: Arc<Mutex<HashMap<U256, (u64, B256)>>>,
enable_steps_tracing: bool,
print_logs: bool,
alphanet: bool,
odyssey: bool,
/// How to keep history state
prune_state_history_config: PruneStateHistoryConfig,
/// max number of blocks with transactions in memory
Expand Down Expand Up @@ -223,7 +223,7 @@ impl Backend {
fork: Arc<RwLock<Option<ClientFork>>>,
enable_steps_tracing: bool,
print_logs: bool,
alphanet: bool,
odyssey: bool,
prune_state_history_config: PruneStateHistoryConfig,
max_persisted_states: Option<usize>,
transaction_block_keeper: Option<usize>,
Expand Down Expand Up @@ -275,7 +275,7 @@ impl Backend {
(cfg.slots_in_an_epoch, cfg.precompile_factory.clone())
};

let (capabilities, executor_wallet) = if alphanet {
let (capabilities, executor_wallet) = if odyssey {
// Insert account that sponsors the delegated txs. And deploy P256 delegation contract.
let mut db = db.write().await;

Expand Down Expand Up @@ -326,7 +326,7 @@ impl Backend {
active_state_snapshots: Arc::new(Mutex::new(Default::default())),
enable_steps_tracing,
print_logs,
alphanet,
odyssey,
prune_state_history_config,
transaction_block_keeper,
node_config,
Expand Down Expand Up @@ -999,7 +999,7 @@ impl Backend {
&'i mut dyn revm::Inspector<WrapDatabaseRef<&'db dyn DatabaseRef<Error = DatabaseError>>>,
WrapDatabaseRef<&'db dyn DatabaseRef<Error = DatabaseError>>,
> {
let mut evm = new_evm_with_inspector_ref(db, env, inspector, self.alphanet);
let mut evm = new_evm_with_inspector_ref(db, env, inspector, self.odyssey);
if let Some(factory) = &self.precompile_factory {
inject_precompiles(&mut evm, factory.precompiles());
}
Expand Down Expand Up @@ -1080,7 +1080,7 @@ impl Backend {
enable_steps_tracing: self.enable_steps_tracing,
print_logs: self.print_logs,
precompile_factory: self.precompile_factory.clone(),
alphanet: self.alphanet,
odyssey: self.odyssey,
};

// create a new pending block
Expand Down Expand Up @@ -1162,7 +1162,7 @@ impl Backend {
blob_gas_used: 0,
enable_steps_tracing: self.enable_steps_tracing,
print_logs: self.print_logs,
alphanet: self.alphanet,
odyssey: self.odyssey,
precompile_factory: self.precompile_factory.clone(),
};
let executed_tx = executor.execute();
Expand Down
6 changes: 3 additions & 3 deletions crates/anvil/tests/it/anvil_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,7 @@ async fn test_reorg() {
// === wallet endpoints === //
#[tokio::test(flavor = "multi_thread")]
async fn can_get_wallet_capabilities() {
let (api, handle) = spawn(NodeConfig::test().with_alphanet(true)).await;
let (api, handle) = spawn(NodeConfig::test().with_odyssey(true)).await;

let provider = handle.http_provider();

Expand All @@ -834,7 +834,7 @@ async fn can_get_wallet_capabilities() {

#[tokio::test(flavor = "multi_thread")]
async fn can_add_capability() {
let (api, _handle) = spawn(NodeConfig::test().with_alphanet(true)).await;
let (api, _handle) = spawn(NodeConfig::test().with_odyssey(true)).await;

let init_capabilities = api.get_capabilities().unwrap();

Expand Down Expand Up @@ -864,7 +864,7 @@ async fn can_add_capability() {

#[tokio::test(flavor = "multi_thread")]
async fn can_set_executor() {
let (api, _handle) = spawn(NodeConfig::test().with_alphanet(true)).await;
let (api, _handle) = spawn(NodeConfig::test().with_odyssey(true)).await;

let expected_addr = address!("f39Fd6e51aad88F6F4ce6aB8827279cffFb92266");
let pk = "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80".to_string();
Expand Down
22 changes: 8 additions & 14 deletions crates/cast/bin/cmd/call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ pub struct CallArgs {
#[arg(long, short)]
block: Option<BlockId>,

/// Enable Alphanet features.
#[arg(long, alias = "odyssey")]
pub alphanet: bool,
/// Enable Odyssey features.
#[arg(long, alias = "alphanet")]
pub odyssey: bool,

#[command(subcommand)]
command: Option<CallSubcommands>,
Expand Down Expand Up @@ -180,7 +180,7 @@ impl CallArgs {
}

let create2_deployer = evm_opts.create2_deployer;
let (mut env, fork, chain, alphanet) =
let (mut env, fork, chain, odyssey) =
TracingExecutor::get_fork_material(&config, evm_opts).await?;

// modify settings that usually set in eth_call
Expand All @@ -195,14 +195,8 @@ impl CallArgs {
InternalTraceMode::None
})
.with_state_changes(shell::verbosity() > 4);
let mut executor = TracingExecutor::new(
env,
fork,
evm_version,
trace_mode,
alphanet,
create2_deployer,
);
let mut executor =
TracingExecutor::new(env, fork, evm_version, trace_mode, odyssey, create2_deployer);

let value = tx.value.unwrap_or_default();
let input = tx.inner.input.into_input().unwrap_or_default();
Expand Down Expand Up @@ -247,8 +241,8 @@ impl figment::Provider for CallArgs {
fn data(&self) -> Result<Map<Profile, Dict>, figment::Error> {
let mut map = Map::new();

if self.alphanet {
map.insert("alphanet".into(), self.alphanet.into());
if self.odyssey {
map.insert("odyssey".into(), self.odyssey.into());
}

if let Some(evm_version) = self.evm_version {
Expand Down
14 changes: 7 additions & 7 deletions crates/cast/bin/cmd/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ pub struct RunArgs {
#[arg(long, value_name = "NO_RATE_LIMITS", visible_alias = "no-rpc-rate-limit")]
pub no_rate_limit: bool,

/// Enables Alphanet features.
#[arg(long, alias = "odyssey")]
pub alphanet: bool,
/// Enables Odyssey features.
#[arg(long, alias = "alphanet")]
pub odyssey: bool,

/// Use current project artifacts for trace decoding.
#[arg(long, visible_alias = "la")]
Expand Down Expand Up @@ -138,7 +138,7 @@ impl RunArgs {
config.fork_block_number = Some(tx_block_number - 1);

let create2_deployer = evm_opts.create2_deployer;
let (mut env, fork, chain, alphanet) =
let (mut env, fork, chain, odyssey) =
TracingExecutor::get_fork_material(&config, evm_opts).await?;

let mut evm_version = self.evm_version;
Expand Down Expand Up @@ -176,7 +176,7 @@ impl RunArgs {
fork,
evm_version,
trace_mode,
alphanet,
odyssey,
create2_deployer,
);
let mut env =
Expand Down Expand Up @@ -283,8 +283,8 @@ impl figment::Provider for RunArgs {
fn data(&self) -> Result<Map<Profile, Dict>, figment::Error> {
let mut map = Map::new();

if self.alphanet {
map.insert("alphanet".into(), self.alphanet.into());
if self.odyssey {
map.insert("odyssey".into(), self.odyssey.into());
}

if let Some(api_key) = &self.etherscan.key {
Expand Down
10 changes: 5 additions & 5 deletions crates/common/src/evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,10 @@ pub struct EvmArgs {
#[serde(skip)]
pub isolate: bool,

/// Whether to enable Alphanet features.
#[arg(long, alias = "odyssey")]
/// Whether to enable Odyssey features.
#[arg(long, alias = "alphanet")]
#[serde(skip)]
pub alphanet: bool,
pub odyssey: bool,
}

// Make this set of options a `figment::Provider` so that it can be merged into the `Config`
Expand All @@ -170,8 +170,8 @@ impl Provider for EvmArgs {
dict.insert("isolate".to_string(), self.isolate.into());
}

if self.alphanet {
dict.insert("alphanet".to_string(), self.alphanet.into());
if self.odyssey {
dict.insert("odyssey".to_string(), self.odyssey.into());
}

if self.always_use_create_2_factory {
Expand Down
9 changes: 5 additions & 4 deletions crates/config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -490,8 +490,9 @@ pub struct Config {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub eof_version: Option<EofVersion>,

/// Whether to enable Alphanet features.
pub alphanet: bool,
/// Whether to enable Odyssey features.
#[serde(alias = "alphanet")]
pub odyssey: bool,

/// Timeout for transactions in seconds.
pub transaction_timeout: u64,
Expand Down Expand Up @@ -1128,7 +1129,7 @@ impl Config {
/// Returns the [SpecId] derived from the configured [EvmVersion]
#[inline]
pub fn evm_spec_id(&self) -> SpecId {
evm_spec_id(self.evm_version, self.alphanet)
evm_spec_id(self.evm_version, self.odyssey)
}

/// Returns whether the compiler version should be auto-detected
Expand Down Expand Up @@ -2373,7 +2374,7 @@ impl Default for Config {
warnings: vec![],
extra_args: vec![],
eof_version: None,
alphanet: false,
odyssey: false,
transaction_timeout: 120,
additional_compiler_profiles: Default::default(),
compilation_restrictions: Default::default(),
Expand Down
2 changes: 1 addition & 1 deletion crates/config/src/providers/ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ impl<P: Provider> Provider for BackwardsCompatTomlProvider<P> {
}

if let Some(v) = dict.remove("odyssey") {
dict.insert("alphanet".to_string(), v);
dict.insert("odyssey".to_string(), v);
}
map.insert(profile, dict);
}
Expand Down
Loading

0 comments on commit 1bd7e71

Please sign in to comment.