Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Soupstraw committed Dec 2, 2024
1 parent 6cc0b86 commit a23e50d
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 21 deletions.
4 changes: 0 additions & 4 deletions shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ in {
nativeBuildInputs = [
specs.agda
cabal-install
(haskellPackages.ghcWithPackages (pkgs: with pkgs; [
specs.ledger.hsExe
specs.midnight.hsExe
]))
];
};
}
36 changes: 24 additions & 12 deletions src/Ledger/Conway/Foreign/HSLedger/Core.agda
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,6 @@ open import Ledger.Conway.Foreign.Util public
open import Tactic.Derive.DecEq
open import Tactic.Derive.Show

module _ {A : Type} ⦃ _ : DecEq A ⦄ ⦃ _ : Show A ⦄ where instance
∀Hashable : Hashable A A
∀Hashable = λ where .hash id

∀isHashableSet : isHashableSet A
∀isHashableSet = mkIsHashableSet A

instance
Hashable-⊤ : Hashable ⊤ ℕ
Hashable-⊤ = λ where .hash tt 0
Expand All @@ -41,8 +34,28 @@ record HSVKey : Type where
field vkey :
storedHash :

unquoteDecl DecEq-HSVKey = derive-DecEq
((quote HSVKey , DecEq-HSVKey) ∷ [])
{-# FOREIGN GHC
data HSVKey = MkHSVKey
{ hvkVKey :: Integer
, hvkStoredHash :: Integer
}
#-}
{-# COMPILE GHC HSVKey = data HSVKey (MkHSVKey) #-}

unquoteDecl DecEq-HSVKey = derive-DecEq ((quote HSVKey , DecEq-HSVKey) ∷ [])

instance
Hashable-HSVKey : Hashable HSVKey ℕ
Hashable-HSVKey = λ where .hash HSVKey.storedHash

isHashableSet-HSVKey : isHashableSet HSVKey
isHashableSet-HSVKey = mkIsHashableSet ℕ

Hashable-ℕ : Hashable ℕ ℕ
Hashable-ℕ = λ where .hash id

isHashableSet-ℕ : isHashableSet ℕ
isHashableSet-ℕ = mkIsHashableSet ℕ

unquoteDecl Show-HSVKey = derive-Show
((quote HSVKey , Show-HSVKey) ∷ [])
Expand All @@ -64,7 +77,7 @@ module Implementation where
ScriptHash =

Data =
Dataʰ = mkHashableSet Data
Dataʰ = mkHashableSet
toData : {A : Type} A Data
toData _ = 0

Expand Down Expand Up @@ -171,7 +184,6 @@ module ExternalStructures (externalFunctions : ExternalFunctions) where
.updateGroups modifiedUpdateGroups
.applyUpdate applyPParamsUpdate
.ppWF? {u} ppWF u
; ppHashingScheme = it
}
where
open PParamsUpdate
Expand Down Expand Up @@ -203,11 +215,11 @@ module ExternalStructures (externalFunctions : ExternalFunctions) where
{ Implementation
; epochStructure = HSEpochStructure
; globalConstants = HSGlobalConstants
; adHashingScheme = it
; crypto = HSCrypto
; govParams = HsGovParams
; txidBytes = id
; scriptStructure = HSScriptStructure
; adHashingScheme = isHashableSet-ℕ
}

open TransactionStructure HSTransactionStructure public
Expand Down
2 changes: 0 additions & 2 deletions src/Ledger/Conway/Foreign/HSLedger/Utxo.agda
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@ module _ (ext : ExternalFunctions) where
∷ show (LW.witsVKeyNeeded utxo body)
"\nwitsKeyHashes = "
∷ show (mapˢ hash (dom vkSigs))
--∷ "\ncredsNeeded = "
--∷ show (credsNeeded utxo body)
∷ []

{-# COMPILE GHC utxow-debug as utxowDebug #-}
2 changes: 0 additions & 2 deletions src/Ledger/PParams.lagda
Original file line number Diff line number Diff line change
Expand Up @@ -462,8 +462,6 @@ record PParamsDiff : Type₁ where
record GovParams : Type₁ where
field ppUpd : PParamsDiff
open PParamsDiff ppUpd renaming (UpdateT to PParamsUpdate) public
field ppHashingScheme : isHashableSet PParams
open isHashableSet ppHashingScheme renaming (THash to PPHash) public
field ⦃ DecEq-UpdT ⦄ : DecEq PParamsUpdate
-- ⦃ Show-UpdT ⦄ : Show PParamsUpdate
\end{code}
2 changes: 2 additions & 0 deletions src/Ledger/hs-src/Lib.hs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ import MAlonzo.Code.Ledger.Conway.Foreign.HSLedger.Utxo as X
, utxoDebug, utxowDebug)
import MAlonzo.Code.Ledger.Conway.Foreign.HSLedger.BaseTypes as X
(Coin, ExUnits, Epoch)
import MAlonzo.Code.Ledger.Conway.Foreign.HSLedger.Core as X
(HSVKey (..))
import MAlonzo.Code.Ledger.Conway.Foreign.ExternalFunctions as X
(ExternalFunctions(..), dummyExternalFunctions)

1 change: 0 additions & 1 deletion src/ScriptVerification/LedgerImplementation.agda
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ SVGovParams = record
.updateGroups λ _
.applyUpdate λ p _ p
.ppWF? ⁇ yes λ _ id
; ppHashingScheme = it
}

SVGovStructure : GovStructure
Expand Down

0 comments on commit a23e50d

Please sign in to comment.