Skip to content

Commit 1be0672

Browse files
authored
Merge pull request #41 from firstbatchxyz/erhant/anvil-provider
fix: Anvil impersonation works correctly now
2 parents 3f1a80e + 1fcf126 commit 1be0672

File tree

19 files changed

+557
-501
lines changed

19 files changed

+557
-501
lines changed

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ authors = ["erhant"]
1212

1313
[workspace.dependencies]
1414
# core
15-
alloy = { version = "0.8.0", features = ["full", "node-bindings"] }
15+
alloy = { version = "0.8.0", features = ["full"] }
1616
alloy-chains = "0.1.24"
1717
tokio = { version = "1.39.2", features = [
1818
"macros",
@@ -31,15 +31,9 @@ log = "0.4.22"
3131
dotenvy = "0.15.7"
3232

3333
# utils
34-
futures-util = "0.3.30"
3534
async-trait = "0.1.81"
36-
bytes = "1.7.1"
37-
rand = "0.8.5"
3835
reqwest = "0.12.5"
3936

40-
# b64, hex, serde
41-
base64 = "0.22.1"
42-
hex = "0.4.3"
43-
hex-literal = "0.4.1"
37+
# serde
4438
serde = "1.0.204"
4539
serde_json = "1.0.122"

contracts/src/errors.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,26 +27,28 @@ pub fn contract_error_report(error: Error) -> ErrReport {
2727
Error::ContractNotDeployed => eyre!("Contract is not deployed"),
2828
Error::AbiError(e) => eyre!("An error occurred ABI encoding or decoding: {}", e),
2929
Error::TransportError(error) => {
30+
const VALIDATE: bool = false;
31+
3032
// here we try to parse the error w.r.t provided contract interfaces
3133
// or return a default one in the end if it was not parsed successfully
3234
if let Some(payload) = error.as_error_resp() {
3335
// an ERC20 error
34-
if let Some(erc_20_error) = payload.as_decoded_error::<ERC20Errors>(false) {
35-
return erc_20_error.into();
36+
if let Some(erc_20_error) = payload.as_decoded_error::<ERC20Errors>(VALIDATE) {
37+
erc_20_error.into()
3638
} else
3739
// an OracleRegistry error
3840
if let Some(registry_error) =
39-
payload.as_decoded_error::<OracleRegistryErrors>(false)
41+
payload.as_decoded_error::<OracleRegistryErrors>(VALIDATE)
4042
{
41-
return registry_error.into();
43+
registry_error.into()
4244
} else
4345
// an OracleCoordinator error
4446
if let Some(coordinator_error) =
45-
payload.as_decoded_error::<OracleCoordinatorErrors>(false)
47+
payload.as_decoded_error::<OracleCoordinatorErrors>(VALIDATE)
4648
{
47-
return coordinator_error.into();
49+
coordinator_error.into()
4850
} else {
49-
return eyre!("Unhandled error response: {:#?}", error);
51+
eyre!("Unhandled error response: {:#?}", error)
5052
}
5153
} else {
5254
eyre!("Unknown transport error: {:#?}", error)

core/Cargo.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ dotenvy = "0.15.7"
2727

2828
# utils
2929
futures-util = "0.3.30"
30-
async-trait = "0.1.81"
3130
bytes = "1.7.1"
3231
rand = "0.8.5"
3332
reqwest.workspace = true
@@ -36,8 +35,8 @@ reqwest.workspace = true
3635
base64 = "0.22.1"
3736
hex = "0.4.3"
3837
hex-literal = "0.4.1"
39-
serde = "1.0.204"
40-
serde_json = "1.0.122"
38+
serde.workspace = true
39+
serde_json.workspace = true
4140

4241
# cli
4342
clap = { version = "4.5.13", features = ["derive", "env"] }

core/src/cli/commands/coordinator/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ impl DriaOracle {
4040
log::debug!("Cancellation signal received. Stopping...");
4141
return Ok(());
4242
}
43-
result = self.process_tasks_within_range(from_block, to_block.clone().unwrap_or(BlockNumberOrTag::Latest)) => {
43+
result = self.process_tasks_within_range(from_block, to_block.unwrap_or(BlockNumberOrTag::Latest)) => {
4444
if let Err(e) = result {
4545
log::error!("Could not handle previous tasks: {:?}", e);
4646
log::warn!("Continuing anyways...");

core/src/compute/generation/execute.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,6 @@ pub async fn execute_generation(
110110
mod tests {
111111
use super::*;
112112
use crate::compute::generation::request::{ChatHistoryRequest, GenerationRequest};
113-
use dkn_workflows::Model;
114-
115113
#[tokio::test]
116114
#[ignore = "run this manually"]
117115
async fn test_ollama_generation() {
@@ -160,11 +158,11 @@ mod tests {
160158

161159
#[tokio::test]
162160
#[ignore = "run this manually"]
163-
async fn test_raw_workflow() {
161+
async fn test_workflow_on_arweave() {
164162
// cargo test --package dria-oracle --lib --all-features -- compute::generation::execute::tests::test_raw_workflow --exact --show-output --ignored
165163
dotenvy::dotenv().unwrap();
166164

167-
let contract_result = hex_literal::hex!("7b2261727765617665223a224d49555775656361634b417a62755442335a6a57613463784e6461774d71435a704550694f71675a625a63227d");
165+
let contract_result = hex_literal::hex!("7b2261727765617665223a22396e52546d4e6742703758384650714968794430546f65447259687579414f345f507342476638566c6e73227d");
168166
let request = GenerationRequest::try_parse_bytes(&contract_result.into())
169167
.await
170168
.unwrap();

0 commit comments

Comments
 (0)