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

feat!: new account constructor for custom access rules #1138

Merged
merged 6 commits into from
Sep 13, 2024

Conversation

mrnaveira
Copy link
Collaborator

@mrnaveira mrnaveira commented Sep 11, 2024

Description

  • Updated the account template constructor to allow custom owner and access rules
  • Updated the CreateAccount instruction type
  • Updated the transaction builder for the new account creation fields
  • Updated the transaction processor to use the new fields
  • Updated the protobuf definitions with the new fields in the account creation instruction type

Motivation and Context

When creating accounts we want to be able to specify custom access rules.

This PR refactors the account template constructor (create function) to allow specifying the following fields:

  • public_key_token: mandatory field. Needed always for component creation. If the owner_rule is not set, it will be used to set up the default owner rule
  • owner_rule: optional field. Used to specify custom logic for the account component ownership (e.g. update the access rules after creation)
  • access_rules: optional field. Used to specify custom access control rules over the account component methods
  • bucket: optional field. Initial funds of the account

How Has This Been Tested?

  • New unit test for accounts: custom_access_rules
  • Manually spawning a network with tari_spawn and checking it works
  • Existing unit and integration tests pass

What process can a PR reviewer use to test or verify this change?

See previous section

Breaking Changes

  • None
  • Requires data directory to be deleted
  • Other - Requires network reset as account creation (including the related instruction type) has changed

Copy link

github-actions bot commented Sep 11, 2024

Test Results (CI)

562 tests  +1   562 ✅ +1   2h 11m 9s ⏱️ + 20m 11s
 61 suites ±0     0 💤 ±0 
  2 files   ±0     0 ❌ ±0 

Results for commit 4157d5c. ± Comparison against base commit 552b7ed.

♻️ This comment has been updated with latest results.

@mrnaveira mrnaveira marked this pull request as ready for review September 12, 2024 16:42
Copy link
Member

@sdbondi sdbondi left a comment

Choose a reason for hiding this comment

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

Nice LGTM

@sdbondi sdbondi added this pull request to the merge queue Sep 13, 2024
Merged via the queue into tari-project:development with commit 5431162 Sep 13, 2024
12 checks passed
sdbondi added a commit to sdbondi/tari-dan that referenced this pull request Sep 16, 2024
* development:
  fix(consensus)!: read-only resource + other fixes (tari-project#1134)
  test(cucumber): add concurrent wallet daemon call (tari-project#1140)
  feat!: new account constructor for custom access rules (tari-project#1138)
  test(cucumber): nft and fungible features (tari-project#1137)
  test(cucumber): enable counter template scenario (tari-project#1136)
  feat(consensus)!: add sidechain id in the genesis block (tari-project#1135)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants