Skip to content

Commit

Permalink
some tests for single accounting
Browse files Browse the repository at this point in the history
  • Loading branch information
mkv-vcm committed Oct 15, 2021
1 parent dc3739d commit df8c29b
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/errors/invalidDataReason.ts
Expand Up @@ -191,4 +191,9 @@ export enum InvalidDataReason {
"invalid required count - higher than number of total scripts",
DERIVE_NATIVE_SCRIPT_HASH_UNKNOWN_TYPE = "unknown script type",
DERIVE_NATIVE_SCRIPT_HASH_INVALID_DISPLAY_FORMAT = "invalid native script hash display format",

/**
* For errors that we don't want to check on the LedgerJS side
*/
LEDGER_POLICY = "Action rejected by Ledger's security policy"
}
43 changes: 43 additions & 0 deletions test/integration/__fixtures__/signTx.ts
Expand Up @@ -1462,6 +1462,49 @@ export const testsShelleyRejects: TestcaseRejectShelley[] = [
errMsg: "Action rejected by Ledger's security policy",
rejectReason: InvalidDataReason.OUTPUT_INVALID_ADDRESS_PARAMS,
},
{
testname: "Reject tx mismatching account numbers - change vs withdrawal",
tx: {
...shelleyBase,
outputs: [outputs.internalBaseWithStakingKeyHash],
withdrawals: [{
stakeCredential: {
type: StakeCredentialParamsType.KEY_PATH,
keyPath: str_to_path("1852'/1815'/1'/2/0"),
},
amount: 5,
}],
},
signingMode: TransactionSigningMode.ORDINARY_TRANSACTION,
errCls: DeviceStatusError,
errMsg: "Action rejected by Ledger's security policy",
rejectReason: InvalidDataReason.LEDGER_POLICY,
},
{
testname: "Reject tx mismatching account numbers - byron vs shelley",
tx: {
...shelleyBase,
outputs: [{
amount: 7120787,
destination: {
type: TxOutputDestinationType.DEVICE_OWNED,
params: {
type: AddressType.BASE_PAYMENT_KEY_STAKE_KEY,
params: {
spendingPath: str_to_path("1852'/1815'/1'/0/0"),
stakingKeyHashHex:
"122a946b9ad3d2ddf029d3a828f0468aece76895f15c9efbd69b4277",
},
},
}
}],
},
additionalWitnessPaths: [str_to_path("44'/1815'/1'/0/0")],
signingMode: TransactionSigningMode.ORDINARY_TRANSACTION,
errCls: DeviceStatusError,
errMsg: "Action rejected by Ledger's security policy",
rejectReason: InvalidDataReason.LEDGER_POLICY,
},
]


Expand Down

0 comments on commit df8c29b

Please sign in to comment.