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

Adding Structured Contracts Framework #657

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

polinavino
Copy link

Description

Adding the Structured Contracts framework for smart contract (and possibly ledger behaviour) verification. For full discussion of framework, see the paper

Checklist

  • Commit sequence broadly makes sense and commits have useful messages
  • Any semantic changes to the specifications are documented in CHANGELOG.md
  • Code is formatted according to CONTRIBUTING.md
  • Self-reviewed the diff

@WhatisRT
Copy link
Collaborator

WhatisRT commented Jan 30, 2025

The CI failure here is because you don't import the newly added file anywhere. You can just add them to Everything.agda if there's no better place.

Copy link
Collaborator

@WhatisRT WhatisRT left a comment

Choose a reason for hiding this comment

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

I don't think this needs to be a literate Agda file, unless you want it to go into an appendix of the spec.

∙ (Γ , tx , u) ~ᵉ (tt , i′)
∙ u ~ˢ s
────────────────────────────────
∃ λ s′ → u′ ~ˢ s′
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
λ s′ u′ ~ˢ s′
[ s′ ] u′ ~ˢ s′

You may need a parenthesis as well, I'm not sure.


-- only for PlutusV3
_~ᵉ_ : LEnv × Tx × LState → ⊤ × I → Type
_~ᵉ_ = λ (le , tx , u) (tt , i) → πⁱ (txInfo PlutusV3 (le .LEnv.pparams) (u .LState.utxoSt .UTxOState.utxo) tx) ≡ i
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
_~ᵉ_ = λ (le , tx , u) (tt , i) πⁱ (txInfo PlutusV3 (le .LEnv.pparams) (u .LState.utxoSt .UTxOState.utxo) tx) ≡ i
(le , tx , u) ~ᵉ (tt , i) = πⁱ (txInfo PlutusV3 (le .LEnv.pparams) (u .LState.utxoSt .UTxOState.utxo) tx) ≡ i

field
πˢ : LState → Maybe S
πⁱ : TxInfo → I
extraAssmp : LEnv → LState → Tx → Type -- extra assumptions about ledger state, env, and transaction that
Copy link
Collaborator

Choose a reason for hiding this comment

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

This comment is incomplete

open import Ledger.ScriptValidation txs abs
open import Ledger.Utxo txs abs
\end{code}
-- open import Prelude hiding (id; _~ˢ_; _~ᵉ_)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
-- open import Prelude hiding (id; _~ˢ_; _~ᵉ_)

Comment on lines +45 to +46
simulates : ∀ Γ s u tx i′ u′ → extraAssmp Γ u tx →
∙ Γ ⊢ u ⇀⦇ tx ,LEDGER⦈ u′
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
simulates : ∀ Γ s u tx i′ u′ → extraAssmp Γ u tx →
∙ Γ ⊢ u ⇀⦇ tx ,LEDGER⦈ u′
simulates : ∀ Γ s u tx i′ u′ →
∙ extraAssmp Γ u tx
∙ Γ ⊢ u ⇀⦇ tx ,LEDGER⦈ u′

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