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

refactor(mirror): return a struct with a Vec of txs in next_batch() #11325

Merged
merged 3 commits into from
May 17, 2024

Conversation

marcelo-gonzalez
Copy link
Contributor

Before this change, the TxTracker returns a MappedBlock from next_batch() and accepts it (via SentBatch) in on_txs_sent(). This struct contains a vec of transactions per chunk, and corresponds to a particular block height. In preparation for implementing a qps option to mirror run, we refactor it to return a new struct TxBatch, which only has a Vec of the transactions we want to send. The previous separation of the transactions by shard served no purpose, really, and removing that will make it easier to implement the qps option, since then we'll no longer be batching transactions by block height, but will just be sending them at a regular interval regardless of block height or shard ID.

The struct MappedBlock doesn't fully go away with this PR, since it's cumbersome to remove it everywhere, but this refactoring should be enough to let us move forward

this can just be an ExtraTxs batch with the txs we send, and there's
no need to queue a fake block
@marcelo-gonzalez marcelo-gonzalez requested a review from a team as a code owner May 16, 2024 04:49
Copy link

codecov bot commented May 16, 2024

Codecov Report

Attention: Patch coverage is 0% with 47 lines in your changes are missing coverage. Please review.

Project coverage is 71.06%. Comparing base (7befdbd) to head (7736ae4).
Report is 2 commits behind head on master.

Files Patch % Lines
tools/mirror/src/chain_tracker.rs 0.00% 41 Missing ⚠️
tools/mirror/src/lib.rs 0.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #11325      +/-   ##
==========================================
+ Coverage   71.04%   71.06%   +0.02%     
==========================================
  Files         782      783       +1     
  Lines      156618   156873     +255     
  Branches   156618   156873     +255     
==========================================
+ Hits       111264   111479     +215     
- Misses      40533    40561      +28     
- Partials     4821     4833      +12     
Flag Coverage Δ
backward-compatibility 0.24% <0.00%> (-0.01%) ⬇️
db-migration 0.24% <0.00%> (-0.01%) ⬇️
genesis-check 1.39% <0.00%> (-0.01%) ⬇️
integration-tests 37.17% <0.00%> (-0.03%) ⬇️
linux 68.97% <0.00%> (+0.05%) ⬆️
linux-nightly 70.52% <0.00%> (+0.01%) ⬆️
macos 52.42% <0.00%> (+0.10%) ⬆️
pytests 1.61% <0.00%> (-0.01%) ⬇️
sanity-checks 1.41% <0.00%> (-0.01%) ⬇️
unittests 65.50% <0.00%> (+0.02%) ⬆️
upgradability 0.29% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@marcelo-gonzalez marcelo-gonzalez added this pull request to the merge queue May 17, 2024
Merged via the queue into near:master with commit 6cd073c May 17, 2024
29 checks passed
@marcelo-gonzalez marcelo-gonzalez deleted the mirror-qps branch May 17, 2024 01:02
marcelo-gonzalez added a commit to marcelo-gonzalez/nearcore that referenced this pull request May 17, 2024
This reverts commit e301c09 from
near#11325. This small commit
was not necessary, and actually incorrect, because there's an assumption
that changed access keys will only appear in SentBatch::MappedBlock(). Otherwise
we hit an assertion here: https://github.com/near/nearcore/blob/510948178c5920c614448dc7bcce72873a1655fd/tools/mirror/src/chain_tracker.rs#L1026
github-merge-queue bot pushed a commit that referenced this pull request May 18, 2024
This reverts commit e301c09 from
#11325. This small commit was not
necessary, and actually incorrect, because there's an assumption that
changed access keys will only appear in SentBatch::MappedBlock().
Otherwise we hit an assertion here:
https://github.com/near/nearcore/blob/510948178c5920c614448dc7bcce72873a1655fd/tools/mirror/src/chain_tracker.rs#L1026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants