Skip to content

Commit 092019b

Browse files
committed
Added HSPlutusScript
1 parent 0a9bc77 commit 092019b

File tree

5 files changed

+26
-14
lines changed

5 files changed

+26
-14
lines changed

src/Ledger/Conway/Conformance/Script.agda

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,28 @@ module Ledger.Conway.Conformance.Script
2424

2525
open Ledger.Script crypto es
2626

27-
record HashedTimelock : Type where
27+
record HSTimelock : Type where
2828
field
2929
timelock : Timelock
3030
storedHash : ScriptHash
3131

3232
instance
33-
Hashable-HashedTimelock : Hashable HashedTimelock ScriptHash
34-
Hashable-HashedTimelock .hash = HashedTimelock.storedHash
33+
Hashable-HSTimelock : Hashable HSTimelock ScriptHash
34+
Hashable-HSTimelock .hash = HSTimelock.storedHash
3535

36-
unquoteDecl DecEq-HashedTimelock = derive-DecEq ((quote HashedTimelock , DecEq-HashedTimelock) ∷ [])
36+
unquoteDecl DecEq-HSTimelock = derive-DecEq ((quote HSTimelock , DecEq-HSTimelock) ∷ [])
37+
38+
record HSPlutusScript : Type where
39+
constructor MkHSPlutusScript
40+
field scriptHash : ScriptHash
41+
serSize :
42+
43+
instance
44+
Hashable-HSPlutusScript : Hashable HSPlutusScript ScriptHash
45+
Hashable-HSPlutusScript .hash = HSPlutusScript.scriptHash
3746

3847
P1ScriptStructure-HTL : P1ScriptStructure
3948
P1ScriptStructure-HTL = record
40-
{ P1Script = HashedTimelock
41-
; validP1Script = λ x y evalTimelock x y ∘ HashedTimelock.timelock }
49+
{ P1Script = HSTimelock
50+
; validP1Script = λ x y evalTimelock x y ∘ HSTimelock.timelock }
51+

src/Ledger/Conway/Foreign/HSLedger/Core.agda

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ module Implementation where
7979
toData : {A : Type} A Data
8080
toData _ = 0
8181

82-
PlutusScript = ℕ × ⊤
8382
ExUnits = ℕ × ℕ
8483
ExUnit-CommutativeMonoid = CommutativeMonoid 0ℓ 0ℓ ExUnits ∋ (Conversion.fromBundle record
8584
{ Carrier = ExUnits
@@ -94,9 +93,6 @@ module Implementation where
9493
instance
9594
Show-ExUnits : Show ExUnits
9695
Show-ExUnits = Show-×
97-
98-
Hashable-PlutusScript : Hashable PlutusScript ℕ
99-
Hashable-PlutusScript .hash (h , _) = h
10096

10197
CostModel =
10298
Language =

src/Ledger/Conway/Foreign/HSLedger/ExternalStructures.agda

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ instance
5050
HSP2ScriptStructure = record
5151
{ Implementation
5252
; validPlutusScript = λ _ _ _ _
53+
; PlutusScript = HSPlutusScript
5354
}
5455

5556
open import Ledger.PParams it it it hiding (Acnt; DrepThresholds; PoolThresholds)
@@ -120,7 +121,9 @@ instance
120121
; indexOfProposal = λ _ _ nothing
121122
}
122123
; runPLCScript = λ _ _ _ _ false
123-
; scriptSize = λ _ 0
124+
; scriptSize = λ where
125+
(inj₁ x) hash x
126+
(inj₂ x) hash x
124127
}
125128

126129
open import Ledger.Address Network KeyHash ScriptHash using () public

src/Ledger/Conway/Foreign/HSLedger/Transaction.agda

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@ instance
1818
{-# TERMINATING #-}
1919
Conv-Timelock = autoConvert Timelock
2020

21-
HsTy-HashedTimelock = autoHsType HashedTimelock
22-
Conv-HashedTimelock = autoConvert HashedTimelock
21+
HsTy-HSTimelock = autoHsType HSTimelock
22+
Conv-HSTimelock = autoConvert HSTimelock
23+
24+
HsTy-HSPlutusScript = autoHsType HSPlutusScript
25+
Conv-HSPlutusScript = autoConvert HSPlutusScript
2326

2427
HsTy-TxWitnessess = autoHsType TxWitnesses ⊣ withConstructor "MkTxWitnesses"
2528
Conv-TxWitnessess = autoConvert TxWitnesses

src/Ledger/hs-src/Lib.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import MAlonzo.Code.Ledger.Conway.Foreign.HSLedger.PParams as X
1212
import MAlonzo.Code.Ledger.Conway.Foreign.HSLedger.Transaction as X
1313
( Tag(..), Timelock(..), TxWitnesses(..), TxBody(..), Tx(..), TxId, Ix, TxIn, P1Script, P2Script
1414
, Script, Datum, DataHash, Value, TxOut, RdmrPtr, ScriptHash, AuxiliaryData, Wdrl
15-
, HashedTimelock(..))
15+
, HSTimelock (..), HSPlutusScript (..))
1616
import MAlonzo.Code.Ledger.Conway.Foreign.HSLedger.Cert as X
1717
(certStep, certsStep, CertState(..))
1818
import MAlonzo.Code.Ledger.Conway.Foreign.HSLedger.Chain as X

0 commit comments

Comments
 (0)