-
Notifications
You must be signed in to change notification settings - Fork 228
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
1664: chore: update get_block_template rpc doc r=quake,u2,keroro520,yangby-cryptape a=shaojunda replace difficulty with compact_target 1669: chore(test): Allow CI debug logs r=u2,zhangsoledad a=keroro520 The number of logs is acceptable after #1474. 1671: test: disconnect check by all part r=u2,keroro520,quake a=driftluo Disconnect check by all part 1673: docs: Update PoW mining algorithm description r=u2,quake a=ashchan Now that this has been decided the doc should reflect that before the next round of mining test. 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 Co-authored-by: shaojunda <[email protected]> Co-authored-by: keroro520 <[email protected]> Co-authored-by: driftluo <[email protected]> Co-authored-by: James Chen <[email protected]> Co-authored-by: zhangsoledad <[email protected]>
- Loading branch information
Showing
12 changed files
with
108 additions
and
13 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
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
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,7 +1,9 @@ | ||
mod block_relay; | ||
mod compact_block; | ||
mod get_block_transactions_process; | ||
mod transaction_relay; | ||
|
||
pub use block_relay::*; | ||
pub use compact_block::*; | ||
pub use get_block_transactions_process::*; | ||
pub use transaction_relay::*; |
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