Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Exit transaction early when insufficient account cpu - 2.0 #8638

Merged
merged 26 commits into from
Feb 22, 2020

Conversation

heifner
Copy link
Contributor

@heifner heifner commented Feb 13, 2020

Change Description

  • Check to make sure account has enough cpu to execute already executed transactions. Do not attempt to execute if not enough account cpu.
  • Add more explicit handling of greylisted accounts to avoid greylisting during validation.

Consensus Changes

  • Consensus Changes

API Changes

  • API Changes

Documentation Additions

  • Documentation Additions

@heifner heifner requested a review from arhag February 13, 2020 00:26
…g with tx_cpu_usage_exceeded so correct exception thrown in early eval of previously billed cpu
…on. Rename failure_is_subjective to block_is_exhausted to better reflect what the function does.
@@ -172,6 +172,11 @@ namespace eosio { namespace chain {
deadline_exception_code = billing_timer_exception_code;
}

if( !explicit_billed_cpu_time ) {
// if account no longer has enough cpu to exec trx, don't try
validate_account_cpu_usage( billed_cpu_time_us, account_cpu_limit );
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't seem to take leeway or the block cpu limit into account.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch. @arhag and I discussed that and came to the conclusion that it should be fine that it doesn't take leeway into account.

Copy link
Contributor

Choose a reason for hiding this comment

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

Won't that effectively make leeway useless?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This only comes into play on unapplied transactions. So if not applied before then leeway will be in effect. Leeway will just not be used for unapplied transactions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we start relaying the billed_cpu_time over the p2p network then we will have to factor in leeway somehow.

libraries/chain/controller.cpp Outdated Show resolved Hide resolved
libraries/chain/controller.cpp Show resolved Hide resolved
libraries/testing/tester.cpp Outdated Show resolved Hide resolved
plugins/producer_plugin/producer_plugin.cpp Show resolved Hide resolved
unittests/api_tests.cpp Outdated Show resolved Hide resolved
unittests/delay_tests.cpp Outdated Show resolved Hide resolved
libraries/chain/transaction_context.cpp Outdated Show resolved Hide resolved
unittests/wasm_tests.cpp Outdated Show resolved Hide resolved
unittests/wasm_tests.cpp Outdated Show resolved Hide resolved
@heifner heifner requested a review from arhag February 17, 2020 21:27
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