Fix fragile powerup_tests/weight_tests so that they can run under Savanna #101
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Under Savanna, powerup
weight_tests
fails in both NET and CPU weight_ratio tests:tests/eosio.powerup_tests.cpp(410): fatal error: in "eosio_system_powerup_tests/weight_tests": critical check near(get_state().net.weight_ratio, net, 1) has failed
The root cause is the tests are fragile.
NET and CPU decays are calculated by
update_weight
in the system contractreference-contracts/contracts/eosio.system/src/powerup.cpp
Lines 91 to 98 in 229dd4f
target_timestamp
is set in tests for examplereference-contracts/tests/eosio.powerup_tests.cpp
Line 382 in 229dd4f
while
initial_timestamp
is set in contractreference-contracts/contracts/eosio.system/src/powerup.cpp
Line 323 in 229dd4f
eosio::current_time_point()
is calculated by host functioninterface::current_time()
to becontext.control.pending_block_time().time_since_epoch().count()
.As
pending_block_time()
ishead_block_time() + 500ms
, whenhead_block_time()
is not on the second,pending_block_time().utc_seconds
will be the next second; this results in(res.target_timestamp.utc_seconds - res.initial_timestamp.utc_seconds)
not equal to exact10
days in the example, causing rounding errors in tests.The solution is to use
pending_block_time()
fortarget_timestamp
.Note: this does not fix the
rent_tests
failures. That is tracked by #104Partially resolved #91.
Change Description
Deployment Changes
API Changes
Documentation Additions