Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(ethexe): Subscribe blocks when Observer is created #4311

Merged
merged 13 commits into from
Dec 10, 2024
14 changes: 7 additions & 7 deletions ethexe/cli/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,13 @@ impl Service {
}
}

pub async fn run(self) -> Result<()> {
self.run_inner().await.map_err(|err| {
log::error!("Service finished work with error: {err:?}");
err
})
}

async fn run_inner(self) -> Result<()> {
let Service {
db,
Expand Down Expand Up @@ -591,13 +598,6 @@ impl Service {
Ok(())
}

pub async fn run(self) -> Result<()> {
self.run_inner().await.map_err(|err| {
log::error!("Service finished work with error: {:?}", err);
err
})
}

async fn post_process_commitments(
code_commitments: Vec<CodeCommitment>,
block_commitments: Vec<BlockCommitment>,
Expand Down
9 changes: 0 additions & 9 deletions ethexe/cli/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -501,10 +501,6 @@ async fn ping_reorg() {
assert_eq!(res.program_id, ping_id);
assert_eq!(res.reply_payload, b"PONG");

// Await for service block with user reply handling
// TODO: this is for better logs reading only, should find a better solution #4099
tokio::time::sleep(env.block_time).await;

log::info!("📗 Test after reverting to the program creation snapshot");
provider
.anvil_revert(program_created_snapshot_id)
Expand Down Expand Up @@ -546,10 +542,6 @@ async fn ping_reorg() {
let res = send_message.wait_for().await.unwrap();
assert_eq!(res.program_id, ping_id);
assert_eq!(res.reply_payload, b"PONG");

// Await for service block with user reply handling
// TODO: this is for better logs reading only, should find a better solution #4099
tokio::time::sleep(Duration::from_secs(1)).await;
}

// Mine 150 blocks - send message - mine 150 blocks.
Expand Down Expand Up @@ -1354,7 +1346,6 @@ mod utils {
None,
None,
);

let handle = task::spawn(service.run());
self.running_service_handle = Some(handle);

Expand Down
4 changes: 3 additions & 1 deletion ethexe/ethereum/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,9 @@ impl<T: Transport + Clone, N: Network> TryGetReceipt<T, N> for PendingTransactio
Err(err) => err,
};

for _ in 0..3 {
log::trace!("Failed to get transaction receipt for {tx_hash}. Retrying...");
for n in 0..3 {
log::trace!("Attempt {n}. Error - {err}");
match err {
PendingTransactionError::TransportError(RpcError::NullResp) => {}
_ => break,
Expand Down
Loading
Loading