-
Notifications
You must be signed in to change notification settings - Fork 220
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
Support for legacy UTxO witness in Jörmungandr #878
Conversation
putWitness (TxWitness bytes) = do | ||
putWord8 1 | ||
putByteString bytes | ||
putWitness (TxWitness bytes) = putByteString bytes |
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.
The tag is now part of the bytes
themselves (cf utxoWitness
and legacyUtxoWitness
)
tag <- getTxWitnessTag | ||
let len = txWitnessSize tag | ||
tag <- lookAhead getTxWitnessTag | ||
let len = txWitnessSize tag + txWitnessTagSize |
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.
The tag is now part of the bytes themselves (cf utxoWitness and legacyUtxoWitness)
@@ -190,13 +205,68 @@ mkStdTxSpec = do | |||
\080f5ac10474c7f6decbbc35f1620817b15bf1594981c034b7f6a15d0a24ec743d\ | |||
\332f1774eb8733a5d40c" | |||
|
|||
describe "mkStdTx unknown input" $ do | |||
unknownInputTest (Proxy @'Mainnet) block0 | |||
unknownInputTest (Proxy @'Testnet) block0 |
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.
Moved down.
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 barely looked at the tests
mkTxWitness (Hash block0) inps outs xprv = | ||
let | ||
xpub = getRawKey $ publicKey $ fst xprv | ||
payload = block0 <> getHash (signData inps outs) |
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.
Nice!
Maybe a bit unfortunate that the payload
-calculation is duplicated. Separate "signing" and "payload", or does things stop making sense then?
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.
Now it would. Initially even the signing was different and I refactored a few things until the point where it got pretty similar. I ended up with this to also make testing a bit easier and the function signature slightly more readable than having a ByteString
signature as argument.
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.
Done.
@@ -109,13 +117,40 @@ newTransactionLayer (Hash block0) = TransactionLayer | |||
$ Left ErrExceededInpsOrOuts | |||
} | |||
|
|||
-- | Provide a transaction witness for a given private key. The type of witness | |||
-- if different between types of keys and, with backward-compatible support, we | |||
-- may have to support many types for one backend target. |
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.
The type of witness
ifdifferent between types of keys
The type of witness is different between different types of keys
Question: would it be possible to use a the random address scheme with new funds, and put sequential addresses in legacy funds (ignoring the specifics of the current mainnet and coming testnet)? If it is possible, maybe the "why" of the cited statement could be made a bit clearer.
we may have to support many types for one backend target
Why "may"? We are?
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 are indeed.
would it be possible to use a the random address scheme with new funds
No, because the address structure for new funds makes it impossible to implement the random scheme.
put sequential addresses in legacy funds
No. Jörmungandr doesn't allow that.
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.
extended comment to clarify that 👍
rndApi <- apiLayer tr (toWLBlock <$> nl) | ||
seqApi <- apiLayer tr (toWLBlock <$> nl) | ||
let rndTl = newTransactionLayer @n (getGenesisBlockHash bp) | ||
let seqTl = newTransactionLayer @n (getGenesisBlockHash bp) |
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.
Why do the transaction layers need to be different? newTransactionLayer
is passed the same arguments.
Ah, right! The implicit key type-param!
273a98e
to
a2e7232
Compare
bors r+ |
862: jormungandr launch: use --rest-listen instead of generating config.yaml r=KtorZ a=rvl Relates to #832 and #848. Supersedes #850. # Overview `cardano-wallet-jormungandr launch` specifies the REST API port and storage directory. The user provides the rest of the Jörmungandr configuration (e.g. trusted peers). # Comments The Jörmungandr P2P listen address, port, and log level are no longer configured by cardano-wallet. 864: nix: Provide derivations for Daedalus installer r=KtorZ a=rvl Relates to #863. Based on #828. # Overview - @disassembler @cleverca22 It's not exactly the same as before but should work ok I think. - Adds source filtering to avoid unnecessary rebuilds. # Comments To build: ``` nix-build -A cardano-wallet-jormungandr nix-build release.nix -A daedalus-jormungandr.windows -o daedalus-jormungandr-windows nix-build release.nix -A daedalus-jormungandr.macos -o daedalus-jormungandr-macos nix-build release.nix -A daedalus-jormungandr.linux -o daedalus-jormungandr-linux ``` Note that `daedalus-jormungandr.{windows,macos,linux}` from `release.nix` reference the same `cardano-wallet-jormungandr` derivation, only with different `system` or `crossSystem` arguments. So Daedalus may also import from `default.nix` rather than `release.nix`. 878: Support for legacy UTxO witness in Jörmungandr r=KtorZ a=KtorZ # Issue Number <!-- Put here a reference to the issue this PR relates to and which requirements it tackles --> #779 # Overview <!-- Detail in a few bullet points the work accomplished in this PR --> - [x] I have extended `mkStdTx` so that it would properly handle transactions coming from a `RndKey` and construct `legacy-utxo` witnesses for it. # Comments <!-- Additional comments or screenshots to attach if any --> Jörmungandr doesn't implement creating legacy utxo witnesses from jcli ... [jcli/src/jcli_app/transaction/mk_witness.rs](https://github.com/input-output-hk/jormungandr/blob/master/jcli/src/jcli_app/transaction/mk_witness.rs#L78-L82) ```rust WitnessType::OldUTxO => { // TODO unimplemented!() let _secret_key: SecretKey<Ed25519Bip32> = self.secret()?; Err(Error::MakeWitnessLegacyUtxoUnsupported)?; unimplemented!() } ``` so I had to construct them by hand according to: - The format defined in [chain-impl-mockchain#witnesses](https://github.com/input-output-hk/chain-libs/blob/incentive/chain-impl-mockchain/doc/format.md#witnesses) - The format from the source (double checking it matches the doc..) [chain-impl-mockchain/src/transaction/witness.rs](https://github.com/input-output-hk/chain-libs/blob/incentive/chain-impl-mockchain/src/transaction/witness.rs#L173-L176) It'd be nice to review our golden if / when the constructor for the witness type gets updated. <!-- Don't forget to: ✓ Self-review your changes to make sure nothing unexpected slipped through ✓ Assign yourself to the PR ✓ Assign one or several reviewer(s) ✓ Once created, link this PR to its corresponding ticket ✓ Acknowledge any changes required to the Wiki --> 879: Porting the rest of forget pending tx integration tests to CLI r=KtorZ a=paweljakubas # Issue Number <!-- Put here a reference to the issue this PR relates to and which requirements it tackles --> #836 # Overview <!-- Detail in a few bullet points the work accomplished in this PR --> - [x] I have ported the rest of forgetting pending tx integration tests to CLI # Comments <!-- Additional comments or screenshots to attach if any --> <!-- Don't forget to: ✓ Self-review your changes to make sure nothing unexpected slipped through ✓ Assign yourself to the PR ✓ Assign one or several reviewer(s) ✓ Once created, link this PR to its corresponding ticket ✓ Acknowledge any changes required to the Wiki --> Co-authored-by: Rodney Lorrimar <[email protected]> Co-authored-by: KtorZ <[email protected]> Co-authored-by: Pawel Jakubas <[email protected]>
Canceled (will resume) |
862: jormungandr launch: use --rest-listen instead of generating config.yaml r=KtorZ a=rvl Relates to #832 and #848. Supersedes #850. # Overview `cardano-wallet-jormungandr launch` specifies the REST API port and storage directory. The user provides the rest of the Jörmungandr configuration (e.g. trusted peers). # Comments The Jörmungandr P2P listen address, port, and log level are no longer configured by cardano-wallet. 864: nix: Provide derivations for Daedalus installer r=KtorZ a=rvl Relates to #863. Based on #828. # Overview - @disassembler @cleverca22 It's not exactly the same as before but should work ok I think. - Adds source filtering to avoid unnecessary rebuilds. # Comments To build: ``` nix-build -A cardano-wallet-jormungandr nix-build release.nix -A daedalus-jormungandr.windows -o daedalus-jormungandr-windows nix-build release.nix -A daedalus-jormungandr.macos -o daedalus-jormungandr-macos nix-build release.nix -A daedalus-jormungandr.linux -o daedalus-jormungandr-linux ``` Note that `daedalus-jormungandr.{windows,macos,linux}` from `release.nix` reference the same `cardano-wallet-jormungandr` derivation, only with different `system` or `crossSystem` arguments. So Daedalus may also import from `default.nix` rather than `release.nix`. 878: Support for legacy UTxO witness in Jörmungandr r=KtorZ a=KtorZ # Issue Number <!-- Put here a reference to the issue this PR relates to and which requirements it tackles --> #779 # Overview <!-- Detail in a few bullet points the work accomplished in this PR --> - [x] I have extended `mkStdTx` so that it would properly handle transactions coming from a `RndKey` and construct `legacy-utxo` witnesses for it. # Comments <!-- Additional comments or screenshots to attach if any --> Jörmungandr doesn't implement creating legacy utxo witnesses from jcli ... [jcli/src/jcli_app/transaction/mk_witness.rs](https://github.com/input-output-hk/jormungandr/blob/master/jcli/src/jcli_app/transaction/mk_witness.rs#L78-L82) ```rust WitnessType::OldUTxO => { // TODO unimplemented!() let _secret_key: SecretKey<Ed25519Bip32> = self.secret()?; Err(Error::MakeWitnessLegacyUtxoUnsupported)?; unimplemented!() } ``` so I had to construct them by hand according to: - The format defined in [chain-impl-mockchain#witnesses](https://github.com/input-output-hk/chain-libs/blob/incentive/chain-impl-mockchain/doc/format.md#witnesses) - The format from the source (double checking it matches the doc..) [chain-impl-mockchain/src/transaction/witness.rs](https://github.com/input-output-hk/chain-libs/blob/incentive/chain-impl-mockchain/src/transaction/witness.rs#L173-L176) It'd be nice to review our golden if / when the constructor for the witness type gets updated. <!-- Don't forget to: ✓ Self-review your changes to make sure nothing unexpected slipped through ✓ Assign yourself to the PR ✓ Assign one or several reviewer(s) ✓ Once created, link this PR to its corresponding ticket ✓ Acknowledge any changes required to the Wiki --> 879: Porting the rest of forget pending tx integration tests to CLI r=KtorZ a=paweljakubas # Issue Number <!-- Put here a reference to the issue this PR relates to and which requirements it tackles --> #836 # Overview <!-- Detail in a few bullet points the work accomplished in this PR --> - [x] I have ported the rest of forgetting pending tx integration tests to CLI # Comments <!-- Additional comments or screenshots to attach if any --> <!-- Don't forget to: ✓ Self-review your changes to make sure nothing unexpected slipped through ✓ Assign yourself to the PR ✓ Assign one or several reviewer(s) ✓ Once created, link this PR to its corresponding ticket ✓ Acknowledge any changes required to the Wiki --> Co-authored-by: Rodney Lorrimar <[email protected]> Co-authored-by: KtorZ <[email protected]> Co-authored-by: Pawel Jakubas <[email protected]>
Build failed (retrying...) |
bors r- |
Canceled |
a2e7232
to
6af04d7
Compare
bors r+ |
878: Support for legacy UTxO witness in Jörmungandr r=KtorZ a=KtorZ # Issue Number <!-- Put here a reference to the issue this PR relates to and which requirements it tackles --> #779 # Overview <!-- Detail in a few bullet points the work accomplished in this PR --> - [x] I have extended `mkStdTx` so that it would properly handle transactions coming from a `RndKey` and construct `legacy-utxo` witnesses for it. # Comments <!-- Additional comments or screenshots to attach if any --> Jörmungandr doesn't implement creating legacy utxo witnesses from jcli ... [jcli/src/jcli_app/transaction/mk_witness.rs](https://github.com/input-output-hk/jormungandr/blob/master/jcli/src/jcli_app/transaction/mk_witness.rs#L78-L82) ```rust WitnessType::OldUTxO => { // TODO unimplemented!() let _secret_key: SecretKey<Ed25519Bip32> = self.secret()?; Err(Error::MakeWitnessLegacyUtxoUnsupported)?; unimplemented!() } ``` so I had to construct them by hand according to: - The format defined in [chain-impl-mockchain#witnesses](https://github.com/input-output-hk/chain-libs/blob/incentive/chain-impl-mockchain/doc/format.md#witnesses) - The format from the source (double checking it matches the doc..) [chain-impl-mockchain/src/transaction/witness.rs](https://github.com/input-output-hk/chain-libs/blob/incentive/chain-impl-mockchain/src/transaction/witness.rs#L173-L176) It'd be nice to review our golden if / when the constructor for the witness type gets updated. <!-- Don't forget to: ✓ Self-review your changes to make sure nothing unexpected slipped through ✓ Assign yourself to the PR ✓ Assign one or several reviewer(s) ✓ Once created, link this PR to its corresponding ticket ✓ Acknowledge any changes required to the Wiki --> Co-authored-by: KtorZ <[email protected]>
Build succeeded |
Issue Number
#779
Overview
mkStdTx
so that it would properly handle transactions coming from aRndKey
and constructlegacy-utxo
witnesses for it.Comments
Jörmungandr doesn't implement creating legacy utxo witnesses from jcli ...
jcli/src/jcli_app/transaction/mk_witness.rs
so I had to construct them by hand according to:
The format defined in chain-impl-mockchain#witnesses
The format from the source (double checking it matches the doc..) chain-impl-mockchain/src/transaction/witness.rs
It'd be nice to review our golden if / when the constructor for the witness type gets updated.