Skip to content

Commit

Permalink
block building fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Brechtpd committed Oct 17, 2024
1 parent f304454 commit f230fcd
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
3 changes: 1 addition & 2 deletions bin/reth/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ fn main() -> eyre::Result<()> {
.with_chain(chain_spec.clone())
.with_network(network_config.clone())
.with_unused_ports()
.with_rpc(RpcServerArgs::default().with_unused_ports().with_static_l2_rpc_ip_and_port(chain_spec.chain.id()))
.set_dev(true);
.with_rpc(RpcServerArgs::default().with_unused_ports().with_static_l2_rpc_ip_and_port(chain_spec.chain.id()));

let NodeHandle { node: gwyneth_node, node_exit_future: _ } =
NodeBuilder::new(node_config.clone())
Expand Down
24 changes: 18 additions & 6 deletions crates/gwyneth/src/exex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ impl<Node: reth_node_api::FullNodeComponents> Rollup<Node> {

let attrs = GwynethPayloadAttributes {
inner: EthPayloadAttributes {
timestamp: INITIAL_TIMESTAMP,
timestamp: block.timestamp,
prev_randao: B256::ZERO,
suggested_fee_recipient: Address::ZERO,
withdrawals: Some(vec![]),
Expand Down Expand Up @@ -154,10 +154,22 @@ impl<Node: reth_node_api::FullNodeComponents> Rollup<Node> {
let mut payload =
EthBuiltPayload::new(payload_id, SealedBlock::default(), U256::ZERO);
loop {
payload =
self.node.payload_builder.best_payload(payload_id).await.unwrap().unwrap();
if payload.block().body.is_empty() {
tokio::time::sleep(std::time::Duration::from_millis(20)).await;
let result = self.node.payload_builder.best_payload(payload_id).await;

// TODO: There seems to be no result when there's an empty tx list
if let Some(result) = result {
if let Ok(new_payload) = result {
payload = new_payload;
if payload.block().body.is_empty() {
tokio::time::sleep(std::time::Duration::from_millis(20)).await;
continue;
}
} else {
println!("Gwyneth: No payload?");
continue;
}
} else {
println!("Gwyneth: No block?");
continue;
}
break;
Expand Down Expand Up @@ -223,7 +235,7 @@ fn decode_chain_into_rollup_events(
.collect()
}

pub fn decode_transactions(tx_list: &[u8]) -> Vec<TransactionSigned> {
fn decode_transactions(tx_list: &[u8]) -> Vec<TransactionSigned> {
#[allow(clippy::useless_asref)]
Vec::<TransactionSigned>::decode(&mut tx_list.as_ref()).unwrap_or_else(|e| {
// If decoding fails we need to make an empty block
Expand Down

0 comments on commit f230fcd

Please sign in to comment.