Skip to content

Commit

Permalink
slight cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Brechtpd committed Oct 17, 2024
1 parent a124cd7 commit 0aa25cd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 26 deletions.
2 changes: 1 addition & 1 deletion crates/rbuilder/src/live_builder/simulation/sim_worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ pub fn run_sim_worker<DB: Database + Clone + Send + 'static>(
telemetry::inc_simulation_gas_used(sim_result.gas_used);
}
Err(err) => {
error!(?err, "Critical error while simulating order Brecht");
error!(?err, "Critical error while simulating order");
// @Metric
break;
}
Expand Down
29 changes: 4 additions & 25 deletions crates/rbuilder/src/proposing/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ impl BlockProposer {
println!("propose_block");

let execution_payload = request.execution_payload();

// Create the transaction data
let (meta, num_txs) = self.create_propose_block_tx_data(&execution_payload)?;

Expand All @@ -81,9 +81,6 @@ impl BlockProposer {
// return Ok(());
// }

println!("meta: {:?}", meta);
println!("proposing tx_list: {:?}", meta.txList);

let decoded_transactions: Vec<TransactionSigned> = decode_transactions(&meta.txList);
println!("decoded_transactions: {:?}", decoded_transactions);

Expand All @@ -96,7 +93,7 @@ impl BlockProposer {
// Sign the transaction
let chain_id = provider.get_chain_id().await?;
let nonce = provider.get_transaction_count(signer.address()).await.unwrap();

//let rollup = Rollup::(Address::from_str(&self.contract_address).unwrap(), provider);
let propose_data = Rollup::proposeBlockCall { data: vec![meta] };
let propose_data = propose_data.abi_encode();
Expand Down Expand Up @@ -132,7 +129,7 @@ impl BlockProposer {
"Transaction included in block {}",
receipt.block_number.expect("Failed to get block number")
);

Ok(())
}

Expand All @@ -151,9 +148,6 @@ impl BlockProposer {
}
};

// Create tx_list from transactions -> Are they RLP encoded alredy ? I guess not so doing now.
//let tx_list = self.rlp_encode_transactions(&execution_payload.transactions);

let mut transactions = Vec::new();
for tx_data in execution_payload.transactions.iter() {
transactions.push(TransactionSigned::decode(&mut tx_data.to_vec().as_slice()).unwrap());
Expand Down Expand Up @@ -187,25 +181,10 @@ impl BlockProposer {
txList: tx_list.into(),
};

println!("meta ok");
println!("meta: {:?}", meta);

Ok((meta, execution_payload.transactions.len()))
}

// This one handles '&[ethers::types::Bytes]' and '&Vec<alloy_primitives::Bytes>' types
fn rlp_encode_transactions<B>(&self, transactions: &[B]) -> Vec<u8>
where
B: AsRef<[u8]>,
{
let mut rlp_stream = rlp::RlpStream::new_list(transactions.len());

for tx in transactions {
rlp_stream.append(&tx.as_ref());
}

rlp_stream.out().to_vec()
}

}

#[derive(Debug, thiserror::Error)]
Expand Down

0 comments on commit 0aa25cd

Please sign in to comment.