Implement eth/64 (EIP-2364) and drop support for eth/62 (#11472)
* sync: make code friendlier to future conditional parsing * Implement eth/64 (EIP-2364) and drop support for eth/62
This commit is contained in:
@@ -46,7 +46,7 @@ impl TestSyncProvider {
|
||||
status: RwLock::new(SyncStatus {
|
||||
state: SyncState::Idle,
|
||||
network_id: config.network_id,
|
||||
protocol_version: 63,
|
||||
protocol_version: 64,
|
||||
start_block_number: 0,
|
||||
last_imported_block_number: None,
|
||||
highest_block_number: None,
|
||||
@@ -82,11 +82,11 @@ impl SyncProvider for TestSyncProvider {
|
||||
PeerInfo {
|
||||
id: Some("node1".to_owned()),
|
||||
client_version: ClientVersion::from("Parity-Ethereum/1/v2.4.0/linux/rustc"),
|
||||
capabilities: vec!["eth/62".to_owned(), "eth/63".to_owned()],
|
||||
capabilities: vec!["eth/63".to_owned(), "eth/64".to_owned()],
|
||||
remote_address: "127.0.0.1:7777".to_owned(),
|
||||
local_address: "127.0.0.1:8888".to_owned(),
|
||||
eth_info: Some(EthProtocolInfo {
|
||||
version: 62,
|
||||
version: 63,
|
||||
difficulty: Some(40.into()),
|
||||
head: H256::from_low_u64_be(50),
|
||||
}),
|
||||
@@ -95,11 +95,11 @@ impl SyncProvider for TestSyncProvider {
|
||||
PeerInfo {
|
||||
id: None,
|
||||
client_version: ClientVersion::from("Parity-Ethereum/2/v2.4.0/linux/rustc"),
|
||||
capabilities: vec!["eth/63".to_owned(), "eth/64".to_owned()],
|
||||
capabilities: vec!["eth/64".to_owned(), "eth/65".to_owned()],
|
||||
remote_address: "Handshake".to_owned(),
|
||||
local_address: "127.0.0.1:3333".to_owned(),
|
||||
eth_info: Some(EthProtocolInfo {
|
||||
version: 64,
|
||||
version: 65,
|
||||
difficulty: None,
|
||||
head: H256::from_low_u64_be(60),
|
||||
}),
|
||||
|
||||
@@ -125,7 +125,7 @@ impl EthTester {
|
||||
#[test]
|
||||
fn rpc_eth_protocol_version() {
|
||||
let request = r#"{"jsonrpc": "2.0", "method": "eth_protocolVersion", "params": [], "id": 1}"#;
|
||||
let response = r#"{"jsonrpc":"2.0","result":"63","id":1}"#;
|
||||
let response = r#"{"jsonrpc":"2.0","result":"64","id":1}"#;
|
||||
|
||||
assert_eq!(EthTester::default().io.handle_request_sync(request), Some(response.to_owned()));
|
||||
}
|
||||
|
||||
@@ -255,7 +255,7 @@ fn rpc_parity_net_peers() {
|
||||
let io = deps.default_client();
|
||||
|
||||
let request = r#"{"jsonrpc": "2.0", "method": "parity_netPeers", "params":[], "id": 1}"#;
|
||||
let response = r#"{"jsonrpc":"2.0","result":{"active":0,"connected":120,"max":50,"peers":[{"caps":["eth/62","eth/63"],"id":"node1","name":{"ParityClient":{"can_handle_large_requests":true,"compiler":"rustc","identity":"1","name":"Parity-Ethereum","os":"linux","semver":"2.4.0"}},"network":{"localAddress":"127.0.0.1:8888","remoteAddress":"127.0.0.1:7777"},"protocols":{"eth":{"difficulty":"0x28","head":"0000000000000000000000000000000000000000000000000000000000000032","version":62},"pip":null}},{"caps":["eth/63","eth/64"],"id":null,"name":{"ParityClient":{"can_handle_large_requests":true,"compiler":"rustc","identity":"2","name":"Parity-Ethereum","os":"linux","semver":"2.4.0"}},"network":{"localAddress":"127.0.0.1:3333","remoteAddress":"Handshake"},"protocols":{"eth":{"difficulty":null,"head":"000000000000000000000000000000000000000000000000000000000000003c","version":64},"pip":null}}]},"id":1}"#;
|
||||
let response = r#"{"jsonrpc":"2.0","result":{"active":0,"connected":120,"max":50,"peers":[{"caps":["eth/63","eth/64"],"id":"node1","name":{"ParityClient":{"can_handle_large_requests":true,"compiler":"rustc","identity":"1","name":"Parity-Ethereum","os":"linux","semver":"2.4.0"}},"network":{"localAddress":"127.0.0.1:8888","remoteAddress":"127.0.0.1:7777"},"protocols":{"eth":{"difficulty":"0x28","head":"0000000000000000000000000000000000000000000000000000000000000032","version":63},"pip":null}},{"caps":["eth/64","eth/65"],"id":null,"name":{"ParityClient":{"can_handle_large_requests":true,"compiler":"rustc","identity":"2","name":"Parity-Ethereum","os":"linux","semver":"2.4.0"}},"network":{"localAddress":"127.0.0.1:3333","remoteAddress":"Handshake"},"protocols":{"eth":{"difficulty":null,"head":"000000000000000000000000000000000000000000000000000000000000003c","version":65},"pip":null}}]},"id":1}"#;
|
||||
|
||||
assert_eq!(io.handle_request_sync(request), Some(response.to_owned()));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user