Skip to content

Commit 271613a

Browse files
authored
fix: revert jsonrpc type of block.header.extra_data (#1444)
1 parent cc20484 commit 271613a

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

core/api/src/jsonrpc/web3_types.rs

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ pub struct Web3Block {
300300
pub number: U256,
301301
pub gas_used: U256,
302302
pub gas_limit: U256,
303-
pub extra_data: Vec<Hex>,
303+
pub extra_data: Hex,
304304
pub logs_bloom: Option<Bloom>,
305305
pub timestamp: U256,
306306
pub difficulty: U256,
@@ -331,12 +331,7 @@ impl From<Block> for Web3Block {
331331
total_difficulty: Some(b.header.number.into()),
332332
seal_fields: vec![],
333333
base_fee_per_gas: b.header.base_fee_per_gas,
334-
extra_data: b
335-
.header
336-
.extra_data
337-
.iter()
338-
.map(|i| Hex::encode(&i.inner.encode().unwrap()))
339-
.collect(),
334+
extra_data: Hex::encode(rlp::encode_list(&b.header.extra_data)),
340335
size: Some(b.header.size().into()),
341336
gas_limit: b.header.gas_limit,
342337
gas_used: b.header.gas_used,
@@ -826,7 +821,7 @@ pub struct FeeHistoryEmpty {
826821
#[serde(rename_all = "camelCase")]
827822
pub struct Web3Header {
828823
pub difficulty: U256,
829-
pub extra_data: Vec<Hex>,
824+
pub extra_data: Hex,
830825
pub gas_limit: U256,
831826
pub gas_used: U256,
832827
pub logs_bloom: Option<Bloom>,
@@ -854,11 +849,7 @@ impl From<Header> for Web3Header {
854849
receipts_root: h.receipts_root,
855850
miner: h.proposer,
856851
difficulty: U256::one(),
857-
extra_data: h
858-
.extra_data
859-
.into_iter()
860-
.map(|i| Hex::encode(i.inner.encode().unwrap()))
861-
.collect(),
852+
extra_data: Hex::encode(rlp::encode_list(&h.extra_data)),
862853
gas_limit: h.gas_limit,
863854
gas_used: h.gas_used,
864855
timestamp: h.timestamp.into(),

0 commit comments

Comments
 (0)