-
Notifications
You must be signed in to change notification settings - Fork 410
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
Contract authz - redesign #1077
Conversation
Great stuff. I think these limits and filters are a very good start. Important for me is that the protobuf schema is built to be extensible to possibly add options features later in a backwards compatible way. Not sure if we need some version field or such for this? But then we can keep from feature creep but allow for more power later |
Looking through this I'm unclear if it's possible to make a grant without either a call or coin limit which i think is important functionality to have. |
Thanks for the feedback @ethanfrey With the interfaces new functionality can be added easily. Can you elaborate on some of the advanced use cases, please?
A call limit of 2^64 is almost infinite. I have removed the infinite declarations to reduce complexity. Can you elaborate on your use case, please? |
This is a totally fair rationale, thank you for the explanation. |
First off, I think this currently solves the issues as requested in #803 (comment) perfectly. You can provide some account access to call "foo" and "bar" on address X as well as "baz" on address Y, right? |
My first two thoughts of an advanced use-cases would be:
I am not sure these have many real world use cases, and the second one definitely brings up a huge design issue to do safely and clearly and I would not consider this for v0.30 or even v0.31 Anyway, just some food for thought on where this might grow next year and glad there is an extension point for this |
Codecov Report
@@ Coverage Diff @@
## main #1077 +/- ##
==========================================
+ Coverage 59.22% 60.10% +0.88%
==========================================
Files 53 54 +1
Lines 6732 7061 +329
==========================================
+ Hits 3987 4244 +257
- Misses 2451 2516 +65
- Partials 294 301 +7
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent work! 🥇
* Add StoreAndInstantiateContract gov proposal * Add integration tests * Bump github.com/prometheus/client_golang from 1.13.0 to 1.14.0 Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.13.0 to 1.14.0. - [Release notes](https://github.com/prometheus/client_golang/releases) - [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md) - [Commits](prometheus/client_golang@v1.13.0...v1.14.0) --- updated-dependencies: - dependency-name: github.com/prometheus/client_golang dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Remove exposed functions * Add tests * Add Developer's guide and best practices (#1075) * Add Developer's guide and best practices * Fix comments * Change genesis preserving contract history (#1076) * preserve contract created date on genesis import and add query contract created date * add validate created * fix sims test app import export * add preserve contract history * Make proto-all only * Remove ResetFromGenesis * Add validation Co-authored-by: Alex Peters <alpe@users.noreply.github.com> * Return contract history updates * Bump github.com/spf13/viper from 1.13.0 to 1.14.0 (#1082) Bumps [github.com/spf13/viper](https://github.com/spf13/viper) from 1.13.0 to 1.14.0. - [Release notes](https://github.com/spf13/viper/releases) - [Commits](spf13/viper@v1.13.0...v1.14.0) --- updated-dependencies: - dependency-name: github.com/spf13/viper dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Revert "Bump github.com/spf13/viper from 1.13.0 to 1.14.0 (#1082)" This reverts commit cf81eb8. * Add cli and refactor code * Contract authz - redesign (#1077) * Add contract authz proto * Implement contract autorization * Register contract authz * Add contract-authz tests * Consume gas for contract authz * Add contract authz cli * Update cli usage * Model spike * Add max funds limit * Redesign authz model * Start e2e test * Full e2e test * Test filter and limits * Test accept * Fix description * No linter warning Co-authored-by: Giancarlos Salas <me@giansalex.dev> * Add StoreAndInstantiateContract gov proposal * Add integration tests * Remove exposed functions * Add tests * Add cli and refactor code * Fix comments Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: GNaD13 <89174180+GNaD13@users.noreply.github.com> Co-authored-by: Alex Peters <alpe@users.noreply.github.com> Co-authored-by: Giancarlos Salas <me@giansalex.dev>
* Add contract authz proto * Implement contract autorization * Register contract authz * Add contract-authz tests * Consume gas for contract authz * Add contract authz cli * Update cli usage * Model spike * Add max funds limit * Redesign authz model * Start e2e test * Full e2e test * Test filter and limits * Test accept * Fix description * No linter warning Co-authored-by: Giancarlos Salas <me@giansalex.dev>
* Add StoreAndInstantiateContract gov proposal * Add integration tests * Bump github.com/prometheus/client_golang from 1.13.0 to 1.14.0 Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.13.0 to 1.14.0. - [Release notes](https://github.com/prometheus/client_golang/releases) - [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md) - [Commits](prometheus/client_golang@v1.13.0...v1.14.0) --- updated-dependencies: - dependency-name: github.com/prometheus/client_golang dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Remove exposed functions * Add tests * Add Developer's guide and best practices (CosmWasm#1075) * Add Developer's guide and best practices * Fix comments * Change genesis preserving contract history (CosmWasm#1076) * preserve contract created date on genesis import and add query contract created date * add validate created * fix sims test app import export * add preserve contract history * Make proto-all only * Remove ResetFromGenesis * Add validation Co-authored-by: Alex Peters <alpe@users.noreply.github.com> * Return contract history updates * Bump github.com/spf13/viper from 1.13.0 to 1.14.0 (CosmWasm#1082) Bumps [github.com/spf13/viper](https://github.com/spf13/viper) from 1.13.0 to 1.14.0. - [Release notes](https://github.com/spf13/viper/releases) - [Commits](spf13/viper@v1.13.0...v1.14.0) --- updated-dependencies: - dependency-name: github.com/spf13/viper dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Revert "Bump github.com/spf13/viper from 1.13.0 to 1.14.0 (CosmWasm#1082)" This reverts commit cf81eb8. * Add cli and refactor code * Contract authz - redesign (CosmWasm#1077) * Add contract authz proto * Implement contract autorization * Register contract authz * Add contract-authz tests * Consume gas for contract authz * Add contract authz cli * Update cli usage * Model spike * Add max funds limit * Redesign authz model * Start e2e test * Full e2e test * Test filter and limits * Test accept * Fix description * No linter warning Co-authored-by: Giancarlos Salas <me@giansalex.dev> * Add StoreAndInstantiateContract gov proposal * Add integration tests * Remove exposed functions * Add tests * Add cli and refactor code * Fix comments Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: GNaD13 <89174180+GNaD13@users.noreply.github.com> Co-authored-by: Alex Peters <alpe@users.noreply.github.com> Co-authored-by: Giancarlos Salas <me@giansalex.dev>
* Add contract authz proto * Implement contract autorization * Register contract authz * Add contract-authz tests * Consume gas for contract authz * Add contract authz cli * Update cli usage * Model spike * Add max funds limit * Redesign authz model * Start e2e test * Full e2e test * Test filter and limits * Test accept * Fix description * No linter warning Co-authored-by: Giancarlos Salas <me@giansalex.dev>
* Add StoreAndInstantiateContract gov proposal * Add integration tests * Bump github.com/prometheus/client_golang from 1.13.0 to 1.14.0 Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.13.0 to 1.14.0. - [Release notes](https://github.com/prometheus/client_golang/releases) - [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md) - [Commits](prometheus/client_golang@v1.13.0...v1.14.0) --- updated-dependencies: - dependency-name: github.com/prometheus/client_golang dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Remove exposed functions * Add tests * Add Developer's guide and best practices (CosmWasm#1075) * Add Developer's guide and best practices * Fix comments * Change genesis preserving contract history (CosmWasm#1076) * preserve contract created date on genesis import and add query contract created date * add validate created * fix sims test app import export * add preserve contract history * Make proto-all only * Remove ResetFromGenesis * Add validation Co-authored-by: Alex Peters <alpe@users.noreply.github.com> * Return contract history updates * Bump github.com/spf13/viper from 1.13.0 to 1.14.0 (CosmWasm#1082) Bumps [github.com/spf13/viper](https://github.com/spf13/viper) from 1.13.0 to 1.14.0. - [Release notes](https://github.com/spf13/viper/releases) - [Commits](spf13/viper@v1.13.0...v1.14.0) --- updated-dependencies: - dependency-name: github.com/spf13/viper dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Revert "Bump github.com/spf13/viper from 1.13.0 to 1.14.0 (CosmWasm#1082)" This reverts commit cf81eb8. * Add cli and refactor code * Contract authz - redesign (CosmWasm#1077) * Add contract authz proto * Implement contract autorization * Register contract authz * Add contract-authz tests * Consume gas for contract authz * Add contract authz cli * Update cli usage * Model spike * Add max funds limit * Redesign authz model * Start e2e test * Full e2e test * Test filter and limits * Test accept * Fix description * No linter warning Co-authored-by: Giancarlos Salas <me@giansalex.dev> * Add StoreAndInstantiateContract gov proposal * Add integration tests * Remove exposed functions * Add tests * Add cli and refactor code * Fix comments Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: GNaD13 <89174180+GNaD13@users.noreply.github.com> Co-authored-by: Alex Peters <alpe@users.noreply.github.com> Co-authored-by: Giancarlos Salas <me@giansalex.dev>
* Add contract authz proto * Implement contract autorization * Register contract authz * Add contract-authz tests * Consume gas for contract authz * Add contract authz cli * Update cli usage * Model spike * Add max funds limit * Redesign authz model * Start e2e test * Full e2e test * Test filter and limits * Test accept * Fix description * No linter warning Co-authored-by: Giancarlos Salas <me@giansalex.dev>
* Add StoreAndInstantiateContract gov proposal * Add integration tests * Bump github.com/prometheus/client_golang from 1.13.0 to 1.14.0 Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.13.0 to 1.14.0. - [Release notes](https://github.com/prometheus/client_golang/releases) - [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md) - [Commits](prometheus/client_golang@v1.13.0...v1.14.0) --- updated-dependencies: - dependency-name: github.com/prometheus/client_golang dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Remove exposed functions * Add tests * Add Developer's guide and best practices (CosmWasm#1075) * Add Developer's guide and best practices * Fix comments * Change genesis preserving contract history (CosmWasm#1076) * preserve contract created date on genesis import and add query contract created date * add validate created * fix sims test app import export * add preserve contract history * Make proto-all only * Remove ResetFromGenesis * Add validation Co-authored-by: Alex Peters <alpe@users.noreply.github.com> * Return contract history updates * Bump github.com/spf13/viper from 1.13.0 to 1.14.0 (CosmWasm#1082) Bumps [github.com/spf13/viper](https://github.com/spf13/viper) from 1.13.0 to 1.14.0. - [Release notes](https://github.com/spf13/viper/releases) - [Commits](spf13/viper@v1.13.0...v1.14.0) --- updated-dependencies: - dependency-name: github.com/spf13/viper dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Revert "Bump github.com/spf13/viper from 1.13.0 to 1.14.0 (CosmWasm#1082)" This reverts commit cf81eb8. * Add cli and refactor code * Contract authz - redesign (CosmWasm#1077) * Add contract authz proto * Implement contract autorization * Register contract authz * Add contract-authz tests * Consume gas for contract authz * Add contract authz cli * Update cli usage * Model spike * Add max funds limit * Redesign authz model * Start e2e test * Full e2e test * Test filter and limits * Test accept * Fix description * No linter warning Co-authored-by: Giancarlos Salas <me@giansalex.dev> * Add StoreAndInstantiateContract gov proposal * Add integration tests * Remove exposed functions * Add tests * Add cli and refactor code * Fix comments Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: GNaD13 <89174180+GNaD13@users.noreply.github.com> Co-authored-by: Alex Peters <alpe@users.noreply.github.com> Co-authored-by: Giancarlos Salas <me@giansalex.dev>
Part of #803 - server side
Based on the great work started by @giansalex in #966
This PR includes a new and more extendable model than #978 . A contract execution or migration grant has:
# Supported "limits" - that are stateful and restrict the number of executions
# Supported "filters" - that check if the submitted message is allowed
Not implemented, to discuss