test: Use byte unit 'M' for -maxuploadtarget functional test #23648

pull dougEfresh wants to merge 1 commits into bitcoin:master from dougEfresh:test-byteunit-maxuploadtarget changing 1 files +1 −1
  1. dougEfresh commented at 11:19 AM on December 2, 2021: contributor

    No description provided.

  2. DrahtBot added the label Tests on Dec 2, 2021
  3. shaavan commented at 6:39 AM on December 8, 2021: contributor

    I agree with the PR’s idea, but IMO this test would be redundant as the condition is being added. Because:

    So, though I agree with the idea, I think this PR is redundant.

  4. dougEfresh commented at 1:28 PM on December 8, 2021: contributor

    So, though I agree with the idea, I think this PR is redundant.

    Think of this as a sanity check. It may seem redundant now, but as time goes on and more code is added this may catch some edge case not known today. Lastly, the cost is about 1 second more of testing time.

  5. MarcoFalke commented at 1:35 PM on December 8, 2021: member

    The arg is used twice in the test, if you pass M once and not the other time, you get the same coverage at twice the speed?

  6. dougEfresh commented at 4:44 PM on December 8, 2021: contributor

    The arg is used twice in the test, if you pass M once and not the other time, you get the same coverage at twice the speed?

    My main intent of this PR is to verify ParseByteUnits is call within init.cpp:

    https://github.com/bitcoin/bitcoin/blob/099325a7594f8187f9067d5bff8390084cceb9dd/src/init.cpp#L1113-L1117

    And that 1 and 1M behave the same (that the default byte unit is M).

    If 1M is sufficient, I'm fine using just this.

  7. MarcoFalke commented at 4:47 PM on December 8, 2021: member

    You can also pick one randomly on the random seed, to converge to the same test coverage at no runtime cost.

  8. dougEfresh force-pushed on Dec 8, 2021
  9. dougEfresh renamed this:
    test: Add functional test for -maxuploadtarget with byte unit '1M'
    test: Use '1M' for -maxuploadtarget feature functional test
    on Dec 8, 2021
  10. dougEfresh commented at 6:17 PM on December 8, 2021: contributor

    I now see what you are saying. I changed it to to simply change 1 to 1M

  11. shaavan commented at 7:26 AM on December 9, 2021: contributor

    Changes since my last review:

    • Updated PR, so that now instead of checking for both ‘1’ and ‘1M’ the test now checks only for ‘1M’

    I tried to wrap my head around this change, but I seemed to can’t understand one thing. How, by doing this change, are we able to check this condition:

    that 1 and 1M behave the same (that the default byte unit is M). @dougEfresh. It would be pretty helpful to add the logic behind the recent changes done to this PR in the PR’s description. Thank you.

  12. dougEfresh commented at 9:00 AM on December 9, 2021: contributor

    that 1 and 1M behave the same (that the default byte unit is M).

    You are correct, this isn't validating this condition. I think it makes more sense to put the byte unit on the 800 :

    https://github.com/bitcoin/bitcoin/blob/529ed3336205e30d94e741a4eb93dd945ad518e7/test/functional/feature_maxuploadtarget.py#L38-L41

    As you mentioned early there are enough unit tests to validate parsing and amounts...etc

    By using 800M I validate byte units don't crash bitcoind, while leaving 1 would be validating that the default byte unit is M

    I think that's good enough, what you think?

  13. shaavan commented at 8:17 AM on December 10, 2021: contributor

    By using 800M I validate byte units don't crash bitcoind, while leaving 1 would be validating that the default byte unit is M

    That sounds like a better idea. This would also make sure using the M suffix is working correctly, along with other advantages you mentioned. So if I am correct, the ultimate patch would look something like this:

    diff: master..PR

    self.extra_args = [[
    -            "-maxuploadtarget=800",
    +            "-maxuploadtarget=800M",
                 "-acceptnonstdtxn=1",
             ]]
    
  14. test: Use byte unit 'M' for -maxuploadtarget functional test 41b9f7d062
  15. dougEfresh force-pushed on Dec 10, 2021
  16. dougEfresh renamed this:
    test: Use '1M' for -maxuploadtarget feature functional test
    test: Use byte unit 'M' for -maxuploadtarget functional test
    on Dec 10, 2021
  17. dougEfresh commented at 6:44 PM on December 10, 2021: contributor

    @shaavan correct.

    41b9f7d062a01cf39b6dba02703213ffb1951a37 reflects this change

  18. shaavan approved
  19. shaavan commented at 8:01 AM on December 11, 2021: contributor

    ACK 41b9f7d062a01cf39b6dba02703213ffb1951a37

  20. stratospher commented at 3:01 PM on December 13, 2021: contributor

    ACK 41b9f7d.

  21. MarcoFalke merged this on Dec 13, 2021
  22. MarcoFalke closed this on Dec 13, 2021

  23. sidhujag referenced this in commit 105451effe on Dec 13, 2021
  24. DrahtBot locked this on Dec 13, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-29 03:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me