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

bug:Eth send will crash the whole program if it send wrong transactions. #625

Open
berryjam opened this issue Jun 23, 2024 · 0 comments
Open

Comments

@berryjam
Copy link

berryjam commented Jun 23, 2024

Code Base:
branch:master
commit:0a4ca2145a0c95b5bafa84c2f095c644907a8825
file:lib.rs

/// Stores the new operation in the database and sends the corresponding transaction.
    async fn initialize_operation(&mut self, tx: TxData, current_block: u64) -> anyhow::Result<()> {
   ....
        if let Err(e) = self.ethereum.send_raw_tx(signed_tx.raw_tx).await {
            // Sending tx error is not critical: this will result in transaction being considered stuck,
            // and resent. We can't do anything about this failure either, since it's most probably is not
            // related to the node logic, so we just log this error and pretend to have this operation
            // processed.
            vlog::warn!("Error while sending the operation: {}", e);
        }

        transaction.commit().await?;

        Ok(())
    }

As the function initialize_operation showed above,the eth sender will ignore the error and just logged warning and commit the status into database.
But it will save the wrong status into database if it send some transactions likes nonce too low.The eth sender will consider the commitBlocks transaction is accepted.It will send the following proveBlocks transaction which will cause the contract reverted and the program crashed.

So the better way to handle this case is processing the failure according to the receipt details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant