Skip to content

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

@berryjam

Description

@berryjam

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions