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

Difficulty understanding Object parameter types in the host #503

Closed
sisuresh opened this issue Sep 29, 2022 · 3 comments
Closed

Difficulty understanding Object parameter types in the host #503

sisuresh opened this issue Sep 29, 2022 · 3 comments

Comments

@sisuresh
Copy link
Contributor

For example, it's not clear if the account_id below contains a byte vector or xdr::AccountId. We should add comments for every Object parameter.

pub(crate) fn transfer_trustline_balance(
      &self,
      account_id: Object,
      asset_code: Object,
      issuer: Object,
      amount: i64,
  )
@leighmcculloch
Copy link
Member

We should avoid passing around Objects and RawVals as much as possible anywhere where their type should be known or is expected to be trusted. As much as possible they should only exist at the boundary between the guest and the host.

@leighmcculloch
Copy link
Member

The transfer_trustline_balance function is an interesting candidate. The only code calling that function is the token contract itself, and so it is really questionable to me why it would even be using Object as a type. At the moment the function is called the type of account_id should be concretely known and validated, so there's no reason we should passing around generic object handles anywhere other than the boundary between the guest and the host.

@graydon
Copy link
Contributor

graydon commented Feb 9, 2023

I think this should get less confusing the more specific types we have in XDR, both with the work happening in #679 and anything following from #599 wrapped up. I'm going to close for now but please reopen if this reoccurs as a problem.

@graydon graydon closed this as completed Feb 9, 2023
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

No branches or pull requests

3 participants