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

Not able to build core #35

Closed
andre-l-mm opened this issue Feb 4, 2019 · 8 comments
Closed

Not able to build core #35

andre-l-mm opened this issue Feb 4, 2019 · 8 comments

Comments

@andre-l-mm
Copy link

Hello I am getting error below on the make step trying to build the core component. Any ideas on what the issue could be?

C02WW21FHV2Q:build a530616101$ make
[  1%] Running C++ protocol buffer compiler using nanopb plugin on /Users/a530616101/Documents/c/subzero/core/proto/squareup/subzero/common.proto
[  2%] Running C++ protocol buffer compiler using nanopb plugin on /Users/a530616101/Documents/c/subzero/core/proto/squareup/subzero/internal.proto
Traceback (most recent call last):
  File "/Users/a530616101/Documents/c/subzero/core/build/nanopb/generator/nanopb_generator.py", line 1861, in <module>
    main_plugin()
  File "/Users/a530616101/Documents/c/subzero/core/build/nanopb/generator/nanopb_generator.py", line 1846, in main_plugin
    results = process_file(filename, fdesc, options, other_files)
  File "/Users/a530616101/Documents/c/subzero/core/build/nanopb/generator/nanopb_generator.py", line 1727, in process_file
    headerdata = ''.join(f.generate_header(includes, headerbasename, options))
  File "/Users/a530616101/Documents/c/subzero/core/build/nanopb/generator/nanopb_generator.py", line 1404, in generate_header
    yield msg.fields_declaration(self.dependencies) + '\n'
  File "/Users/a530616101/Documents/c/subzero/core/build/nanopb/generator/nanopb_generator.py", line 1028, in fields_declaration
    defval = self.default_value(dependencies)
  File "/Users/a530616101/Documents/c/subzero/core/build/nanopb/generator/nanopb_generator.py", line 1127, in default_value
    desc = google.protobuf.descriptor.MakeDescriptor(optional_only)
  File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/google/protobuf/descriptor.py", line 1015, in MakeDescriptor
    _message.default_pool.Add(file_descriptor_proto)
TypeError: Couldn't build proto file into descriptor pool!
Invalid proto descriptor for file "b3f05eb848476f7dca0c05a3400c4658.proto":
  InternalCommandRequest.FinalizeWalletRequest.encrypted_master_seed: ".EncryptedMasterSeed" is not defined.
  InternalCommandRequest.FinalizeWalletRequest.encrypted_pub_keys: ".EncryptedPubKey" is not defined.
  InternalCommandRequest.SignTxRequest.encrypted_master_seed: ".EncryptedMasterSeed" is not defined.
  InternalCommandRequest.SignTxRequest.encrypted_pub_keys: ".EncryptedPubKey" is not defined.
  InternalCommandRequest.SignTxRequest.inputs: ".TxInput" is not defined.
  InternalCommandRequest.SignTxRequest.outputs: ".TxOutput" is not defined.
  InternalCommandRequest.command: Oneof must have at least one field.
@alokmenghrajani
Copy link
Contributor

Are you building inside docker? This could be due to a proto compiler mismatch.

@andre-l-mm
Copy link
Author

Thanks Alok for your help. I am building on a MacOS laptop from the source (no docker). I installed protoc using homebrew. Is there a specific version I should look for?

@alokmenghrajani
Copy link
Contributor

The dockerfile uses 3.5.2. On my mac, I believe I have used 3.6.1 (I can confirm that tomorrow).

@alokmenghrajani
Copy link
Contributor

3.6.1 on mac os works. What version are you using?

You might want to try picking up #37 and running

mkdir core/build
cd core/build
TARGET=dev CURRENCY=btc-testnet cmake ../
make

@andre-l-mm
Copy link
Author

andre-l-mm commented Feb 12, 2019

Yes I had that same protoc version. Those instructions worked fine though.

Originally I had cloned the nanopb and trezor-crypto dependencies myself. I guess something went wrong with that. Now with the submodules this is how I did:

git fetch origin pull/37/head:pull_37
git checkout pull_37
git submodule update --init --recursive

And then the build instructions you provided:

mkdir core/build
cd core/build
TARGET=dev CURRENCY=btc-testnet cmake ../
make

Now when I run ./subzero I see the error below:

[ERROR] src/checks/validate_fees.c:118 (next line is expected to show red text...)
[ERROR] src/sign.c:243 validate_fees: fee underflow for output 1.

But those don't prevent it from starting as I see final message [INFO] src/main.c:94 waiting for client.

Are the errors above expected behaviour for execution outside HSM?

This is the complete output:

C02WW21FHV2Q:build a530616101$ ./subzero
[DEBUG] src/main.c:28 in main
[DEBUG] src/dev/check_ver.c:59 writing version file (/tmp/.subzero-ver).
[INFO] src/main.c:40 running self checks.
[INFO] src/checks/verify_mix_entropy.c:55 verify_mix_entropy: ok
[INFO] src/checks/verify_protect_pubkey.c:31 verify_protect_pubkey: ok
[INFO] src/checks/bip32.c:93 verify_bip32 ok
[INFO] src/checks/check_sign_tx.c:108 checking sign_tx.
[DEBUG] src/sign.c:530 Loaded pubkey 0: tpubD9jBarsLCKot45kvTTu7yWxmNnkBPbpn2CgS1F3yuxZGgohTkamYwJJKenZHrsYwPRJY66dk3ZUt3aZwZqFf7QGsgUUUcNSvvb9NXHFt5Vb
[DEBUG] src/sign.c:530 Loaded pubkey 1: tpubD8u5eHk8B6q63G4ekfBB2eVCeBYTrW2uCvi7Z3BF6bY2z33jW14Uzna8f5cFQWS3HFwdAzUWxqESq7j5x2CUQ7uBPgpXnpf8X9FPnh63XYd
[DEBUG] src/sign.c:530 Loaded pubkey 2: tpubD9dkteiWZqa3jL17meqVvy1RSUQsmJvU3hBfAosMzrSa69DacRku8yHy3E2fma1Q4Den25ukcsBL3bYTFyKjKbF8CEWHu86Xg9YXiY6CkeC
[DEBUG] src/sign.c:530 Loaded pubkey 3: tpubD8GrNWdYHDjdJryH5tng8LUzHSrEo4gToaguKnzthEqTxyfF13jTsp4sMtmso4n1VC58R5Wvt4Ua4npZTecR1xaGGYJgLLQj5sQGdD2xh2N
[DEBUG] src/sign.c:29 Computing prevout hash, input 0
27d180c652f83556518040d296fc5a00aa2bee8bcba11e6b5789c0a3c66573d3
00000000
[DEBUG] src/sign.c:537 prevoutsHash
1beaae4b6bb87b2892b4ce4ffe0ec228602a8f4ead2d436d029f7fb299b4d31e
[DEBUG] src/sign.c:545 seqHash
18606b350cd8bf565266bc352f0caddcf01e8fa789dd8a15386327cf8cabe198
[DEBUG] src/sign.c:331 public_key: 
0263ca186765e4df92ef8d1fc39fb8f4f1cef6000dfd5752f1dbde4b79c9d5d9df
[DEBUG] src/sign.c:372 hashing output script:
1976a91414b8b8a87b0695442f9df6858a42ef399db3fab588ac
[DEBUG] src/sign.c:554 outputHash
65e916ab1b0f368cac37059e2b732fce7c7db8e35e3dd3f30a7de6cc09889acf
[DEBUG] src/sign.c:265 hash_input
010000001beaae4b6bb87b2892b4ce4ffe0ec228602a8f4ead2d436d029f7fb299b4d31e
18606b350cd8bf565266bc352f0caddcf01e8fa789dd8a15386327cf8cabe198
27d180c652f83556518040d296fc5a00aa2bee8bcba11e6b5789c0a3c66573d3
00000000[DEBUG] src/sign.c:293 script.data:
8b52210242d1e4eb9d5b8102013c71210aaceb1ef83d400a70dc7103634cdbb6fead7c7b21025773e967c3adcafc6d2958254c4609360ef7cb5d0cd3c2858a00bcc060f5a99e2102abbc5c832a0e7ed5fd4dedd1618d0bf4052a66a0aab7d0f6716ec8c2a7f56d422102f48bd236291c172b83002f51d859627ea926b7d4b83df4cd85327987cee8da0054ae
40420f0000000000feffffff65e916ab1b0f368cac37059e2b732fce7c7db8e35e3dd3f30a7de6cc09889acf
0000000001000000
[DEBUG] src/sign.c:318 That's it folks. Final input hash:
20e02943a743fd5d1eb1092699aa17872d9d064e20ccfe5c35c93ccbb2c33355
[DEBUG] src/sign.c:590 Signing for pubkey 0
[DEBUG] src/sign.c:617 Successfully validated with public key:
0242d1e4eb9d5b8102013c71210aaceb1ef83d400a70dc7103634cdbb6fead7c7b
[DEBUG] src/sign.c:624 Signature:
30450221009db16421c956c694498acce44eb4de031cc87187f12860fa11377993e4621a8f02203e80612543f4f7b4d2d7c7e59c3977014fec7ce59f97305e9a2f5ee91dc420b8
[INFO] src/checks/check_sign_tx.c:135 sign_tx passed
[ERROR] src/checks/validate_fees.c:118 (next line is expected to show red text...)
[ERROR] src/sign.c:243 validate_fees: fee underflow for output 1.
[INFO] src/checks/validate_fees.c:127 verify_validate_fees: ok
[INFO] src/main.c:47 self-checks passed.
[INFO] src/main.c:94 waiting for client.

@alokmenghrajani
Copy link
Contributor

Great! Sorry for not including the submodule in the first place, I didn't set things up the right way.

Yes, the code performs a bunch of self checks at startup. We do this, because our CI infrastructure don't have HSMs. I guess I could set/unset a flag to not show the output in red?

You are now ready to talk to the C code from the Java GUI (or your own custom thing if you don't want to use the GUI).

The java piece is still missing a bunch of build scripts, which I'm currently working on.

@andre-l-mm
Copy link
Author

I think it is ok the way it is in red. Thanks a lot for your help on this.

@alokmenghrajani
Copy link
Contributor

I'm going to close this ticket. I'll post an update in #11 once our build story improves (I'm getting close -- probably need another few days and we should be good).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants