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

Add caller field to the AccountUpdate #1817

Open
dfstio opened this issue Sep 11, 2024 · 0 comments
Open

Add caller field to the AccountUpdate #1817

dfstio opened this issue Sep 11, 2024 · 0 comments

Comments

@dfstio
Copy link

dfstio commented Sep 11, 2024

  • In Ethereum, there is msg.sender that allows to get the information about the caller of the method. If contract A calls contract B, then B knows that the caller is A. We cannot get it in SmartContract, although there is an indirect way described in https://github.com/o1-labs/o1js/blob/main/src/examples/zkapps/joint-update.ts that require several AccountUpdates to be added to the tx and does not work with token accounts due to the limit of having max 5 AccountUpdates with proof authorization:
    https://discord.com/channels/484437221055922177/1282303057526263879
  • In gsn.org, there is msgSender() that allows contract B also to get the address of the user who initiated and signed the transaction. We can get it in SmartContract by using this.sender.getAndRequireSignatureV2()

Proposal:

  • add to each AccountUpdate that is being created for SmartContract method call the field caller (this.self.caller) that will contain the address and tokenId of the caller of a method - feePayer in case the method is called inside Mina.transaction and calling contract address in case it is called by another SmartContract
  • add the possibility to get inside the SmartContract the verification key hash of the account {publicKey, tokenId} to enable the SmartContract to do different actions depending on who called the method (account.verificationKey.get()).
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

1 participant