OnChain invalid timestamp block propagation fail
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- rust
- Lĩnh vực
- blockchain, networking
Hướng nghiên cứu
Bắt đầu với core/verification/queue/mod.rs và hàm verify() được hiển thị trong issue. Tái hiện kịch bản timestamp của block1/block2 với các thông báo status, header response và body response, sau đó theo dõi ready_signal và phản hồi status của node đích. Được xem là hoàn tất khi block không hợp lệ bị từ chối, predecessor hợp lệ được xử lý và thông báo status mong đợi được gửi mà không dựa vào các câu lệnh logging.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
There are some issues in sending invalid timestamp onChain blocks.
Below is a test scenario.
- Make block1 and block2.
- The timestamp in Block2's header should be invalid. Simply make it smaller than block1.
- Send a
status messagewith block2's hash as the bestHash. - Send a
header response messagewhich is [genesisHeader, block1Header, block2Header]. - Send a
body response message== [[], []], which is correspond to block1's body and block2's body. - Block is accepted from the target node only for block1. So the target node should send a status message with block1's hash as bestHash.(This is normal behaviour but it didn't)
And here are problems
- The target node does not send
status messageif in the above situation. However, if I insertedinfo!("55");then thestatus messagecome properly. - In below
verify()function in/core/verification/queue/mod.rs,Ok(verified)is returned twice although the block2 is invalid.
fn verify(
verification: Arc<Verification<K>>,
engine: Arc<CodeChainEngine>,
ready_signal: Arc<QueueSignal>,
empty: Arc<SCondvar>,
more_to_verify: Arc<SCondvar>,
_id: usize,
) {
loop {
// wait for work if empty.
{
let mut more_to_verify_mutex = verification.more_to_verify_mutex.lock().unwrap();
if verification.unverified.lock().is_empty() && verification.verifying.lock().is_empty() {
empty.notify_all();
}
while verification.unverified.lock().is_empty() {
more_to_verify_mutex = more_to_verify.wait(more_to_verify_mutex).unwrap();
}
}
// do work.
let item = {
// acquire these locks before getting the item to verify.
let mut unverified = verification.unverified.lock();
let mut verifying = verification.verifying.lock();
let item = match unverified.pop_front() {
Some(item) => item,
None => continue,
};
verification.sizes.unverified.fetch_sub(item.heap_size_of_children(), AtomicOrdering::SeqCst);
verifying.push_back(Verifying {
hash: item.hash(),
output: None,
});
item
};
let hash = item.hash();
let is_ready = match K::verify(item, &*engine, verification.check_seal) {
Ok(verified) => {
let mut verifying = verification.verifying.lock();
let mut idx = None;
for (i, e) in verifying.iter_mut().enumerate() {
if e.hash == hash {
idx = Some(i);
verification
.sizes
.verifying
.fetch_add(verified.heap_size_of_children(), AtomicOrdering::SeqCst);
e.output = Some(verified);
break
}
}
if idx == Some(0) {
// we're next!
let mut verified = verification.verified.lock();
let mut bad = verification.bad.lock();
VerificationQueue::drain_verifying(
&mut verifying,
&mut verified,
&mut bad,
&verification.sizes,
);
info!("111");
true
} else {
info!("222");
false
}
}
Err(_) => {
let mut verifying = verification.verifying.lock();
let mut verified = verification.verified.lock();
let mut bad = verification.bad.lock();
bad.insert(hash.clone());
verifying.retain(|e| e.hash != hash);
if verifying.front().map_or(false, |x| x.output.is_some()) {
VerificationQueue::drain_verifying(
&mut verifying,
&mut verified,
&mut bad,
&verification.sizes,
);
info!("33");
true
} else {
info!("44");
false
}
}
};
if is_ready {
info!("55");
// Import the block immediately
ready_signal.set_sync();
}
}
}
- Ngôn ngữ chính
- Rust
- Star
- 256
- Fork
- 50
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của CodeChain-io/codechain
-
is this project still alive? Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
CodeChain-io/codechain#2002 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
CodeChain-io/codechain#1993 · 2 bình luận ·
-
Terminate gracefully Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
CodeChain-io/codechain#1987 · 1 bình luận ·
-
performance rpc
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
CodeChain-io/codechain#1973 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
CodeChain-io/codechain#1971 ·
Tất cả issue của CodeChain-io/codechain
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Eynzof/Hermes-CN-Desktop#616 ·
-
bug rules
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
app bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
IronCoreLabs/ironcore-alloy#346 ·
-
good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100