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] Replay repeat the L1 tx #2763

Open
jolestar opened this issue Oct 14, 2024 · 0 comments
Open

[bug] Replay repeat the L1 tx #2763

jolestar opened this issue Oct 14, 2024 · 0 comments
Labels
proposal New external API or other notable changes
Milestone

Comments

@jolestar
Copy link
Contributor

Proposal Details

Repeat execute the L1 tx, cause pending_block abort 3(ErrorPendingTxNotFound)

2024-10-14T03:25:05.149323Z  WARN moveos::moveos: execute_action error tx(hash:0xb5b7…f56e) vm_err:VMError { major_status: ABORTED, sub_status: Some(3), message: Some("0x0000000000000000000000000000000000000000000000000000000000000004::pending_block::process_pending_tx at offset 45"), exec_state: Some(ExecutionState { stack_trace: [(Some(ModuleId { address: 0000000000000000000000000000000000000000000000000000000000000004, name: Identifier("bitcoin") }), FunctionDefinitionIndex(5), 5)] }), location: Module(ModuleId { address: 0000000000000000000000000000000000000000000000000000000000000004, name: Identifier("pending_block") }), indices: [], offsets: [(FunctionDefinitionIndex(22), 45)] } need respawn session.
2024-10-14T03:25:05.151216Z  WARN moveos::moveos: System call failed: ABORTED { code: 3, location: 0x0000000000000000000000000000000000000000000000000000000000000004::pending_block }
2024-10-14T03:25:05.151592Z ERROR rooch_rpc_server: System call panic Execute system call with Panic Some(VMErrorInfo { error_message: "VMError with status ABORTED with sub status 3 at location Module ModuleId { address: 0000000000000000000000000000000000000000000000000000000000000004, name: Identifier(\"pending_block\") } and message 0x0000000000000000000000000000000000000000000000000000000000000004::pending_block::process_pending_tx at offset 45 at code offset 45 in function definition 22", execution_state: ["0x4::bitcoin::execute_l1_tx.5"] })

Solution

Validate the l1 tx before execution via contract, if it already execute, skip the tx.

#[named]
pub fn validate_l1_tx(&self, l1_tx: L1Transaction) -> Result<VerifiedMoveOSTransaction> {
let fn_name = function_name!();
let _timer = self
.metrics
.executor_validate_tx_latency_seconds
.with_label_values(&[fn_name])
.start_timer();
let tx_hash = l1_tx.tx_hash();
let tx_size = l1_tx.tx_size();
let ctx = TxContext::new_system_call_ctx(tx_hash, tx_size);
//TODO we should call the contract to validate the l1 tx has been executed
let result = match RoochMultiChainID::try_from(l1_tx.chain_id.id())? {
RoochMultiChainID::Bitcoin => {
let action = VerifiedMoveAction::Function {
call: BitcoinModule::create_execute_l1_tx_call(l1_tx.block_hash, l1_tx.txid)?,
bypass_visibility: true,
};
Ok(VerifiedMoveOSTransaction::new(
self.root.clone(),
ctx,
action,
))
}
id => Err(anyhow::anyhow!("Chain {} not supported yet", id)),
};
self.metrics
.executor_validate_tx_bytes
.with_label_values(&[fn_name])
.observe(tx_size as f64);
result
}

@jolestar jolestar added the proposal New external API or other notable changes label Oct 14, 2024
@jolestar jolestar added this to the Rooch v0.9 milestone Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal New external API or other notable changes
Projects
Status: No status
Development

No branches or pull requests

1 participant