Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check mempool pending account resources prior to applying transaction #802

Merged
merged 1 commit into from
Jan 3, 2023

Conversation

sgerbino
Copy link
Member

@sgerbino sgerbino commented Dec 22, 2022

Resolves #801.

Brief description

If the mempool would reject the transaction due to insufficient pending account resources throw an exception rather than processing the transaction.

Checklist

  • I have built this pull request locally
  • I have ran the unit tests locally
  • I have manually tested this pull request
  • I have reviewed my pull request
  • I have added any relevant tests

Demonstration

ctest -j9
Test project /Users/sgerbino/Projects/koinos-chain/build/tests
      Start  1: koinos_tests-controller_tests/submission_tests
      Start  2: koinos_tests-controller_tests/block_irreversibility
      Start  3: koinos_tests-controller_tests/fork_heads
      Start  4: koinos_tests-controller_tests/read_contract_tests
      Start  5: koinos_tests-controller_tests/transaction_reversion_test
      Start  6: koinos_tests-controller_tests/receipt_test
      Start  7: koinos_tests-controller_tests/system_call_override_test
      Start  8: koinos_tests-stack_tests/simple_user_contract
      Start  9: koinos_tests-stack_tests/syscall_from_user
 1/43 Test  #1: koinos_tests-controller_tests/submission_tests ....................   Passed    1.86 sec
      Start 10: koinos_tests-stack_tests/user_from_user
 2/43 Test  #8: koinos_tests-stack_tests/simple_user_contract .....................   Passed    1.91 sec
      Start 11: koinos_tests-stack_tests/syscall_override_from_thunk
 3/43 Test  #4: koinos_tests-controller_tests/read_contract_tests .................   Passed    1.95 sec
      Start 12: koinos_tests-stack_tests/syscall_override_from_syscall_override
 4/43 Test  #7: koinos_tests-controller_tests/system_call_override_test ...........   Passed    1.95 sec
      Start 13: koinos_tests-stack_tests/system_contract_from_syscall_override
 5/43 Test  #9: koinos_tests-stack_tests/syscall_from_user ........................   Passed    1.98 sec
      Start 14: koinos_tests-thunk_tests/get_transaction_field
 6/43 Test #10: koinos_tests-stack_tests/user_from_user ...........................   Passed    0.31 sec
      Start 15: koinos_tests-thunk_tests/get_block_field
 7/43 Test #14: koinos_tests-thunk_tests/get_transaction_field ....................   Passed    0.14 sec
      Start 16: koinos_tests-thunk_tests/get_operation
 8/43 Test  #6: koinos_tests-controller_tests/receipt_test ........................   Passed    2.19 sec
      Start 17: koinos_tests-thunk_tests/db_crud
 9/43 Test #16: koinos_tests-thunk_tests/get_operation ............................   Passed    0.12 sec
      Start 18: koinos_tests-thunk_tests/db_permissions
10/43 Test #15: koinos_tests-thunk_tests/get_block_field ..........................   Passed    0.14 sec
      Start 19: koinos_tests-thunk_tests/contract_tests
11/43 Test #11: koinos_tests-stack_tests/syscall_override_from_thunk ..............   Passed    0.36 sec
      Start 20: koinos_tests-thunk_tests/override_tests
12/43 Test #17: koinos_tests-thunk_tests/db_crud ..................................   Passed    0.13 sec
      Start 21: koinos_tests-thunk_tests/thunk_test
13/43 Test #18: koinos_tests-thunk_tests/db_permissions ...........................   Passed    0.13 sec
      Start 22: koinos_tests-thunk_tests/system_call_test
14/43 Test #21: koinos_tests-thunk_tests/thunk_test ...............................   Passed    0.12 sec
      Start 23: koinos_tests-thunk_tests/get_head_info_thunk_test
15/43 Test #12: koinos_tests-stack_tests/syscall_override_from_syscall_override ...   Passed    0.54 sec
      Start 24: koinos_tests-thunk_tests/hash_thunk_test
16/43 Test #13: koinos_tests-stack_tests/system_contract_from_syscall_override ....   Passed    0.51 sec
      Start 25: koinos_tests-thunk_tests/privileged_calls
17/43 Test #22: koinos_tests-thunk_tests/system_call_test .........................   Passed    0.14 sec
      Start 26: koinos_tests-thunk_tests/last_irreversible_block_test
18/43 Test #23: koinos_tests-thunk_tests/get_head_info_thunk_test .................   Passed    0.13 sec
      Start 27: koinos_tests-thunk_tests/stack_tests
19/43 Test #19: koinos_tests-thunk_tests/contract_tests ...........................   Passed    0.32 sec
      Start 28: koinos_tests-thunk_tests/check_authority
20/43 Test #20: koinos_tests-thunk_tests/override_tests ...........................   Passed    0.34 sec
      Start 29: koinos_tests-thunk_tests/transaction_nonce_test
21/43 Test #25: koinos_tests-thunk_tests/privileged_calls .........................   Passed    0.17 sec
      Start 30: koinos_tests-thunk_tests/get_contract_id_test
22/43 Test #26: koinos_tests-thunk_tests/last_irreversible_block_test .............   Passed    0.13 sec
      Start 31: koinos_tests-thunk_tests/token_tests
23/43 Test #24: koinos_tests-thunk_tests/hash_thunk_test ..........................   Passed    0.26 sec
      Start 32: koinos_tests-thunk_tests/call_contract_operation_failure
24/43 Test  #2: koinos_tests-controller_tests/block_irreversibility ...............   Passed    2.77 sec
      Start 33: koinos_tests-thunk_tests/tick_limit
25/43 Test #30: koinos_tests-thunk_tests/get_contract_id_test .....................   Passed    0.12 sec
      Start 34: koinos_tests-thunk_tests/disk_usage
26/43 Test #28: koinos_tests-thunk_tests/check_authority ..........................   Passed    0.20 sec
      Start 35: koinos_tests-thunk_tests/transaction_reversion
27/43 Test #29: koinos_tests-thunk_tests/transaction_nonce_test ...................   Passed    0.15 sec
      Start 36: koinos_tests-thunk_tests/authorize_tests
28/43 Test #27: koinos_tests-thunk_tests/stack_tests ..............................   Passed    0.22 sec
      Start 37: koinos_tests-thunk_tests/get_chain_id
29/43 Test #34: koinos_tests-thunk_tests/disk_usage ...............................   Passed    0.14 sec
      Start 38: koinos_tests-thunk_tests/system_resources
30/43 Test #35: koinos_tests-thunk_tests/transaction_reversion ....................   Passed    0.13 sec
      Start 39: koinos_tests-thunk_tests/system_rc
31/43 Test #37: koinos_tests-thunk_tests/get_chain_id .............................   Passed    0.12 sec
      Start 40: koinos_tests-thunk_tests/contract_exit
32/43 Test #38: koinos_tests-thunk_tests/system_resources .........................   Passed    0.12 sec
      Start 41: koinos_tests-thunk_tests/syscall_override_return
33/43 Test #33: koinos_tests-thunk_tests/tick_limit ...............................   Passed    0.28 sec
      Start 42: koinos_tests-thunk_tests/thunk_time
34/43 Test #32: koinos_tests-thunk_tests/call_contract_operation_failure ..........   Passed    0.39 sec
      Start 43: koinos_tests-thunk_tests/null_bytes_written_test
35/43 Test  #5: koinos_tests-controller_tests/transaction_reversion_test ..........   Passed    3.15 sec
36/43 Test #40: koinos_tests-thunk_tests/contract_exit ............................   Passed    0.25 sec
37/43 Test #31: koinos_tests-thunk_tests/token_tests ..............................   Passed    0.57 sec
38/43 Test #41: koinos_tests-thunk_tests/syscall_override_return ..................   Passed    0.19 sec
39/43 Test  #3: koinos_tests-controller_tests/fork_heads ..........................   Passed    3.25 sec
40/43 Test #43: koinos_tests-thunk_tests/null_bytes_written_test ..................   Passed    0.14 sec
41/43 Test #39: koinos_tests-thunk_tests/system_rc ................................   Passed    0.35 sec
42/43 Test #36: koinos_tests-thunk_tests/authorize_tests ..........................   Passed    0.61 sec
43/43 Test #42: koinos_tests-thunk_tests/thunk_time ...............................   Passed    2.20 sec

100% tests passed, 0 tests failed out of 43

Total Test time (real) =   5.30 sec

@mvandeberg mvandeberg merged commit b6df29b into master Jan 3, 2023
@mvandeberg mvandeberg deleted the 801-check-pending branch January 3, 2023 22:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE]: check_pending_account_resources prior to applying a transaction
2 participants