Skip to content

Commit db23449

Browse files
authored
Merge pull request #395 from nervosnetwork/change-by-upstream
feat: change by upstream
2 parents f95b53d + 6afc544 commit db23449

File tree

4 files changed

+8
-10
lines changed

4 files changed

+8
-10
lines changed

Makefile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,7 @@ features-check:
4747
# required wasm32-unknown-unknown target
4848
$(Change_Work_Path) && cargo build --features wasm-timer,unstable --no-default-features --target=wasm32-unknown-unknown
4949
$(Change_Work_Path) && cargo build --features wasm-timer,unstable,secio-async-trait --no-default-features --target=wasm32-unknown-unknown
50-
# required wasm32-wasip1 target
51-
$(Change_Work_Path) && cargo build --features wasm-timer,unstable --no-default-features --target=wasm32-wasip1
52-
$(Change_Work_Path) && cargo build --features wasm-timer,unstable,secio-async-trait --no-default-features --target=wasm32-wasip1
50+
5351
bench_p2p:
5452
cd bench && cargo run --release
5553

fuzz/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ edition = "2021"
99
cargo-fuzz = true
1010

1111
[dependencies]
12-
libfuzzer-sys = "0.3"
12+
libfuzzer-sys = "0.4"
1313
tentacle-secio = { path = "../secio" }
1414
tokio-yamux = { path = "../yamux" }
1515
rand = "0.8"

multiaddr/src/protocol.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const WS: u32 = 0x01dd;
2020
const WSS: u32 = 0x01de;
2121
const MEMORY: u32 = 0x0309;
2222

23-
const SHA256_CODE: u16 = 0x12;
23+
const SHA256_CODE: u64 = 0x12;
2424
const SHA256_SIZE: u8 = 32;
2525

2626
/// `Protocol` describes all possible multiaddress protocols.
@@ -276,7 +276,7 @@ impl<'a> From<Ipv6Addr> for Protocol<'a> {
276276
}
277277

278278
fn check_p2p(data: &[u8]) -> Result<(), Error> {
279-
let (code, bytes) = unsigned_varint::decode::u16(data)?;
279+
let (code, bytes) = unsigned_varint::decode::u64(data)?;
280280

281281
if code != SHA256_CODE {
282282
return Err(Error::UnknownHash);

secio/src/peer_id.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use unsigned_varint::{decode, encode};
66

77
use crate::handshake::handshake_struct::PublicKey;
88

9-
const SHA256_CODE: u16 = 0x12;
9+
const SHA256_CODE: u64 = 0x12;
1010
const SHA256_SIZE: u8 = 32;
1111

1212
/// Identifier of a peer of the network
@@ -31,7 +31,7 @@ impl PeerId {
3131
return Err(Error::Empty);
3232
}
3333

34-
let (code, bytes) = decode::u16(&data).map_err(|_| Error::InvalidData)?;
34+
let (code, bytes) = decode::u64(&data).map_err(|_| Error::InvalidData)?;
3535

3636
if code != SHA256_CODE {
3737
return Err(Error::NotSupportHashCode);
@@ -57,8 +57,8 @@ impl PeerId {
5757

5858
/// Return `PeerId` which used hashed seed as inner.
5959
fn from_seed(seed: &[u8]) -> Self {
60-
let mut buf = encode::u16_buffer();
61-
let code = encode::u16(SHA256_CODE, &mut buf);
60+
let mut buf = encode::u64_buffer();
61+
let code = encode::u64(SHA256_CODE, &mut buf);
6262

6363
let header_len = code.len() + 1;
6464

0 commit comments

Comments
 (0)