Skip to content

Commit

Permalink
chore: move Forge code into relay_rpc
Browse files Browse the repository at this point in the history
  • Loading branch information
chris13524 committed Apr 23, 2024
1 parent aec8d23 commit 53373ae
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 9 deletions.
4 changes: 0 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ rand = "0.8.5"
futures-util = "0.3"
once_cell = "1.19"

[build-dependencies]
serde_json = "1.0"
hex = "0.4.3"

[[example]]
name = "websocket_client"
required-features = ["client", "rpc"]
Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ The core Relay client. Provides access to all available Relay RPC methods to bui

Provides all of the Relay domain types (e.g. `ClientId`, `ProjectId` etc.) as well as auth token generation and validation functionality.

### `cacao` feature

To aid IDE integration you may want to add this to your local `relay_rpc/Cargo.toml` file:

```toml
[features]
default = ["cacao"]
```

### Test dependencies

Foundry is required to be installed to your system for testing: <https://book.getfoundry.sh/getting-started/installation>
Expand Down
4 changes: 4 additions & 0 deletions relay_rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,9 @@ strum = { version = "0.26", features = ["strum_macros", "derive"] }
[dev-dependencies]
tokio = { version = "1.35.1", features = ["test-util", "macros"] }

[build-dependencies]
serde_json = "1.0"
hex = "0.4.3"

[lints.clippy]
indexing_slicing = "deny"
10 changes: 6 additions & 4 deletions build.rs → relay_rpc/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,19 @@ use {
};

fn main() {
println!("cargo::rerun-if-changed=contracts/");
println!("cargo::rerun-if-changed=relay_rpc/contracts/");
#[cfg(feature = "cacao")]
compile_contracts();

#[cfg(feature = "cacao")]
extract_eip6492_bytecode();
}

fn compile_contracts() {
let output = Command::new("forge")
.args([
"build",
"--contracts=contracts",
"--contracts=relay_rpc/contracts",
"--cache-path",
"target/.forge/cache",
"--out",
Expand All @@ -35,9 +37,9 @@ fn compile_contracts() {
}

fn extract_eip6492_bytecode() {
const EIP6492_FILE: &str = "target/.forge/out/Eip6492.sol/ValidateSigOffchain.json";
const EIP6492_FILE: &str = "../target/.forge/out/Eip6492.sol/ValidateSigOffchain.json";
const EIP6492_BYTECODE_FILE: &str =
"target/.forge/out/Eip6492.sol/ValidateSigOffchain.bytecode";
"../target/.forge/out/Eip6492.sol/ValidateSigOffchain.bytecode";

let contents = serde_json::from_slice::<Value>(&std::fs::read(EIP6492_FILE).unwrap()).unwrap();
let bytecode = contents
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion relay_rpc/src/auth/cacao/signature/test_helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub async fn deploy_contract(rpc_url: &Url, private_key: &SigningKey) -> Address
let output = Command::new("forge")
.args([
"create",
"--contracts=contracts",
"--contracts=relay_rpc/contracts",
"Eip1271Mock",
"--rpc-url",
rpc_url.as_str(),
Expand Down

0 comments on commit 53373ae

Please sign in to comment.