Skip to content

Commit

Permalink
Merge pull request #708 from primitivefinance/arbiter_bind/debug
Browse files Browse the repository at this point in the history
Arbiter bind/debug
  • Loading branch information
0xJepsen authored Nov 15, 2023
2 parents bb87da2 + 266a005 commit e8480b2
Show file tree
Hide file tree
Showing 5 changed files with 396 additions and 109 deletions.
1 change: 0 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,4 @@ jobs:
uses: codecov/codecov-action@v3
with:
files: lcov.info
yml: .github/codecov.yml
fail_ci_if_error: true
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ Inflector = { version = "=0.11.4" }
# Building files
quote.workspace = true
foundry-config = { version = "=0.2.0" }
tempfile = { version = "3.8.1"}

# Errors
thiserror.workspace = true

# Dependencies for the test build and development
[dev-dependencies]
tokio.workspace = true
tempfile = { version = "=3.8.1" }
assert_cmd = { version = "=2.0.12" }
rayon = { version = "1.8.0" }
revm-primitives.workspace = true
Expand Down
34 changes: 31 additions & 3 deletions bin/bind/digest.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use super::*;

#[derive(Debug, Deserialize, serde::Serialize)]
#[derive(Debug, Deserialize, serde::Serialize, Clone)]
pub struct ArbiterConfig {
/// The path to the directory where the bindings will be generated.
pub bindings_path: PathBuf,
Expand All @@ -18,14 +18,42 @@ impl ArbiterConfig {
ignore_interfaces: false,
}
}

pub fn _new_mock_config_with_submodules() -> Self {
ArbiterConfig {
bindings_path: PathBuf::from("src").join("bindings"),
submodules: true,
ignore_interfaces: false,
}
}
}

impl ArbiterConfig {
pub(crate) fn new() -> Result<Self, ConfigError> {
let s = Config::builder()
.add_source(config::File::with_name("arbiter.toml"))
.build()?;
s.try_deserialize()
// Try loading the TOML content from the file
Ok(s.into())
}
}

impl Default for ArbiterConfig {
fn default() -> Self {
Self {
bindings_path: PathBuf::from("src").join("bindings"),
submodules: false,
ignore_interfaces: false,
}
}
}

impl From<config::Config> for ArbiterConfig {
fn from(config: config::Config) -> Self {
// Here you need to convert the `config::Config` into `ArbiterConfig`
ArbiterConfig {
bindings_path: PathBuf::from("src").join("bindings"),
submodules: config.get_bool("submodules").unwrap_or(false),
ignore_interfaces: config.get_bool("ignore_interfaces").unwrap_or(true),
}
}
}
Loading

0 comments on commit e8480b2

Please sign in to comment.