Update test vector instructions

This commit is contained in:
Simon Warta 2021-02-21 11:48:14 +01:00
parent 733bbe6314
commit 72eb2de23e

View File

@ -10,17 +10,22 @@ my branch (which can be rebased).
## Setup
Test vectors are generated using those additions:
https://github.com/CosmWasm/cosmos-sdk/pull/58
```
git clone https://github.com/CosmWasm/cosmos-sdk.git
cd cosmos-sdk
git checkout cosmjs-test-vectors
git checkout cosmjs-test-vectors-v2
make build-simd-linux # or on OSX: make build-simd-darwin
# this takes a while to download a docker image and make a deterministic build....
# Use one of those build commands. The first one is native, the other two use a docker build container.
make build
make build-simd-linux
make build-simd-darwin
ls -l ./build/simd
ls -l ./build
./build/simd version
# I got `goz-phase-1-706-g1a67086b6` for commit `1a67086b6`
# I got `goz-phase-1-1170-g2a8d2d35d` for commit `2a8d2d35daab`
```
**IMPORTANT** this stores the proper `simd` binary in `./build/simd`. You may
@ -31,7 +36,7 @@ proper version.
## Prepare the Keys
You want to ensure you use the same keys as in the test vector,
[taken from here](https://github.com/cosmos/cosmjs/blob/db1f183/packages/proto-signing/src/signing.spec.ts#L19-L27).
[taken from here](https://github.com/cosmos/cosmjs/blob/v0.24.0-alpha.25/packages/proto-signing/src/testutils.spec.ts#L4-L12).
This uses the testgen mnemonic:
`economy stock theory fatal elder harbor betray wasp final emotion task crumble siren bottom lizard educate guess current outdoor pair theory focus wife stone`
@ -102,26 +107,29 @@ test that:
## Generating Signatures
All current test vectors were signed from account number 1, with increasing
signatures (0, 1, 2). You can produce these with the following commands:
sequences (0, 1, 2). You can produce these with the following commands:
```
# you may not need `--home /tmp` but I got an odd error without it
# you may need to add `--home /tmp` if you get errors
./build/simd tx sign --offline --sign-mode direct -a 1 -s 0 --from testgen --chain-id simd-testing unsigned_tx.json
./build/simd tx sign --home /tmp --offline --sign-mode direct -a 1 -s 1 --from testgen --chain-id simd-testing unsigned_tx.json
./build/simd tx sign --offline --sign-mode direct -a 1 -s 1 --from testgen --chain-id simd-testing unsigned_tx.json
./build/simd tx sign --offline --sign-mode direct -a 1 -s 2 --from testgen --chain-id simd-testing unsigned_tx.json
```
You will get some output that looks more or less like this:
For each sign command you will get output that looks more or less like this:
```
Sign Mode: SIGN_MODE_DIRECT
Body bytes: 0a90010a1c2f636f736d6f732e62616e6b2e763162657461312e4d736753656e6412700a2d636f736d6f7331706b707472653766646b6c366766727a6c65736a6a766878686c63337234676d6d6b38727336122d636f736d6f7331717970717870713971637273737a673270767871367273307a716733797963356c7a763778751a100a0575636f736d120731323334353637
Auth info bytes: 0a4e0a460a1f2f636f736d6f732e63727970746f2e736563703235366b312e5075624b657912230a21034f04181eeba35391b858633a765c4a0c189697b40d216354d50890d350c7029012040a02080112130a0d0a0575636f736d12043230303010c09a0c
Sign Bytes: 0a93010a90010a1c2f636f736d6f732e62616e6b2e763162657461312e4d736753656e6412700a2d636f736d6f7331706b707472653766646b6c366766727a6c65736a6a766878686c63337234676d6d6b38727336122d636f736d6f7331717970717870713971637273737a673270767871367273307a716733797963356c7a763778751a100a0575636f736d12073132333435363712650a4e0a460a1f2f636f736d6f732e63727970746f2e736563703235366b312e5075624b657912230a21034f04181eeba35391b858633a765c4a0c189697b40d216354d50890d350c7029012040a02080112130a0d0a0575636f736d12043230303010c09a0c1a0c73696d642d74657374696e672001
Signature: c9dd20e07464d3a688ff4b710b1fbc027e495e797cfa0b4804da2ed117959227772de059808f765aa29b8f92edf30f4c2c5a438e30d3fe6897daa7141e3ce6f9
Signed TX Bytes: 0a93010a90010a1c2f636f736d6f732e62616e6b2e763162657461312e4d736753656e6412700a2d636f736d6f7331706b707472653766646b6c366766727a6c65736a6a766878686c63337234676d6d6b38727336122d636f736d6f7331717970717870713971637273737a673270767871367273307a716733797963356c7a763778751a100a0575636f736d12073132333435363712650a4e0a460a1f2f636f736d6f732e63727970746f2e736563703235366b312e5075624b657912230a21034f04181eeba35391b858633a765c4a0c189697b40d216354d50890d350c7029012040a02080112130a0d0a0575636f736d12043230303010c09a0c1a40c9dd20e07464d3a688ff4b710b1fbc027e495e797cfa0b4804da2ed117959227772de059808f765aa29b8f92edf30f4c2c5a438e30d3fe6897daa7141e3ce6f9
{"body":{"messages":[{"@type":"/cosmos.bank.v1beta1.MsgSend","from_address":"cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6","to_address":"cosmos1qypqxpq9qcrsszg2pvxq6rs0zqg3yyc5lzv7xu","amount":[{"denom":"ucosm","amount":"1234567"}]}],"memo":"","timeout_height":"0","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[{"public_key":{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"A08EGB7ro1ORuFhjOnZcSgwYlpe0DSFjVNUIkNNQxwKQ"},"mode_info":{"single":{"mode":"SIGN_MODE_DIRECT"}},"sequence":"0"}],"fee":{"amount":[{"denom":"ucosm","amount":"2000"}],"gas_limit":"200000","payer":"","granter":""}},"signatures":["yd0g4HRk06aI/0txCx+8An5JXnl8+gtIBNou0ReVkid3LeBZgI92WqKbj5Lt8w9MLFpDjjDT/miX2qcUHjzm+Q=="]}
```