Skip to content

Commit

Permalink
feat: split the simple resharding test to separately test the V1 and …
Browse files Browse the repository at this point in the history
…V2 reshardings (#9373)

* feat: splitting the simple resharding test to separately test V1 and V2 reshardings

* devlog

* debugging

* should be fine

* revert debug logging

* rust features are hard
  • Loading branch information
wacban authored Aug 2, 2023
1 parent 83d6d08 commit 4efb31f
Show file tree
Hide file tree
Showing 2 changed files with 198 additions and 101 deletions.
18 changes: 9 additions & 9 deletions chain/client/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2016,9 +2016,11 @@ impl Client {

let shard_id =
self.epoch_manager.account_id_to_shard_id(&tx.transaction.signer_id, &epoch_id)?;
if self.shard_tracker.care_about_shard(me, &head.last_block_hash, shard_id, true)
|| self.shard_tracker.will_care_about_shard(me, &head.last_block_hash, shard_id, true)
{
let care_about_shard =
self.shard_tracker.care_about_shard(me, &head.last_block_hash, shard_id, true);
let will_care_about_shard =
self.shard_tracker.will_care_about_shard(me, &head.last_block_hash, shard_id, true);
if care_about_shard || will_care_about_shard {
let shard_uid = self.epoch_manager.shard_id_to_uid(shard_id, &epoch_id)?;
let state_root = match self.chain.get_chunk_extra(&head.last_block_hash, &shard_uid) {
Ok(chunk_extra) => *chunk_extra.state_root(),
Expand Down Expand Up @@ -2089,14 +2091,12 @@ impl Client {
}
} else if check_only {
Ok(ProcessTxResponse::DoesNotTrackShard)
} else if is_forwarded {
// Received forwarded transaction but we are not tracking the shard
debug!(target: "client", "Received forwarded transaction but no tracking shard {}, I'm {:?}", shard_id, me);
Ok(ProcessTxResponse::NoResponse)
} else {
if is_forwarded {
// received forwarded transaction but we are not tracking the shard
debug!(target: "client", "Received forwarded transaction but no tracking shard {}, I'm {:?}", shard_id, me);
return Ok(ProcessTxResponse::NoResponse);
}
// We are not tracking this shard, so there is no way to validate this tx. Just rerouting.

self.forward_tx(&epoch_id, tx)?;
Ok(ProcessTxResponse::RequestRouted)
}
Expand Down
Loading

0 comments on commit 4efb31f

Please sign in to comment.