Keccak V Genesis Testing

     ..::[ Diana Coman's Keccak V Genesis ]::..

  Recently, diana_coman created a V Genesis of my vtron.  Up until this
point, it had been distributed in non-Vtronic form, as a simple tarball.  This
step to make it into a Genesis is important and necessary.  I applaud
diana_coman for taking the initiative.  diana_coman utilized my vtron version
V99994 [signature] as the Genesis [signature].  Additionally, she provides
a vpatch [signature] of the changes between V99994 and V99993 (the latest
release from mod6 on 2018.02.22).  Furthermore, there is a third vpatch
[signature] she released that alters my vtron to utilize keccak tools.  Lastly,
there is a Keccak V Starter Kit [signature] that is bundled up as well.

  The change to move to using the keccak tools is an important milestone as
TMSR~ breaks away from the heathen hashing algorithms, to using it's own Keccak
Tools.

  With excitement to try out the new vtree with the corresponding changes, I
went ahead and downloaded all the aforementioned files and setup a sandbox
to try it out.  What follows here is recreation of diana_coman's vpatches
for validation purposes, the building of diana_coman's Keccak Vtron, and a small
bit of happy-path testing.

This post will basically consist of the following parts:

  0x01: Setting Up Our Test Sandbox
  0x02: Vpatch Validation
  0x03: Building Keccak Vtron

0x01]: Setting Up Our Test Sandbox

// Let's create a sandbox directory to contain all of this:

mod6@gentoo ~ $ mkdir v_keccak
mod6@gentoo ~ $ cd v_keccak/

// Next, let's download all of the vpatches and seals from diana_coman's Ossasepia:

mod6@gentoo ~/v_keccak $ curl -sL "http://ossasepia.com/vpatches/v_mod6_genesis.vpatch" -O
mod6@gentoo ~/v_keccak $ curl -sL "http://ossasepia.com/vpatches/v_mod6_genesis.vpatch.diana_coman.sig" -O
mod6@gentoo ~/v_keccak $ curl -sL "http://ossasepia.com/vpatches/v_mod6_99993.vpatch" -O
mod6@gentoo ~/v_keccak $ curl -sL "http://ossasepia.com/vpatches/v_mod6_99993.vpatch.diana_coman.sig" -O
mod6@gentoo ~/v_keccak $ curl -sL "http://ossasepia.com/vpatches/v_keccak_vtools.vpatch" -O
mod6@gentoo ~/v_keccak $ curl -sL "http://ossasepia.com/vpatches/v_keccak_vtools.vpatch.diana_coman.sig" -O
mod6@gentoo ~/v_keccak $ curl -sL "http://ossasepia.com/vpatches/starter_v.zip" -O
mod6@gentoo ~/v_keccak $ curl -sL "http://ossasepia.com/vpatches/starter_v.zip.diana_coman.sig" -O

// Let's put everything where it's supposed to go in true vtron style;
// vptaches in 'patches', signature files in '.seals, and pubkeys in '.wot'

mod6@gentoo ~/v_keccak $ mkdir .wot

// Let's check, see what we're working with.
mod6@gentoo ~/v_keccak $ ls
starter_v.zip                  v_keccak_vtools.vpatch.diana_coman.sig  v_mod6_genesis.vpatch
starter_v.zip.diana_coman.sig  v_mod6_99993.vpatch                     v_mod6_genesis.vpatch.diana_coman.sig
v_keccak_vtools.vpatch         v_mod6_99993.vpatch.diana_coman.sig

// Move the vpatches into 'patches'
mod6@gentoo ~/v_keccak $ mv *.vpatch patches/
mod6@gentoo ~/v_keccak $ ls patches/
v_keccak_vtools.vpatch  v_mod6_99993.vpatch  v_mod6_genesis.vpatch

// Move the signatures into '.seals'
mod6@gentoo ~/v_keccak $ mv *.vpatch.diana_coman.sig .seals/
mod6@gentoo ~/v_keccak $ ls .seals/
v_keccak_vtools.vpatch.diana_coman.sig  v_mod6_99993.vpatch.diana_coman.sig  v_mod6_genesis.vpatch.diana_coman.sig

// Let's verify all of the files and their signatures:
mod6@gentoo ~/v_keccak $ for i in `ls patches`; do echo "Vpatch: patches/$i" && gpg --verify .seals/$i.diana_coman.sig patches/$i; done
Vpatch: patches/v_keccak_vtools.vpatch
gpg: Signature made Wed Nov 14 10:35:28 2018  using RSA key ID 390F999E
gpg: Good signature from "Diana Coman <office@dianacoman.com>"
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: E72D CCB7 3A5E 0669 4C5C  D781 D519 6EE6 390F 999E
Vpatch: patches/v_mod6_99993.vpatch
gpg: Signature made Wed Nov 14 10:06:15 2018  using RSA key ID 390F999E
gpg: Good signature from "Diana Coman <office@dianacoman.com>"
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: E72D CCB7 3A5E 0669 4C5C  D781 D519 6EE6 390F 999E
Vpatch: patches/v_mod6_genesis.vpatch
gpg: Signature made Tue Nov 13 20:10:22 2018  using RSA key ID 390F999E
gpg: Good signature from "Diana Coman <office@dianacoman.com>"
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: E72D CCB7 3A5E 0669 4C5C  D781 D519 6EE6 390F 999E
mod6@gentoo ~/v_keccak $ gpg --verify starter_v.zip.diana_coman.sig starter_v.zip
gpg: Signature made Wed Nov 14 10:39:50 2018  using RSA key ID 390F999E
gpg: Good signature from "Diana Coman <office@dianacoman.com>"
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: E72D CCB7 3A5E 0669 4C5C  D781 D519 6EE6 390F 999E

// Place diana_coman's pubkey in .wot
mod6@gentoo ~/v_keccak $ cp ~/pubkeys/diana_coman.asc .wot

---------------------------------------------------------------------------------

0x02]: Vpatch Validation

// Let's setup another little sandbox to replicate the vpatches diana_coman created:
mod6@gentoo ~/v_keccak $ mkdir check_diffs
mod6@gentoo ~/v_keccak $ cd check_diffs/
mod6@gentoo ~/v_keccak/check_diffs $ mkdir -p v99994 v99993

// Let's grab my published Vtrons from The Bitcoin Foundation website:
mod6@gentoo ~/v_keccak/check_diffs $ cd v99994; curl -sL "http://thebitcoin.foundation/v/V-20170317.tar.gz" -O ; curl -sL "http://thebitcoin.foundation/v/V-20170317.tar.gz.mod6.sig" -O ; cd ..
mod6@gentoo ~/v_keccak/check_diffs $ cd v99993; curl -sL "http://thebitcoin.foundation/v/V-20180222.tar.gz" -O ; curl -sL "http://thebitcoin.foundation/v/V-20180222.tar.gz.mod6.sig" -O ; cd ..

// Always check the signatures!
mod6@gentoo ~/v_keccak/check_diffs $ gpg --verify v99994/V-20170317.tar.gz.mod6.sig v99994/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) <modsix@gmail.com>"
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 ~/v_keccak/check_diffs $ gpg --verify v99993/V-20180222.tar.gz.mod6.sig v99993/V-20180222.tar.gz
gpg: Signature made Thu Feb 22 21:19:30 2018  using RSA key ID B71EADAF
gpg: Good signature from "mod6 (mod6) <modsix@gmail.com>"
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

// Extract the tarballs into their respective directories
mod6@gentoo ~/v_keccak/check_diffs $ for i in `ls`; do cd $i; tar -xf V-201*.tar.gz; cd ..; done

// Start by going to the v99994 (older version from 2017.03.17)
mod6@gentoo ~/v_keccak/check_diffs $ cd v99994

// Let's match up the directory structure with diana_coman's: Add a 'v' subdir:
mod6@gentoo ~/v_keccak/check_diffs/v99994 $ mkdir -p a/v b/v

// Let's add all of the included files in diana_coman's 'v_mod6_genesis.vpatch':
mod6@gentoo ~/v_keccak/check_diffs/v99994 $ cp v.pl v_quick_start.txt v_users_manual.txt b/v/

// Now diff them with vdiff into their own output vpatch '99994_genesis.vpatch'
mod6@gentoo ~/v_keccak/check_diffs/v99994 $ vdiff a b > 99994_genesis.vpatch

// Finally, vdiff our genesis '99994_genesis.vpatch' to diana_coman's genesis 'v_mod6_genesis.vpatch'
mod6@gentoo ~/v_keccak/check_diffs/v99994 $ vdiff ../../patches/v_mod6_genesis.vpatch 99994_genesis.vpatch
mod6@gentoo ~/v_keccak/check_diffs/v99994 $

// Matches perfectly.  Excellent!

// Next let's create our own diff of v99994 to v99993 and compare it to diana_coman's:
mod6@gentoo ~/v_keccak/check_diffs/v99994 $ cd ../v99993

// Make our compare directories
mod6@gentoo ~/v_keccak/check_diffs/v99993 $ mkdir -p a/v b/v

// Let's copy in our v99994 files into 'a/v' (the old)
mod6@gentoo ~/v_keccak/check_diffs/v99993 $ cp -pv ../v99994/{v.pl,v_quick_start.txt,v_users_manual.txt} a/v
'../v99994/v.pl' -> 'a/v/v.pl'
'../v99994/v_quick_start.txt' -> 'a/v/v_quick_start.txt'
'../v99994/v_users_manual.txt' -> 'a/v/v_users_manual.txt'

// Let's copy in our v99993 files into 'b/v' (the new)
mod6@gentoo ~/v_keccak/check_diffs/v99993 $ cp -pv v.pl v_quick_start.txt v_users_manual.txt b/v
'v.pl' -> 'b/v/v.pl'
'v_quick_start.txt' -> 'b/v/v_quick_start.txt'
'v_users_manual.txt' -> 'b/v/v_users_manual.txt'

// Let's diff them with vdiff into our own output vpatch 'v99994_v99993.vpatch'
mod6@gentoo ~/v_keccak/check_diffs/v99993 $ vdiff a b > v99994_v99993.vpatch

// Finally vdiff my vpatch 'v99994_v99993.vpatch' against diana's distributed vpatch 'v_mod6_v99993.vpatch'
mod6@gentoo ~/v_keccak/check_diffs/v99993 $ vdiff ../../patches/v_mod6_99993.vpatch v99994_v99993.vpatch
mod6@gentoo ~/v_keccak/check_diffs/v99993 $

// Matches perfectly.  Excellent!

---------------------------------------------------------------------------------

0x03]: Building Keccak Vtron

// Unpack starter_v.zip (Archive and corresponding seal, already verified in section 0x02).

// Check which Ada version we have installed
mod6@gentoo ~/v_keccak $ gprbuild --version
GPRBUILD GPL 2015 (20150428) (x86_64-pc-linux-gnu)
Copyright (C) 2004-2015, Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

mod6@gentoo ~/v_keccak $ gnat --version
GNAT GPL 2015 (20150428-49)
Copyright (C) 1996-2015, Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

mod6@gentoo ~/v_keccak $ unzip starter_v.zip
Archive:  starter_v.zip
   creating: starter_v/
  inflating: starter_v/clean.sh
  inflating: starter_v/build.sh
   creating: starter_v/vtools/
  inflating: starter_v/vtools/vdiff.gpr
  inflating: starter_v/vtools/vpatch.gpr
  inflating: starter_v/vtools/Makefile
  inflating: starter_v/vtools/ksum.gpr
  inflating: starter_v/vtools/manifest
   creating: starter_v/v/
  inflating: starter_v/v/v.pl
  inflating: starter_v/v/v_quick_start.txt
  inflating: starter_v/v/manifest
   creating: starter_v/vtools/src/
  inflating: starter_v/vtools/src/bits.ads
  inflating: starter_v/vtools/src/keccak_c.adb
  inflating: starter_v/vtools/src/vpatch.adb
  inflating: starter_v/vtools/src/dir.c
  inflating: starter_v/vtools/src/util.c
  inflating: starter_v/vtools/src/keccak.h
  inflating: starter_v/vtools/src/diff.h
  inflating: starter_v/vtools/src/bits.adb
  inflating: starter_v/vtools/src/character_io.ads
  inflating: starter_v/vtools/src/context.c
  inflating: starter_v/vtools/src/smg_keccak.adb
  inflating: starter_v/vtools/src/character_io.adb
  inflating: starter_v/vtools/src/ksum.adb
  inflating: starter_v/vtools/src/analyze.c
  inflating: starter_v/vtools/src/keccak_c.ads
  inflating: starter_v/vtools/src/io.c
  inflating: starter_v/vtools/src/diff.c
  inflating: starter_v/vtools/src/smg_keccak.ads
  inflating: starter_v/vtools/src/system.h
   creating: starter_v/vtools/lib/
  inflating: starter_v/vtools/lib/hash.c
  inflating: starter_v/vtools/lib/cmpbuf.c
  inflating: starter_v/vtools/lib/progname.c
  inflating: starter_v/vtools/lib/filetype.h
  inflating: starter_v/vtools/lib/xalloc.c
  inflating: starter_v/vtools/lib/dirname.h
  inflating: starter_v/vtools/lib/filetype.c
  inflating: starter_v/vtools/lib/progname.h
  inflating: starter_v/vtools/lib/cmpbuf.h
  inflating: starter_v/vtools/lib/error.h
  inflating: starter_v/vtools/lib/error.c
  inflating: starter_v/vtools/lib/filenamecat.c
  inflating: starter_v/vtools/lib/dirname.c
  inflating: starter_v/vtools/lib/diffseq.h
  inflating: starter_v/vtools/lib/hash.h
  inflating: starter_v/vtools/lib/filenamecat.h
  inflating: starter_v/vtools/lib/xalloc.h
   creating: starter_v/vtools/obj/
 extracting: starter_v/vtools/obj/readme
mod6@gentoo ~/v_keccak $ cd starter_v
mod6@gentoo ~/v_keccak/starter_v $ ls
build.sh  clean.sh  v  vtools
mod6@gentoo ~/v_keccak/starter_v $ chmod +x build.sh
mod6@gentoo ~/v_keccak/starter_v $ ./build.sh
gcc -c diff.c
gcc -c progname.c
gcc -c dirname.c
gcc -c hash.c
gcc -c cmpbuf.c
gcc -c filenamecat.c
gcc -c filetype.c
gcc -c error.c
gcc -c xalloc.c
gcc -c dir.c
gcc -c analyze.c
gcc -c util.c
gcc -c context.c
gcc -c io.c
gcc -c bits.adb
gcc -c ksum.adb
gcc -c character_io.adb
gcc -c keccak_c.adb
gcc -c smg_keccak.adb
gprbind diff.bexch
gnatbind bits.ali ... -n
gcc -c b__diff.adb
ar cr libvdiff.a ...
ranlib libvdiff.a
gcc diff.o -o vdiff
gcc -c vpatch.adb
gprbind vpatch.bexch
gnatbind vpatch.ali
gcc -c b__vpatch.adb
gcc vpatch.o -o vpatch
vpatch.o: In function `vpatch__temp_file_name.3044':
vpatch.adb:(.text+0xbb1): warning: the use of `mktemp' is dangerous, better use `mkstemp'
gprbind ksum.bexch
gnatbind ksum.ali
gcc -c b__ksum.adb
gcc ksum.o -o ksum
Done.

// Compile complete.

mod6@gentoo ~/v_keccak/starter_v $ ls
build.sh  clean.sh  ksum  v  vdiff  vk.pl  vpatch  vtools
mod6@gentoo ~/v_keccak/starter_v $ ./vk.pl v
Dependent program not found! : vpatch

// Let's place the compiled binaries in our PATH
mod6@gentoo ~/v_keccak/starter_v $ su
Password:
gentoo starter_v # cp vdiff vpatch ksum /usr/bin/
gentoo starter_v # exit
exit

// Ok, now let's try and see if it can find the binaries it needs...
mod6@gentoo ~/v_keccak/starter_v $ ./vk.pl v
/home/mod6/v_keccak/starter_v/.wot directory does not exist.
See 'init' or 'sync' commands in 'help'.

// Ok, better!

mod6@gentoo ~/v_keccak/starter_v $ cd ..

// Let's place the version from the starter_v bundle where we can test it properly
// with keccak vpatches.

mod6@gentoo ~/v_keccak $ cp starter_v/vk.pl .
mod6@gentoo ~/v_keccak $ ./vk.pl v
################################################################################
#               ..::[ The Bitcoin Foundation: V ]::..                          #
#                                                                              #
#     Version: 99992 K                                                         #
#      Author: mod6                                                            #
# Fingerprint: 0x027A8D7C0FB8A16643720F40721705A8B71EADAF                      #
#                                                                              #
################################################################################
mod6@gentoo ~/v_keccak $ ./vk.pl p v vk v_keccak_vtools.vpatch
v_mod6_genesis.vpatch
  creating v/v.pl
  creating v/v_quick_start.txt
  creating v/v_users_manual.txt
v_mod6_99993.vpatch
  patching v/v.pl
  patching v/v_quick_start.txt
  patching v/v_users_manual.txt
v_keccak_vtools.vpatch
  patching v/v.pl
  patching v/v_quick_start.txt
  deleting v/v_users_manual.txt
mod6@gentoo ~/v_keccak $ cd vk
mod6@gentoo ~/v_keccak/vk $ ls
v
mod6@gentoo ~/v_keccak/vk $ cd v/
mod6@gentoo ~/v_keccak/vk/v $ ls
v.pl  v_quick_start.txt
mod6@gentoo ~/v_keccak/vk/v $ ksum v.pl ../../starter_v/vk.pl
115b06a799eae048ffbd18642234dc234e9bf879ebdedf0ed9b4be69a410187537b618d2b4b581954b89d1f63ef0925f9ff1ae26f0882c28f05d3a1fcdb1a732  v.pl
115b06a799eae048ffbd18642234dc234e9bf879ebdedf0ed9b4be69a410187537b618d2b4b581954b89d1f63ef0925f9ff1ae26f0882c28f05d3a1fcdb1a732  ../../starter_v/vk.pl

// Alright!  The press of diana_coman's keccak vpatches for her V genesis worked great,
// and produced the same ksum (keccak sum) as the original from the starter_v.zip archive.

----------------------------------------------

That's all for now, if or when I do some more work surrounding `vk.pl`, I'll
write it up and make another blog post about it.

Leave a Reply