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

Swallow deal termination error in cron #1125

Merged
merged 4 commits into from
Feb 10, 2023
Merged

Conversation

ZenGround0
Copy link
Contributor

Today if market cron freezes over in case of programmer error then any miner actors making use of cron to terminate sectors will also freeze. We should prefer to not do this to make frozen cron easier to recover and less disruptive. We don't gain much from this. Any recovery of frozen cron is going to need a migration and that migration should be able to filter out deals that have terminated since market cron froze. Frozen cron from programmer error isn't esoteric: this is exactly the cause of calibration reset last year. With FVM approaching and new classes of exploits becoming possible it makes sense to do this hardening.

@codecov-commenter
Copy link

codecov-commenter commented Jan 28, 2023

Codecov Report

Merging #1125 (c113833) into master (9ccfd89) will increase coverage by 0.08%.
The diff coverage is 88.88%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1125      +/-   ##
==========================================
+ Coverage   88.33%   88.42%   +0.08%     
==========================================
  Files         103      103              
  Lines       20409    20417       +8     
==========================================
+ Hits        18029    18054      +25     
+ Misses       2380     2363      -17     
Impacted Files Coverage Δ
actors/miner/src/lib.rs 82.97% <88.88%> (+0.16%) ⬆️
actors/power/src/lib.rs 83.58% <0.00%> (-1.30%) ⬇️
state/src/check.rs 86.05% <0.00%> (-0.27%) ⬇️
test_vm/src/lib.rs 83.13% <0.00%> (+0.29%) ⬆️
runtime/src/util/message_accumulator.rs 94.54% <0.00%> (+0.90%) ⬆️
actors/miner/src/deadline_info.rs 96.62% <0.00%> (+16.85%) ⬆️

actors/miner/src/lib.rs Outdated Show resolved Hide resolved
actors/miner/src/lib.rs Outdated Show resolved Hide resolved
actors/miner/src/lib.rs Outdated Show resolved Hide resolved
))?;
));
// Intentionally swallow this error to prevent frozen market cron corruption from also freezing this miner cron.
// This is safe from a malicious caller perspective because this method's callstack should always originate with the trusted system caller.
Copy link
Member

Choose a reason for hiding this comment

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

Please update this comment; it's confusing, given the code below that denies the "should".

Copy link
Contributor

@arajasek arajasek left a comment

Choose a reason for hiding this comment

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

How hard would it be to add a unit test for this? I think most of the work would be setting up the state of having a sector with deals, then

  • Call terminate sectors from the owner, mock the ON_MINER_SECTORS_TERMINATE_METHOD as failing, assert the call fails.
  • Call on_deferred_cron_event / handle_proving_deadline from the syst,m mock the ON_MINER_SECTORS_TERMINATE_METHOD as failing, assert the call succeeds?

@ZenGround0 ZenGround0 merged commit 2d0b49c into master Feb 10, 2023
@ZenGround0 ZenGround0 deleted the fix/remove-cron-contagion branch February 10, 2023 00:02
@ZenGround0
Copy link
Contributor Author

I did the bad thing of merging without test because otherwise I don't think this will make it into code freeze tomorrow and introducing without test is less risky than not introducing at all IMO. Follow up issue #1194

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

5 participants