-
Notifications
You must be signed in to change notification settings - Fork 236
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
1680: fix: get_block_transactions_process r=u2,quake a=zhangsoledad 1689: chore: issuance comment r=u2,quake a=zhangsoledad comments were lost on rebase 1690: ci: Make sure cargo-audit up-to-date r=quake,u2 a=zhangsoledad rustsec/rustsec#143 https://internals.rust-lang.org/t/idea-cargo-install-update/11072 rust-lang/cargo#6797 1691: chore: speed up maturity test r=u2,quake a=zhangsoledad 1693: test: simple header field json format check r=quake,u2 a=zhangsoledad 1696: fix: set `next_epoch_diff` to one instead of panic when it is zero r=zhangsoledad,u2 a=doitian Co-authored-by: zhangsoledad <787953403@qq.com> Co-authored-by: ian <ian@nervos.org>
- Loading branch information
Showing
12 changed files
with
125 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
use crate::{Net, Spec, TestProtocol}; | ||
use ckb_sync::NetworkProtocol; | ||
use ckb_types::{ | ||
core::UncleBlockView, | ||
packed::{self, RelayMessage}, | ||
prelude::*, | ||
}; | ||
|
||
pub struct MissingUncleRequest; | ||
|
||
impl Spec for MissingUncleRequest { | ||
crate::name!("missing_uncle_request"); | ||
|
||
crate::setup!(protocols: vec![TestProtocol::sync(), TestProtocol::relay()]); | ||
|
||
// Case: Send to node GetBlockTransactions with missing uncle index, node should response BlockTransactions with uncles | ||
fn run(&self, net: &mut Net) { | ||
net.exit_ibd_mode(); | ||
let node = &net.nodes[0]; | ||
net.connect(node); | ||
let (peer_id, _, _) = net.receive(); | ||
|
||
node.generate_block(); | ||
let _ = net.receive(); | ||
|
||
let builder = node.new_block_builder(None, None, None); | ||
let block1 = builder.clone().nonce(0.pack()).build(); | ||
let block2 = builder.clone().nonce(1.pack()).build(); | ||
node.submit_block(&block1.data()); | ||
node.submit_block(&block2.data()); | ||
|
||
let builder = node.new_block_builder(None, None, None); | ||
let block = builder | ||
.clone() | ||
.set_uncles(vec![block2.as_uncle()]) | ||
.nonce(0.pack()) | ||
.build(); | ||
node.submit_block(&block.data()); | ||
|
||
let content = packed::GetBlockTransactions::new_builder() | ||
.block_hash(block.hash()) | ||
.uncle_indexes(vec![0u32].pack()) | ||
.build(); | ||
let message = packed::RelayMessage::new_builder().set(content).build(); | ||
|
||
(0..3).for_each(|_| { | ||
net.receive(); // ignore three new block announce | ||
}); | ||
|
||
net.send( | ||
NetworkProtocol::RELAY.into(), | ||
peer_id, | ||
message.as_slice().into(), | ||
); | ||
|
||
let (_, _, data) = net.receive(); | ||
let message = RelayMessage::from_slice(&data).unwrap(); | ||
|
||
assert_eq!( | ||
message.to_enum().item_name(), | ||
packed::BlockTransactions::NAME, | ||
"Node should reponse BlockTransactions message", | ||
); | ||
|
||
if let packed::RelayMessageUnionReader::BlockTransactions(reader) = | ||
message.to_enum().as_reader() | ||
{ | ||
let block_transactions = reader.to_entity(); | ||
let received_uncles: Vec<UncleBlockView> = block_transactions | ||
.uncles() | ||
.into_iter() | ||
.map(|uncle| uncle.into_view()) | ||
.collect(); | ||
assert_eq!(received_uncles[0], block2.as_uncle()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
mod block_relay; | ||
mod compact_block; | ||
mod get_block_transactions_process; | ||
mod transaction_relay; | ||
mod transaction_relay_low_fee_rate; | ||
|
||
pub use block_relay::*; | ||
pub use compact_block::*; | ||
pub use get_block_transactions_process::*; | ||
pub use transaction_relay::*; | ||
pub use transaction_relay_low_fee_rate::TransactionRelayLowFeeRate; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,3 +16,4 @@ jsonrpc-core = "10.1" | |
[dev-dependencies] | ||
proptest = "0.9" | ||
regex = "1.1" | ||
lazy_static = "1.3" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters