This repository has been archived by the owner on Aug 2, 2022. It is now read-only.
use explicit billing for unapplied and deferred transactions in tester - develop #7610
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.
Change Description
When producing a block in the
tester
library, it optionally applies any unapplied transactions and scheduled deferred transactions.The
tester
library has been passing in a maximum time for the deadline which supports the intended behavior that the outcome of the tests not be sensitive to the time it takes to execute them. However, it has been using the default value of 0 for thebilled_cpu_time_us
which means that the chain controller will determine the billing time based on the measured wall clock time. This is not what we want because it adds a source of non-determinism to the unit tests. It also means, as we have recently seen in some tests in the eosio.contracts repository when used with an EOSIO dependency compiled in debug mode (and therefore operating slower), that it is possible to get theleeway_deadline_exception
which was expected to never happen in the unit tests.This PR sets the
billed_cpu_time_us
argument of both transaction pushing calls withinbase_tester::_produce_block
to use theDEFAULT_BILLED_CPU_TIME_US
which is of course greater than 0. It is also supposed to be no less than the minimum billable time (and it is greater than the default minimum billable time). But if a test changes the minimum billable time for the chain it is working with to something greater thanDEFAULT_BILLED_CPU_TIME_US
, or if the test needs control over the billed time for the individual transactions (unapplied and deferred) that are applied when producing a block, the test creator is currently expected to re-implementbase_tester::_produce_block
but also to modify it so that the desired billing times are individually specified. (Later improvements to thetester
library may provide a more convenient way to control this behavior.)Consensus Changes
API Changes
Documentation Additions