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

Scrap hex and rely on bech32 for converting to hex #291

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

coding standards

1f88908
Select commit
Loading
Failed to load commit list.
Open

Scrap hex and rely on bech32 for converting to hex #291

coding standards
1f88908
Select commit
Loading
Failed to load commit list.
Garnix CI / check ghc810:cardano-addresses-cli:test:unit [x86_64-linux] succeeded Jan 13, 2025 in 5m 1s

Run results

Build succeeded

Details

Last 100 lines of logs:

on top of the required one, in particular:
 - check if 'all' is non-empty
 - check if there are redundant timelocks in a given level
 - check if there are no duplicated verification keys in a given level
 - check if 'at_least' coeffcient is positive
 - check if 'all', 'any' are non-empty and `'at_least' has no less elements in the list than the coeffcient after timelocks are filtered out. 
The validation of the script does not take into account transaction validity. We assume that the user will take care of this.

Example:
  cardano-address script validate 'all
    [ addr_shared_vk1wgj79fxw2vmxkp85g88nhwlflkxevd77t6wy0nsktn2f663wdcmqcd4fp3
    , addr_shared_vk1jthguyss2vffmszq63xsmxlpc9elxnvdyaqk7susl4sppp2s9xqsuszh44
    ]'
  Validated.

  cardano-address script validate --required 'all
    [ addr_shared_vk1wgj79fxw2vmxkp85g88nhwlflkxevd77t6wy0nsktn2f663wdcmqcd4fp3
    , addr_shared_vk1jthguyss2vffmszq63xsmxlpc9elxnvdyaqk7susl4sppp2s9xqsuszh44
    ]'
  Validated.

  cardano-address script validate --recommended 'all []'
  Not validated: The list inside a script is empty or only contains timelocks (which is not recommended).

  cardano-address script validate 'at_least 1 [active_from 11, active_until 16]'
  Validated.

  cardano-address script validate 'all
    [ addr_shared_vk1wgj79fxw2vmxkp85g88nhwlflkxevd77t6wy0nsktn2f663wdcmqcd4fp3
    , addr_shared_vk1wgj79fxw2vmxkp85g88nhwlflkxevd77t6wy0nsktn2f663wdcmqcd4fp3
    ]'
  Validated.

  cardano-address script validate --recommended 'all
    [ addr_shared_vk1wgj79fxw2vmxkp85g88nhwlflkxevd77t6wy0nsktn2f663wdcmqcd4fp3
    , addr_shared_vk1wgj79fxw2vmxkp85g88nhwlflkxevd77t6wy0nsktn2f663wdcmqcd4fp3
    ]'
  Not validated: The list inside a script has duplicate keys (which is not recommended).

    addr_shared_vkh1zxt0uvrza94h3hv4jpv0ttddgnwkvdgeyq8jf9w30mcs6y8w3nq => Validated. [✔]
    at_least 2 [ addr_shared_vkh1zxt0uvrza94h3hv4jpv0ttddgnwkvdgeyq8jf9w30mcs6y8w3nq, addr_shared_vkh1y3zl4nqgm96ankt96dsdhc86vd5geny0wr7hu8cpzdfcqskq2cp, addr_shared_vkh175wsm9ckhm3snwcsn72543yguxeuqm7v9r6kl6gx57h8gdydcd9 ] => Validated. [✔]
    at_least 2 [ addr_shared_vkh1zxt0uvrza94h3hv4jpv0ttddgnwkvdgeyq8jf9w30mcs6y8w3nq, addr_shared_vkh1y3zl4nqgm96ankt96dsdhc86vd5geny0wr7hu8cpzdfcqskq2cp, active_from 10, active_until 25] => Validated. [✔]
    at_least 2 [ addr_shared_vkh1zxt0uvrza94h3hv4jpv0ttddgnwkvdgeyq8jf9w30mcs6y8w3nq, addr_shared_vkh1y3zl4nqgm96ankt96dsdhc86vd5geny0wr7hu8cpzdfcqskq2cp, active_from 6, active_until 15] => Validated. [✔]
    at_least 2 [ addr_shared_vkh1zxt0uvrza94h3hv4jpv0ttddgnwkvdgeyq8jf9w30mcs6y8w3nq, addr_shared_vkh1y3zl4nqgm96ankt96dsdhc86vd5geny0wr7hu8cpzdfcqskq2cp, active_from 6, active_until 25] => Validated. [✔]
    all [] => Validated. [✔]
    any [ addr_shared_vkh1zxt0uvrza94h3hv4jpv0ttddgnwkvdgeyq8jf9w30mcs6y8w3nq, addr_shared_vkh1y3zl4nqgm96ankt96dsdhc86vd5geny0wr7hu8cpzdfcqskq2cp, active_from a] => Malformed [✔]
    all [] => NotRecommended EmptyList [✔]
    at_least 2 [ active_from 11, active_until 25] => Validated. [✔]
    at_least 2 [ addr_shared_vkh1zxt0uvrza94h3hv4jpv0ttddgnwkvdgeyq8jf9w30mcs6y8w3nq, active_from 11, active_until 25] => Validated. [✔]
    at_least 2 [ addr_shared_vkh1zxt0uvrza94h3hv4jpv0ttddgnwkvdgeyq8jf9w30mcs6y8w3nq, active_from 11, active_until 25] => NotRecommended ListTooSmall [✔]
    at_least 2 [ addr_shared_vkh1zxt0uvrza94h3hv4jpv0ttddgnwkvdgeyq8jf9w30mcs6y8w3nq, active_from 11, active_until 25, active_until 30] => Validated. [✔]
    at_least 1 [ addr_shared_vkh1zxt0uvrza94h3hv4jpv0ttddgnwkvdgeyq8jf9w30mcs6y8w3nq, active_from 11, active_until 25, active_until 30] => NotRecommended RedundantTimelocks [✔]
    any [ addr_shared_vkh1zxt0uvrza94h3hv4jpv0ttddgnwkvdgeyq8jf9w30mcs6y8w3nq, addr_shared_vkh1y3zl4nqgm96ankt96dsdhc86vd5geny0wr7hu8cpzdfcqskq2cp, addr_shared_vkh1y3zl4nqgm96ankt96dsdhc86vd5geny0wr7hu8cpzdfcqskq2cp] => Validated. [✔]
    any [ addr_shared_vkh1zxt0uvrza94h3hv4jpv0ttddgnwkvdgeyq8jf9w30mcs6y8w3nq, addr_shared_vkh1y3zl4nqgm96ankt96dsdhc86vd5geny0wr7hu8cpzdfcqskq2cp, addr_shared_vkh1y3zl4nqgm96ankt96dsdhc86vd5geny0wr7hu8cpzdfcqskq2cp] => NotRecommended DuplicateSignatures [✔]
    at_least 0 [ addr_shared_vkh1zxt0uvrza94h3hv4jpv0ttddgnwkvdgeyq8jf9w30mcs6y8w3nq, addr_shared_vkh1y3zl4nqgm96ankt96dsdhc86vd5geny0wr7hu8cpzdfcqskq2cp ] => Validated. [✔]
    at_least 0 [ addr_shared_vkh1zxt0uvrza94h3hv4jpv0ttddgnwkvdgeyq8jf9w30mcs6y8w3nq, addr_shared_vkh1y3zl4nqgm96ankt96dsdhc86vd5geny0wr7hu8cpzdfcqskq2cp ] => NotRecommended MZero [✔]
    any [ addr_shared_vkh1zxt0uvrza94h3hv4jpv0ttddgnwkvdgeyq8jf9w30mcs6y8w3nq, stake_shared_vkh1nqc00hvlc6cq0sfhretk0rmzw8dywmusp8retuqnnxzajtzhjg5] => NotUniformKeyType [✔]
    at_least 1 [ addr_shared_vkh1zxt0uvrza94h3hv4jpv0ttddgnwkvdgeyq8jf9w30mcs6y8w3nq, stake_shared_vkh1nqc00hvlc6cq0sfhretk0rmzw8dywmusp8retuqnnxzajtzhjg5 ] => NotUniformKeyType [✔]
    all [ drep15k6929drl7xt0spvudgcxndryn4kmlzpk4meed0xhqe25nle07s, active_from 5001] => Validated. [✔]
    all [ cc_cold1lmaet9hdvu9d9jvh34u0un4ndw3yewaq5ch6fnwsctw02xxwylj, active_from 5001] => Validated. [✔]
    all [ cc_hot17mffcrm3vnfhvyxt7ea3y65e804jfgrk6pjn78aqd9vg7xpq8dv, active_from 5001] => Validated. [✔]
    any [ drep15k6929drl7xt0spvudgcxndryn4kmlzpk4meed0xhqe25nle07s, all [ active_from 5001, active_until 6001]] => Validated. [✔]
    any [ cc_cold1lmaet9hdvu9d9jvh34u0un4ndw3yewaq5ch6fnwsctw02xxwylj, all [ active_from 5001, active_until 6001]] => Validated. [✔]
    any [ cc_hot17mffcrm3vnfhvyxt7ea3y65e804jfgrk6pjn78aqd9vg7xpq8dv, all [ active_from 5001, active_until 6001]] => Validated. [✔]
Options.Applicative.Derivation
  DerivationIndex
    invalid soft derivation index [✔]
    invalid hard derivation index [✔]
    toString . fromString @ DerivationIndex [✔]
      +++ OK, passed 100 tests.
  DerivationPath
    empty derivation path [✔]
    toString . fromString @ DerivationPath [✔]
      +++ OK, passed 100 tests.
System.IO.Extra
  hGetBytes
    MyString => bech321f4u4xarjd9hxwrhhlr2 [✔]
    MyString => 4d79537472696e67 [✔]
    MyString => DxbTmqWepdC [✔]
    invalid encoding; bech321aaaaaaaaaaaaaaaa [✔]
    invalid encoding; bech321f4u4xarjd9hxwrhö [✔]
    invalid encoding; �� [✔]
  markCharsRedAtIndices
    generates strings of expected length [✔]
      +++ OK, passed 100 tests; 18 discarded.
    all red chars correspond to indices [✔]
      +++ OK, passed 100 tests.
  hGetXPrv
    roundtrip: hGetXPrv vs hPutBytes [✔]
      +++ OK, passed 1000 tests.
  hGetXPub
    roundtrip: hGetXPub vs hPutBytes [✔]
      +++ OK, passed 1000 tests.
  hGetXP__
    roundtrip: hGetXP__ vs hPutBytes [✔]
      +++ OK, passed 1000 tests.

Finished in 53.9768 seconds
357 examples, 0 failures
buildPhase completed in 54 seconds