Skip to content

Commit b0efb8d

Browse files
JulianVenturaJulian Ventura
authored andcommitted
fix(l1): update rpc-compat hive tests to Prague and fix failing ones (#2043)
**Description** This PR updates the hive tests suite to a new hive revision and fixes new tests by removing the `total_difficulty` field on the block scheme. This field was already removed in #304 and reintroduced in #566 due to the usage in hive engine test suite. Hive tests related to the wrong encoding of `nonce` field were also fixed --------- Co-authored-by: Julian Ventura <[email protected]>
1 parent b34be1e commit b0efb8d

File tree

5 files changed

+10
-33
lines changed

5 files changed

+10
-33
lines changed

.github/workflows/ci_l1.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ jobs:
153153
include:
154154
- name: "Rpc Compat tests"
155155
simulation: ethereum/rpc-compat
156-
test_pattern: /eth_chainId|eth_getTransactionByBlockHashAndIndex|eth_getTransactionByBlockNumberAndIndex|eth_getCode|eth_getStorageAt|eth_call|eth_getTransactionByHash|eth_getBlockByHash|eth_getBlockByNumber|eth_createAccessList|eth_getBlockTransactionCountByNumber|eth_getBlockTransactionCountByHash|eth_getBlockReceipts|eth_getTransactionReceipt|eth_blobGasPrice|eth_blockNumber|ethGetTransactionCount|debug_getRawHeader|debug_getRawBlock|debug_getRawTransaction|debug_getRawReceipts|eth_estimateGas|eth_getBalance|eth_sendRawTransaction|eth_getProof|eth_getLogs|eth_syncing
156+
test_pattern: /debug_getRawBlock|debug_getRawHeader|debug_getRawReceipts|debug_getRawTransaction|eth_blobBaseFee|eth_blockNumber|eth_call|eth_chainId|eth_createAccessList|eth_estimateGas|eth_getBalance|eth_getBlockByHash|eth_getBlockByNumber|eth_getBlockReceipts|eth_getBlockTransactionCountByHash|eth_getBlockTransactionCountByNumber|eth_getCode|eth_getLogs|eth_getProof|eth_getStorageAt|eth_getTransactionByBlockHashAndIndex|eth_getTransactionByBlockNumberAndIndex|eth_getTransactionByHash|eth_getTransactionCount|eth_getTransactionReceipt|eth_sendRawTransaction|eth_syncing
157157
- name: "Devp2p discv4 tests"
158158
simulation: devp2p
159159
test_pattern: discv4

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ stop-localnet-silent:
7676
@kurtosis enclave stop $(ENCLAVE) >/dev/null 2>&1 || true
7777
@kurtosis enclave rm $(ENCLAVE) --force >/dev/null 2>&1 || true
7878

79-
HIVE_REVISION := feb4333db7fe9f6dc161326ebb11957d4306d2f9
79+
HIVE_REVISION := b21c217ba5f48949b6b64ef28f7fb11e40584652
8080
# Shallow clones can't specify a single revision, but at least we avoid working
8181
# the whole history by making it shallow since a given date (one day before our
8282
# target revision).

crates/common/types/transaction.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1582,6 +1582,7 @@ mod serde_impl {
15821582
pub struct AuthorizationTupleEntry {
15831583
pub chain_id: U256,
15841584
pub address: Address,
1585+
#[serde(default, with = "crate::serde_utils::u64::hex_str")]
15851586
pub nonce: u64,
15861587
pub y_parity: U256,
15871588
pub r: U256,

crates/networking/rpc/eth/block.rs

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,8 @@ use crate::{
1212
utils::RpcErr,
1313
RpcApiContext, RpcHandler,
1414
};
15-
use ethrex_common::{
16-
types::{
17-
calculate_base_fee_per_blob_gas, Block, BlockBody, BlockHash, BlockHeader, BlockNumber,
18-
Receipt,
19-
},
20-
U256,
15+
use ethrex_common::types::{
16+
calculate_base_fee_per_blob_gas, Block, BlockBody, BlockHash, BlockHeader, BlockNumber, Receipt,
2117
};
2218
use ethrex_storage::Store;
2319

@@ -83,15 +79,7 @@ impl RpcHandler for GetBlockByNumberRequest {
8379
_ => return Ok(Value::Null),
8480
};
8581
let hash = header.compute_block_hash();
86-
// TODO (#307): Remove TotalDifficulty.
87-
let total_difficulty = storage.get_block_total_difficulty(hash)?;
88-
let block = RpcBlock::build(
89-
header,
90-
body,
91-
hash,
92-
self.hydrated,
93-
total_difficulty.unwrap_or(U256::zero()),
94-
);
82+
let block = RpcBlock::build(header, body, hash, self.hydrated);
9583

9684
serde_json::to_value(&block).map_err(|error| RpcErr::Internal(error.to_string()))
9785
}
@@ -125,15 +113,7 @@ impl RpcHandler for GetBlockByHashRequest {
125113
_ => return Ok(Value::Null),
126114
};
127115
let hash = header.compute_block_hash();
128-
// TODO (#307): Remove TotalDifficulty.
129-
let total_difficulty = storage.get_block_total_difficulty(hash)?;
130-
let block = RpcBlock::build(
131-
header,
132-
body,
133-
hash,
134-
self.hydrated,
135-
total_difficulty.unwrap_or(U256::zero()),
136-
);
116+
let block = RpcBlock::build(header, body, hash, self.hydrated);
137117
serde_json::to_value(&block).map_err(|error| RpcErr::Internal(error.to_string()))
138118
}
139119
}

crates/networking/rpc/types/block.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use super::transaction::RpcTransaction;
22
use ethrex_common::{
33
serde_utils,
44
types::{Block, BlockBody, BlockHash, BlockHeader, BlockNumber, Withdrawal},
5-
H256, U256,
5+
H256,
66
};
77
use ethrex_rlp::encode::RLPEncode;
88

@@ -14,8 +14,6 @@ pub struct RpcBlock {
1414
hash: H256,
1515
#[serde(with = "serde_utils::u64::hex_str")]
1616
size: u64,
17-
// TODO (#307): Remove TotalDifficulty.
18-
total_difficulty: U256,
1917
#[serde(flatten)]
2018
pub header: BlockHeader,
2119
#[serde(flatten)]
@@ -50,7 +48,6 @@ impl RpcBlock {
5048
body: BlockBody,
5149
hash: H256,
5250
full_transactions: bool,
53-
total_difficulty: U256,
5451
) -> RpcBlock {
5552
let size = Block::new(header.clone(), body.clone())
5653
.encode_to_vec()
@@ -67,7 +64,6 @@ impl RpcBlock {
6764

6865
RpcBlock {
6966
hash,
70-
total_difficulty,
7167
size: size as u64,
7268
header,
7369
body: body_wrapper,
@@ -192,8 +188,8 @@ mod test {
192188
};
193189
let hash = block_header.compute_block_hash();
194190

195-
let block = RpcBlock::build(block_header, block_body, hash, true, U256::zero());
196-
let expected_block = r#"{"hash":"0x94fb81ef7259ad4cef032745a2a5254babe26037f2850d320b872692f7c60178","size":"0x2f7","totalDifficulty":"0x0","parentHash":"0x48e29e7357408113a4166e04e9f1aeff0680daa2b97ba93df6512a73ddf7a154","sha3Uncles":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","miner":"0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba","stateRoot":"0x9de6f95cb4ff4ef22a73705d6ba38c4b927c7bca9887ef5d24a734bb863218d9","transactionsRoot":"0x578602b2b7e3a3291c3eefca3a08bc13c0d194f9845a39b6f3bcf843d9fed79d","receiptsRoot":"0x035d56bac3f47246c5eed0e6642ca40dc262f9144b582f058bc23ded72aa72fa","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","difficulty":"0x0","number":"0x1","gasLimit":"0x16345785d8a0000","gasUsed":"0xa8de","timestamp":"0x3e8","extraData":"0x","mixHash":"0x0000000000000000000000000000000000000000000000000000000000000000","nonce":"0x0000000000000000","baseFeePerGas":"0x7","withdrawalsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","blobGasUsed":"0x0","excessBlobGas":"0x0","parentBeaconBlockRoot":"0x0000000000000000000000000000000000000000000000000000000000000000","requestsHash":"0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470","transactions":[{"type":"0x2","nonce":"0x0","to":"0x6177843db3138ae69679a54b95cf345ed759450d","gas":"0xf618","value":"0xaa87bee538000","input":"0x307831353638","maxPriorityFeePerGas":"0x11","maxFeePerGas":"0x4e","gasPrice":"0x4e","accessList":[{"address":"0x6177843db3138ae69679a54b95cf345ed759450d","storageKeys":[]}],"chainId":"0x301824","yParity":"0x0","v":"0x0","r":"0x151ccc02146b9b11adf516e6787b59acae3e76544fdcd75e77e67c6b598ce65d","s":"0x64c5dd5aae2fbb535830ebbdad0234975cd7ece3562013b63ea18cc0df6c97d4","blockNumber":"0x1","blockHash":"0x94fb81ef7259ad4cef032745a2a5254babe26037f2850d320b872692f7c60178","from":"0x35af8ea983a3ba94c655e19b82b932a30d6b9558","hash":"0x0b8c8f37731d9493916b06d666c3fd5dee2c3bbda06dfe866160d717e00dda91","transactionIndex":"0x0"}],"uncles":[],"withdrawals":[]}"#;
191+
let block = RpcBlock::build(block_header, block_body, hash, true);
192+
let expected_block = r#"{"hash":"0x94fb81ef7259ad4cef032745a2a5254babe26037f2850d320b872692f7c60178","size":"0x2f7","parentHash":"0x48e29e7357408113a4166e04e9f1aeff0680daa2b97ba93df6512a73ddf7a154","sha3Uncles":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","miner":"0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba","stateRoot":"0x9de6f95cb4ff4ef22a73705d6ba38c4b927c7bca9887ef5d24a734bb863218d9","transactionsRoot":"0x578602b2b7e3a3291c3eefca3a08bc13c0d194f9845a39b6f3bcf843d9fed79d","receiptsRoot":"0x035d56bac3f47246c5eed0e6642ca40dc262f9144b582f058bc23ded72aa72fa","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","difficulty":"0x0","number":"0x1","gasLimit":"0x16345785d8a0000","gasUsed":"0xa8de","timestamp":"0x3e8","extraData":"0x","mixHash":"0x0000000000000000000000000000000000000000000000000000000000000000","nonce":"0x0000000000000000","baseFeePerGas":"0x7","withdrawalsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","blobGasUsed":"0x0","excessBlobGas":"0x0","parentBeaconBlockRoot":"0x0000000000000000000000000000000000000000000000000000000000000000","requestsHash":"0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470","transactions":[{"type":"0x2","nonce":"0x0","to":"0x6177843db3138ae69679a54b95cf345ed759450d","gas":"0xf618","value":"0xaa87bee538000","input":"0x307831353638","maxPriorityFeePerGas":"0x11","maxFeePerGas":"0x4e","gasPrice":"0x4e","accessList":[{"address":"0x6177843db3138ae69679a54b95cf345ed759450d","storageKeys":[]}],"chainId":"0x301824","yParity":"0x0","v":"0x0","r":"0x151ccc02146b9b11adf516e6787b59acae3e76544fdcd75e77e67c6b598ce65d","s":"0x64c5dd5aae2fbb535830ebbdad0234975cd7ece3562013b63ea18cc0df6c97d4","blockNumber":"0x1","blockHash":"0x94fb81ef7259ad4cef032745a2a5254babe26037f2850d320b872692f7c60178","from":"0x35af8ea983a3ba94c655e19b82b932a30d6b9558","hash":"0x0b8c8f37731d9493916b06d666c3fd5dee2c3bbda06dfe866160d717e00dda91","transactionIndex":"0x0"}],"uncles":[],"withdrawals":[]}"#;
197193
assert_eq!(serde_json::to_string(&block).unwrap(), expected_block)
198194
}
199195
}

0 commit comments

Comments
 (0)