fix snv checks with namespaces

This commit is contained in:
Jude Nelson
2017-10-04 15:31:50 -04:00
parent ea3a974063
commit f44cc718f1
4 changed files with 16 additions and 5 deletions

View File

@@ -60,6 +60,7 @@ def scenario( wallets, **kw ):
print json.dumps( resp, indent=4 )
testlib.next_block( **kw )
testlib.expect_snv_fail_at('test', testlib.get_current_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, safety_checks=False )
@@ -72,6 +73,7 @@ def scenario( wallets, **kw ):
print json.dumps( resp, indent=4 )
testlib.next_block( **kw )
testlib.expect_snv_fail_at('test', testlib.get_current_block(**kw))
resp = testlib.blockstack_namespace_ready( "test", wallets[1].privkey, safety_checks=False )
if debug or 'error' in resp:

View File

@@ -50,6 +50,7 @@ def scenario( wallets, **kw ):
print json.dumps( resp, indent=4 )
testlib.next_block( **kw )
testlib.expect_snv_fail_at('test', testlib.get_current_block(**kw))
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 )
testlib.next_block( **kw )
@@ -63,18 +64,21 @@ def scenario( wallets, **kw ):
print json.dumps( resp, indent=4 )
testlib.next_block( **kw )
testlib.expect_snv_fail_at('test', testlib.get_current_block(**kw))
resp = testlib.blockstack_namespace_reveal( "test", wallets[3].addr, 52595, 251, 4, [6,5,4,3,2,1,0,0,0,0,0,0,0,0,0,0], 10, 10, wallets[4].privkey )
if 'error' in resp:
print json.dumps( resp, indent=4 )
testlib.next_block( **kw )
testlib.expect_snv_fail_at('test', testlib.get_current_block(**kw))
resp = testlib.blockstack_namespace_ready( "test", wallets[4].privkey )
if 'error' in resp:
print json.dumps( resp, indent=4 )
testlib.next_block( **kw )
testlib.expect_snv_fail_at('test', testlib.get_current_block(**kw))
# can't re-reveal test
resp = testlib.blockstack_namespace_reveal( "test", wallets[1].addr, 52595, 252, 4, [6,5,4,3,2,1,0,0,0,0,0,0,0,0,0,0], 10, 10, wallets[0].privkey )
@@ -82,6 +86,7 @@ def scenario( wallets, **kw ):
print json.dumps( resp, indent=4 )
testlib.next_block( **kw )
testlib.expect_snv_fail_at('test', testlib.get_current_block(**kw))
# can't re-ready test
resp = testlib.blockstack_namespace_ready( "test", wallets[1].privkey )
@@ -89,6 +94,7 @@ def scenario( wallets, **kw ):
print json.dumps( resp, indent=4 )
testlib.next_block( **kw )
testlib.expect_snv_fail_at('test', testlib.get_current_block(**kw))
# warn the serialization checker that this changes behavior from 0.13
print "BLOCKSTACK_SERIALIZATION_CHANGE_BEHAVIOR"

View File

@@ -81,15 +81,14 @@ def scenario( wallets, **kw ):
print 'accidentally succeeded to preorder test2'
return False
testlib.expect_snv_fail_at( "foo.test", testlib.get_current_block(**kw)+1)
# try to reveal; it should fail
res = 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 'error' not in res:
print 'accidentally succeeded to reveal test'
return False
testlib.expect_snv_fail_at( "foo.test", testlib.get_current_block(**kw)+1)
testlib.expect_snv_fail_at( "test2", testlib.get_current_block(**kw)+1)
testlib.expect_snv_fail_at( "test", testlib.get_current_block(**kw)+1)
for i in xrange(0, 3):
testlib.next_block( **kw )
@@ -109,7 +108,7 @@ def scenario( wallets, **kw ):
print res
return False
testlib.expect_snv_fail_at( "foo.test", testlib.get_current_block(**kw)+1)
testlib.expect_snv_fail_at( "test", testlib.get_current_block(**kw)+1)
for i in xrange(0, 3):
testlib.next_block( **kw )

View File

@@ -268,7 +268,7 @@ def expect_snv_fail_at( name, block_id ):
"""
global snv_fail_at
if name not in snv_fail_at.keys():
if block_id not in snv_fail_at.keys():
snv_fail_at[block_id] = [name]
else:
snv_fail_at[block_id].append(name)
@@ -2981,6 +2981,10 @@ def snv_all_names( state_engine ):
log.debug("SNV lookup %s failed at %s as expected" % (name, block_id))
continue
print 'SNV lookup on {} at {} with {} failed'.format(name, block_id, trusted_consensus_hash)
print 'Expected SNV failures at {}: {}'.format(block_id, snv_fail_at.get(block_id, []))
print 'All SNV failures expected:\n{}'.format(json.dumps(snv_fail_at, indent=4, sort_keys=True))
print 'SNV lookup return value:'
print json.dumps(snv_recs, indent=4, sort_keys=True )
return False