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

[FEATURE]: provide call_args in call_data #819

Open
1 task done
roaminro opened this issue Apr 26, 2023 · 11 comments
Open
1 task done

[FEATURE]: provide call_args in call_data #819

roaminro opened this issue Apr 26, 2023 · 11 comments
Labels
enhancement New feature or request task A technical work item

Comments

@roaminro
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

New feature

As a smart contract developer I would like to be able to retrieve, from the authorize entry point, the arguments that were provded in a contract call.

Currently, authorize_arguments.call only provides contract_id and entry_point and relies on the data field to let smart contracts provide additional data. This means that if a smart contract call check_authority and does not provide the contract call args in data then authorize is not able to verify the contract call arguments.

The idea is to add a new field to call_data and provide the contract call args in this new field:

message call_data {
   bytes contract_id = 1 [(btype) = ADDRESS];
   uint32 entry_point = 2;
   bytes caller = 3;
   bytes data = 4;
   bytes call_args = 5;
}

Anything else?

authorize_arguments message definition

call_data message definition

@roaminro roaminro added the enhancement New feature or request label Apr 26, 2023
@roaminro roaminro changed the title [FEATURE]: provide args in call_data [FEATURE]: provide call_args in call_data Apr 26, 2023
@koinos-ci
Copy link

This issue is stale because it has been open for 30 days with no activity.

@roaminro
Copy link
Author

not stale

@koinos-ci koinos-ci removed the stale label May 30, 2023
@koinos-ci
Copy link

This issue is stale because it has been open for 30 days with no activity.

@sgerbino sgerbino removed the stale label Jun 29, 2023
@koinos-ci
Copy link

This issue is stale because it has been open for 30 days with no activity.

@sgerbino sgerbino removed the stale label Jul 30, 2023
@koinos-ci
Copy link

This issue is stale because it has been open for 30 days with no activity.

@mvandeberg
Copy link
Member

I suppose this issue comes down to the following question. Should the call data be a requirement or a standard?

Let's consider the following scenarios. What if the calling contract lies or doesn't follow the standard, what should authorize return?

Well, it could just refuse to authorize if the data is not expected.

And if the data is incorrect, what is the worst that could happen? You would authorize a call to a contract that was unintended. But what harm could that do? That contract cannot use that authorization to take tokens from you because the token contracts will also check for authority.

The worst that can happen is that a dumb contract gets your authorization to do dumb contract things limited to the dumb contract's space.

I understand the motivation for the proposal, I do not think it adds any significant value. I am happy to continue the discussion.

@koinos-ci koinos-ci removed the stale label Aug 31, 2023
@roaminro
Copy link
Author

I feel like if we can provide the information in a trustless way then we should do it. Also, it would probably save Mana doing so since you would not be passing the arguments around from the contracts.

@koinos-ci
Copy link

This issue is stale because it has been open for 30 days with no activity.

@koinos-ci koinos-ci added the stale label Oct 1, 2023
@sgerbino sgerbino removed the stale label Oct 1, 2023
@mvandeberg
Copy link
Member

mvandeberg commented Oct 2, 2023

Making this change would require a hardfork as it changes how the framework behaves. So we need to decide if it is worth the pain of a hardfork to add this or if making it a part of an application standard makes more sense given the ease of implementation.

Note: We cannot simply add the behavior in a contract implemented system call because the contract does not have access to the full call stack that would be required for the implementation.

@roaminro
Copy link
Author

roaminro commented Oct 6, 2023

I guess the application standard should be good enough for now, maybe we can revisit this item if/whenever a hardfork is planned one day.

Should I close this issue for now? Is there a place we should use to "save" items that could be part of a hardfork later?

@koinos-ci
Copy link

This issue is stale because it has been open for 30 days with no activity.

@koinos-ci koinos-ci added the stale label Nov 6, 2023
@mvandeberg mvandeberg added task A technical work item and removed stale labels Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request task A technical work item
Projects
None yet
Development

No branches or pull requests

4 participants