Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bindings/src/codegen/** linguist-generated=true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ configs/

# Contract Bindings
**/codegen
!bindings/src/codegen/
# Grafana alloy config
config.alloy

Expand Down
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 20 additions & 7 deletions bindings/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,22 @@ fn main() -> anyhow::Result<()> {
println!("cargo:rerun-if-changed={}", contracts_package_path.join("remappings.txt"));
println!("cargo:rerun-if-changed={}", contracts_package_path.join("foundry.toml"));

// Check if forge is available
if Command::new("forge").arg("--version").output().is_err() {
println!("cargo:warning=Forge not found in PATH. Skipping bindings generation.");
return Ok(());
// Check if forge is available; skip regeneration if not (e.g. Docker builds).
// CI jobs with forge (cargo-tests, lint) will catch ABI drift.
let forge_check = Command::new("forge").arg("--version").output();
match forge_check {
Err(_) => {
println!("cargo:warning=Forge not found in PATH. Skipping bindings generation.");
return Ok(());
}
Ok(output) if !output.status.success() => {
anyhow::bail!(
"Forge is installed but returned an error. Check your Foundry installation."
);
}
Ok(_) => {} // forge available, continue
}

// Use 'forge bind' to generate bindings for only the contracts we need for E2E tests
let mut forge_command = Command::new("forge");
forge_command.args([
"bind",
Expand All @@ -38,8 +47,8 @@ fn main() -> anyhow::Result<()> {
"--skip-extra-derives",
]);

// Only generate bindings for the contracts we actually need for E2E testing
let required_contracts = [
// E2E test contracts
"DisputeGameFactory",
"SuperchainConfig",
"MockOptimismPortal2",
Expand All @@ -49,10 +58,14 @@ fn main() -> anyhow::Result<()> {
"OPSuccinctFaultDisputeGame",
"ERC1967Proxy",
"MockPermissionedDisputeGame",
// Also include interfaces that we need
// Interfaces
"IDisputeGameFactory",
"IDisputeGame",
"IFaultDisputeGame",
"IAnchorStateRegistry",
// Production contracts (host utils)
"OPSuccinctL2OutputOracle",
"OPSuccinctDisputeGame",
];

// Create a regex pattern that matches any of our required contracts
Expand Down
Loading
Loading