Skip to content
Merged
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
11 changes: 11 additions & 0 deletions prdoc/pr_10016.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
title: '[pallet-revive] fix subxt submit & add debug statments'
doc:
- audience: Runtime Dev
description: |-
- Fix subxt submit by default it's using `author_submitAndWatchExtrinsic` even though we just want to fire and forget
- Add debug instructions to log the signer & nonce of new eth transactions when the node validate the transaction
crates:
- name: pallet-revive-eth-rpc
bump: patch
- name: pallet-revive
bump: patch
14 changes: 11 additions & 3 deletions substrate/frame/revive/rpc/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -430,10 +430,14 @@ impl Client {
pub async fn submit(
&self,
call: subxt::tx::DefaultPayload<EthTransact>,
) -> Result<H256, ClientError> {
) -> Result<(), ClientError> {
let ext = self.api.tx().create_unsigned(&call).map_err(ClientError::from)?;
let hash = ext.submit().await?;
Ok(hash)
let hash: H256 = self
.rpc_client
.request("author_submitExtrinsic", rpc_params![to_hex(ext.encoded())])
.await?;
log::debug!(target: LOG_TARGET, "Submitted transaction with substrate hash: {hash:?}");
Ok(())
}

/// Get an EVM transaction receipt by hash.
Expand Down Expand Up @@ -749,3 +753,7 @@ impl Client {
get_automine(&self.rpc_client).await
}
}

fn to_hex(bytes: impl AsRef<[u8]>) -> String {
format!("0x{}", hex::encode(bytes.as_ref()))
}
2 changes: 2 additions & 0 deletions substrate/frame/revive/rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ impl EthRpcServer for EthRpcServerImpl {
err
})?;

log::debug!(target: LOG_TARGET, "send_raw_transaction with hash: {hash:?}");

// Wait for the transaction to be included in a block if automine is enabled
if let Some(mut receiver) = receiver {
if let Err(err) = tokio::time::timeout(Duration::from_millis(500), async {
Expand Down
2 changes: 2 additions & 0 deletions substrate/frame/revive/src/evm/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,8 @@ pub trait EthExtra {
log::debug!(target: LOG_TARGET, "Failed to convert nonce");
InvalidTransaction::Call
})?;

log::debug!(target: LOG_TARGET, "Decoded Ethereum transaction with signer: {signer_addr:?} nonce: {nonce:?}");
let call_info = create_call::<Self::Config>(tx, Some(encoded_len as u32))?;
let storage_credit = <Self::Config as Config>::Currency::withdraw(
&signer,
Expand Down
Loading