-
Notifications
You must be signed in to change notification settings - Fork 10
Introduce GlobalStateCS to directory node & introduce blacklist node minting policy #87
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
Conversation
| pvalidateConditions [pelem # mintingLogicCred # invokedScripts] | ||
| ) | ||
|
|
||
| -- TODO: |
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.
Will this be part of this PR?
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.
Yes, but before implementing it I wanted to discuss with you and the others to see if this is reasonable. Basically, the issue is because the idea is that all programmable tokens will be minted with this same issuance script with only the parameter being different, and the parameter is the credential associated with a withdraw-zero script that contains the logic for minting that specific programmable token, the withdraw-zero script needs to know which minted token it is responsible for validating, but because the issuance script is parameterized by the withdraw-zero script, the withdraw-zero script cannot be parameterized by the issuance script, so it needs another way to figure out which minting policy it is responsible for. This approach uses the redeemer of the issuance script to provide that information to the minting logic script, another approach would be to provide the minting logic withdraw-zero script in the directory node so that the withdraw-zero script just needs the directory node as a reference input to know what policy id it is validating against.
| prefixScriptBytes :: Term s PByteString | ||
| prefixScriptBytes = phexByteStr "deadbeef" | ||
|
|
||
| _pisProgrammableTokenRegistration :: Term s PCurrencySymbol -> Term s PByteString -> Term s (PValue 'Sorted 'NonZero) -> Term s PBool |
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.
Is this going to be used for anything?
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.
Yes, this will be used to ensure that only programmable tokens can be inserted into the directory. It enforces this via parameter validation, it validates that the inserted policy id is indeed an instance of the issuance script (and thus guarantees that the token can never be minted anywhere outside the programmableLogicBase script). I just need to add some tests to make sure parameter validation works correctly for all cases (because this trick relies on manipulation of the underlying script cbor hex, which is very finnicky with byte alignment etc.
| pdeserializeCurrencySymbol :: Term s (PAsData PCurrencySymbol) -> Term s (PAsData PCurrencySymbol) | ||
| pdeserializeCurrencySymbol term = | ||
| plet (pasByteStr # pforgetData term) $ \bstr -> | ||
| pif (plengthBS # bstr #<= 28) |
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.
I thought this would have to be #== 28 for a currency symbol?
(Twice in this file)
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.
The empty string is also a valid currency symbol.
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.
For Ada, right?
Ok, is there any scenario where it would be possible to craft a string of size 13, say? And does this break anything?
|
I'm happy with the changes. The conflicts are due to the compiled scripts being moved by the previous PR (#77 ). I'll try to sort it out. |
8ea6851 to
48c4071
Compare
choener
left a comment
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.
Especially after yesterdays discussion, I agree with these changes.
Add new field to the
DirectorySetNode,Global State Currency Symbol: The currency symbol of an NFT that uniquely identifies a UTxO that contains the global state associated with the programmable token. This is optionally and can be set to the empty currency symbol if not needed.