mirror of
https://github.com/alexgo-io/stacks-puppet-node.git
synced 2026-06-02 19:40:32 +08:00
remove use of consensus_hash= where appropriate; use safety_check
This commit is contained in:
@@ -49,8 +49,8 @@ def scenario( wallets, **kw ):
|
||||
testlib.next_block( **kw )
|
||||
|
||||
# only wallets[3] should get it
|
||||
testlib.blockstack_name_register( "foo.test", wallets[4].privkey, wallets[3].addr )
|
||||
testlib.blockstack_name_register( "foo.test", wallets[2].privkey, wallets[3].addr )
|
||||
testlib.blockstack_name_register( "foo.test", wallets[4].privkey, wallets[3].addr, safety_checks=False )
|
||||
testlib.blockstack_name_register( "foo.test", wallets[2].privkey, wallets[3].addr, safety_checks=False )
|
||||
testlib.next_block( **kw )
|
||||
|
||||
|
||||
|
||||
@@ -42,55 +42,55 @@ debug = True
|
||||
|
||||
def scenario( wallets, **kw ):
|
||||
|
||||
resp = testlib.blockstack_namespace_preorder( "test", wallets[1].addr, wallets[0].privkey )
|
||||
resp = testlib.blockstack_namespace_preorder( "test", wallets[1].addr, wallets[0].privkey, safety_checks=False )
|
||||
if debug or 'error' in resp:
|
||||
print json.dumps( resp, indent=4 )
|
||||
|
||||
testlib.next_block( **kw )
|
||||
|
||||
# should get rejected
|
||||
resp = testlib.blockstack_namespace_reveal( "test", wallets[1].addr, 52595, 250, 4, [6,5,4,3,2,1,0,0,0,0,0,0,0,0,0,0], 10, 10, wallets[0].privkey )
|
||||
resp = testlib.blockstack_namespace_reveal( "test", wallets[1].addr, 52595, 250, 4, [6,5,4,3,2,1,0,0,0,0,0,0,0,0,0,0], 10, 10, wallets[0].privkey, safety_checks=False )
|
||||
if debug or 'error' in resp:
|
||||
print json.dumps( resp, indent=4 )
|
||||
|
||||
# should get rejected (NOTE: the underlying mock utxo provider doesn't handle double-spends!)
|
||||
resp = testlib.blockstack_namespace_reveal( "test", wallets[1].addr, 52595, 250, 4, [6,5,4,3,2,1,0,0,0,0,0,0,0,0,0,0], 10, 10, wallets[0].privkey )
|
||||
resp = testlib.blockstack_namespace_reveal( "test", wallets[1].addr, 52595, 250, 4, [6,5,4,3,2,1,0,0,0,0,0,0,0,0,0,0], 10, 10, wallets[0].privkey, safety_checks=False )
|
||||
if debug or 'error' in resp:
|
||||
print json.dumps( resp, indent=4 )
|
||||
|
||||
testlib.next_block( **kw )
|
||||
|
||||
# should get accepted
|
||||
resp = testlib.blockstack_namespace_reveal( "test", wallets[1].addr, 52595, 250, 4, [6,5,4,3,2,1,0,0,0,0,0,0,0,0,0,0], 10, 10, wallets[0].privkey )
|
||||
resp = testlib.blockstack_namespace_reveal( "test", wallets[1].addr, 52595, 250, 4, [6,5,4,3,2,1,0,0,0,0,0,0,0,0,0,0], 10, 10, wallets[0].privkey, safety_checks=False )
|
||||
if debug or 'error' in resp:
|
||||
print json.dumps( resp, indent=4 )
|
||||
|
||||
# should get rejected (but only because the namespace isn't revealed until the block goes through)
|
||||
resp = testlib.blockstack_namespace_ready( "test", wallets[1].privkey )
|
||||
resp = testlib.blockstack_namespace_ready( "test", wallets[1].privkey, safety_checks=False )
|
||||
if debug or 'error' in resp:
|
||||
print json.dumps( resp, indent=4 )
|
||||
|
||||
testlib.next_block( **kw )
|
||||
|
||||
resp = testlib.blockstack_namespace_ready( "test", wallets[1].privkey )
|
||||
resp = testlib.blockstack_namespace_ready( "test", wallets[1].privkey, safety_checks=False )
|
||||
if debug or 'error' in resp:
|
||||
print json.dumps( resp, indent=4 )
|
||||
|
||||
testlib.next_block( **kw )
|
||||
|
||||
resp = testlib.blockstack_name_preorder( "foo.test", wallets[2].privkey, wallets[3].addr )
|
||||
resp = testlib.blockstack_name_preorder( "foo.test", wallets[2].privkey, wallets[3].addr, safety_checks=False )
|
||||
if debug or 'error' in resp:
|
||||
print json.dumps( resp, indent=4 )
|
||||
|
||||
testlib.next_block( **kw )
|
||||
|
||||
# should get rejected
|
||||
resp = testlib.blockstack_name_register( "foo.test", wallets[2].privkey, wallets[3].addr )
|
||||
resp = testlib.blockstack_name_register( "foo.test", wallets[2].privkey, wallets[3].addr, safety_checks=False )
|
||||
if 'error' in resp:
|
||||
print json.dumps( resp, indent=4 )
|
||||
|
||||
# should get rejected (NOTE: the underlying mock utxo provider doesn't handle double-spends!)
|
||||
resp = testlib.blockstack_name_register( "foo.test", wallets[2].privkey, wallets[3].addr )
|
||||
resp = testlib.blockstack_name_register( "foo.test", wallets[2].privkey, wallets[3].addr, safety_checks=False )
|
||||
if 'error' in resp:
|
||||
print json.dumps( resp, indent=4 )
|
||||
|
||||
@@ -99,36 +99,36 @@ def scenario( wallets, **kw ):
|
||||
testlib.next_block( **kw )
|
||||
|
||||
# should succeed
|
||||
resp = testlib.blockstack_name_register( "foo.test", wallets[2].privkey, wallets[3].addr )
|
||||
resp = testlib.blockstack_name_register( "foo.test", wallets[2].privkey, wallets[3].addr, safety_checks=False )
|
||||
if 'error' in resp:
|
||||
print json.dumps( resp, indent=4 )
|
||||
|
||||
testlib.next_block( **kw )
|
||||
|
||||
# (this should succeed)
|
||||
resp = testlib.blockstack_name_update( "foo.test", "11" * 20, wallets[3].privkey )
|
||||
resp = testlib.blockstack_name_update( "foo.test", "11" * 20, wallets[3].privkey, safety_checks=False )
|
||||
if 'error' in resp:
|
||||
print json.dumps( resp, indent=4 )
|
||||
|
||||
# (this should also succeed)
|
||||
resp = testlib.blockstack_name_transfer( "foo.test", wallets[4].addr, True, wallets[3].privkey )
|
||||
resp = testlib.blockstack_name_transfer( "foo.test", wallets[4].addr, True, wallets[3].privkey, safety_checks=False )
|
||||
if 'error' in resp:
|
||||
print json.dumps( resp, indent=4 )
|
||||
|
||||
testlib.next_block( **kw )
|
||||
|
||||
# (this should succeed)
|
||||
resp = testlib.blockstack_name_renew( "foo.test", wallets[4].privkey )
|
||||
resp = testlib.blockstack_name_renew( "foo.test", wallets[4].privkey, safety_checks=False )
|
||||
if 'error' in resp:
|
||||
print json.dumps( resp, indent=4 )
|
||||
|
||||
# (this should also succeed)
|
||||
resp = testlib.blockstack_name_update( "foo.test", "22" * 20, wallets[4].privkey )
|
||||
resp = testlib.blockstack_name_update( "foo.test", "22" * 20, wallets[4].privkey, safety_checks=False )
|
||||
if 'error' in resp:
|
||||
print json.dumps( resp, indent=4 )
|
||||
|
||||
# (this should succeed)
|
||||
resp = testlib.blockstack_name_transfer( "foo.test", wallets[3].addr, True, wallets[4].privkey )
|
||||
resp = testlib.blockstack_name_transfer( "foo.test", wallets[3].addr, True, wallets[4].privkey, safety_checks=False )
|
||||
if 'error' in resp:
|
||||
print json.dumps( resp, indent=4 )
|
||||
|
||||
@@ -136,7 +136,7 @@ def scenario( wallets, **kw ):
|
||||
|
||||
# lots of updates
|
||||
for i in xrange(0, 9):
|
||||
resp = testlib.blockstack_name_update( "foo.test", ("%s%s" % (i,i)) * 20, wallets[3].privkey )
|
||||
resp = testlib.blockstack_name_update( "foo.test", ("%s%s" % (i,i)) * 20, wallets[3].privkey, safety_checks=False )
|
||||
if 'error' in resp:
|
||||
print json.dumps( resp, indent=4 )
|
||||
|
||||
@@ -146,11 +146,11 @@ def scenario( wallets, **kw ):
|
||||
for i in xrange(0, 5):
|
||||
|
||||
#resp = testlib.blockstack_name_transfer( "foo.test", wallets[3].addr, True, wallets[4].privkey )
|
||||
resp = testlib.blockstack_name_transfer( "foo.test", wallets[4].addr, True, wallets[3].privkey )
|
||||
resp = testlib.blockstack_name_transfer( "foo.test", wallets[4].addr, True, wallets[3].privkey, safety_checks=False )
|
||||
if 'error' in resp:
|
||||
print json.dumps( resp, indent=4 )
|
||||
|
||||
resp = testlib.blockstack_name_transfer( "foo.test", wallets[3].addr, True, wallets[4].privkey )
|
||||
resp = testlib.blockstack_name_transfer( "foo.test", wallets[3].addr, True, wallets[4].privkey, safety_checks=False )
|
||||
if 'error' in resp:
|
||||
print json.dumps( resp, indent=4 )
|
||||
|
||||
@@ -160,19 +160,19 @@ def scenario( wallets, **kw ):
|
||||
# update/transfer/update/transfer
|
||||
for i in xrange(0, 5):
|
||||
|
||||
resp = testlib.blockstack_name_transfer("foo.test", wallets[4].addr, True, wallets[3].privkey )
|
||||
resp = testlib.blockstack_name_transfer("foo.test", wallets[4].addr, True, wallets[3].privkey, safety_checks=False )
|
||||
if 'error' in resp:
|
||||
print json.dumps( resp, indent=4 )
|
||||
|
||||
resp = testlib.blockstack_name_update("foo.test", "aa" * 20, wallets[4].privkey )
|
||||
resp = testlib.blockstack_name_update("foo.test", "aa" * 20, wallets[4].privkey, safety_checks=False )
|
||||
if 'error' in resp:
|
||||
print json.dumps( resp, indent=4 )
|
||||
|
||||
resp = testlib.blockstack_name_transfer("foo.test", wallets[3].addr, True, wallets[4].privkey )
|
||||
resp = testlib.blockstack_name_transfer("foo.test", wallets[3].addr, True, wallets[4].privkey, safety_checks=False )
|
||||
if 'error' in resp:
|
||||
print json.dumps( resp, indent=4 )
|
||||
|
||||
resp = testlib.blockstack_name_update("foo.test", "bb" * 20, wallets[3].privkey )
|
||||
resp = testlib.blockstack_name_update("foo.test", "bb" * 20, wallets[3].privkey, safety_checks=False )
|
||||
if 'error' in resp:
|
||||
print json.dumps( resp, indent=4 )
|
||||
|
||||
|
||||
@@ -46,17 +46,17 @@ def scenario( wallets, **kw ):
|
||||
testlib.blockstack_namespace_ready( "test", wallets[1].privkey )
|
||||
testlib.next_block( **kw )
|
||||
|
||||
testlib.blockstack_name_preorder( "foo.test", wallets[2].privkey, wallets[3].addr )
|
||||
testlib.blockstack_name_preorder( "foo.test", wallets[4].privkey, wallets[5].addr )
|
||||
testlib.blockstack_name_preorder( "foo.test", wallets[0].privkey, wallets[1].addr )
|
||||
testlib.blockstack_name_preorder( "foo.test", wallets[5].privkey, wallets[2].addr )
|
||||
testlib.blockstack_name_preorder( "foo.test", wallets[2].privkey, wallets[3].addr, safety_checks=False )
|
||||
testlib.blockstack_name_preorder( "foo.test", wallets[4].privkey, wallets[5].addr, safety_checks=False )
|
||||
testlib.blockstack_name_preorder( "foo.test", wallets[0].privkey, wallets[1].addr, safety_checks=False )
|
||||
testlib.blockstack_name_preorder( "foo.test", wallets[5].privkey, wallets[2].addr, safety_checks=False )
|
||||
testlib.next_block( **kw )
|
||||
|
||||
# all of these should fail, since they're in the same block
|
||||
testlib.blockstack_name_register( "foo.test", wallets[2].privkey, wallets[3].addr )
|
||||
testlib.blockstack_name_register( "foo.test", wallets[4].privkey, wallets[5].addr )
|
||||
testlib.blockstack_name_register( "foo.test", wallets[0].privkey, wallets[1].addr )
|
||||
testlib.blockstack_name_register( "foo.test", wallets[5].privkey, wallets[2].addr )
|
||||
testlib.blockstack_name_register( "foo.test", wallets[2].privkey, wallets[3].addr, safety_checks=False )
|
||||
testlib.blockstack_name_register( "foo.test", wallets[4].privkey, wallets[5].addr, safety_checks=False )
|
||||
testlib.blockstack_name_register( "foo.test", wallets[0].privkey, wallets[1].addr, safety_checks=False )
|
||||
testlib.blockstack_name_register( "foo.test", wallets[5].privkey, wallets[2].addr, safety_checks=False )
|
||||
testlib.next_block( **kw )
|
||||
|
||||
def check( state_engine ):
|
||||
|
||||
@@ -68,7 +68,7 @@ def scenario( wallets, **kw ):
|
||||
testlib.next_block( **kw )
|
||||
|
||||
# should fail
|
||||
resp = testlib.blockstack_name_register( "bar.test", wallets[2].privkey, wallets[3].addr )
|
||||
resp = testlib.blockstack_name_register( "bar.test", wallets[2].privkey, wallets[3].addr, safety_checks=False )
|
||||
if 'error' in resp:
|
||||
print json.dumps( resp, indent=4 )
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ def scenario( wallets, **kw ):
|
||||
testlib.blockstack_name_register( "foo.test", wallets[2].privkey, wallets[3].addr )
|
||||
testlib.next_block( **kw )
|
||||
|
||||
resp = testlib.blockstack_name_revoke( "foo.test", wallets[4].privkey )
|
||||
resp = testlib.blockstack_name_revoke( "foo.test", wallets[4].privkey, safety_checks=False )
|
||||
testlib.next_block( **kw )
|
||||
|
||||
|
||||
|
||||
@@ -56,21 +56,21 @@ def scenario( wallets, **kw ):
|
||||
testlib.next_block( **kw )
|
||||
|
||||
# can't do anything with the name for another 10 blocks
|
||||
resp = testlib.blockstack_name_update( "foo.test", "11" * 20, wallets[3].privkey )
|
||||
resp = testlib.blockstack_name_update( "foo.test", "11" * 20, wallets[3].privkey, safety_checks=False )
|
||||
if 'error' in resp:
|
||||
print json.dumps( resp, indent=4 )
|
||||
|
||||
testlib.next_block( **kw )
|
||||
|
||||
# should fail
|
||||
resp = testlib.blockstack_name_transfer( "foo.test", wallets[4].addr, True, wallets[3].privkey )
|
||||
resp = testlib.blockstack_name_transfer( "foo.test", wallets[4].addr, True, wallets[3].privkey, safety_checks=False )
|
||||
if 'error' in resp:
|
||||
print json.dumps( resp, indent=4 )
|
||||
|
||||
testlib.next_block( **kw )
|
||||
|
||||
# should fail
|
||||
resp = testlib.blockstack_name_renew( "foo.test", wallets[3].privkey )
|
||||
resp = testlib.blockstack_name_renew( "foo.test", wallets[3].privkey, safety_checks=False )
|
||||
if 'error' in resp:
|
||||
print json.dumps( resp, indent=4 )
|
||||
|
||||
@@ -81,21 +81,21 @@ def scenario( wallets, **kw ):
|
||||
testlib.next_block( **kw )
|
||||
|
||||
# verify that operations continue to fail
|
||||
resp = testlib.blockstack_name_update( "foo.test", "11" * 20, wallets[3].privkey )
|
||||
resp = testlib.blockstack_name_update( "foo.test", "11" * 20, wallets[3].privkey, safety_checks=False )
|
||||
if 'error' in resp:
|
||||
print json.dumps( resp, indent=4 )
|
||||
|
||||
testlib.next_block( **kw )
|
||||
|
||||
# should fail
|
||||
resp = testlib.blockstack_name_transfer( "foo.test", wallets[4].addr, True, wallets[3].privkey )
|
||||
resp = testlib.blockstack_name_transfer( "foo.test", wallets[4].addr, True, wallets[3].privkey, safety_checks=False )
|
||||
if 'error' in resp:
|
||||
print json.dumps( resp, indent=4 )
|
||||
|
||||
testlib.next_block( **kw )
|
||||
|
||||
# should fail
|
||||
resp = testlib.blockstack_name_renew( "foo.test", wallets[3].privkey )
|
||||
resp = testlib.blockstack_name_renew( "foo.test", wallets[3].privkey, safety_checks=False )
|
||||
if 'error' in resp:
|
||||
print json.dumps( resp, indent=4 )
|
||||
|
||||
|
||||
@@ -63,14 +63,14 @@ def scenario( wallets, **kw ):
|
||||
testlib.next_block( **kw )
|
||||
|
||||
# should fail
|
||||
resp = testlib.blockstack_name_transfer( "foo.test", wallets[4].addr, True, wallets[3].privkey )
|
||||
resp = testlib.blockstack_name_transfer( "foo.test", wallets[4].addr, True, wallets[3].privkey, safety_checks=False )
|
||||
if 'error' in resp:
|
||||
print json.dumps( resp, indent=4 )
|
||||
|
||||
testlib.next_block( **kw )
|
||||
|
||||
# should fail
|
||||
resp = testlib.blockstack_name_renew( "foo.test", wallets[3].privkey )
|
||||
resp = testlib.blockstack_name_renew( "foo.test", wallets[3].privkey, safety_checks=False )
|
||||
if 'error' in resp:
|
||||
print json.dumps( resp, indent=4 )
|
||||
|
||||
@@ -81,21 +81,21 @@ def scenario( wallets, **kw ):
|
||||
testlib.next_block( **kw )
|
||||
|
||||
# verify that operations continue to fail
|
||||
resp = testlib.blockstack_name_update( "foo.test", "11" * 20, wallets[3].privkey )
|
||||
resp = testlib.blockstack_name_update( "foo.test", "11" * 20, wallets[3].privkey, safety_checks=False )
|
||||
if 'error' in resp:
|
||||
print json.dumps( resp, indent=4 )
|
||||
|
||||
testlib.next_block( **kw )
|
||||
|
||||
# should fail
|
||||
resp = testlib.blockstack_name_transfer( "foo.test", wallets[4].addr, True, wallets[3].privkey )
|
||||
resp = testlib.blockstack_name_transfer( "foo.test", wallets[4].addr, True, wallets[3].privkey, safety_checks=False )
|
||||
if 'error' in resp:
|
||||
print json.dumps( resp, indent=4 )
|
||||
|
||||
testlib.next_block( **kw )
|
||||
|
||||
# should fail
|
||||
resp = testlib.blockstack_name_renew( "foo.test", wallets[3].privkey )
|
||||
resp = testlib.blockstack_name_renew( "foo.test", wallets[3].privkey, safety_checks=False )
|
||||
if 'error' in resp:
|
||||
print json.dumps( resp, indent=4 )
|
||||
|
||||
|
||||
@@ -56,21 +56,21 @@ def scenario( wallets, **kw ):
|
||||
testlib.next_block( **kw )
|
||||
|
||||
# can't do anything with the name for another 10 blocks
|
||||
resp = testlib.blockstack_name_update( "foo.test", "11" * 20, wallets[3].privkey )
|
||||
resp = testlib.blockstack_name_update( "foo.test", "11" * 20, wallets[3].privkey, safety_checks=False )
|
||||
if 'error' in resp:
|
||||
print json.dumps( resp, indent=4 )
|
||||
|
||||
testlib.next_block( **kw )
|
||||
|
||||
# should fail
|
||||
resp = testlib.blockstack_name_transfer( "foo.test", wallets[4].addr, True, wallets[3].privkey )
|
||||
resp = testlib.blockstack_name_transfer( "foo.test", wallets[4].addr, True, wallets[3].privkey, safety_checks=False )
|
||||
if 'error' in resp:
|
||||
print json.dumps( resp, indent=4 )
|
||||
|
||||
testlib.next_block( **kw )
|
||||
|
||||
# should fail
|
||||
resp = testlib.blockstack_name_renew( "foo.test", wallets[3].privkey )
|
||||
resp = testlib.blockstack_name_renew( "foo.test", wallets[3].privkey, safety_checks=False )
|
||||
if 'error' in resp:
|
||||
print json.dumps( resp, indent=4 )
|
||||
|
||||
@@ -81,21 +81,21 @@ def scenario( wallets, **kw ):
|
||||
testlib.next_block( **kw )
|
||||
|
||||
# verify that operations continue to fail
|
||||
resp = testlib.blockstack_name_update( "foo.test", "11" * 20, wallets[3].privkey )
|
||||
resp = testlib.blockstack_name_update( "foo.test", "11" * 20, wallets[3].privkey, safety_checks=False )
|
||||
if 'error' in resp:
|
||||
print json.dumps( resp, indent=4 )
|
||||
|
||||
testlib.next_block( **kw )
|
||||
|
||||
# should fail
|
||||
resp = testlib.blockstack_name_transfer( "foo.test", wallets[4].addr, True, wallets[3].privkey )
|
||||
resp = testlib.blockstack_name_transfer( "foo.test", wallets[4].addr, True, wallets[3].privkey, safety_checks=False )
|
||||
if 'error' in resp:
|
||||
print json.dumps( resp, indent=4 )
|
||||
|
||||
testlib.next_block( **kw )
|
||||
|
||||
# should fail
|
||||
resp = testlib.blockstack_name_renew( "foo.test", wallets[3].privkey )
|
||||
resp = testlib.blockstack_name_renew( "foo.test", wallets[3].privkey, safety_checks=False )
|
||||
if 'error' in resp:
|
||||
print json.dumps( resp, indent=4 )
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ def scenario( wallets, **kw ):
|
||||
testlib.next_block( **kw )
|
||||
testlib.next_block( **kw )
|
||||
|
||||
resp = testlib.blockstack_namespace_reveal( "test", wallets[1].addr, 52595, 250, 4, [6,5,4,3,2,1,0,0,0,0,0,0,0,0,0,0], 10, 10, wallets[0].privkey, consensus_hash=consensus_hash )
|
||||
resp = testlib.blockstack_namespace_reveal( "test", wallets[1].addr, 52595, 250, 4, [6,5,4,3,2,1,0,0,0,0,0,0,0,0,0,0], 10, 10, wallets[0].privkey )
|
||||
if debug or 'error' in resp:
|
||||
print json.dumps( resp, indent=4 )
|
||||
|
||||
@@ -58,7 +58,7 @@ def scenario( wallets, **kw ):
|
||||
testlib.next_block( **kw )
|
||||
testlib.next_block( **kw )
|
||||
|
||||
resp = testlib.blockstack_namespace_ready( "test", wallets[1].privkey, consensus_hash=consensus_hash )
|
||||
resp = testlib.blockstack_namespace_ready( "test", wallets[1].privkey )
|
||||
if debug or 'error' in resp:
|
||||
print json.dumps( resp, indent=4 )
|
||||
|
||||
@@ -76,7 +76,7 @@ def scenario( wallets, **kw ):
|
||||
testlib.next_block( **kw )
|
||||
testlib.next_block( **kw )
|
||||
|
||||
resp = testlib.blockstack_name_register( "foo.test", wallets[2].privkey, wallets[3].addr, consensus_hash=consensus_hash )
|
||||
resp = testlib.blockstack_name_register( "foo.test", wallets[2].privkey, wallets[3].addr )
|
||||
if debug or 'error' in resp:
|
||||
print json.dumps( resp, indent=4 )
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ def scenario( wallets, **kw ):
|
||||
testlib.next_block( **kw )
|
||||
testlib.next_block( **kw )
|
||||
|
||||
resp = testlib.blockstack_name_register( "foo.test", wallets[i].privkey, wallets[(i+1)%11].addr, consensus_hash=consensus_hash )
|
||||
resp = testlib.blockstack_name_register( "foo.test", wallets[i].privkey, wallets[(i+1)%11].addr )
|
||||
if 'error' in resp:
|
||||
print json.dumps( resp, indent=4 )
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ def scenario( wallets, **kw ):
|
||||
wallet_keys = blockstack_client.make_wallet_keys( owner_privkey=wallets[3].privkey, data_privkey=wallets[4].privkey )
|
||||
|
||||
# migrate profiles
|
||||
res = blockstack_client.migrate_profile( "foo.test", proxy=test_proxy, wallet_keys=wallet_keys )
|
||||
res = testlib.migrate_profile( "foo.test", proxy=test_proxy, wallet_keys=wallet_keys )
|
||||
if 'error' in res:
|
||||
res['test'] = 'Failed to initialize foo.test profile'
|
||||
print json.dumps(res, indent=4, sort_keys=True)
|
||||
|
||||
@@ -133,7 +133,7 @@ def scenario( wallets, **kw ):
|
||||
testlib.next_block( **kw )
|
||||
|
||||
# migrate
|
||||
res = blockstack_client.migrate_profile( "foo.test", proxy=test_proxy, wallet_keys=wallet_keys )
|
||||
res = testlib.migrate_profile( "foo.test", proxy=test_proxy, wallet_keys=wallet_keys )
|
||||
if 'error' in res:
|
||||
res['test'] = 'Failed to initialize foo.test profile'
|
||||
print json.dumps(res, indent=4, sort_keys=True)
|
||||
@@ -143,7 +143,7 @@ def scenario( wallets, **kw ):
|
||||
zonefile_hash = res['zonefile_hash']
|
||||
|
||||
# migrate
|
||||
res = blockstack_client.migrate_profile( "bar.test", proxy=test_proxy, wallet_keys=wallet_keys_2 )
|
||||
res = testlib.migrate_profile( "bar.test", proxy=test_proxy, wallet_keys=wallet_keys_2 )
|
||||
if 'error' in res:
|
||||
res['test'] = 'Failed to initialize foo.test profile'
|
||||
print json.dumps(res, indent=4, sort_keys=True)
|
||||
|
||||
@@ -72,7 +72,7 @@ def scenario( wallets, **kw ):
|
||||
wallet_keys = blockstack_client.make_wallet_keys( owner_privkey=wallets[3].privkey, data_privkey=wallets[4].privkey )
|
||||
|
||||
# migrate profile
|
||||
res = blockstack_client.migrate_profile( "foo.test", proxy=test_proxy, wallet_keys=wallet_keys )
|
||||
res = testlib.migrate_profile( "foo.test", proxy=test_proxy, wallet_keys=wallet_keys )
|
||||
if 'error' in res:
|
||||
res['test'] = 'Failed to initialize foo.test profile'
|
||||
print json.dumps(res, indent=4, sort_keys=True)
|
||||
|
||||
@@ -72,7 +72,7 @@ def scenario( wallets, **kw ):
|
||||
wallet_keys = blockstack_client.make_wallet_keys( owner_privkey=wallets[3].privkey, data_privkey=wallets[4].privkey )
|
||||
|
||||
# migrate profile
|
||||
res = blockstack_client.migrate_profile( "foo.test", proxy=test_proxy, wallet_keys=wallet_keys )
|
||||
res = testlib.migrate_profile( "foo.test", proxy=test_proxy, wallet_keys=wallet_keys )
|
||||
if 'error' in res:
|
||||
res['test'] = 'Failed to initialize foo.test profile'
|
||||
print json.dumps(res, indent=4, sort_keys=True)
|
||||
|
||||
@@ -104,7 +104,7 @@ def scenario( wallets, **kw ):
|
||||
|
||||
# migrate profiles
|
||||
for name in ['foo.test', 'bar.test', 'baz.test']:
|
||||
res = blockstack_client.migrate_profile( name, proxy=test_proxy, wallet_keys=wallet_keys[name] )
|
||||
res = testlib.migrate_profile( name, proxy=test_proxy, wallet_keys=wallet_keys[name] )
|
||||
if 'error' in res:
|
||||
res['test'] = 'Failed to initialize %s profile' % name
|
||||
print json.dumps(res, indent=4, sort_keys=True)
|
||||
|
||||
@@ -151,7 +151,7 @@ def scenario( wallets, **kw ):
|
||||
|
||||
# migrate profiles
|
||||
for name in ['foo.test', 'bar.test']:
|
||||
res = blockstack_client.migrate_profile( name, proxy=test_proxy, wallet_keys=wallet_keys[name] )
|
||||
res = testlib.migrate_profile( name, proxy=test_proxy, wallet_keys=wallet_keys[name] )
|
||||
if 'error' in res:
|
||||
res['test'] = 'Failed to initialize %s profile' % name
|
||||
print json.dumps(res, indent=4, sort_keys=True)
|
||||
|
||||
@@ -82,14 +82,14 @@ def scenario( wallets, **kw ):
|
||||
wallet_keys_2 = blockstack_client.make_wallet_keys( owner_privkey=wallets[6].privkey, data_privkey=wallets[7].privkey )
|
||||
|
||||
# migrate profiles
|
||||
res = blockstack_client.migrate_profile( "foo.test", proxy=test_proxy, wallet_keys=wallet_keys )
|
||||
res = testlib.migrate_profile( "foo.test", proxy=test_proxy, wallet_keys=wallet_keys )
|
||||
if 'error' in res:
|
||||
res['test'] = 'Failed to initialize foo.test profile'
|
||||
print json.dumps(res, indent=4, sort_keys=True)
|
||||
error = True
|
||||
return
|
||||
|
||||
res = blockstack_client.migrate_profile( "bar.test", proxy=test_proxy, wallet_keys=wallet_keys_2 )
|
||||
res = testlib.migrate_profile( "bar.test", proxy=test_proxy, wallet_keys=wallet_keys_2 )
|
||||
if 'error' in res:
|
||||
res['test'] = 'Failed to initialize bar.test profile'
|
||||
print json.dumps(res, indent=4, sort_keys=True)
|
||||
|
||||
@@ -133,7 +133,7 @@ def scenario( wallets, **kw ):
|
||||
wallet_keys = blockstack_client.make_wallet_keys( owner_privkey=wallets[3].privkey, data_privkey=wallets[4].privkey )
|
||||
|
||||
# migrate profile
|
||||
res = blockstack_client.migrate_profile( "foo.test", proxy=test_proxy, wallet_keys=wallet_keys )
|
||||
res = testlib.migrate_profile( "foo.test", proxy=test_proxy, wallet_keys=wallet_keys )
|
||||
if 'error' in res:
|
||||
res['test'] = 'Failed to initialize foo.test profile'
|
||||
print json.dumps(res, indent=4, sort_keys=True)
|
||||
|
||||
@@ -131,7 +131,7 @@ def scenario( wallets, **kw ):
|
||||
testlib.next_block( **kw )
|
||||
|
||||
# migrate profiles
|
||||
res = blockstack_client.migrate_profile( "foo.test", proxy=test_proxy, wallet_keys=wallet_keys )
|
||||
res = testlib.migrate_profile( "foo.test", proxy=test_proxy, wallet_keys=wallet_keys )
|
||||
if 'error' in res:
|
||||
res['test'] = 'Failed to initialize foo.test profile'
|
||||
print json.dumps(res, indent=4, sort_keys=True)
|
||||
@@ -140,7 +140,7 @@ def scenario( wallets, **kw ):
|
||||
|
||||
zonefile_hash = res['zonefile_hash']
|
||||
|
||||
res = blockstack_client.migrate_profile( "bar.test", proxy=test_proxy, wallet_keys=wallet_keys_2 )
|
||||
res = testlib.migrate_profile( "bar.test", proxy=test_proxy, wallet_keys=wallet_keys_2 )
|
||||
if 'error' in res:
|
||||
res['test'] = 'Failed to initialize bar.test profile'
|
||||
print json.dumps(res, indent=4, sort_keys=True)
|
||||
|
||||
@@ -62,7 +62,8 @@ def scenario( wallets, **kw ):
|
||||
testlib.next_block( **kw )
|
||||
|
||||
# update with stale consensus hash (should fail)
|
||||
testlib.blockstack_name_update( "foo.test", "22" * 20, wallets[3].privkey, consensus_hash=consensus_hash, test_api_proxy=False )
|
||||
print "\n\nsend update with consensus hash %s\n\n" % consensus_hash
|
||||
testlib.blockstack_name_update( "foo.test", "22" * 20, wallets[3].privkey, consensus_hash=consensus_hash )
|
||||
testlib.next_block( **kw )
|
||||
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ def scenario( wallets, **kw ):
|
||||
wallet_keys = blockstack_client.make_wallet_keys( owner_privkey=wallets[3].privkey, data_privkey=wallets[4].privkey )
|
||||
|
||||
# migrate profile
|
||||
res = blockstack_client.migrate_profile( "foo.test", proxy=test_proxy, wallet_keys=wallet_keys )
|
||||
res = testlib.migrate_profile( "foo.test", proxy=test_proxy, wallet_keys=wallet_keys )
|
||||
if 'error' in res:
|
||||
res['test'] = 'Failed to initialize foo.test profile'
|
||||
print json.dumps(res, indent=4, sort_keys=True)
|
||||
|
||||
@@ -72,7 +72,7 @@ def scenario( wallets, **kw ):
|
||||
wallet_keys = blockstack_client.make_wallet_keys( owner_privkey=wallets[3].privkey, data_privkey=wallets[4].privkey )
|
||||
|
||||
# migrate profile
|
||||
res = blockstack_client.migrate_profile( "foo.test", proxy=test_proxy, wallet_keys=wallet_keys )
|
||||
res = testlib.migrate_profile( "foo.test", proxy=test_proxy, wallet_keys=wallet_keys )
|
||||
if 'error' in res:
|
||||
res['test'] = 'Failed to initialize foo.test profile'
|
||||
print json.dumps(res, indent=4, sort_keys=True)
|
||||
|
||||
@@ -49,7 +49,7 @@ def scenario( wallets, **kw ):
|
||||
testlib.next_block( **kw )
|
||||
testlib.next_block( **kw )
|
||||
|
||||
resp = testlib.blockstack_namespace_reveal( "test", wallets[1].addr, 52595, 250, 4, [6,5,4,3,2,1,0,0,0,0,0,0,0,0,0,0], 10, 10, wallets[0].privkey, consensus_hash=consensus_hash )
|
||||
resp = testlib.blockstack_namespace_reveal( "test", wallets[1].addr, 52595, 250, 4, [6,5,4,3,2,1,0,0,0,0,0,0,0,0,0,0], 10, 10, wallets[0].privkey )
|
||||
if debug or 'error' in resp:
|
||||
print json.dumps( resp, indent=4 )
|
||||
|
||||
@@ -58,7 +58,7 @@ def scenario( wallets, **kw ):
|
||||
testlib.next_block( **kw )
|
||||
testlib.next_block( **kw )
|
||||
|
||||
resp = testlib.blockstack_namespace_ready( "test", wallets[1].privkey, consensus_hash=consensus_hash )
|
||||
resp = testlib.blockstack_namespace_ready( "test", wallets[1].privkey )
|
||||
if debug or 'error' in resp:
|
||||
print json.dumps( resp, indent=4 )
|
||||
|
||||
@@ -76,7 +76,7 @@ def scenario( wallets, **kw ):
|
||||
testlib.next_block( **kw )
|
||||
testlib.next_block( **kw )
|
||||
|
||||
resp = testlib.blockstack_name_register( "foo.test", wallets[2].privkey, wallets[3].addr, consensus_hash=consensus_hash )
|
||||
resp = testlib.blockstack_name_register( "foo.test", wallets[2].privkey, wallets[3].addr )
|
||||
if debug or 'error' in resp:
|
||||
print json.dumps( resp, indent=4 )
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ def scenario( wallets, **kw ):
|
||||
testlib.next_block( **kw )
|
||||
testlib.next_block( **kw )
|
||||
|
||||
resp = testlib.blockstack_name_register( "foo.test", wallets[i].privkey, wallets[(i+1)%11].addr, consensus_hash=consensus_hash )
|
||||
resp = testlib.blockstack_name_register( "foo.test", wallets[i].privkey, wallets[(i+1)%11].addr )
|
||||
if 'error' in resp:
|
||||
print json.dumps( resp, indent=4 )
|
||||
|
||||
|
||||
@@ -173,8 +173,8 @@ def check( state_engine ):
|
||||
print "http://localhost:%s" % blockstack.RPC_SERVER_PORT
|
||||
try:
|
||||
profile_resp_txt = srv.get_profile("foo.test")
|
||||
profile_resp = json.loads(profile_json_txt)
|
||||
assert 'error' not in profile_json
|
||||
profile_resp = json.loads(profile_resp_txt)
|
||||
assert 'error' not in profile_resp
|
||||
assert 'profile' in profile_resp
|
||||
profile = profile_resp['profile']
|
||||
assert 'data' in profile
|
||||
|
||||
@@ -115,20 +115,33 @@ def check( state_engine ):
|
||||
print "Still in queue:\n%s" % json.dumps(queue_info, indent=4, sort_keys=True)
|
||||
return False
|
||||
|
||||
# have an update haash
|
||||
# have an update hash
|
||||
if 'value_hash' not in name_rec or name_rec.get('value_hash', None) is None:
|
||||
print "No value hash"
|
||||
return False
|
||||
|
||||
# have a zonefile
|
||||
zonefile = testlib.blockstack_get_zonefile( name_rec['value_hash'] )
|
||||
if 'error' in zonefile:
|
||||
print "zonefile lookup error: %s" % zonefile['error']
|
||||
if zonefile is None or 'error' in zonefile:
|
||||
if zonefile is not None:
|
||||
print "zonefile lookup error: %s" % zonefile['error']
|
||||
else:
|
||||
print "no zonefile returned"
|
||||
return False
|
||||
|
||||
# hashes to this zonefile
|
||||
if blockstack_client.hash_zonefile( zonefile ) != name_rec['value_hash']:
|
||||
print "wrong zonefile: %s != %s" % (blockstack_client.hash_zonefile(zonefile), name_rec['value_hash'])
|
||||
return False
|
||||
|
||||
|
||||
# verify that the profile is there
|
||||
profile = testlib.blockstack_get_profile( "foo.test" )
|
||||
if profile is None or 'error' in profile:
|
||||
if profile is None:
|
||||
print "no profile returned"
|
||||
else:
|
||||
print "profile lookup error: %s" % profile['error']
|
||||
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
@@ -26,6 +26,7 @@ import pybitcoin
|
||||
import time
|
||||
import json
|
||||
import sys
|
||||
import blockstack_client
|
||||
|
||||
wallets = [
|
||||
testlib.Wallet( "5JesPiN68qt44Hc2nT8qmyZ1JDwHebfoh9KQ52Lazb1m1LaKNj9", 100000000000 ),
|
||||
@@ -109,6 +110,30 @@ def check( state_engine ):
|
||||
print "sender is wrong"
|
||||
return False
|
||||
|
||||
# have a zonefile
|
||||
zonefile = testlib.blockstack_get_zonefile( name_rec['value_hash'] )
|
||||
if zonefile is None or 'error' in zonefile:
|
||||
if zonefile is not None:
|
||||
print "zonefile lookup error: %s" % zonefile['error']
|
||||
else:
|
||||
print "no zonefile returned"
|
||||
return False
|
||||
|
||||
# hashes to this zonefile
|
||||
if blockstack_client.hash_zonefile( zonefile ) != name_rec['value_hash']:
|
||||
print "wrong zonefile: %s != %s" % (blockstack_client.hash_zonefile(zonefile), name_rec['value_hash'])
|
||||
return False
|
||||
|
||||
# verify that the profile is there
|
||||
profile = testlib.blockstack_get_profile( "foo_%s.test" % i )
|
||||
if profile is None or 'error' in profile:
|
||||
if profile is None:
|
||||
print "no profile returned"
|
||||
else:
|
||||
print "profile lookup error: %s" % profile['error']
|
||||
|
||||
return False
|
||||
|
||||
# all queues are drained
|
||||
queue_info = testlib.blockstack_client_queue_state()
|
||||
if len(queue_info) > 0:
|
||||
|
||||
@@ -26,6 +26,7 @@ import pybitcoin
|
||||
import time
|
||||
import json
|
||||
import sys
|
||||
import blockstack_client
|
||||
|
||||
wallets = [
|
||||
testlib.Wallet( "5JesPiN68qt44Hc2nT8qmyZ1JDwHebfoh9KQ52Lazb1m1LaKNj9", 100000000000 ),
|
||||
@@ -110,6 +111,30 @@ def check( state_engine ):
|
||||
print "sender is wrong"
|
||||
return False
|
||||
|
||||
# have a zonefile
|
||||
zonefile = testlib.blockstack_get_zonefile( name_rec['value_hash'] )
|
||||
if zonefile is None or 'error' in zonefile:
|
||||
if zonefile is not None:
|
||||
print "zonefile lookup error: %s" % zonefile['error']
|
||||
else:
|
||||
print "no zonefile returned"
|
||||
return False
|
||||
|
||||
# hashes to this zonefile
|
||||
if blockstack_client.hash_zonefile( zonefile ) != name_rec['value_hash']:
|
||||
print "wrong zonefile: %s != %s" % (blockstack_client.hash_zonefile(zonefile), name_rec['value_hash'])
|
||||
return False
|
||||
|
||||
# verify that the profile is there
|
||||
profile = testlib.blockstack_get_profile( "foo_%s.test" % i )
|
||||
if profile is None or 'error' in profile:
|
||||
if profile is None:
|
||||
print "no profile returned"
|
||||
else:
|
||||
print "profile lookup error: %s" % profile['error']
|
||||
|
||||
return False
|
||||
|
||||
# all queues are drained
|
||||
queue_info = testlib.blockstack_client_queue_state()
|
||||
if len(queue_info) > 0:
|
||||
|
||||
Reference in New Issue
Block a user