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

Babbage: TxBody + TxOut #2560

Merged
merged 9 commits into from
Jan 4, 2022
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ index-state: 2021-02-15T00:00:00Z
packages:
eras/alonzo/impl
eras/alonzo/test-suite
eras/babbage/impl
eras/byron/chain/executable-spec
eras/byron/ledger/executable-spec
eras/byron/ledger/impl
Expand Down Expand Up @@ -121,6 +122,9 @@ package cardano-ledger-alonzo
package cardano-ledger-alonzo-test
ghc-options: -Werror

package cardano-ledger-babbage
ghc-options: -Werror

package byron-spec-chain
ghc-options: -Werror

Expand Down
11 changes: 9 additions & 2 deletions eras/alonzo/impl/src/Cardano/Ledger/Alonzo/TxBody.hs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ module Cardano.Ledger.Alonzo.TxBody
scriptIntegrityHash',
adHash',
txnetworkid',
getAdaOnly,
decodeDataHash32,
encodeDataHash32,
encodeAddress28,
decodeAddress28,
AlonzoBody,
EraIndependentScriptIntegrity,
ScriptIntegrityHash,
Expand Down Expand Up @@ -275,7 +280,8 @@ viewCompactTxOut txOut = case txOut of
toCompactValue adaVal,
SJust (decodeDataHash32 e f g h)
)
_ -> error "Impossible: Compacted and address or hash of non-standard size"
TxOut_AddrHash28_AdaOnly {} -> error "Impossible: Compacted and address or hash of non-standard size"
TxOut_AddrHash28_AdaOnly_DataHash32 {} -> error "Impossible: Compacted and address or hash of non-standard size"
where
toCompactValue :: CompactForm Coin -> CompactForm (Core.Value era)
toCompactValue ada =
Expand Down Expand Up @@ -304,7 +310,8 @@ viewTxOut (TxOut_AddrHash28_AdaOnly_DataHash32 stakeRef a b c d adaVal e f g h)
| Just Refl <- sameNat (Proxy @(SizeHash (CC.ADDRHASH (Crypto era)))) (Proxy @28),
Just Refl <- sameNat (Proxy @(SizeHash (CC.HASH (Crypto era)))) (Proxy @32) =
(decodeAddress28 stakeRef a b c d, inject (fromCompact adaVal), SJust (decodeDataHash32 e f g h))
viewTxOut _ = error "Impossible: Compacted and address or hash of non-standard size"
viewTxOut (TxOut_AddrHash28_AdaOnly {}) = error "Impossible: Compacted and address or hash of non-standard size"
viewTxOut (TxOut_AddrHash28_AdaOnly_DataHash32 {}) = error "Impossible: Compacted and address or hash of non-standard size"

instance
( Era era,
Expand Down
1 change: 1 addition & 0 deletions eras/babbage/impl/.ghcid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-c "nix-shell ../../shell.nix --run \"cabal repl cardano-ledger-babbage\"" -o ghcid.txt
3 changes: 3 additions & 0 deletions eras/babbage/impl/Setup.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import Distribution.Simple

main = defaultMain
69 changes: 69 additions & 0 deletions eras/babbage/impl/cardano-ledger-babbage.cabal
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
cabal-version: 3.0

name: cardano-ledger-babbage
version: 0.1.0.0
synopsis: TODO
description: TODO
bug-reports: https://github.com/input-output-hk/cardano-ledger/issues
license: Apache-2.0
author: IOHK Formal Methods Team
maintainer: [email protected]
copyright: 2020 Input Output (Hong Kong) Ltd.
category: Network
build-type: Simple

source-repository head
type: git
location: https://github.com/input-output-hk/cardano-ledger
subdir: eras/babbage/impl

common base
build-depends: base >= 4.12 && < 4.15

common project-config
default-language: Haskell2010

ghc-options: -Wall
-Wcompat
-Wincomplete-record-updates
-Wincomplete-uni-patterns
-Wpartial-fields
-Wredundant-constraints
-- -Wunused-packages

library
import: base, project-config
exposed-modules:
Cardano.Ledger.Babbage.TxBody
build-depends:
array,
base-deriving-via,
base64-bytestring,
bytestring,
cardano-binary,
cardano-crypto-class,
cardano-ledger-core,
cardano-ledger-shelley-ma,
cardano-ledger-alonzo,
cardano-prelude,
cardano-slotting,
containers,
data-default,
deepseq,
measures,
mtl,
nothunks,
plutus-ledger-api,
plutus-tx,
plutus-core,
prettyprinter,
serialise,
cardano-ledger-shelley,
small-steps,
strict-containers,
text,
time,
transformers,
utf8-string,
hs-source-dirs:
src
Loading