-
Notifications
You must be signed in to change notification settings - Fork 213
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
Implement Jörmungandr TransactionLayer #439
Conversation
newTransactionLayer = TransactionLayer | ||
{ mkStdTx = error "TODO: See http-bridge as starting point" | ||
newTransactionLayer | ||
:: forall n . Hash "Block0Hash" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure about this type ... And, does this really have to be the hash from the first block header?
To my knowledge — yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
8762a3d
to
586db8d
Compare
a936dc8
to
b76bbac
Compare
6a6a7ec
to
85ae50e
Compare
b76bbac
to
24b1e35
Compare
Hm… the diff is messed up since I force-pushed |
86f81c4
to
1a85616
Compare
general comment : the signing looks good at first sight, but I will be persuaded if extensive golden tests will support this feeling :-) |
24b1e35
to
64c9000
Compare
2714a7a
to
3f42a9a
Compare
0478c90
to
095a434
Compare
095a434
to
dba548c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It mostly looks good to me. There are few places where I am not sure in the correctness (I wasn't able to find the corresponding place in rust code)
putMessage :: Message -> Put | ||
putMessage m = withSizeHeader16be $ case m of | ||
Transaction (tx, wits) -> do | ||
putWord8 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should probably add a comment explaining why constant 2 (or reference to the actuall rust api line containing this info)
@@ -244,37 +258,43 @@ putSignedTransaction (tx, witnesses) = do | |||
putWitness :: TxWitness -> Put | |||
putWitness witness = | |||
case witness of | |||
PublicKeyWitness xPub (Hash sig) -> do | |||
PublicKeyWitness _xPub (Hash sig) -> do | |||
-- Witness sum type: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we might want to define sum type that would describe the constants in this module, at least for documentation
putWord8 1 | ||
putByteString xPub | ||
--putByteString xPub |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But then old address scheme won't work, right? (as it expects xPub in its format)
mapM_ putInput inputs | ||
mapM_ putOutput outputs | ||
where | ||
putInput (TxIn inputId inputIx) = do | ||
-- NOTE: special value 0xff indicates account spending | ||
-- only old utxo/address scheme supported for now | ||
putWord8 $ fromIntegral inputIx | ||
putWord64be 14 -- TODO: We need input value! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure I understand the idea behind this ?
EDIT: aha - I see https://github.com/input-output-hk/rust-cardano/blob/13af7aa08cdac8efc9dc8b0f7ff9162d28b2d479/chain-impl-mockchain/src/transaction/transfer.rs#L21 👍
@@ -84,7 +79,7 @@ genesis = BlockHeader | |||
-- The corresponding rust implementation is: | |||
-- https://github.com/input-output-hk/rust-cardano/blob/e5d974f7bedeb00c9c9d688ac66094a34bf8f40d/chain-impl-mockchain/src/transaction/transaction.rs#L115-L119 | |||
instance TxId (Jormungandr n) where | |||
txId = blake2b256 . putTokenTransfer | |||
txId = blake2b256 . putTxBody |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let keyFrom _ = Just (key, pwd) | ||
let inps = pure | ||
( txin | ||
, TxOut (Address "used for lookup") (Coin 14) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
address content is not important?
dba548c
to
eb58f1f
Compare
eb58f1f
to
0388931
Compare
0388931
to
bd4119e
Compare
55cfa17
to
8f5b202
Compare
bd4119e
to
ddf0286
Compare
This PR is to merge after:
|
8f5b202
to
43f1aca
Compare
ddf0286
to
a05841d
Compare
Co-authored-by: KtorZ <matthias.benkort@gmail.com>
This makes it more flexible to manipulate 'TxWitness' across different backend target. The application layer only regards it as a bunch of bytes anyway. Co-authored-by: KtorZ <matthias.benkort@gmail.com>
a05841d
to
0e8f1f0
Compare
0e8f1f0
to
6c2f5d1
Compare
Issue Number
#219
KtorZ/transaction-id-golden-tests
Overview
TransactionLayer
Comments
I'd call for merging this as soon as possible still.