Changes Made to V in version 99993


Defect Uncovered In Press Path Calculation

During diana_coman's creation of eucrypt, a defect was uncovered in V version 99993 (also mentioned here).

High level examination shows if the vpatch flow is used to feed the press operation, a possible situation where you want to press up to a given HEAD, also ends up pressing the sibling leaves to the HEAD, even if you didn't want the siblings pressed. This is due to feeding the entire vpatch flow into the press operation.

Let's start by replication of the defect.

Outline: Setup V (99994) with diana_coman's pgp key, corresponding vpatches, and seals.

    mod6@gentoo ~ $ mkdir eucrypt
    mod6@gentoo ~ $ cd eucrypt/
    mod6@gentoo ~/eucrypt $ ls
    mod6@gentoo ~/eucrypt $ curl -sL "http://dianacoman.com/vpatches/eucrypt_genesis.vpatch" -O
    mod6@gentoo ~/eucrypt $ curl -sL "http://dianacoman.com/vpatches/eucrypt_genesis.vpatch.diana_coman.sig" -O
    mod6@gentoo ~/eucrypt $ curl -sL "http://dianacoman.com/vpatches/ch1_mpi.vpatch" -O
    mod6@gentoo ~/eucrypt $ curl -sL "http://dianacoman.com/vpatches/ch1_mpi.vpatch.diana_coman.sig" -O
    mod6@gentoo ~/eucrypt $ curl -sL "http://dianacoman.com/vpatches/ch2_truerandom.vpatch" -O
    mod6@gentoo ~/eucrypt $ curl -sL "http://dianacoman.com/vpatches/ch2_truerandom.vpatch.diana_coman.sig" -O
    mod6@gentoo ~/eucrypt $ curl -sL "http://dianacoman.com/vpatches/diana_coman.asc" -O
    mod6@gentoo ~/eucrypt $ curl -sL "http://dianacoman.com/vpatches/eucrypt_mpi_fix_copy_incr.vpatch" -O
    mod6@gentoo ~/eucrypt $ curl -sL "http://dianacoman.com/vpatches/eucrypt_mpi_fix_copy_incr.vpatch.diana_coman.sig" -O
    mod6@gentoo ~/eucrypt $ curl -sL "http://thebitcoin.foundation/v/V-20170317.tar.gz" -O 
    mod6@gentoo ~/eucrypt $ curl -sL "http://thebitcoin.foundation/v/V-20170317.tar.gz.mod6.sig" -O
    mod6@gentoo ~/eucrypt $ gpg --verify V-20170317.tar.gz.mod6.sig V-20170317.tar.gz
    gpg: Signature made Fri Mar 17 19:25:29 2017  using RSA key ID B71EADAF
    gpg: Good signature from "mod6 (mod6) "
    gpg: WARNING: This key is not certified with a trusted signature!
    gpg:          There is no indication that the signature belongs to the owner.
    Primary key fingerprint: 027A 8D7C 0FB8 A166 4372  0F40 7217 05A8 B71E ADAF
    mod6@gentoo ~/eucrypt $ tar -xf V-20170317.tar.gz
    mod6@gentoo ~/eucrypt $ mkdir -p .wot .seals patches
    mod6@gentoo ~/eucrypt $ mv diana_coman.asc .wot ; mv *.diana_coman.sig .seals ; mv *.vpatch patches
    mod6@gentoo ~/eucrypt $ ./v.pl v
    ################################################################################
    #               ..::[ The Bitcoin Foundation: V ]::..                          #
    #                                                                              #
    #     Version: 99994 K                                                         #
    #      Author: mod6                                                            #
    # Fingerprint: 0x027A8D7C0FB8A16643720F40721705A8B71EADAF                      #
    #                                                                              #
    ################################################################################
    mod6@gentoo ~/eucrypt $ ./v.pl w
    diana_coman:E72DCCB73A5E06694C5CD781D5196EE6390F999E:Diana Coman 
    mod6@gentoo ~/eucrypt $ ./v.pl f
    eucrypt_genesis.vpatch (diana_coman)
    ch1_mpi.vpatch (diana_coman)
    eucrypt_mpi_fix_copy_incr.vpatch (diana_coman)
    ch2_truerandom.vpatch (diana_coman)
    mod6@gentoo ~/eucrypt $ ./v.pl r
    Root: eucrypt_genesis.vpatch (diana_coman)
    mod6@gentoo ~/eucrypt $ ./v.pl l
    Leaf: ch2_truerandom.vpatch (diana_coman)
    Leaf: eucrypt_mpi_fix_copy_incr.vpatch (diana_coman)
    

Now we're all set here. You can see where we're going to get into trouble from the flow. If the user should want to press up through 'ch2_truerandom.vpatch', 'eucrypt_mpi_fix_copy_incr.vpatch' will also, incorrectly, be pressed.

From the above shell commands we can see that there are two leaves: 'ch2_truerandom.vpatch' and 'eucrypt_mpi_fix_copy_incr.vpatch'.

Here is a graph of the eucrypt tree generated by the vtron:



Proposed Fix

The correct fix for this problem is not to use the flow as the list of vpatches to press. Instead, build a calculated press path list by recursively traversing the vtree for all of the given HEAD's antecedents and finally, topologically sorting them.



Defect Replication and Resolution

To demonstrate this change and it's impact let's try it out on our eucrypt test case.

    mod6@gentoo ~/eucrypt $ ./v.pl v 
    ################################################################################
    #               ..::[ The Bitcoin Foundation: V ]::..                          #
    #                                                                              #
    #     Version: 99993 K                                                         #
    #      Author: mod6                                                            #
    # Fingerprint: 0x027A8D7C0FB8A16643720F40721705A8B71EADAF                      #
    #                                                                              #
    ################################################################################
    mod6@gentoo ~/eucrypt $ ./v.pl w
    diana_coman:E72DCCB73A5E06694C5CD781D5196EE6390F999E:Diana Coman 
    mod6@gentoo ~/eucrypt $ ./v.pl f
    eucrypt_genesis.vpatch (diana_coman)
    ch1_mpi.vpatch (diana_coman)
    eucrypt_mpi_fix_copy_incr.vpatch (diana_coman)
    ch2_truerandom.vpatch (diana_coman)
    mod6@gentoo ~/eucrypt $ ./v.pl pp ch2_truerandom.vpatch
    eucrypt_genesis.vpatch (diana_coman)
    ch1_mpi.vpatch (diana_coman)
    ch2_truerandom.vpatch (diana_coman)
    mod6@gentoo ~/eucrypt $ ./v.pl pp eucrypt_mpi_fix_copy_incr.vpatch
    eucrypt_genesis.vpatch (diana_coman)
    ch1_mpi.vpatch (diana_coman)
    eucrypt_mpi_fix_copy_incr.vpatch (diana_coman)
    mod6@gentoo ~/eucrypt $ ./v.pl p v ch2 ch2_truerandom.vpatch
    eucrypt_genesis.vpatch  
      patching file eucrypt/mpi/README
      patching file eucrypt/README
      patching file eucrypt/smg_comm/README
      patching file eucrypt/smg_keccak/README
      patching file eucrypt/smg_rsa/README
      patching file eucrypt/smg_serpent/README
    ch1_mpi.vpatch
      patching file eucrypt/mpi/bin/README
      patching file eucrypt/mpi/COPYING
      patching file eucrypt/mpi/include/knobs.h
      patching file eucrypt/mpi/include/longlong.h
      patching file eucrypt/mpi/include/memory.h
      patching file eucrypt/mpi/include/mpi.h
      patching file eucrypt/mpi/include/mpi-inline.h
      patching file eucrypt/mpi/include/mpi-internal.h
      patching file eucrypt/mpi/include/types.h
      patching file eucrypt/mpi/include/util.h
      patching file eucrypt/mpi/Makefile
      patching file eucrypt/mpi/memory.c
      patching file eucrypt/mpi/mpi-add.c
      patching file eucrypt/mpi/mpi-bit.c
      patching file eucrypt/mpi/mpi-cmp.c
      patching file eucrypt/mpi/mpicoder.c
      patching file eucrypt/mpi/mpi-div.c
      patching file eucrypt/mpi/mpi-gcd.c
      patching file eucrypt/mpi/mpih-add1.c
      patching file eucrypt/mpi/mpih-cmp.c
      patching file eucrypt/mpi/mpih-div.c
      patching file eucrypt/mpi/mpih-lshift.c
      patching file eucrypt/mpi/mpih-mul1.c
      patching file eucrypt/mpi/mpih-mul2.c
      patching file eucrypt/mpi/mpih-mul3.c
      patching file eucrypt/mpi/mpih-mul.c
      patching file eucrypt/mpi/mpih-rshift.c
      patching file eucrypt/mpi/mpih-sub1.c
      patching file eucrypt/mpi/mpi-inline.c
      patching file eucrypt/mpi/mpi-inv.c
      patching file eucrypt/mpi/mpi-mpow.c
      patching file eucrypt/mpi/mpi-mul.c
      patching file eucrypt/mpi/mpi-pow.c
      patching file eucrypt/mpi/mpi-scan.c
      patching file eucrypt/mpi/mpiutil.c
      patching file eucrypt/mpi/obj/README
      patching file eucrypt/mpi/README
      patching file eucrypt/mpi/secmem.c
      patching file eucrypt/mpi/tests/Makefile
      patching file eucrypt/mpi/tests/test_mpi.c
    ch2_truerandom.vpatch   
      patching file eucrypt/mpi/README
      patching file eucrypt/smg_rsa/bin/README
      patching file eucrypt/smg_rsa/include/knobs.h
      patching file eucrypt/smg_rsa/include/smg_rsa.h
      patching file eucrypt/smg_rsa/Makefile
      patching file eucrypt/smg_rsa/obj/README
      patching file eucrypt/smg_rsa/README
      patching file eucrypt/smg_rsa/tests/Makefile
      patching file eucrypt/smg_rsa/tests/tests.c
      patching file eucrypt/smg_rsa/truerandom.c


    mod6@gentoo ~/eucrypt $ ./v.pl p v ch1_with_mpi_fix_copy eucrypt_mpi_fix_copy_incr.vpatch
    eucrypt_genesis.vpatch  
      patching file eucrypt/mpi/README
      patching file eucrypt/README
      patching file eucrypt/smg_comm/README
      patching file eucrypt/smg_keccak/README
      patching file eucrypt/smg_rsa/README
      patching file eucrypt/smg_serpent/README
    ch1_mpi.vpatch
      patching file eucrypt/mpi/bin/README
      patching file eucrypt/mpi/COPYING
      patching file eucrypt/mpi/include/knobs.h
      patching file eucrypt/mpi/include/longlong.h
      patching file eucrypt/mpi/include/memory.h
      patching file eucrypt/mpi/include/mpi.h
      patching file eucrypt/mpi/include/mpi-inline.h
      patching file eucrypt/mpi/include/mpi-internal.h
      patching file eucrypt/mpi/include/types.h
      patching file eucrypt/mpi/include/util.h
      patching file eucrypt/mpi/Makefile
      patching file eucrypt/mpi/memory.c
      patching file eucrypt/mpi/mpi-add.c
      patching file eucrypt/mpi/mpi-bit.c
      patching file eucrypt/mpi/mpi-cmp.c
      patching file eucrypt/mpi/mpicoder.c
      patching file eucrypt/mpi/mpi-div.c
      patching file eucrypt/mpi/mpi-gcd.c
      patching file eucrypt/mpi/mpih-add1.c
      patching file eucrypt/mpi/mpih-cmp.c
      patching file eucrypt/mpi/mpih-div.c
      patching file eucrypt/mpi/mpih-lshift.c
      patching file eucrypt/mpi/mpih-mul1.c
      patching file eucrypt/mpi/mpih-mul2.c
      patching file eucrypt/mpi/mpih-mul3.c
      patching file eucrypt/mpi/mpih-mul.c
      patching file eucrypt/mpi/mpih-rshift.c
      patching file eucrypt/mpi/mpih-sub1.c
      patching file eucrypt/mpi/mpi-inline.c
      patching file eucrypt/mpi/mpi-inv.c
      patching file eucrypt/mpi/mpi-mpow.c
      patching file eucrypt/mpi/mpi-mul.c
      patching file eucrypt/mpi/mpi-pow.c
      patching file eucrypt/mpi/mpi-scan.c
      patching file eucrypt/mpi/mpiutil.c
      patching file eucrypt/mpi/obj/README
      patching file eucrypt/mpi/README
      patching file eucrypt/mpi/secmem.c
      patching file eucrypt/mpi/tests/Makefile
      patching file eucrypt/mpi/tests/test_mpi.c
    eucrypt_mpi_fix_copy_incr.vpatch
      patching file eucrypt/mpi/include/mpi-internal.h
      patching file eucrypt/mpi/tests/test_mpi.c
    

As you can see, with the fix implemented, when we press 'ch2' with the given head of 'ch2_truerandom.vpatch', we press the following vpatches in order:

  1. eucrypt_genesis.vpatch
  2. ch1_mpi.vpatch
  3. ch2_truerandom.vpatch

Additionally, with the fix implemented, when we press 'ch1_with_mpi_fix_copy' with the given head of 'eucrypt_mpi_fix_copy_incr.vpatch', we press the following vpatches in order:
  1. eucrypt_genesis.vpatch
  2. ch1_mpi.vpatch
  3. eucrypt_mpi_fix_copy_incr.vpatch

Additional Test Case

Let's conduct another test with the trb code base.

Outline: Using all of the trb patches currently available at thebitcoin.foundation, with only asciilifeform in the wot, press with head 'asciilifeform_add_verifyall_option.vpatch'.

    mod6@gentoo ~/sandbox-v-99993/testcase1 $ ./v.pl v
    ################################################################################
    #               ..::[ The Bitcoin Foundation: V ]::..                          #
    #                                                                              #
    #     Version: 99993 K                                                         #
    #      Author: mod6                                                            #
    # Fingerprint: 0x027A8D7C0FB8A16643720F40721705A8B71EADAF                      #
    #                                                                              #
    ################################################################################
    mod6@gentoo ~/sandbox-v-99993/testcase1 $ ./v.pl w
    asciilifeform:17215D118B7239507FAFED98B98228A001ABFFC7:Stanislav Datskovskiy 
    mod6@gentoo ~/sandbox-v-99993/testcase1 $ ./v.pl f
    genesis.vpatch (asciilifeform)
    bitcoin-asciilifeform.1.vpatch (asciilifeform)
    rm_rf_upnp.vpatch (asciilifeform)
    bitcoin-asciilifeform.3-turdmeister-alert-snip.vpatch (asciilifeform)
    bitcoin-asciilifeform.2-https_snipsnip.vpatch (asciilifeform)
    bitcoin-asciilifeform.4-goodbye-win32.vpatch (asciilifeform)
    asciilifeform_dnsseed_snipsnip.vpatch (asciilifeform)
    asciilifeform_zap_hardcoded_seeds.vpatch (asciilifeform)
    asciilifeform-kills-integer-retardation.vpatch (asciilifeform)
    asciilifeform_zap_showmyip_crud.vpatch (asciilifeform)
    asciilifeform_dns_thermonyukyoolar_kleansing.vpatch (asciilifeform)
    asciilifeform_and_now_we_have_block_dumper_corrected.vpatch (asciilifeform)
    mod6_fix_dumpblock_params.vpatch (asciilifeform)
    bitcoin-v0_5_3_1-static_makefile_v002.8.vpatch (asciilifeform)
    bitcoin-v0_5_3_1-rev_bump.7.vpatch (asciilifeform)
    asciilifeform_ver_now_5_4_and_irc_is_gone_and_now_must_give_ip.vpatch (asciilifeform)
    asciilifeform_orphanage_thermonuke.vpatch (asciilifeform)
    asciilifeform_and_now_we_have_eatblock.vpatch (asciilifeform)
    bitcoin-v0_5_3-db_config.6.vpatch (asciilifeform)
    asciilifeform_tx-orphanage_amputation.vpatch (asciilifeform)
    asciilifeform_maxint_locks_corrected.vpatch (asciilifeform)
    asciilifeform_lets_lose_testnet.vpatch (asciilifeform)
    asciilifeform_add_verifyall_option.vpatch (asciilifeform)
    
    mod6@gentoo ~/sandbox-v-99993/testcase1 $ ./v.pl pp asciilifeform_add_verifyall_option.vpatch
    genesis.vpatch (asciilifeform)
    bitcoin-asciilifeform.1.vpatch (asciilifeform)
    rm_rf_upnp.vpatch (asciilifeform)
    bitcoin-asciilifeform.2-https_snipsnip.vpatch (asciilifeform)
    bitcoin-asciilifeform.3-turdmeister-alert-snip.vpatch (asciilifeform)
    bitcoin-asciilifeform.4-goodbye-win32.vpatch (asciilifeform)
    bitcoin-v0_5_3_1-rev_bump.7.vpatch (asciilifeform)
    bitcoin-v0_5_3_1-static_makefile_v002.8.vpatch (asciilifeform)
    asciilifeform-kills-integer-retardation.vpatch (asciilifeform)
    asciilifeform_and_now_we_have_block_dumper_corrected.vpatch (asciilifeform)
    asciilifeform_dnsseed_snipsnip.vpatch (asciilifeform)
    asciilifeform_orphanage_thermonuke.vpatch (asciilifeform)
    asciilifeform_tx-orphanage_amputation.vpatch (asciilifeform)
    asciilifeform_zap_hardcoded_seeds.vpatch (asciilifeform)
    asciilifeform_zap_showmyip_crud.vpatch (asciilifeform)
    mod6_fix_dumpblock_params.vpatch (asciilifeform)
    asciilifeform_dns_thermonyukyoolar_kleansing.vpatch (asciilifeform)
    asciilifeform_ver_now_5_4_and_irc_is_gone_and_now_must_give_ip.vpatch (asciilifeform)
    asciilifeform_and_now_we_have_eatblock.vpatch (asciilifeform)
    asciilifeform_lets_lose_testnet.vpatch (asciilifeform)
    asciilifeform_add_verifyall_option.vpatch (asciilifeform)
    

From this, we can already see that the flow doesn't match the calculated press path. If we examine the above output, we can see that both 'bitcoin-v0_5_3-db_config.6.vpatch' and 'asciilifeform_maxint_locks_corrected.vpatch' are not included in the press path when the head is set to 'asciilifeform_add_verifyall_option.vpatch'. As an aid here, I have created a graph of the flow from my vtron, altered the graph by hand, setting the edges between these vpatches not included in the press path to the color red:


Let's see what our press path looks like when we set the HEAD to the other leaf, 'asciilifeform_maxint_locks_corrected.vpatch'.

    mod6@gentoo ~/sandbox-v-99993/testcase1 $ ./v.pl pp asciilifeform_maxint_locks_corrected.vpatch
    genesis.vpatch (asciilifeform)
    bitcoin-asciilifeform.1.vpatch (asciilifeform)
    rm_rf_upnp.vpatch (asciilifeform)
    bitcoin-asciilifeform.2-https_snipsnip.vpatch (asciilifeform)
    bitcoin-asciilifeform.3-turdmeister-alert-snip.vpatch (asciilifeform)
    bitcoin-asciilifeform.4-goodbye-win32.vpatch (asciilifeform)
    bitcoin-v0_5_3-db_config.6.vpatch (asciilifeform)
    asciilifeform_maxint_locks_corrected.vpatch (asciilifeform)
    

Alright, so we see that it has included all of the antecedents from the given HEAD, 'asciilifeform_maxint_locks_corrected.vpatch'. As an aid here as well, I have created a graph of the vpatch from my vtron, colorizing the excluded path in red:


Thoughts?

A change in behavior such as this needs to be reviewed. Please let me know if you have questions, or comments. And importantly, if you agree that this change is correct and that the outcomes contained within this post are accurate. Comments will be accepted in the TMSR~ chamber, #trilema.