Page MenuHomePhabricator

[avalanche] Actually dump/load the peers list upon shutdown/startup
ClosedPublic

Authored by Fabien on Nov 21 2023, 21:16.

Details

Summary

This has several benefits:

  • It makes the avalanche bootstraping faster
  • It solves the issue of the local proof requiring a block to be verified (if the proof was in the dump)
  • It makes the selection of the staking reward winner faster

The tests that are not designed to work with loading the file (i.e. tests that restart the nodes) have the feature disabled.

There are a few implementation details that need to be explained:

  • The change to the getavalancheinfo RPC is needed to make the local proof recognized when loaded from the dump file. Previously it was only registered from the processor using the local data so comparing using the identify function was enough, but it's on longer the case as the local proof is now deserialized from the file.
  • The staking rewards are computed upon block connection, so in order to not have to wait for a block to get the next winner when the proofs are loaded from the dump file, the computation is also processed once when ready_to_poll turns true.
  • I added some logs to make it easier to check the file is dumped/loaded as expected. It happens once opon startup and once upon shutdown and only if the avalanche debug category is enabled so it won't bloat the logs.

Depends on D14834.

Test Plan
ninja all check-all

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Fabien requested review of this revision.Nov 21 2023, 21:16

This needs a release note, will rebase

Tail of the build log:

/work /work/abc-ci-builds/lint-circular-dependencies
A new circular dependency in the form of "avalanche/processor -> policy/block/stakingrewards -> avalanche/processor" appears to have been introduced.

Good job! The circular dependency "avalanche/processor -> validation -> policy/block/stakingrewards -> avalanche/processor" is no longer present.
Please remove it from EXPECTED_CIRCULAR_DEPENDENCIES in /work/test/lint/lint-circular-dependencies.sh
to make sure this circular dependency is not accidentally reintroduced.

/work/abc-ci-builds/lint-circular-dependencies
Build lint-circular-dependencies failed with exit code 1

Tail of the build log:

/work /work/abc-ci-builds/lint-circular-dependencies
A new circular dependency in the form of "avalanche/processor -> policy/block/stakingrewards -> avalanche/processor" appears to have been introduced.

Good job! The circular dependency "avalanche/processor -> validation -> policy/block/stakingrewards -> avalanche/processor" is no longer present.
Please remove it from EXPECTED_CIRCULAR_DEPENDENCIES in /work/test/lint/lint-circular-dependencies.sh
to make sure this circular dependency is not accidentally reintroduced.

/work/abc-ci-builds/lint-circular-dependencies
Build lint-circular-dependencies failed with exit code 1
PiRK requested changes to this revision.Nov 22 2023, 07:13
PiRK added a subscriber: PiRK.

There is a linter issue.
Also, we could mention the new file in files.md

This revision now requires changes to proceed.Nov 22 2023, 07:13
test/functional/abc_feature_persist_avapeers.py
2 ↗(On Diff #43208)

nit 2023

Also, we could mention the new file in files.md

Good point

test/functional/abc_feature_persist_avapeers.py
104 ↗(On Diff #43208)

remove debugging log

Update the circular dependency, update the files.md doc, remove the debugging log and fix the copyright year.

This revision is now accepted and ready to land.Nov 22 2023, 09:08