GolosChain / golos-python

Official Python Library for Golos Blockchain
MIT License
3 stars 4 forks source link

[0.17.0-declined] Transaction signing is broken due to changed op ids #6

Open bitphage opened 6 years ago

bitphage commented 6 years ago

Fixing #5 eliminates python tx.sign() problem, but it appears produced transaction signature is wrong and golos node refuses to verify_authority. Reproducible both with 0.16 and 0.17.

Used keypair:

test suite:

#!/usr/bin/env python

from steem import Steem

nodes = ['https://ws.testnet.golos.io']
keys = ['5K2qsUM3YXVNYGGJzfS9hjT2p1cM7t4XZ2E8LcMePsxGjpQ3Fps']
title = 'test'
body = 'test post'
tags = 'test'
account = 'test1'

golos = Steem(nodes=nodes, keys=keys, debug=True)
golos.commit.post(title, body, account, tags=tags)
% ./tmp_p.py
['5K2qsUM3YXVNYGGJzfS9hjT2p1cM7t4XZ2E8LcMePsxGjpQ3Fps']
Format GLS unkown. You've been warned!

{'GLS5KAn8JU79Gop3k4Hv2bqwdkQTzPM4q8795whZWagDRiEXcXBGE': '5K2qsUM3YXVNYGGJzfS9hjT2p1cM7t4XZ2E8LcMePsxGjpQ3Fps'}
['GLS5KAn8JU79Gop3k4Hv2bqwdkQTzPM4q8795whZWagDRiEXcXBGE', 1]
5K2qsUM3YXVNYGGJzfS9hjT2p1cM7t4XZ2E8LcMePsxGjpQ3Fps
signing with: ['5K2qsUM3YXVNYGGJzfS9hjT2p1cM7t4XZ2E8LcMePsxGjpQ3Fps']
Traceback (most recent call last):
  File "./tmp_p.py", line 14, in <module>
    golos.commit.post(title, body, account, tags=tags)
  File "/home/vvk/devel/golos/scripts/venv/lib/python3.6/site-packages/steem/commit.py", line 325, in post
    return self.finalizeOp(ops, author, "posting")
  File "/home/vvk/devel/golos/scripts/venv/lib/python3.6/site-packages/steem/commit.py", line 128, in finalizeOp
    return tx.broadcast()
  File "/home/vvk/devel/golos/scripts/venv/lib/python3.6/site-packages/steem/transactionbuilder.py", line 129, in broadcast
    raise e
  File "/home/vvk/devel/golos/scripts/venv/lib/python3.6/site-packages/steem/transactionbuilder.py", line 126, in broadcast
    if not self.steemd.verify_authority(self.json()):
  File "/home/vvk/devel/golos/scripts/venv/lib/python3.6/site-packages/steem/steemd.py", line 689, in verify_authority
    return self.exec('verify_authority', signed_transaction, api='database_api')
  File "/home/vvk/devel/golos/scripts/venv/lib/python3.6/site-packages/steembase/http_client.py", line 186, in exec
    return_with_args=return_with_args)
  File "/home/vvk/devel/golos/scripts/venv/lib/python3.6/site-packages/steembase/http_client.py", line 206, in _return
    raise RPCError(error_message)
steembase.exceptions.RPCError: 3030000 basic_exception: rity
Missing Posting Authority test1
    {"id":"test1","posting":{"weight_threshold":1,"account_auths":[],"key_auths":[["GLS5KAn8JU79Gop3k4Hv2bqwdkQTzPM4q8795whZWagDRiEXcXBGE",1]]},"active":{"weight_threshold":1,"account_auths":[],"key_auths":[["GLS6QkHZvP68wAUPz6SK3DhaCT6866Grgi3j2wnNGGJoF38FnDr3J",1]]},"owner":{"weight_threshold":1,"account_auths":[],"key_auths":[["GLS61mtEB8Ffq6KMxoPHqdX7DzaLYXgCSH8wFsT56NwXH4sCVDjss",1]]}}
    th_a  transaction.cpp:115 verify_authority

    {"ops":[["comment",{"parent_author":"","parent_permlink":"test","author":"test1","permlink":"test","title":"test","body":"test post","json_metadata":"{\"tags\": [\"test\"]}"}]],"sigs":["GLS58FVXbvpHjHdNLz21e2rmxM9mmxDmeTpe5vTCcH95gp8PgXwQc"]}
    th_a  transaction.cpp:153 verify_authority

    {"*this":{"ref_block_num":37803,"ref_block_prefix":1981343695,"expiration":"2017-11-10T16:25:46","operations":[["comment",{"parent_author":"","parent_permlink":"test","author":"test1","permlink":"test","title":"test","body":"test post","json_metadata":"{\"tags\": [\"test\"]}"}]],"extensions":[],"signatures":["1f61ace236e8be815764e49c10cb8832f76b171cd3f73dce432ab75e7ddd0e61e02e1293b9f7776f464cf17ee3eb018ab65dd671d0a649600a3a065ace08798d5d"]}}
    th_a  transaction.cpp:263 verify_authority

    {"call.method":"call","call.params":["database_api","verify_authority",[{"ref_block_num":37803,"ref_block_prefix":1981343695,"expiration":"2017-11-10T16:25:46","operations":[["comment",{"parent_author":"","parent_permlink":"test","author":"test1","permlink":"test","title":"test","body":"test post","json_metadata":"{\"tags\": [\"test\"]}"}]],"extensions":[],"signatures":["1f61ace236e8be815764e49c10cb8832f76b171cd3f73dce432ab75e7ddd0e61e02e1293b9f7776f464cf17ee3eb018ab65dd671d0a649600a3a065ace08798d5d"]}]]}
    th_a  websocket_api.cpp:135 on_message_impl
bitphage commented 6 years ago

OK the root cause is https://github.com/GolosChain/golos/issues/259