Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor!: remove useless fields in BlockHeader #1339

Merged
merged 4 commits into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
change default difficulty from 0x0 to 0x1
  • Loading branch information
KaoImin committed Aug 22, 2023
commit fbb43705e3135afe9e902d3a42b57f4f2acbd7ba
6 changes: 3 additions & 3 deletions core/api/src/jsonrpc/web3_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,8 @@ impl From<Block> for Web3Block {
state_root: b.header.state_root,
receipts_root: b.header.receipts_root,
miner: b.header.proposer,
difficulty: U256::zero(),
total_difficulty: Some(U256::zero()),
difficulty: U256::one(),
total_difficulty: Some(b.header.number.into()),
seal_fields: vec![],
base_fee_per_gas: b.header.base_fee_per_gas,
extra_data: Hex::encode(&b.header.extra_data),
Expand Down Expand Up @@ -839,7 +839,7 @@ impl From<Header> for Web3Header {
state_root: h.state_root,
receipts_root: h.receipts_root,
miner: h.proposer,
difficulty: U256::zero(),
difficulty: U256::one(),
extra_data: Hex::encode(&h.extra_data),
gas_limit: h.gas_limit,
gas_used: h.gas_used,
Expand Down
1 change: 0 additions & 1 deletion core/executor/benches/bench_transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ impl BenchAdapter {
block_coinbase: DISTRIBUTE_ADDRESS.0,
block_timestamp: time_now().into(),
chain_id: U256::one(),
difficulty: U256::one(),
origin: DISTRIBUTE_ADDRESS.0,
gas_price: 85u64.into(),
block_gas_limit: 100_000_000_000u64.into(),
Expand Down
1 change: 0 additions & 1 deletion core/executor/benches/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ pub fn mock_executor_context() -> ExecutorContext {
block_coinbase: DISTRIBUTE_ADDRESS.0,
block_timestamp: time_now().into(),
chain_id: U256::one(),
difficulty: U256::one(),
origin: DISTRIBUTE_ADDRESS.0,
gas_price: 85u64.into(),
block_gas_limit: 100_000_000_000u64.into(),
Expand Down
2 changes: 1 addition & 1 deletion core/executor/src/adapter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ where
}

fn block_difficulty(&self) -> U256 {
self.exec_ctx.difficulty
U256::one()
}

fn block_gas_limit(&self) -> U256 {
Expand Down
1 change: 0 additions & 1 deletion core/executor/src/debugger/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ impl EvmDebugger {
block_coinbase: H160::random(),
block_timestamp: time_now().into(),
chain_id: 5u64.into(),
difficulty: U256::one(),
origin: H160::random(),
gas_price: 1u64.into(),
block_gas_limit: 4294967295000u64.into(),
Expand Down
3 changes: 0 additions & 3 deletions protocol/src/types/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ pub struct ExecutorContext {
pub block_coinbase: H160,
pub block_timestamp: U256,
pub chain_id: U256,
pub difficulty: U256,
pub origin: H160,
pub gas_price: U256,
pub block_gas_limit: U256,
Expand All @@ -63,7 +62,6 @@ impl From<Proposal> for ExecutorContext {
block_coinbase: h.proposer,
block_timestamp: h.timestamp.into(),
chain_id: h.chain_id.into(),
difficulty: U256::zero(),
origin: h.proposer,
gas_price: U256::one(),
block_gas_limit: h.gas_limit,
Expand All @@ -80,7 +78,6 @@ impl From<&Header> for ExecutorContext {
block_coinbase: h.proposer,
block_timestamp: h.timestamp.into(),
chain_id: h.chain_id.into(),
difficulty: U256::one(),
origin: h.proposer,
gas_price: U256::one(),
block_gas_limit: h.gas_limit,
Expand Down
3 changes: 0 additions & 3 deletions tests/data/genesis.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,11 @@
"signed_txs_hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"receipts_root": "0x0000000000000000000000000000000000000000000000000000000000000000",
"log_bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"difficulty": "0x0",
"timestamp": 1679656015,
"number": 0,
"gas_used": "0x0",
"gas_limit": "0x0",
"extra_data": [],
"mixed_hash": null,
"nonce": "0x0000000000000000",
"base_fee_per_gas": "0x539",
"proof": {
"number": 0,
Expand Down