Skip to content

Commit

Permalink
valid payload
Browse files Browse the repository at this point in the history
  • Loading branch information
Brechtpd committed Aug 17, 2024
1 parent 738d9ea commit e3240e4
Show file tree
Hide file tree
Showing 3 changed files with 166 additions and 171 deletions.
73 changes: 2 additions & 71 deletions bin/reth/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,54 +187,19 @@ impl<Node: reth_node_api::FullNodeComponents> Rollup<Node> {

let transactions: Vec<TransactionSigned> = decode_transactions(&tx_list);
self.node.payload.transactions = transactions.clone();

println!("transactions: {:?}", transactions);

// let wallet = Wallet::default();
// let raw_tx = TransactionTestContext::transfer_tx_bytes(1, wallet.inner).await;

// // make the node advance
// //let tx_hash = self.node.rpc.inject_tx(raw_tx).await?;


// println!("tx_hash start");

// let tx_hash = tokio::task::block_in_place(|| {
// tokio::runtime::Handle::current().block_on({
// self.node.rpc.inject_tx(raw_tx)
// })
// }).unwrap();

// println!("tx_hash start");

// make the node advance
//let (payload, _): (EthBuiltPayload, _) = self.node.advance_block(vec![], eth_payload_attributes).await?;

// let block_hash = payload.block().hash();
// let block_number = payload.block().number;

// println!("L2 block number: {}", block_number);

//let tx_hash = B256::default();
//let block_hash = B256::default();
//let block_number = 10;

// // assert the block has been committed to the blockchain
//self.node.assert_new_block(tx_hash, block_hash, block_number).await?;


// submit the block
println!("payload start");

let (payload, _): (EthBuiltPayload, _) = tokio::task::block_in_place(|| {
tokio::runtime::Handle::current().block_on({
self.node.advance_block(vec![], eth_payload_attributes)
})
}).unwrap();

println!("payload end");

let block_hash = payload.block().hash();
let block_number = payload.block().number;

println!("block_hash: {:?}", block_hash);
println!("block_number: {:?}", block_number);

Expand All @@ -248,10 +213,6 @@ impl<Node: reth_node_api::FullNodeComponents> Rollup<Node> {

println!("assert_new_block done: {:?}", res);

//let tx_hash = self.node.rpc.inject_tx(raw_tx).await?;

println!("{:?}", self.node.inner.evm_config);

/*if let RollupContractCalls::submitBlock(RollupContract::submitBlockCall {
header,
blockData,
Expand Down Expand Up @@ -291,36 +252,6 @@ impl<Node: reth_node_api::FullNodeComponents> Rollup<Node> {
}
//}
}
// A deposit of ETH to the rollup contract. The deposit is added to the recipient's
// balance and committed into the database.
/*RollupContractEvents::Enter(RollupContract::Enter {
rollupChainId,
token,
rollupRecipient,
amount,
}) => {
if rollupChainId != U256::from(CHAIN_ID) {
error!(tx_hash = %tx.recalculate_hash(), "Invalid rollup chain ID");
continue;
}
if token != Address::ZERO {
error!(tx_hash = %tx.recalculate_hash(), "Only ETH deposits are supported");
continue;
}
self.db.upsert_account(rollupRecipient, |account| {
let mut account = account.unwrap_or_default();
account.balance += amount;
Ok(account)
})?;
info!(
tx_hash = %tx.recalculate_hash(),
%amount,
recipient = %rollupRecipient,
"Deposit",
);
}*/
_ => (),
}
}
Expand Down
11 changes: 10 additions & 1 deletion crates/ethereum/node/tests/assets/genesis.json
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
{"config":{"chainId":1,"homesteadBlock":0,"daoForkSupport":true,"eip150Block":0,"eip155Block":0,"eip158Block":0,"byzantiumBlock":0,"constantinopleBlock":0,"petersburgBlock":0,"istanbulBlock":0,"muirGlacierBlock":0,"berlinBlock":0,"londonBlock":0,"arrowGlacierBlock":0,"grayGlacierBlock":0,"shanghaiTime":0,"cancunTime":0,"terminalTotalDifficulty":"0x0","terminalTotalDifficultyPassed":true},"nonce":"0x0","timestamp":"0x0","extraData":"0x00","gasLimit":"0x1c9c380","difficulty":"0x0","mixHash":"0x0000000000000000000000000000000000000000000000000000000000000000","coinbase":"0x0000000000000000000000000000000000000000","alloc":{"0x14dc79964da2c08b23698b3d3cc7ca32193d9955":{"balance":"0xd3c21bcecceda1000000"},"0x15d34aaf54267db7d7c367839aaf71a00a2c6a65":{"balance":"0xd3c21bcecceda1000000"},"0x1cbd3b2770909d4e10f157cabc84c7264073c9ec":{"balance":"0xd3c21bcecceda1000000"},"0x23618e81e3f5cdf7f54c3d65f7fbc0abf5b21e8f":{"balance":"0xd3c21bcecceda1000000"},"0x2546bcd3c84621e976d8185a91a922ae77ecec30":{"balance":"0xd3c21bcecceda1000000"},"0x3c44cdddb6a900fa2b585dd299e03d12fa4293bc":{"balance":"0xd3c21bcecceda1000000"},"0x70997970c51812dc3a010c7d01b50e0d17dc79c8":{"balance":"0xd3c21bcecceda1000000"},"0x71be63f3384f5fb98995898a86b02fb2426c5788":{"balance":"0xd3c21bcecceda1000000"},"0x8626f6940e2eb28930efb4cef49b2d1f2c9c1199":{"balance":"0xd3c21bcecceda1000000"},"0x90f79bf6eb2c4f870365e785982e1f101e93b906":{"balance":"0xd3c21bcecceda1000000"},"0x976ea74026e726554db657fa54763abd0c3a0aa9":{"balance":"0xd3c21bcecceda1000000"},"0x9965507d1a55bcc2695c58ba16fb37d819b0a4dc":{"balance":"0xd3c21bcecceda1000000"},"0x9c41de96b2088cdc640c6182dfcf5491dc574a57":{"balance":"0xd3c21bcecceda1000000"},"0xa0ee7a142d267c1f36714e4a8f75612f20a79720":{"balance":"0xd3c21bcecceda1000000"},"0xbcd4042de499d14e55001ccbb24a551f3b954096":{"balance":"0xd3c21bcecceda1000000"},"0xbda5747bfd65f08deb54cb465eb87d40e51b197e":{"balance":"0xd3c21bcecceda1000000"},"0xcd3b766ccdd6ae721141f452c550ca635964ce71":{"balance":"0xd3c21bcecceda1000000"},"0xdd2fd4581271e230360230f9337d5c0430bf44c0":{"balance":"0xd3c21bcecceda1000000"},"0xdf3e18d64bc6a983f673ab319ccae4f1a57c7097":{"balance":"0xd3c21bcecceda1000000"},"0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266":{"balance":"0xd3c21bcecceda1000000"},"0xfabb0ac9d68b0b445fb7357272ff202c5651694a":{"balance":"0xd3c21bcecceda1000000"}},"number":"0x0"}
{"config":{"chainId":1,"homesteadBlock":0,"daoForkSupport":true,"eip150Block":0,"eip155Block":0,"eip158Block":0,"byzantiumBlock":0,"constantinopleBlock":0,"petersburgBlock":0,"istanbulBlock":0,"muirGlacierBlock":0,"berlinBlock":0,"londonBlock":0,"arrowGlacierBlock":0,"grayGlacierBlock":0,"shanghaiTime":0,"cancunTime":0,"terminalTotalDifficulty":"0x0","terminalTotalDifficultyPassed":true},"nonce":"0x0","timestamp":"0x0","extraData":"0x00","gasLimit":"0x1c9c380","difficulty":"0x0","mixHash":"0x0000000000000000000000000000000000000000000000000000000000000000","coinbase":"0x0000000000000000000000000000000000000000","alloc":{"0x14dc79964da2c08b23698b3d3cc7ca32193d9955":{"balance":"0xd3c21bcecceda1000000"},"0x15d34aaf54267db7d7c367839aaf71a00a2c6a65":{"balance":"0xd3c21bcecceda1000000"},"0x1cbd3b2770909d4e10f157cabc84c7264073c9ec":{"balance":"0xd3c21bcecceda1000000"},"0x23618e81e3f5cdf7f54c3d65f7fbc0abf5b21e8f":{"balance":"0xd3c21bcecceda1000000"},"0x2546bcd3c84621e976d8185a91a922ae77ecec30":{"balance":"0xd3c21bcecceda1000000"},"0x3c44cdddb6a900fa2b585dd299e03d12fa4293bc":{"balance":"0xd3c21bcecceda1000000"},"0x70997970c51812dc3a010c7d01b50e0d17dc79c8":{"balance":"0xd3c21bcecceda1000000"},"0x71be63f3384f5fb98995898a86b02fb2426c5788":{"balance":"0xd3c21bcecceda1000000"},"0x8626f6940e2eb28930efb4cef49b2d1f2c9c1199":{"balance":"0xd3c21bcecceda1000000"},"0x90f79bf6eb2c4f870365e785982e1f101e93b906":{"balance":"0xd3c21bcecceda1000000"},"0x976ea74026e726554db657fa54763abd0c3a0aa9":{"balance":"0xd3c21bcecceda1000000"},"0x9965507d1a55bcc2695c58ba16fb37d819b0a4dc":{"balance":"0xd3c21bcecceda1000000"},"0x9c41de96b2088cdc640c6182dfcf5491dc574a57":{"balance":"0xd3c21bcecceda1000000"},"0xa0ee7a142d267c1f36714e4a8f75612f20a79720":{"balance":"0xd3c21bcecceda1000000"},"0xbcd4042de499d14e55001ccbb24a551f3b954096":{"balance":"0xd3c21bcecceda1000000"},"0xbda5747bfd65f08deb54cb465eb87d40e51b197e":{"balance":"0xd3c21bcecceda1000000"},"0xcd3b766ccdd6ae721141f452c550ca635964ce71":{"balance":"0xd3c21bcecceda1000000"},"0xdd2fd4581271e230360230f9337d5c0430bf44c0":{"balance":"0xd3c21bcecceda1000000"},"0xdf3e18d64bc6a983f673ab319ccae4f1a57c7097":{"balance":"0xd3c21bcecceda1000000"},"0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266":{"balance":"0xd3c21bcecceda1000000"},"0xfabb0ac9d68b0b445fb7357272ff202c5651694a":{"balance":"0xd3c21bcecceda1000000"},

"0x8943545177806ED17B9F23F0a21ee5948eCaa776":{"balance":"0xd3c21bcecceda1000000"},
"0xE25583099BA105D9ec0A67f5Ae86D90e50036425":{"balance":"0xd3c21bcecceda1000000"},
"0x614561D2d143621E126e87831AEF287678B442b8":{"balance":"0xd3c21bcecceda1000000"},
"0xf93Ee4Cf8c6c40b329b0c0626F28333c132CF241":{"balance":"0xd3c21bcecceda1000000"}

},

"number":"0x0"}
Loading

0 comments on commit e3240e4

Please sign in to comment.