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

spec for scripts and multi-currency #3

Merged
merged 5 commits into from
Oct 11, 2018

Conversation

JaredCorduan
Copy link
Contributor

This is the beginning of a spec for a UTxO Ledger that has scripts and mutli-currency. It is essentially putting the two papers An Abstract Model of UTxO-based Cryptocurrencies with Scripts and Multi-Currency Ledgers into a rule style spec.

So far it has the types, basic functions, needed ledger state, validation rules, and a few notes about disabling multi-currency and scripts, and adding extended UTxO.

\caption{Scripts}
\label{fig:scripts}
\end{figure}

Copy link
Contributor

@mgudemann mgudemann Oct 9, 2018

Choose a reason for hiding this comment

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

although it's an arbitrary type, T should be mentioned and maybe renamed to R as in the utxo/scripts paper

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, R would be better, thanks! I was going to explain that arbitrary type in a paragraph explaining the scripts in general. Do you think I should mention R in that figure as well?

Copy link
Contributor

Choose a reason for hiding this comment

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

I would prefer having something like R : arbitrary return type of redeemer script / input type of validator script, because I often quickly look at figures like this for reference.

\type{Tx}
& \powerset{\type{TxIn}} \times (\type{Ix} \mapsto
\type{TxOut}) \times \type{Forge} \times \type{Value}
&
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't the optional Create also be part of this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, thanks!

\begin{equation*}
tx.create.currency \notin currencies
\end{equation*}

Copy link
Contributor

Choose a reason for hiding this comment

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

There are more validation rules in the paper, e.g., creator has enough money to cover fees, fee is non-negative. Are these implicitly present here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

please check that I am correct (though we'll cover this more when doing property testing), but I think negative fees and cover fees are not an issue since this spec is UTxO only (accounts make some things trickier).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thinking about this a bit more, I realize I'm making an assumption that I'm not stating, namely that Quantity is an alias for Nat. We don't need inverses/subtraction if we don't have accounts.


\todo[inline]{We need to think carefully about how to handle similar names,
like ``ada", ``Ada", and ``ADA".}

Copy link
Contributor

Choose a reason for hiding this comment

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

in my opinion the policy should offer the lowest risk of surprises, i.e., only uppercase or only lowercase, no UTF-8 etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree completely!

@JaredCorduan JaredCorduan changed the title WIP spec for scripts and multi-currency spec for scripts and multi-currency Oct 9, 2018
@mgudemann
Copy link
Contributor

@JaredCorduan one thing which I was thinking about, is it possible to create a new currency CUR and forge a quantity of CUR in the same transaction? One would have to consider the currencies of the ledger and of the current transaction in that case. Does this make sense?

@dnadales
Copy link
Member

Why not putting figure 4 and 6 as a single inference rule?

@JaredCorduan
Copy link
Contributor Author

Why not putting figure 4 and 6 as a single inference rule?

yea, I should probably do that to be consistent with our other specs. It's just that figure 4 has so much information in it. Maybe I could define a new predicate that is just the conjunction of fig 4, and place it in a judgment style rule?

@JaredCorduan
Copy link
Contributor Author

@JaredCorduan one thing which I was thinking about, is it possible to create a new currency CUR and forge a quantity of CUR in the same transaction? One would have to consider the currencies of the ledger and of the current transaction in that case. Does this make sense?

that's an excellent point! As I have it written now it would fail, since in "forge obeys policy" the new currency is not yet inside currencies (the ledger state has not yet been updated), so "∃ policy" fails. I guess the question now is should we require a newly created currency to follow the policy in the transaction in which it is created? I seems reasonable to me to allow forging in the transaction that creates a currency to be independent of the policy. I can make a TODO in the document for this is we want to think more about it later...

@mgudemann
Copy link
Contributor

@JaredCorduan right, so currently it isn't possible. But there does not seem to be any problem with allowing it, right? We do have the monetary policy from Create, so we could check it. Of course it would then be a question what to do if the script does not verify. Should only the forge be dropped or should the Create also be rejected.

@JaredCorduan
Copy link
Contributor Author

@mgudemann you are totally right, there is no problem, and in fact I think we want to be able to forge and create at the same time. If the script fails, then I think that the entire transaction should fail. I've just pushed a change that separates the state transition rule into two rules. And then I made a note/todo about being careful about the order in which rules are processed (with the understanding that if any rule fails validation, the transaction will not be processed at all). the other solution is to just search for policies in currencies U {new_currency -> new_policy}.

@JaredCorduan JaredCorduan merged commit a84fc62 into master Oct 11, 2018
@JaredCorduan JaredCorduan deleted the scripts_and_multicurrency branch October 11, 2018 11:41
JaredCorduan pushed a commit that referenced this pull request Feb 12, 2019
# This is the 1st commit message:

Alter the endorsement registration rule, so that the set of confirmed proposals remains the same.

# This is the commit message #2:

Perform cleanup of confirmed proposals in  the epoch change rule.

# This is the commit message #3:

Remove the section that expressed that there were no voting deadlines. There are now.

# This is the commit message #4:

Define what "endorsement" means in this context.

# This is the commit message #5:

Explain the acronyms used in the labels of the update-proposal interface.

# This is the commit message #6:

Add a figure explaining the situation with a too small endorsement window.

# This is the commit message #7:

Model the software update proposal in the update proposal validity rule.

# This is the commit message #8:

Make it possible for an update proposal not to change the protocol version.
mdimjasevic pushed a commit that referenced this pull request May 30, 2019
kevinhammond added a commit that referenced this pull request Oct 28, 2019
# This is the 1st commit message:
Merge branch 'spec/incentives-kh' of https://github.com/input-output-hk/cardano-ledger-specs into spec/incentives-kh

# This is the commit message #2:

overcoming fake make error

Signed-off-by: Kevin Hammond <12563287+kevinhammond@users.noreply.github.com>

# This is the commit message #3:

overcoming fake make error

Signed-off-by: Kevin Hammond <12563287+kevinhammond@users.noreply.github.com>

# This is the commit message #4:

overcoming fake make error

Signed-off-by: Kevin Hammond <12563287+kevinhammond@users.noreply.github.com>

# This is the commit message #5:

overcoming fake make error

Signed-off-by: Kevin Hammond <12563287+kevinhammond@users.noreply.github.com>

# This is the commit message #6:

overcoming fake make error

Signed-off-by: Kevin Hammond <12563287+kevinhammond@users.noreply.github.com>

# This is the commit message #7:

fix user.email

Signed-off-by: Kevin Hammond <12563287+kevinhammond@users.noreply.github.com>

# This is the commit message #8:

overcoming fake make error

Signed-off-by: Kevin Hammond <12563287+kevinhammond@users.noreply.github.com>

# This is the commit message #9:

overcoming fake make error

Signed-off-by: Kevin Hammond <12563287+kevinhammond@users.noreply.github.com>
JaredCorduan added a commit that referenced this pull request Jan 22, 2020
JaredCorduan added a commit that referenced this pull request Jan 22, 2020
JaredCorduan pushed a commit that referenced this pull request Jan 22, 2020
…udit-pt-3

small shelley ledger spec edits from isabelle review #3
nc6 pushed a commit that referenced this pull request May 19, 2020
nc6 pushed a commit that referenced this pull request May 19, 2020
# This is the 1st commit message:

Alter the endorsement registration rule, so that the set of confirmed proposals remains the same.

# This is the commit message #2:

Perform cleanup of confirmed proposals in  the epoch change rule.

# This is the commit message #3:

Remove the section that expressed that there were no voting deadlines. There are now.

# This is the commit message #4:

Define what "endorsement" means in this context.

# This is the commit message #5:

Explain the acronyms used in the labels of the update-proposal interface.

# This is the commit message #6:

Add a figure explaining the situation with a too small endorsement window.

# This is the commit message #7:

Model the software update proposal in the update proposal validity rule.

# This is the commit message #8:

Make it possible for an update proposal not to change the protocol version.
teodanciu pushed a commit to bienpulenta/cardano-ledger that referenced this pull request Apr 19, 2023
* Add a `goldenTestCBOR` function.

This function is basically a re-implementation of 'goldenTestBi', but it can be
used with values of types that don't have a `Bi` instance.

* Implement `goldenTestBi` in terms of `goldenTestCBOR`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants