Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fixing cross_shard_tx* tests and small fixes for some other nigh… #2204

Merged
merged 1 commit into from
Feb 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion chain/chain/src/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2533,7 +2533,7 @@ impl<'a> ChainUpdate<'a> {
return Err(ErrorKind::Orphan.into());
}

if block.header.inner_lite.height > head.height + self.epoch_length {
if block.header.inner_lite.height > head.height + self.epoch_length * 2 {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need this kind of check with doomslug and NFG? It seems extremely unlikely that someone would be able to produce a block that far into the future.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't hurt. It would only surface itself in some very bad cases, but doesn't hurt much.
If cross_shard_tx continues hitting it, we can revisit and see if we can convince ourselves it can be removed.

return Err(ErrorKind::InvalidBlockHeight.into());
}

Expand Down
12 changes: 5 additions & 7 deletions chain/client/src/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ pub fn setup_mock_all_validators(
let num_shards = validators.iter().map(|x| x.len()).min().unwrap() as NumShards;

let last_height_score =
Arc::new(RwLock::new(vec![(0, ScoreAndHeight::from_ints(0, 0)); key_pairs.len()]));
Arc::new(RwLock::new(vec![ScoreAndHeight::from_ints(0, 0); key_pairs.len()]));
let largest_endorsed_height = Arc::new(RwLock::new(vec![0u64; key_pairs.len()]));
let largest_skipped_height = Arc::new(RwLock::new(vec![0u64; key_pairs.len()]));
let hash_to_score = Arc::new(RwLock::new(HashMap::new()));
Expand Down Expand Up @@ -344,8 +344,8 @@ pub fn setup_mock_all_validators(
chain_id: "unittest".to_string(),
hash: Default::default(),
},
height: last_height_score2[i].0,
score: last_height_score2[i].1.score,
height: last_height_score2[i].height,
score: last_height_score2[i].score,
tracked_shards: vec![],
},
edge_info: EdgeInfo::default(),
Expand Down Expand Up @@ -378,10 +378,8 @@ pub fn setup_mock_all_validators(

let my_height_score = &mut last_height_score1[my_ord];

my_height_score.0 =
max(my_height_score.0, block.header.inner_lite.height);
my_height_score.1 =
max(my_height_score.1, block.header.score_and_height());
*my_height_score =
max(*my_height_score, block.header.score_and_height());

hash_to_score1
.write()
Expand Down
2 changes: 1 addition & 1 deletion chain/client/tests/catching_up.rs
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ mod tests {
key_pairs.clone(),
validator_groups,
true,
400,
600,
false,
false,
5,
Expand Down
2 changes: 1 addition & 1 deletion chain/client/tests/cross_shard_tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ mod tests {
!test_doomslug,
20,
test_doomslug,
false,
true,
Arc::new(RwLock::new(move |_account_id: String, _msg: &NetworkRequests| {
(NetworkResponses::NoResponse, true)
})),
Expand Down
10 changes: 5 additions & 5 deletions nightly/nightly.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ expensive near-client catching_up tests::test_catchup_random_single_part_sync_se
expensive near-client catching_up tests::test_catchup_random_single_part_sync_non_zero_amounts
expensive near-client catching_up tests::test_catchup_random_single_part_sync_height_6
expensive near-client catching_up tests::test_catchup_sanity_blocks_produced
expensive near-client catching_up tests::test_all_chunks_accepted_1000
expensive near-client catching_up tests::test_all_chunks_accepted_1000_slow
expensive near-client catching_up tests::test_all_chunks_accepted_1000_rare_epoch_changing
expensive --timeout=3600 near-client catching_up tests::test_all_chunks_accepted_1000
# expensive --timeout=7200 near-client catching_up tests::test_all_chunks_accepted_1000_slow
expensive --timeout=1800 near-client catching_up tests::test_all_chunks_accepted_1000_rare_epoch_changing
expensive near-client catching_up tests::test_catchup_sanity_blocks_produced_doomslug

expensive nearcore test_catchup test_catchup
Expand All @@ -66,8 +66,8 @@ expensive --timeout=3600 near-client cross_shard_tx tests::test_cross_shard_tx_w

# doomslug / finality gadget safety and light client fuzzy tests
expensive --timeout=900 near-chain doomslug tests::test_fuzzy_doomslug_liveness_and_safety
expensive --timeout=900 near-epoch-manager finality tests::test_fuzzy_safety
expensive --timeout=900 near-epoch-manager finality tests::test_fuzzy_light_client
expensive --timeout=2400 near-epoch-manager finality tests::test_fuzzy_safety
expensive --timeout=1200 near-epoch-manager finality tests::test_fuzzy_light_client

# state sync tests
expensive near sync_state_nodes sync_state_nodes_multishard
Expand Down
1 change: 1 addition & 0 deletions pytest/tests/sanity/state_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@

assert catch_up_height in boot_heights, "%s not in %s" % (catch_up_height, boot_heights)

tracker.offset = 0 # the transition might have happened before we initialized the tracker
if catch_up_height >= 100:
assert tracker.check("transition to State Sync")
elif catch_up_height <= 30:
Expand Down
1 change: 1 addition & 0 deletions pytest/tests/sanity/state_sync_late.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@

assert catch_up_height in boot_heights, "%s not in %s" % (catch_up_height, boot_heights)

tracker.offset = 0 # the transition might have happened before we initialized the tracker
if catch_up_height >= 100:
assert tracker.check("transition to State Sync")
elif catch_up_height <= 30:
Expand Down
1 change: 1 addition & 0 deletions pytest/tests/sanity/state_sync_routed.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@

assert catch_up_height in boot_heights, "%s not in %s" % (catch_up_height, boot_heights)

tracker.offset = 0 # the transition might have happened before we initialized the tracker
if catch_up_height >= 100:
assert tracker4.check("transition to State Sync")
elif catch_up_height <= 30:
Expand Down