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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix chain slow on chaos and round timeout #1890

Merged
merged 3 commits into from
Dec 13, 2022
Merged

Fix chain slow on chaos and round timeout #1890

merged 3 commits into from
Dec 13, 2022

Conversation

peterlimg
Copy link
Member

@peterlimg peterlimg commented Dec 13, 2022

Fixes

  • Chain would stuck for a while till round timeout occurs on small network (3 miners and 3 sharders) when chaos is enabled. This happens when one of the generator is down, and the alive generator have 'node not found' error. We did quick node states syncing for block verification before, but didn't do it for block generation process. So when this happens, we will have to wait for the round restart to re-generate the block. The fix is simply do the quick state syncing and retry just like we did for the block verification.
  • Fix VRF tickets cache related slow consensus issue. See details in commit description in 47826

Changes

Need to be mentioned in CHANGELOG.md?

Tests

Tasks to complete before merging PR:

  • Ensure system tests are passing. If not Run them manually to check for any regressions 馃搵
  • Do any new system tests need added to test this change? do any existing system tests need updated? If so create a PR at 0chain/system_test
  • Merge your system tests PR to master AFTER merging this PR

Associated PRs (Link as appropriate):

  • blobber:
  • gosdk:
  • system_test:
  • zboxcli:
  • zwalletcli:
  • Other: ...

Set current round on StartNextRound before adding the VRF to lock the current round. Otherwise, we will miss one future VRF, and if that's the last ticket to meet threshold, we will have to wait soft round timeout.

- on round 100, receive future VRF for round 101, cache it
- start next round (still on round 100 at the moment), create VRF for round 101, and broadcast it to others
- add the created VRF to local meanwhile checking if there are cached future VRF, and process it. So now, we have 2 tickets
- received another ticket, but since the current round is still on 100, we will cache it instead of processing it.
- set current round to 101 when start next round process is finished.
- wait soft round time out to re do the VRF process

So if in StartNextRound method, we set current round to 101 before creating local VRF, the last ticket will not be treated as future ticket and we will process it immediately, and meet the threshold
@codecov-commenter
Copy link

Codecov Report

Merging #1890 (4782606) into staging (ed70aa7) will increase coverage by 0.03%.
The diff coverage is 40.74%.

@@             Coverage Diff             @@
##           staging    #1890      +/-   ##
===========================================
+ Coverage    26.60%   26.63%   +0.03%     
===========================================
  Files          356      356              
  Lines        59754    59759       +5     
===========================================
+ Hits         15896    15916      +20     
+ Misses       41962    41944      -18     
- Partials      1896     1899       +3     
Flag Coverage 螖
Unit-Tests 26.63% <40.74%> (+0.03%) 猬嗭笍

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

Impacted Files Coverage 螖
code/go/0chain.net/miner/protocol_round.go 5.22% <25.00%> (+0.07%) 猬嗭笍
code/go/0chain.net/miner/protocol_block.go 22.29% <41.17%> (+1.60%) 猬嗭笍
code/go/0chain.net/miner/protocol_block_main.go 86.66% <100.00%> (酶)
.../go/0chain.net/smartcontract/dbs/event/snapshot.go 0.00% <0.00%> (酶)
...0chain.net/smartcontract/minersc/delegate_pools.go 0.00% <0.00%> (酶)
...de/go/0chain.net/smartcontract/vestingsc/config.go 50.52% <0.00%> (+1.57%) 猬嗭笍

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Member

@dabasov dabasov left a comment

Choose a reason for hiding this comment

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

lgtm

@dabasov dabasov merged commit 22a92a9 into staging Dec 13, 2022
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

3 participants