Skip to content

Commit

Permalink
Add options when sending tx with retry.
Browse files Browse the repository at this point in the history
  • Loading branch information
lesa-telos committed Dec 9, 2024
1 parent 6d351d9 commit 1b21d2d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
1 change: 0 additions & 1 deletion crates/rpc/rpc-eth-types/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use std::time::Duration;
use alloy_primitives::{Address, Bytes, U256};
use alloy_rpc_types::{error::EthRpcErrorCode, request::TransactionInputError, BlockError};
use alloy_sol_types::decode_revert_reason;
use jsonrpsee_core::ClientError;
use reth_errors::RethError;
use reth_primitives::{revm_primitives::InvalidHeader, BlockId};
use reth_rpc_server_types::result::{
Expand Down
11 changes: 9 additions & 2 deletions crates/telos/node/tests/live_test_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,11 @@ pub async fn test_1559_tx<T>(
.with_max_fee_per_gas(20_000_000_000);

let tx_result = provider.send_transaction(tx).await;

info!("test_1559_tx");



assert!(tx_result.is_err());
}

Expand Down Expand Up @@ -266,6 +271,8 @@ pub async fn test_2930_tx<T>(
}]))
.max_fee_per_gas(2e9 as u128);
let tx_result = provider.send_transaction(tx).await;
info!("test_2930_tx");

assert!(tx_result.is_err());
}

Expand Down Expand Up @@ -320,9 +327,9 @@ pub async fn test_double_approve_erc20<T>(

let block_number = receipt2.unwrap().block_number.unwrap();

// make sure the block is included
// make sure the block is included and there is a progress
while let Some(block) = provider.get_block_by_number(Latest, false).await.unwrap() {
if block.header.number == block_number {
if block.header.number >= block_number {
break;
}
}
Expand Down
10 changes: 8 additions & 2 deletions crates/telos/rpc/src/eth/telos_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ fn parse_error_message(message: String) -> Option<EthApiError> {
}

fn parse_server_error(server_error: SendTransactionResponse2Error) -> EthApiError {
let mut error_message = server_error.message;
let error_message = server_error.message;
for detail in server_error.details.unwrap_or_default() {
if let Some(error) = parse_error_message(detail.message) {
return error;
Expand Down Expand Up @@ -232,11 +232,17 @@ impl TelosClient {
context_free_data: vec![],
};

let options = SendTransaction2Options{
return_failure_trace: true,
retry_trx: true,
retry_trx_num_blocks: 2,
};

let tx_response = self
.inner
.api_client
.v1_chain
.send_transaction2(signed_telos_transaction.clone(), None)
.send_transaction2(signed_telos_transaction.clone(), Some(options))
.await;

let tx = match tx_response {
Expand Down

0 comments on commit 1b21d2d

Please sign in to comment.