Skip to content
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

Merged
merged 1 commit into from
Jul 9, 2019

Conversation

arhag
Copy link
Contributor

@arhag arhag commented Jul 9, 2019

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 the billed_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 the leeway_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 within base_tester::_produce_block to use the DEFAULT_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 than DEFAULT_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-implement base_tester::_produce_block but also to modify it so that the desired billing times are individually specified. (Later improvements to the tester library may provide a more convenient way to control this behavior.)

Consensus Changes

  • Consensus Changes

API Changes

  • API Changes

Documentation Additions

  • Documentation Additions

@arhag arhag merged commit d44d836 into develop Jul 9, 2019
@arhag arhag deleted the tester-explicit-billing-fix-develop branch July 9, 2019 18:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants