From dd37afac3605d380eb2e8dceef100cabf3b8293f Mon Sep 17 00:00:00 2001 From: andreespirela Date: Wed, 22 Jan 2025 10:53:05 -0500 Subject: [PATCH 1/3] chore: rpc-get_arweave_storage_proof --- Cargo.toml | 4 ++-- crates/rpc/rpc-eth-api/src/core.rs | 10 ++++++++ .../rpc-eth-api/src/helpers/transaction.rs | 23 +++++++++++++++++++ 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index cd76f2bfa4d5..2bbd4fb53b46 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -623,8 +623,8 @@ borsh = "1.5.1" brotlic = "0.8.2" # exex-templates -exex-wvm-da = { git = "https://github.com/weaveVM/exex-templates?a", branch = "main" } -exex-wvm-bigquery = { git = "https://github.com/weaveVM/exex-templates?e", branch = "main" } +exex-wvm-da = { git = "https://github.com/weaveVM/exex-templates?f", branch = "main" } +exex-wvm-bigquery = { git = "https://github.com/weaveVM/exex-templates?f", branch = "main" } # fees fees = { git = "https://github.com/weaveVM/miscalleneous?c", branch = "main" } diff --git a/crates/rpc/rpc-eth-api/src/core.rs b/crates/rpc/rpc-eth-api/src/core.rs index 4622ca10e5fc..5d2c52c9256f 100644 --- a/crates/rpc/rpc-eth-api/src/core.rs +++ b/crates/rpc/rpc-eth-api/src/core.rs @@ -336,6 +336,10 @@ pub trait EthApi { #[method(name = "sendWvmTransaction")] async fn send_wvm_transaction(&self, request: WvmTransactionRequest) -> RpcResult; + /// Gets the arweave transaction id that prooves the permanency of a given block + #[method(name = "getArweaveStorageProof")] + async fn get_arweave_storage_proof(&self, block_height: String) -> RpcResult; + /// Sends signed transaction, returning its hash. #[method(name = "sendRawTransaction")] async fn send_raw_transaction(&self, bytes: Bytes) -> RpcResult; @@ -777,6 +781,12 @@ where Ok(EthTransactions::send_wvm_transaction(self, request).await?) } + /// Handler for: `eth_getArweaveStorageProof` + async fn get_arweave_storage_proof(&self, block_height: String) -> RpcResult { + trace!(target: "rpc::eth", ?block_height, "Serving eth_getArweaveStorageProof"); + Ok(EthTransactions::get_arweave_storage_proof(self, block_height).await?) + } + /// Handler for: `eth_sendRawTransaction` async fn send_raw_transaction(&self, tx: Bytes) -> RpcResult { trace!(target: "rpc::eth", ?tx, "Serving eth_sendRawTransaction"); diff --git a/crates/rpc/rpc-eth-api/src/helpers/transaction.rs b/crates/rpc/rpc-eth-api/src/helpers/transaction.rs index 6748928f9531..de8c7510d7cc 100644 --- a/crates/rpc/rpc-eth-api/src/helpers/transaction.rs +++ b/crates/rpc/rpc-eth-api/src/helpers/transaction.rs @@ -395,6 +395,29 @@ pub trait EthTransactions: LoadTransaction { } } + /// WVM Exclusive + /// Obtains the Arweave Hash of the transaction containing the WEVM Block + fn get_arweave_storage_proof(&self, block_height: String) -> impl Future> + Send + where + Self: EthApiSpec + LoadBlock + LoadPendingBlock + Call { + let bq_client = (&*PRECOMPILE_WVM_BIGQUERY_CLIENT).clone(); + + async move { + let result_set = bq_client.bq_query_block(block_height).await; + + match result_set { + Some(result_set) => { + match result_set.get_string_by_name("arweave_id") { + Ok(Some(arweave_id)) => Ok(arweave_id), // Successfully found the string + Ok(None) => Err(EthApiError::TransactionNotFound), // Field missing + Err(err) => Err(EthApiError::TransactionNotFound), // Handle the inner error + } + } + None => Err(EthApiError::TransactionNotFound), // Result set is None + } + } + } + /// Signs transaction with a matching signer, if any and submits the transaction to the pool. /// Returns the hash of the signed transaction. fn send_transaction( From 51929cd01798d1d48cf2c58b08141e0c9126fe73 Mon Sep 17 00:00:00 2001 From: andreespirela Date: Thu, 23 Jan 2025 09:35:49 -0500 Subject: [PATCH 2/3] chore: Fixing ar process --- Cargo.toml | 4 ++-- wvm-apps/wvm-exexed/crates/reth-exexed/src/exex/ar_actor.rs | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 2bbd4fb53b46..497bb5a72432 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -623,8 +623,8 @@ borsh = "1.5.1" brotlic = "0.8.2" # exex-templates -exex-wvm-da = { git = "https://github.com/weaveVM/exex-templates?f", branch = "main" } -exex-wvm-bigquery = { git = "https://github.com/weaveVM/exex-templates?f", branch = "main" } +exex-wvm-da = { git = "https://github.com/weaveVM/exex-templates?h", branch = "main" } +exex-wvm-bigquery = { git = "https://github.com/weaveVM/exex-templates?h", branch = "main" } # fees fees = { git = "https://github.com/weaveVM/miscalleneous?c", branch = "main" } diff --git a/wvm-apps/wvm-exexed/crates/reth-exexed/src/exex/ar_actor.rs b/wvm-apps/wvm-exexed/crates/reth-exexed/src/exex/ar_actor.rs index 61a3e673e6da..68b344bd5e1c 100644 --- a/wvm-apps/wvm-exexed/crates/reth-exexed/src/exex/ar_actor.rs +++ b/wvm-apps/wvm-exexed/crates/reth-exexed/src/exex/ar_actor.rs @@ -329,12 +329,14 @@ async fn update_bigquery( update_bigquery_tags(big_query_client, block).await?; let save_block_start_time = std::time::Instant::now(); + let block_hash = block.block.hash().to_string(); let result = exex_wvm_bigquery::save_block( state_repo.clone(), block, block_number, arweave_id.to_string(), + block_hash ) .await; From 35dd9d8152790670a7781e86098d6168acc1daf3 Mon Sep 17 00:00:00 2001 From: andreespirela Date: Thu, 23 Jan 2025 10:20:28 -0500 Subject: [PATCH 3/3] chore: Upgrade deps --- Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 497bb5a72432..8ae67778e75f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -623,8 +623,8 @@ borsh = "1.5.1" brotlic = "0.8.2" # exex-templates -exex-wvm-da = { git = "https://github.com/weaveVM/exex-templates?h", branch = "main" } -exex-wvm-bigquery = { git = "https://github.com/weaveVM/exex-templates?h", branch = "main" } +exex-wvm-da = { git = "https://github.com/weaveVM/exex-templates?i", branch = "main" } +exex-wvm-bigquery = { git = "https://github.com/weaveVM/exex-templates?i", branch = "main" } # fees fees = { git = "https://github.com/weaveVM/miscalleneous?c", branch = "main" }