Skip to content

Commit

Permalink
fix: revert jsonrpc type of block.header.extra_data (#1444)
Browse files Browse the repository at this point in the history
  • Loading branch information
driftluo authored Sep 22, 2023
1 parent cc20484 commit 271613a
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions core/api/src/jsonrpc/web3_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ pub struct Web3Block {
pub number: U256,
pub gas_used: U256,
pub gas_limit: U256,
pub extra_data: Vec<Hex>,
pub extra_data: Hex,
pub logs_bloom: Option<Bloom>,
pub timestamp: U256,
pub difficulty: U256,
Expand Down Expand Up @@ -331,12 +331,7 @@ impl From<Block> for Web3Block {
total_difficulty: Some(b.header.number.into()),
seal_fields: vec![],
base_fee_per_gas: b.header.base_fee_per_gas,
extra_data: b
.header
.extra_data
.iter()
.map(|i| Hex::encode(&i.inner.encode().unwrap()))
.collect(),
extra_data: Hex::encode(rlp::encode_list(&b.header.extra_data)),
size: Some(b.header.size().into()),
gas_limit: b.header.gas_limit,
gas_used: b.header.gas_used,
Expand Down Expand Up @@ -826,7 +821,7 @@ pub struct FeeHistoryEmpty {
#[serde(rename_all = "camelCase")]
pub struct Web3Header {
pub difficulty: U256,
pub extra_data: Vec<Hex>,
pub extra_data: Hex,
pub gas_limit: U256,
pub gas_used: U256,
pub logs_bloom: Option<Bloom>,
Expand Down Expand Up @@ -854,11 +849,7 @@ impl From<Header> for Web3Header {
receipts_root: h.receipts_root,
miner: h.proposer,
difficulty: U256::one(),
extra_data: h
.extra_data
.into_iter()
.map(|i| Hex::encode(i.inner.encode().unwrap()))
.collect(),
extra_data: Hex::encode(rlp::encode_list(&h.extra_data)),
gas_limit: h.gas_limit,
gas_used: h.gas_used,
timestamp: h.timestamp.into(),
Expand Down

0 comments on commit 271613a

Please sign in to comment.