eos icon indicating copy to clipboard operation
eos copied to clipboard

Add handlers for native actions in system contract

Open zorba80 opened this issue 8 years ago • 7 comments

zorba80 avatar Mar 29 '18 13:03 zorba80

Can we have ATC for this?

andriantolie avatar Apr 03 '18 02:04 andriantolie

@andriantolie

Verify that native action handlers in system contract are being called properly.

gleehokie avatar Apr 03 '18 03:04 gleehokie

For now, the handlers don't do anything. The way I verified that they are being called properly is by including print statements.

zorba80 avatar Apr 03 '18 13:04 zorba80

@gleehokie actually, (assuming that I am correct that this is referring to the apply method in eosio.system.hpp) it is not complete, it is not processing the currency::create action. But shouldn't this task really be to come up with a way in code (either in the contract or with a test) to ensure that this remains to be the case? We can verify right now and someone can commit a new message and it be insufficient immediately.

brianjohnson5972 avatar Apr 03 '18 16:04 brianjohnson5972

@brianjohnson5972 @zorba80 I certainly like having automatic ways to handle the known case where the addition of new action/message will create untested conditions. I think this is what @brianjohnson5972 is suggesting.

gleehokie avatar Apr 03 '18 18:04 gleehokie

@zorba80 and I talked, here's the ATC:

  1. Verify that all native actions are routed to the system contract. The current system contract has native action handlers in the system contract that are empty functions. The system contract chooses what native actions to handle, if no handler is present the action is ignored.
  2. A suggestion for how to do this is to modify eos/contracts/eosio.system/native.hpp and add a print statement to each of the handlers which are the on() functions, for example this line is one of them: https://github.com/EOSIO/eos/blob/2cb8030554d1e9145f44785b9a564cd6dd1e1cab/contracts/eosio.system/native.hpp#L98 This will verify that all of the native actions that have handlers in the system contract are being handled.
  3. At a later date we can write a more complex test case that generates code to handle and verify all of the native actions by pulling the list from the code.

gleehokie avatar Apr 03 '18 22:04 gleehokie

ATC Passes.

I modified the handler inside native.hpp to print a statement. For postrecovery/ passrecovery/ vetorecovery/ onerror, I modified recovery_tests to be able to reach the desired action handler. For unlink_auth and delete_auth, auth_tests is modified. Running chain_test with --verbose, I can see the statement printed by native handler is called for every action.

This branch is used to test https://github.com/andriantolie/eos/tree/1938-QA

andriantolie avatar Apr 04 '18 06:04 andriantolie