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

authenticated calls using arbitrary cpi [poc and draft] #38

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

skosito
Copy link
Contributor

@skosito skosito commented Oct 4, 2024

Still just poc - please check comments with NOTE: for discussion questions and findings.

@codecov-commenter
Copy link

codecov-commenter commented Oct 4, 2024

Codecov Report

Attention: Patch coverage is 10.14493% with 62 lines in your changes missing coverage. Please review.

Project coverage is 8.94%. Comparing base (98bd5c3) to head (9781206).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
programs/protocol-contracts-solana/src/lib.rs 1.92% 51 Missing ⚠️
programs/callable-test/src/lib.rs 33.33% 6 Missing ⚠️
programs/callable-test-2/src/lib.rs 37.50% 5 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##            main     #38      +/-   ##
========================================
+ Coverage   8.60%   8.94%   +0.33%     
========================================
  Files          1       3       +2     
  Lines        244     313      +69     
========================================
+ Hits          21      28       +7     
- Misses       223     285      +62     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

.pack();

// NOTE: calling function in other program without passing accounts seems very limitting in what can be done
// every account that instruction interacts with has to be predetermined and set before the call, and various callable contracts might have different behavior and need different accounts
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think it is a set of data that could be potentially represented during the call on ZetaChain using a standard?

A bit like the idea of the Bitcoin memo standard.

User provide a generate bytes input, following a standard, this input is decoded to represent the full call on Solana.
This could be a generic field that we would need to other chain, it seems there will be lot of considerations to have as well for TON smart contract calls

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was not refering to data, but accounts. Accounts that solana programs interact with have to be determined before the call, that is how state is changed with stateless solana programs - state is maintained in accounts that program interacts with, not the program itself (difference with solidity where smart contracts contain state as well). Also important, program can not access those accounts when it executes transaction, the only way is that account need to be passed with instruction, basically preloaded before execution happens.

For example, if someone wants to have on_call(data) in their solana program, i would expect they want to somehow store that data, or modify existing data etc, but in order for program to access any state, account containing the state has to be sent inside instruction - in case of making generic calls to on_call not sure how we can pass any account there, maybe something generic, but not sure.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also important, program can not access those accounts when it executes transaction, the only way is that account need to be passed with instruction, basically preloaded before execution happens.

Yes, but this is a piece of information that could be passed in the gateway on ZetaChain?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe it would have to be in call to gateway execute function already and then passed to on_call. But still not sure what we should send there.
@brewmaster012 what do you think about this, could you please check when you get a chance?

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.

3 participants