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]: Add system call to read contract metadata #806

Open
1 task done
joticajulian opened this issue Jan 12, 2023 · 4 comments
Open
1 task done

[FEATURE]: Add system call to read contract metadata #806

joticajulian opened this issue Jan 12, 2023 · 4 comments
Labels
enhancement New feature or request task A technical work item

Comments

@joticajulian
Copy link
Contributor

joticajulian commented Jan 12, 2023

Is there an existing issue for this?

  • I have searched the existing issues

New feature

As a smart contract developer I would like to have a system call to read contract metadata (authorizations flags, and bytecode).
Use case example: Fogata.
In Fogata we have a contract to submit and approve new mining pools. The new pools must upload a valid fogata contract. However, the approval needs to be done by a centralized party because there is no way to read the bytecode from the new pools in a decentralized way.

Anything else?

No response

@joticajulian joticajulian added the enhancement New feature or request label Jan 12, 2023
@mvandeberg
Copy link
Member

mvandeberg commented Jan 12, 2023

I don't have any problems with this living in Chain, but it could also live in Contract Meta Store.

@roaminro
Copy link

@joticajulian you could also get around that by implementing a function in Fogata that is called to register a contract, here's what you could do in this function:

  • get all the operations included in the current transaction (System.getTransactionField('operations'))
  • check that there are only 2 operations:
    • 1st operation is upload_contract:
      • check that it has the different authorizes overriden the way you want
      • check the bytecode's hash
    • 2nd operation is the operation that called your register contract in the first place

This should be enough to validate that the contract uploaded is what you expect it to be (although it doesn't solve the other issue you mentionned regarding the storage)

@koinos-ci
Copy link

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

@mvandeberg mvandeberg added task A technical work item stale and removed stale task A technical work item labels Mar 3, 2023
@mvandeberg
Copy link
Member

This is going to need governance approval.

A tentative proposition:

Handle this upgrade in two phases. Phase one implements it as a contract to provide the behavior in the near term. Phase two is providing an optimized thunk implementation to keep mana costs low and provide the thunk at genesis in the framework.

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