Skip to content

Commit

Permalink
Update chain tiers (#386)
Browse files Browse the repository at this point in the history
* Make celo and opbnbn tiers experimental

* Run formatter
  • Loading branch information
JonoPrest authored Dec 13, 2024
1 parent 79f82fb commit 131e7b8
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 52 deletions.
5 changes: 2 additions & 3 deletions codegenerator/cli/src/config_parsing/chain_helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -503,14 +503,13 @@ impl HypersyncNetwork {

Manta | Base | BerachainBartio | Boba | Blast | Cyber | Aurora | Harmony | Scroll
| Darwinia | Mode | Rsk | ShimmerEvm | Linea | NeonEvm | Amoy | Saakuru | Moonbeam
| Opbnb | Lisk | BlastSepolia | Celo | Chiliz | Fuji | ArbitrumOne | Merlin
| Holesky => Silver,
| Lisk | BlastSepolia | Chiliz | Fuji | ArbitrumOne | Merlin | Holesky => Silver,

Zora | MoonbaseAlpha | Morph | LuksoTestnet | Kroma | GnosisChiado | Lukso | Gnosis
| C1Milkomeda | Crab | Sophon | Flare | PolygonZkevm | MevCommit | Tangle => Bronze,

SophonTestnet | MorphTestnet | GaladrielDevnet | CitreaTestnet | Goerli
| BscTestnet | UnichainSepolia | Zircuit => Experimental,
| BscTestnet | UnichainSepolia | Zircuit | Celo | Opbnb => Experimental,
}
}

Expand Down
12 changes: 8 additions & 4 deletions codegenerator/cli/src/config_parsing/human_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,8 @@ pub mod evm {
pub save_full_history: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
#[schemars(
description = "Select the block and transaction fields to include in all events globally"
description = "Select the block and transaction fields to include in all events \
globally"
)]
pub field_selection: Option<FieldSelection>,
#[serde(skip_serializing_if = "Option::is_none")]
Expand All @@ -206,11 +207,13 @@ pub mod evm {
#[serde(deny_unknown_fields)]
pub struct FieldSelection {
#[schemars(
description = "The transaction fields to include in the event, or in all events if applied globally"
description = "The transaction fields to include in the event, or in all events if \
applied globally"
)]
pub transaction_fields: Option<Vec<TransactionField>>,
#[schemars(
description = "The block fields to include in the event, or in all events if applied globally"
description = "The block fields to include in the event, or in all events if applied \
globally"
)]
pub block_fields: Option<Vec<BlockField>>,
}
Expand Down Expand Up @@ -445,7 +448,8 @@ pub mod evm {
pub name: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
#[schemars(
description = "Select the block and transaction fields to include in the specific event"
description = "Select the block and transaction fields to include in the specific \
event"
)]
pub field_selection: Option<FieldSelection>,
}
Expand Down
102 changes: 57 additions & 45 deletions codegenerator/cli/src/config_parsing/system_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,12 @@ impl EnvState {
}
Err(err) => {
match err {
dotenvy::Error::Io(_, _) => (),
_ => println!("Warning: Failed loading .env file with unexpected error: {err}"),
};
dotenvy::Error::Io(_, _) => (),
_ => println!(
"Warning: Failed loading .env file with unexpected error: \
{err}"
),
};
self.maybe_dotenv = Some(EnvMap::new());
Err(err)
}
Expand Down Expand Up @@ -185,16 +188,18 @@ mod interpolation {

if !invalid_vars.is_empty() {
return Err(anyhow!(
"Failed to interpolate variables into your config file. Invalid environment variables are present: {}",
invalid_vars.join(", ")
));
"Failed to interpolate variables into your config file. Invalid environment \
variables are present: {}",
invalid_vars.join(", ")
));
}

if !missing_vars.is_empty() {
return Err(anyhow!(
"Failed to interpolate variables into your config file. Environment variables are not present: {}",
missing_vars.join(", ")
));
"Failed to interpolate variables into your config file. Environment variables are \
not present: {}",
missing_vars.join(", ")
));
}

Ok(config_string.to_string())
Expand Down Expand Up @@ -544,9 +549,10 @@ impl SystemConfig {
has_rpc_sync_src,
)
.context(format!(
"Failed parsing abi types for events in contract {} on network {}",
contract.name, network.id,
))?;
"Failed parsing abi types for events in contract {} on \
network {}",
contract.name, network.id,
))?;

let contract = Contract::new(
contract.name,
Expand All @@ -555,9 +561,10 @@ impl SystemConfig {
Abi::Evm(evm_abi),
)
.context(format!(
"Failed parsing locally defined network contract at network id {}",
network.id
))?;
"Failed parsing locally defined network contract at network \
id {}",
network.id
))?;

//Check if contract exists
unique_hashmap::try_insert(
Expand All @@ -566,22 +573,22 @@ impl SystemConfig {
contract,
)
.context(format!(
"Failed inserting locally defined network contract at network id \
{}",
network.id,
))?;
"Failed inserting locally defined network contract at network \
id {}",
network.id,
))?;
}
None => {
//Validate that there is a global contract for the given contract if
//there is no config
if !contracts.get(&contract.name).is_some() {
Err(anyhow!(
"Failed to parse contract '{}' for the network '{}'. If you use a \
global contract definition, please verify that the name \
reference is correct.",
contract.name,
network.id
))?;
"Failed to parse contract '{}' for the network '{}'. If \
you use a global contract definition, please verify that \
the name reference is correct.",
contract.name,
network.id
))?;
}
}
}
Expand Down Expand Up @@ -680,14 +687,15 @@ impl SystemConfig {
match contract.config {
Some(l_contract) => {
let (events, fuel_abi) = Event::from_fuel_events_config(
&l_contract.events,
&l_contract.abi_file_path,
&project_paths,
)
.context(format!(
"Failed parsing abi types for events in contract {} on network {}",
contract.name, network.id,
))?;
&l_contract.events,
&l_contract.abi_file_path,
&project_paths,
)
.context(format!(
"Failed parsing abi types for events in contract {} on \
network {}",
contract.name, network.id,
))?;

let contract = Contract::new(
contract.name.clone(),
Expand All @@ -697,24 +705,28 @@ impl SystemConfig {
)?;

//Check if contract exists
unique_hashmap::try_insert(&mut contracts, contract.name.clone(), contract)
.context(format!(
"Failed inserting locally defined network contract at network id \
{}",
network.id,
))?;
unique_hashmap::try_insert(
&mut contracts,
contract.name.clone(),
contract,
)
.context(format!(
"Failed inserting locally defined network contract at network \
id {}",
network.id,
))?;
}
None => {
//Validate that there is a global contract for the given contract if
//there is no local_contract_config
if !contracts.get(&contract.name).is_some() {
Err(anyhow!(
"Failed to parse contract '{}' for the network '{}'. If you use a \
global contract definition, please verify that the name \
reference is correct.",
contract.name,
network.id
))?;
"Failed to parse contract '{}' for the network '{}'. If \
you use a global contract definition, please verify that \
the name reference is correct.",
contract.name,
network.id
))?;
}
}
}
Expand Down

0 comments on commit 131e7b8

Please sign in to comment.