Implement SMART_ACTION_INVOKER_CAST and SMART_ACTION_CROSS_CAST in the database and code