-
Notifications
You must be signed in to change notification settings - Fork 622
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
feat: implemented incoming receipts handling in resharding #9474
Conversation
I see @pugachAG you have assigned yourself as a reviewer. Thank you for reviewing! I will remove myself, ping me if you think my input specifically is needed somewhere. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overall looks good to me, but please take a look at my comments before merging
chain/chain/src/store.rs
Outdated
mut block_hash: CryptoHash, | ||
last_chunk_height_included: BlockHeight, | ||
) -> Result<Vec<ReceiptProofResponse>, Error> { | ||
let _span = | ||
tracing::debug_span!(target: "store", "get_incoming_receipts_for_shard").entered(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
target: "store"
is used in store crate, I think here target: "chain"
would be more appropriate (applies to the all instances in this function)
@@ -192,9 +192,11 @@ fn apply_block_from_range( | |||
} | |||
}; | |||
|
|||
// TODO(wacban) OK, has epoch manager handy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would be nice to have a bit more descriptive comment here 😃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opsie daisy :)
chain/chain/src/store.rs
Outdated
); | ||
ret.push(ReceiptProofResponse(block_hash, receipt_proofs)); | ||
|
||
// If the shard layout changed we need to filter to make |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: consider moving that part to a separate function, something like
fn filter_incoming_receipts_for_shard(parent_shard_receipts: &[ReceiptProof], ...) -> Vec<ReceiptProof> {
...
}
chain/chain/src/store.rs
Outdated
// TODO(resharding) adjust the shard proof accordingly | ||
// currently this only matters for state sync | ||
let receipt_proof = ReceiptProof(filtered_receipts, shard_proof); | ||
filtered_receipt_proofs.push(receipt_proof); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note for the rightfully concerned reviewer.
This method has two important usages:
- From the
get_apply_chunk_job_new_chunk
where the proofs are immediately discarded and only the receipts are usednearcore/chain/chain/src/chain.rs
Line 3985 in 6762c06
let receipt_proof_response = &self.store().get_incoming_receipts_for_shard( - From the
compute_state_response_header
where it will likely break things. This method is used for state sync which currently is not supported together with resharding but it will need to be fixed, hence the TODO.nearcore/chain/chain/src/chain.rs
Line 2929 in 6762c06
let incoming_receipts_proofs = self.store.get_incoming_receipts_for_shard(
@@ -192,9 +192,11 @@ fn apply_block_from_range( | |||
} | |||
}; | |||
|
|||
// TODO(wacban) OK, has epoch manager handy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opsie daisy :)
73e2d28
to
f5d461b
Compare
This PR implements proper handling of incoming receipts in resharding.
Conceptually there are two parts, that take place when iterating back through the chain and collecting incoming receipts.
For example in the following scenario:
The implementation when getting incoming receipts for 4' will do the following:
This scenario is covered by the integration test implemented in #9467.