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

Interface refactoring #162

Merged
merged 21 commits into from
Mar 29, 2024
Merged

Interface refactoring #162

merged 21 commits into from
Mar 29, 2024

Conversation

dr-orlovsky
Copy link
Member

@dr-orlovsky dr-orlovsky commented Mar 12, 2024

  • Remove state aliases from operations
  • Increase iface version
  • Use lowercase names for operations
  • Refactor errors: take error variant id from pre-defined register
  • Move timestamp into genesis
  • Add issuer identity and certificate to genesis
  • Refactor asset terms (ricardian contract, attachment)
  • Refactor asset name (flatten it)
  • Question the need in RGB25 (it is needed)
  • Add explicit media files to the mediakit in supplement
  • Add signature for the supplement
  • RGB20 has isufficientReserves but doesn't provide reserves state (it does, in metadata)
  • Create iface compiler verifying iface consistency
  • Export interfaces into Contractum code
  • Add support for interface inheritance

@dr-orlovsky dr-orlovsky marked this pull request as ready for review March 24, 2024 15:01
@dr-orlovsky dr-orlovsky requested a review from zoedberg March 24, 2024 15:01
@dr-orlovsky dr-orlovsky added this to the v0.11.0 milestone Mar 24, 2024
@dr-orlovsky
Copy link
Member Author

@zoedberg can I merge this? It is required for #151

I mean I understand that it's hard to review; I rather expect you to check the checklist and ask if you see any red flags there. If not - I will merge and we will debug over time all things which may be wrong here

Copy link
Contributor

@zoedberg zoedberg left a comment

Choose a reason for hiding this comment

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

This doesn't compile in rgb-lib because it breaks compilation of rgb-schemata. I don't think we should merge this without first having a PR for rgb-schemata.

@dr-orlovsky
Copy link
Member Author

@zoedberg right, fully forgot about that. Here it is: RGB-WG/rgb-schemata#36

I will also work on the RGB wallet changes

Copy link
Contributor

@zoedberg zoedberg left a comment

Choose a reason for hiding this comment

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

I've updated rgb-lib to try the PRs refactoring the interfaces (#162, RGB-WG/rgb-schemata#36 and RGB-WG/rgb#154) but when doing:

let iface_nia = Rgb20::from(contract_iface);
let terms = iface_nia.contract_terms();

I encounter the following panic:

thread 'wallet::test::send::success' panicked at /home/zoe/.cargo/registry/src/index.crates.io-6f17d22bba15001f/strict_types-2.7.0-beta.2/src/value/val.rs:399:32:
StrictVal struct doesn't have field named terms

I've found a fix for this, see the provided suggestions.

After fixing this I've found another issue: before I was retrieving the asset timestamp with contract.global("created"), but I see this PR removed the created global state. Why this has been removed and how can we now retrieve this information?

src/stl/specs.rs Outdated Show resolved Hide resolved
src/stl/specs.rs Outdated Show resolved Hide resolved
@dr-orlovsky
Copy link
Member Author

Thanks for finding a fix.

Regarding the created timestamp, it is moved into the genesis itself, as was proposed in RCP-240227A and discussed in Telegram.

If you need to have an access to it, you can just read timestamp property on genesis: https://github.com/RGB-WG/rgb-core/blob/e04cfffe989642eb03db4d065c6f53c1d6d218ba/src/contract/operations.rs#L317

Copy link
Contributor

@zoedberg zoedberg left a comment

Choose a reason for hiding this comment

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

Ok, thanks, sorry I missed that. I've updated rgb-lib timestamp extraction code and now all tests are passing. ACK 00f1983

@dr-orlovsky dr-orlovsky merged commit 5d5d37a into master Mar 29, 2024
16 of 19 checks passed
@dr-orlovsky dr-orlovsky deleted the iface branch September 5, 2024 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactoring Code refactoring
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Beneficiary vs assetOwner field name for transitions
2 participants