11//! Scroll-specific payload attributes.
22
33use alloc:: vec:: Vec ;
4- use alloy_primitives:: { Bytes , U256 } ;
4+ use alloy_primitives:: { Address , Bytes , B256 , U256 } ;
55use alloy_rpc_types_engine:: PayloadAttributes ;
66
77/// The payload attributes for block building tailored for Scroll.
@@ -18,6 +18,8 @@ pub struct ScrollPayloadAttributes {
1818 /// The pre-Euclid block data hint, necessary for the block builder to derive the correct block
1919 /// hash.
2020 pub block_data_hint : Option < BlockDataHint > ,
21+ /// The gas limit for the block building task.
22+ pub gas_limit : Option < u64 > ,
2123}
2224
2325/// Block data provided as a hint to the payload attributes.
@@ -27,14 +29,26 @@ pub struct ScrollPayloadAttributes {
2729pub struct BlockDataHint {
2830 /// The extra data for the block.
2931 pub extra_data : Bytes ,
32+ /// The state root for the block.
33+ pub state_root : B256 ,
34+ /// The optional coinbase for the block.
35+ pub coinbase : Option < Address > ,
36+ /// The optional nonce for the block.
37+ pub nonce : Option < u64 > ,
3038 /// The difficulty for the block.
3139 pub difficulty : U256 ,
3240}
3341
3442#[ cfg( feature = "arbitrary" ) ]
3543impl < ' a > arbitrary:: Arbitrary < ' a > for BlockDataHint {
3644 fn arbitrary ( u : & mut arbitrary:: Unstructured < ' a > ) -> arbitrary:: Result < Self > {
37- Ok ( Self { extra_data : Bytes :: arbitrary ( u) ?, difficulty : U256 :: arbitrary ( u) ? } )
45+ Ok ( Self {
46+ extra_data : Bytes :: arbitrary ( u) ?,
47+ state_root : B256 :: arbitrary ( u) ?,
48+ coinbase : Some ( Address :: arbitrary ( u) ?) ,
49+ nonce : Some ( u64:: arbitrary ( u) ?) ,
50+ difficulty : U256 :: arbitrary ( u) ?,
51+ } )
3852 }
3953}
4054
@@ -52,6 +66,7 @@ impl<'a> arbitrary::Arbitrary<'a> for ScrollPayloadAttributes {
5266 transactions : Some ( Vec :: arbitrary ( u) ?) ,
5367 no_tx_pool : bool:: arbitrary ( u) ?,
5468 block_data_hint : Some ( BlockDataHint :: arbitrary ( u) ?) ,
69+ gas_limit : Some ( u64:: arbitrary ( u) ?) ,
5570 } )
5671 }
5772}
@@ -76,8 +91,12 @@ mod test {
7691 no_tx_pool : true ,
7792 block_data_hint : Some ( BlockDataHint {
7893 extra_data : b"world" . into ( ) ,
94+ state_root : B256 :: random ( ) ,
95+ coinbase : Some ( Address :: random ( ) ) ,
96+ nonce : Some ( 0x12345 ) ,
7997 difficulty : U256 :: from ( 10 ) ,
8098 } ) ,
99+ gas_limit : Some ( 10_000_000 ) ,
81100 } ;
82101
83102 let ser = serde_json:: to_string ( & attributes) . unwrap ( ) ;
0 commit comments