From 79036e1e0155d5e1841a02a0e613348e224f7d38 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Sat, 9 Nov 2024 19:09:27 +0100 Subject: [PATCH] Fix hash / receipt --- substrate/frame/revive/rpc/src/client.rs | 8 ++------ substrate/frame/revive/rpc/src/lib.rs | 2 ++ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/substrate/frame/revive/rpc/src/client.rs b/substrate/frame/revive/rpc/src/client.rs index e312abc93f5e..4374a13bfd43 100644 --- a/substrate/frame/revive/rpc/src/client.rs +++ b/substrate/frame/revive/rpc/src/client.rs @@ -24,7 +24,6 @@ use crate::{ }, TransactionLegacySigned, LOG_TARGET, }; -use codec::Encode; use futures::{stream, StreamExt}; use jsonrpsee::types::{error::CALL_EXECUTION_FAILED_CODE, ErrorObjectOwned}; use pallet_revive::{ @@ -35,7 +34,6 @@ use pallet_revive::{ }, EthContractResult, }; -use sp_runtime::traits::{BlakeTwo256, Hash}; use sp_weights::Weight; use std::{ collections::{HashMap, VecDeque}, @@ -177,8 +175,6 @@ pub enum ClientError { // TODO convert error code to https://eips.ethereum.org/EIPS/eip-1474#error-codes impl From for ErrorObjectOwned { fn from(err: ClientError) -> Self { - log::debug!(target: LOG_TARGET, "ClientError: {err:?}"); - let msg = err.to_string(); match err { ClientError::SubxtError(subxt::Error::Rpc(err)) | ClientError::RpcError(err) => { @@ -311,10 +307,11 @@ impl ClientInner { let success = events.has::()?; let transaction_index = ext.index(); - let transaction_hash = BlakeTwo256::hash(&Vec::from(ext.bytes()).encode()); let block_hash = block.hash(); let block_number = block.number().into(); + let transaction_hash= ext.hash(); + log::debug!(target: LOG_TARGET, "Adding receipt for tx hash: {transaction_hash:?} - block: {block_number:?}"); let receipt = ReceiptInfo { block_hash, block_number, @@ -481,7 +478,6 @@ impl Client { .unwrap_or_default(); if !receipts.is_empty() { - log::debug!(target: LOG_TARGET, "Adding {} receipts", receipts.len()); let values = receipts .iter() .map(|(hash, (_, receipt))| (receipt.transaction_index, *hash)) diff --git a/substrate/frame/revive/rpc/src/lib.rs b/substrate/frame/revive/rpc/src/lib.rs index 0cc5471a0b30..f6709edc96c9 100644 --- a/substrate/frame/revive/rpc/src/lib.rs +++ b/substrate/frame/revive/rpc/src/lib.rs @@ -121,6 +121,7 @@ impl EthRpcServer for EthRpcServerImpl { transaction_hash: H256, ) -> RpcResult> { let receipt = self.client.receipt(&transaction_hash).await; + log::debug!(target: LOG_TARGET, "transaction_receipt for {transaction_hash:?}: {}", receipt.is_some()); Ok(receipt) } @@ -167,6 +168,7 @@ impl EthRpcServer for EthRpcServerImpl { storage_deposit, ); let hash = self.client.submit(call).await?; + log::debug!(target: LOG_TARGET, "send_raw_transaction hash: {hash:?}"); Ok(hash) }