def scenario( wallets, **kw ): testlib.blockstore_namespace_preorder( "test", wallets[1].addr, wallets[0].privkey ) testlib.next_block( **kw ) testlib.blockstore_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 )
def scenario(wallets, **kw): testlib.blockstore_namespace_preorder("test", wallets[1].addr, wallets[0].privkey) testlib.next_block(**kw) testlib.blockstore_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) testlib.blockstore_namespace_ready("test", wallets[1].privkey) testlib.next_block(**kw) testlib.blockstore_name_preorder("foo.test", wallets[2].privkey, wallets[3].addr) testlib.next_block(**kw) testlib.blockstore_name_register("foo.test", wallets[2].privkey, wallets[3].addr) testlib.next_block(**kw) testlib.blockstore_name_update("foo.test", "11" * 20, wallets[3].privkey) testlib.next_block(**kw) # should fail--can't give a name to yourself testlib.blockstore_name_transfer("foo.test", wallets[4].addr, True, wallets[4].privkey) testlib.next_block(**kw) # should fail--can't steal a name testlib.blockstore_name_transfer("foo.test", wallets[4].addr, True, wallets[0].privkey) testlib.next_block(**kw)
def scenario(wallets, **kw): global snv_consensus, snv_block_id testlib.blockstore_namespace_preorder("test", wallets[1].addr, wallets[0].privkey) testlib.next_block(**kw) testlib.blockstore_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) testlib.blockstore_namespace_ready("test", wallets[1].privkey) testlib.next_block(**kw) testlib.blockstore_name_preorder("foo.test", wallets[2].privkey, wallets[3].addr) testlib.next_block(**kw) testlib.blockstore_name_register("foo.test", wallets[2].privkey, wallets[3].addr) testlib.next_block(**kw) snv_block_id = testlib.get_current_block() snv_consensus = testlib.get_consensus_at(snv_block_id)
def scenario( wallets, **kw ): testlib.blockstore_namespace_preorder( "test", wallets[1].addr, wallets[0].privkey ) testlib.next_block( **kw ) testlib.blockstore_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 ) testlib.blockstore_namespace_ready( "test", wallets[1].privkey ) testlib.next_block( **kw ) testlib.blockstore_name_preorder( "foo.test", wallets[2].privkey, wallets[3].addr ) testlib.next_block( **kw ) testlib.blockstore_name_register( "foo.test", wallets[2].privkey, wallets[3].addr ) testlib.next_block( **kw ) # wait for a bit... for i in xrange(0, 10): testlib.next_block( **kw ) # has to be the same key that registered... resp = testlib.blockstore_name_renew( "foo.test", wallets[4].privkey ) if 'error' in resp: print json.dumps( resp, indent=4 ) testlib.next_block( **kw ) testlib.next_block( **kw )
def scenario( wallets, **kw ): global snv_block_id, last_consensus testlib.blockstore_namespace_preorder( "test", wallets[1].addr, wallets[0].privkey ) testlib.next_block( **kw ) # NOTE: names expire in 13 blocks testlib.blockstore_namespace_reveal( "test", wallets[1].addr, 13, 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 ) testlib.blockstore_namespace_ready( "test", wallets[1].privkey ) testlib.next_block( **kw ) testlib.blockstore_name_preorder( "foo.test", wallets[2].privkey, wallets[3].addr ) testlib.next_block( **kw ) testlib.blockstore_name_register( "foo.test", wallets[2].privkey, wallets[3].addr ) testlib.next_block( **kw ) snv_block_id = testlib.get_current_block() for i in xrange(0, 15): testlib.next_block( **kw ) last_consensus = testlib.get_consensus_at( testlib.get_current_block() )
def scenario( wallets, **kw ): testlib.blockstore_namespace_preorder( "test", wallets[1].addr, wallets[0].privkey ) testlib.next_block( **kw ) testlib.blockstore_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 ) resp = testlib.blockstore_name_import( "foo.test", "1BKufFedDrueBBFBXtiATB2PSdsBGZxf3N", "11" * 20, wallets[1].privkey ) # master if 'error' in resp: print json.dumps(resp, indent=4 ) testlib.next_block( **kw ) resp = testlib.blockstore_name_import( "foo.test", "1ARVjrtKnUVWt2GNrpuFLnNCL2WGUhKdkW", "33" * 20, wallets[3].privkey ) # derived child 2 if 'error' in resp: print json.dumps(resp, indent=4 ) testlib.next_block( **kw ) resp = testlib.blockstore_name_import( "foo.test", "1PYu4vKB3g2QLDFdurxqYSJ9aJSed7tne1", "22" * 20, wallets[2].privkey ) # derived child 1 if 'error' in resp: print json.dumps(resp, indent=4 ) testlib.next_block( **kw ) testlib.blockstore_namespace_ready( "test", wallets[1].privkey ) testlib.next_block( **kw )
def scenario( wallets, **kw ): testlib.blockstore_namespace_preorder( "test", wallets[1].addr, wallets[0].privkey ) testlib.next_block( **kw ) testlib.blockstore_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 ) resp = testlib.blockstore_name_import( "foo.test", wallets[2].addr, "11" * 20, wallets[1].privkey ) if 'error' in resp: print json.dumps(resp, indent=4 ) testlib.next_block( **kw ) resp = testlib.blockstore_name_import( "foo.test", wallets[3].addr, "22" * 20, wallets[1].privkey ) if 'error' in resp: print json.dumps(resp, indent=4 ) testlib.next_block( **kw ) resp = testlib.blockstore_name_import( "foo.test", wallets[4].addr, "44" * 20, wallets[1].privkey ) resp = testlib.blockstore_name_import( "foo.test", wallets[4].addr, "55" * 20, wallets[1].privkey ) resp = testlib.blockstore_name_import( "foo.test", wallets[4].addr, "33" * 20, wallets[1].privkey ) if 'error' in resp: print json.dumps(resp, indent=4 ) testlib.next_block( **kw ) testlib.blockstore_namespace_ready( "test", wallets[1].privkey ) testlib.next_block( **kw )
def scenario( wallets, **kw ): global working_dir testlib.blockstore_namespace_preorder( "id", wallets[1].addr, wallets[0].privkey ) testlib.next_block( **kw ) testlib.blockstore_namespace_reveal( "id", 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 ) testlib.blockstore_namespace_ready( "id", wallets[1].privkey ) testlib.next_block( **kw ) testlib.blockstore_name_preorder( "judecn.id", wallets[2].privkey, wallets[3].addr ) testlib.next_block( **kw ) testlib.blockstore_name_register( "judecn.id", wallets[2].privkey, wallets[3].addr ) testlib.next_block( **kw ) resp = testlib.blockstore_announce( "hello world!", wallets[3].privkey ) if 'error' in resp: print json.dumps( resp, indent=4 ) testlib.next_block( **kw ) resp = testlib.blockstore_announce( "This should not appear", wallets[4].privkey ) if 'error' in resp: print json.dumps( resp, indent=4 ) testlib.next_block( **kw ) # save... working_dir = testlib.get_working_dir( **kw )
def scenario( wallets, **kw ): testlib.blockstore_namespace_preorder( "test", wallets[1].addr, wallets[0].privkey ) testlib.next_block( **kw ) testlib.blockstore_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 ) testlib.blockstore_namespace_ready( "test", wallets[1].privkey ) testlib.next_block( **kw ) testlib.blockstore_name_preorder( "foo.test", wallets[2].privkey, wallets[3].addr ) testlib.next_block( **kw ) testlib.blockstore_name_register( "foo.test", wallets[2].privkey, wallets[3].addr ) testlib.next_block( **kw ) testlib.blockstore_name_update( "foo.test", "11" * 20, wallets[3].privkey ) testlib.next_block( **kw ) consensus_hash = testlib.get_consensus_at( testlib.get_current_block( **kw ), **kw ) # lots of blocks later... for i in xrange(0, 50): testlib.next_block( **kw ) # update with stale consensus hash (should fail) testlib.blockstore_name_update( "foo.test", "22" * 20, wallets[3].privkey, consensus_hash=consensus_hash ) testlib.next_block( **kw )
def scenario( wallets, **kw ): testlib.blockstore_namespace_preorder( "test", wallets[1].addr, wallets[0].privkey ) testlib.next_block( **kw ) testlib.blockstore_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 ) testlib.blockstore_namespace_ready( "test", wallets[1].privkey ) testlib.next_block( **kw ) testlib.blockstore_name_preorder( "foo.test", wallets[2].privkey, wallets[3].addr ) testlib.next_block( **kw ) testlib.blockstore_name_register( "foo.test", wallets[2].privkey, wallets[3].addr ) testlib.next_block( **kw ) testlib.blockstore_name_update( "foo.test", "11" * 20, wallets[3].privkey ) testlib.next_block( **kw ) # should fail--can't give a name to yourself testlib.blockstore_name_transfer( "foo.test", wallets[4].addr, True, wallets[4].privkey ) testlib.next_block( **kw ) # should fail--can't steal a name testlib.blockstore_name_transfer( "foo.test", wallets[4].addr, True, wallets[0].privkey ) testlib.next_block( **kw )
def scenario( wallets, **kw ): global snv_consensus, snv_block_id, last_consensus, last_block_id testlib.blockstore_namespace_preorder( "test", wallets[1].addr, wallets[0].privkey ) testlib.next_block( **kw ) testlib.blockstore_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 ) testlib.blockstore_namespace_ready( "test", wallets[1].privkey ) testlib.next_block( **kw ) testlib.blockstore_name_preorder( "foo.test", wallets[2].privkey, wallets[3].addr ) testlib.next_block( **kw ) testlib.blockstore_name_register( "foo.test", wallets[2].privkey, wallets[3].addr ) testlib.next_block( **kw ) snv_block_id = testlib.get_current_block() snv_consensus = testlib.get_consensus_at( snv_block_id ) testlib.blockstore_name_update( "foo.test", "11" * 20, wallets[3].privkey ) testlib.next_block( **kw ) last_block_id = testlib.get_current_block() last_consensus = testlib.get_consensus_at( last_block_id )
def scenario( wallets, **kw ): testlib.blockstore_namespace_preorder( "test", wallets[1].addr, wallets[0].privkey ) testlib.next_block( **kw ) testlib.blockstore_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 ) # will all be rejected trivially, since the first import must come from the importer's address testlib.blockstore_name_import( "foo.test", wallets[4].addr, "11" * 20, wallets[2].privkey ) testlib.blockstore_name_import( "bar.test", wallets[2].addr, "22" * 20, wallets[3].privkey ) testlib.blockstore_name_import( "baz.test", wallets[3].addr, "33" * 20, wallets[4].privkey ) testlib.next_block( **kw ) # will be accepted testlib.blockstore_name_import( "goo.test", wallets[2].addr, "11" * 20, wallets[1].privkey ) # will all be rejected because they weren't sent from a importer-derived key testlib.blockstore_name_import( "foo.test", wallets[4].addr, "11" * 20, wallets[2].privkey ) testlib.blockstore_name_import( "bar.test", wallets[2].addr, "22" * 20, wallets[3].privkey ) testlib.blockstore_name_import( "baz.test", wallets[3].addr, "33" * 20, wallets[4].privkey ) testlib.next_block( **kw ) testlib.blockstore_namespace_ready( "test", wallets[1].privkey ) testlib.next_block( **kw )
def scenario( wallets, **kw ): testlib.blockstore_namespace_preorder( "test", wallets[1].addr, wallets[0].privkey ) testlib.next_block( **kw ) testlib.blockstore_namespace_reveal( "test", wallets[1].addr, 1, 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 ) testlib.blockstore_namespace_ready( "test", wallets[1].privkey ) testlib.next_block( **kw ) # preorder, register, update, expire (multiple times) for i in xrange(2, 11): resp = testlib.blockstore_name_preorder( "foo.test", wallets[i].privkey, wallets[(i+1)%11].addr ) if 'error' in resp: print json.dumps( resp, indent=4 ) testlib.next_block( **kw ) resp = testlib.blockstore_name_register( "foo.test", wallets[i].privkey, wallets[(i+1)%11].addr ) if 'error' in resp: print json.dumps( resp, indent=4 ) testlib.next_block( **kw ) resp = testlib.blockstore_name_update( "foo.test", ("%02x" % i) * 20, wallets[(i+1)%11].privkey ) if 'error' in resp: print json.dumps( resp, indent=4 ) testlib.next_block( **kw ) if i == 10: break testlib.next_block( **kw )
def scenario( wallets, **kw ): testlib.blockstore_namespace_preorder( "test", wallets[1].addr, wallets[0].privkey ) testlib.next_block( **kw ) testlib.blockstore_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 ) testlib.blockstore_namespace_ready( "test", wallets[1].privkey ) testlib.next_block( **kw ) resp = testlib.blockstore_name_preorder( "foo.test", wallets[2].privkey, wallets[3].addr ) if 'error' in resp: print json.dumps( resp ) testlib.next_block( **kw ) # wait for it to expire (takes a day) for i in xrange(0, 145): testlib.next_block( **kw ) # re-preorder it resp = testlib.blockstore_name_preorder( "foo.test", wallets[3].privkey, wallets[4].addr ) if 'error' in resp: print json.dumps( resp ) testlib.next_block( **kw ) # register it resp = testlib.blockstore_name_register( "foo.test", wallets[3].privkey, wallets[4].addr ) if 'error' in resp: print json.dumps( resp ) testlib.next_block( **kw )
def scenario(wallets, **kw): testlib.blockstore_namespace_preorder("test", wallets[1].addr, wallets[0].privkey) testlib.next_block(**kw) testlib.blockstore_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) testlib.blockstore_namespace_ready("test", wallets[1].privkey) testlib.next_block(**kw) testlib.blockstore_name_preorder("foo.test", wallets[2].privkey, wallets[3].addr) testlib.next_block(**kw) testlib.blockstore_name_register("foo.test", wallets[2].privkey, wallets[3].addr) testlib.next_block(**kw) resp = testlib.blockstore_name_revoke("foo.test", wallets[3].privkey) print json.dumps(resp, indent=4) testlib.next_block(**kw)
def scenario(wallets, **kw): testlib.blockstore_namespace_preorder("test", wallets[1].addr, wallets[0].privkey) # wait 10 blocks between for i in xrange(0, 10): testlib.next_block(**kw) testlib.blockstore_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, ) # wait 10 blocks between for i in xrange(0, 10): testlib.next_block(**kw) testlib.blockstore_namespace_ready("test", wallets[1].privkey) # wait 10 blocks between for i in xrange(0, 10): testlib.next_block(**kw)
def scenario(wallets, **kw): resp = testlib.blockstore_namespace_preorder("test", wallets[1].addr, wallets[0].privkey) if 'error' in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) resp = testlib.blockstore_namespace_preorder("test", wallets[2].addr, wallets[3].privkey) if 'error' in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) resp = testlib.blockstore_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' in resp: print json.dumps(resp, indent=4) resp = testlib.blockstore_namespace_reveal( "test", wallets[2].addr, 11111, 222, 3, [4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0], 11, 12, wallets[3].privkey) if 'error' in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw)
def scenario(wallets, **kw): testlib.blockstore_namespace_preorder("test", wallets[1].addr, wallets[0].privkey) testlib.next_block(**kw) testlib.blockstore_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) testlib.blockstore_namespace_ready("test", wallets[1].privkey) testlib.next_block(**kw) testlib.blockstore_name_preorder("foo.test", wallets[2].privkey, wallets[3].addr) testlib.next_block(**kw) # only wallets[3] should get it testlib.blockstore_name_register("foo.test", wallets[4].privkey, wallets[3].addr) testlib.blockstore_name_register("foo.test", wallets[2].privkey, wallets[3].addr) testlib.next_block(**kw)
def scenario(wallets, **kw): testlib.blockstore_namespace_preorder("test", wallets[1].addr, wallets[0].privkey) testlib.next_block(**kw) testlib.blockstore_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) testlib.blockstore_namespace_ready("test", wallets[1].privkey) testlib.next_block(**kw) testlib.blockstore_name_preorder("foo.test", wallets[2].privkey, wallets[3].addr) testlib.next_block(**kw) testlib.blockstore_name_register("foo.test", wallets[2].privkey, wallets[3].addr) testlib.next_block(**kw) testlib.blockstore_name_update("foo.test", "11" * 20, wallets[3].privkey) testlib.next_block(**kw) testlib.blockstore_name_renew("foo.test", wallets[3].privkey) testlib.next_block(**kw)
def scenario(wallets, **kw): testlib.blockstore_namespace_preorder("test", wallets[1].addr, wallets[0].privkey) testlib.next_block(**kw) # NOTE: names expire in 13 blocks testlib.blockstore_namespace_reveal( "test", wallets[1].addr, 13, 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) testlib.blockstore_namespace_ready("test", wallets[1].privkey) testlib.next_block(**kw) testlib.blockstore_name_preorder("foo.test", wallets[2].privkey, wallets[3].addr) testlib.next_block(**kw) testlib.blockstore_name_register("foo.test", wallets[2].privkey, wallets[3].addr) testlib.next_block(**kw) for i in xrange(0, 15): testlib.next_block(**kw)
def scenario( wallets, **kw ): global txids global consensuses testlib.blockstore_namespace_preorder( "test", wallets[1].addr, wallets[0].privkey ) testlib.next_block( **kw ) testlib.blockstore_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 ) testlib.blockstore_namespace_ready( "test", wallets[1].privkey ) testlib.next_block( **kw ) testlib.blockstore_name_preorder( "foo.test", wallets[2].privkey, wallets[3].addr ) testlib.next_block( **kw ) testlib.blockstore_name_register( "foo.test", wallets[2].privkey, wallets[3].addr ) testlib.next_block( **kw ) testlib.next_block( **kw ) # do a sequence of updates, every other block for i in xrange( 0, 20 ): if (i % 2) != 0: update_hash = ("%02x" % (i)) * 20 resp = testlib.blockstore_name_update( "foo.test", update_hash, wallets[3].privkey ) txids[ update_hash ] = resp['transaction_hash'] consensuses[ update_hash ] = testlib.get_consensus_at( testlib.get_current_block( **kw ), **kw ) testlib.next_block( **kw ) testlib.next_block( **kw )
def scenario( wallets, **kw ): testlib.blockstore_namespace_preorder( "test", wallets[1].addr, wallets[0].privkey ) testlib.next_block( **kw ) testlib.blockstore_namespace_reveal( "test", wallets[1].addr, 1, 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 ) testlib.blockstore_namespace_ready( "test", wallets[1].privkey ) testlib.next_block( **kw ) # preorder, register, expire (multiple times) for i in xrange(2, 5): resp = testlib.blockstore_name_preorder( "foo.test", wallets[2].privkey, wallets[3].addr ) if 'error' in resp: print json.dumps( resp, indent=4 ) testlib.next_block( **kw ) resp = testlib.blockstore_name_register( "foo.test", wallets[2].privkey, wallets[3].addr ) if 'error' in resp: print json.dumps( resp, indent=4 ) testlib.next_block( **kw ) if i == 4: break testlib.next_block( **kw ) testlib.next_block( **kw )
def scenario( wallets, **kw ): testlib.blockstore_namespace_preorder( "test", wallets[1].addr, wallets[0].privkey ) testlib.next_block( **kw ) testlib.blockstore_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 ) testlib.blockstore_namespace_ready( "test", wallets[1].privkey ) testlib.next_block( **kw ) testlib.blockstore_name_preorder( "foo.test", wallets[2].privkey, wallets[3].addr ) testlib.next_block( **kw ) testlib.blockstore_name_register( "foo.test", wallets[2].privkey, wallets[3].addr ) testlib.next_block( **kw ) # wait for a bit... for i in xrange(0, 10): testlib.next_block( **kw ) resp = testlib.blockstore_name_renew( "foo.test", wallets[3].privkey ) if 'error' in resp: print json.dumps( resp, indent=4 ) testlib.next_block( **kw ) global snv_consensus, snv_block_id snv_block_id = testlib.get_current_block() snv_consensus = testlib.get_consensus_at( snv_block_id ) testlib.next_block( **kw )
def scenario(wallets, **kw): testlib.blockstore_namespace_preorder("test", wallets[1].addr, wallets[0].privkey) testlib.next_block(**kw) testlib.blockstore_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) testlib.blockstore_namespace_ready("test", wallets[1].privkey) testlib.next_block(**kw) testlib.blockstore_name_preorder("foo.test", wallets[2].privkey, wallets[3].addr) testlib.next_block(**kw) testlib.blockstore_name_register("foo.test", wallets[2].privkey, wallets[3].addr) testlib.next_block(**kw) # wait for a bit... for i in xrange(0, 10): testlib.next_block(**kw) resp = testlib.blockstore_name_renew("foo.test", wallets[3].privkey) if 'error' in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) testlib.next_block(**kw)
def scenario(wallets, **kw): testlib.blockstore_namespace_preorder("test", wallets[1].addr, wallets[0].privkey) testlib.next_block(**kw) testlib.blockstore_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) testlib.blockstore_namespace_ready("test", wallets[1].privkey) testlib.next_block(**kw) resp = testlib.blockstore_name_preorder_multi( ["foo.test", "bar.test", "baz.test"], wallets[2].privkey, [wallets[3].addr, wallets[4].addr, wallets[5].addr] ) if "error" in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw)
def scenario(wallets, **kw): testlib.blockstore_namespace_preorder("test", wallets[1].addr, wallets[0].privkey) testlib.next_block(**kw) # NOTE: names expire in 13 blocks testlib.blockstore_namespace_reveal( "test", wallets[1].addr, 13, 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) testlib.blockstore_namespace_ready("test", wallets[1].privkey) testlib.next_block(**kw) testlib.blockstore_name_preorder("foo.test", wallets[2].privkey, wallets[3].addr) testlib.next_block(**kw) testlib.blockstore_name_register("foo.test", wallets[2].privkey, wallets[3].addr) testlib.next_block(**kw) global snv_block_id, snv_consensus snv_block_id = testlib.get_current_block() snv_consensus = testlib.get_consensus_at(snv_block_id) for i in xrange(0, 15): testlib.next_block(**kw)
def scenario( wallets, **kw ): testlib.blockstore_namespace_preorder( "test", wallets[1].addr, wallets[0].privkey ) testlib.next_block( **kw ) testlib.blockstore_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 ) testlib.blockstore_namespace_ready( "test", wallets[1].privkey ) testlib.next_block( **kw )
def scenario(wallets, **kw): global last_consensus, snv_block_id testlib.blockstore_namespace_preorder("test", wallets[1].addr, wallets[0].privkey) testlib.next_block(**kw) testlib.blockstore_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) testlib.blockstore_namespace_ready("test", wallets[1].privkey) testlib.next_block(**kw) resp = testlib.blockstore_name_preorder_multi( ["foo.test", "bar.test", "baz.test"], wallets[2].privkey, [wallets[3].addr, wallets[4].addr, wallets[5].addr]) if 'error' in resp: print json.dumps(resp, indent=4) sys.exit(1) testlib.next_block(**kw) preorder_consensus = testlib.get_consensus_at(testlib.get_current_block()) resp = testlib.blockstore_name_register("foo.test", wallets[2].privkey, wallets[3].addr) if 'error' in resp: print json.dumps(resp, indent=4) sys.exit(1) testlib.next_block(**kw) resp = testlib.blockstore_name_register("bar.test", wallets[2].privkey, wallets[4].addr) if 'error' in resp: print json.dumps(resp, indent=4) sys.exit(1) resp = testlib.blockstore_name_register("baz.test", wallets[2].privkey, wallets[5].addr) if 'error' in resp: print json.dumps(resp, indent=4) sys.exit(1) testlib.next_block(**kw) # all blocks registered here snv_block_id = testlib.get_current_block(**kw) testlib.next_block(**kw) last_consensus = testlib.get_consensus_at(testlib.get_current_block(**kw), **kw)
def scenario(wallets, **kw): global final_consensus testlib.blockstore_namespace_preorder("test", wallets[1].addr, wallets[0].privkey) testlib.next_block(**kw) testlib.blockstore_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) testlib.blockstore_namespace_ready("test", wallets[1].privkey) testlib.next_block(**kw) resp = testlib.blockstore_name_preorder_multi( ["foo.test", "bar.test", "baz.test"], wallets[2].privkey, [wallets[3].addr, wallets[4].addr, wallets[5].addr]) if 'error' in resp: print json.dumps(resp, indent=4) sys.exit(1) testlib.next_block(**kw) preorder_consensus = testlib.get_consensus_at(testlib.get_current_block()) resp = testlib.blockstore_name_register("foo.test", wallets[2].privkey, wallets[3].addr) if 'error' in resp: print json.dumps(resp, indent=4) sys.exit(1) resp = testlib.blockstore_name_register("bar.test", wallets[2].privkey, wallets[4].addr) if 'error' in resp: print json.dumps(resp, indent=4) sys.exit(1) testlib.next_block(**kw) # should cause the whole thing to fail, since we didn't preorder this separately resp = testlib.blockstore_name_register("goo.test", wallets[2].privkey, wallets[5].addr) if 'error' in resp: print json.dumps(resp, indent=4) sys.exit(1) resp = testlib.blockstore_name_register("baz.test", wallets[2].privkey, wallets[5].addr) if 'error' in resp: print json.dumps(resp, indent=4) sys.exit(1) testlib.next_block(**kw)
def scenario(wallets, **kw): testlib.blockstore_namespace_preorder("test", wallets[1].addr, wallets[0].privkey) testlib.next_block(**kw) testlib.blockstore_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) testlib.blockstore_namespace_ready("test", wallets[1].privkey) testlib.next_block(**kw) resp = testlib.blockstore_name_preorder("foo.test", wallets[2].privkey, wallets[3].addr) if 'error' in resp: print json.dumps(resp) testlib.next_block(**kw) # no name operations should work on this name, except register resp = testlib.blockstore_name_update("foo.test", "11" * 20, wallets[3].privkey) if 'error' in resp: print json.dumps(resp) testlib.next_block(**kw) resp = testlib.blockstore_name_renew("foo.test", wallets[3].privkey) if 'error' in resp: print json.dumps(resp) testlib.next_block(**kw) resp = testlib.blockstore_name_transfer("foo.test", wallets[4].addr, True, wallets[3].privkey) if 'error' in resp: print json.dumps(resp) testlib.next_block(**kw) # try both addresses (should both fail) resp = testlib.blockstore_name_revoke("foo.test", wallets[4].privkey) if 'error' in resp: print json.dumps(resp) testlib.next_block(**kw) resp = testlib.blockstore_name_revoke("foo.test", wallets[3].privkey) if 'error' in resp: print json.dumps(resp)
def scenario( wallets, **kw ): global snv_block_id_foo, snv_serial_number_bar, snv_serial_number_baz, last_consensus, snv_txid_bar, snv_txid_baz testlib.blockstore_namespace_preorder( "test", wallets[1].addr, wallets[0].privkey ) testlib.next_block( **kw ) testlib.blockstore_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 ) testlib.blockstore_namespace_ready( "test", wallets[1].privkey ) testlib.next_block( **kw ) testlib.blockstore_name_preorder( "foo.test", wallets[2].privkey, wallets[3].addr ) testlib.next_block( **kw ) testlib.blockstore_name_register( "foo.test", wallets[2].privkey, wallets[3].addr ) testlib.next_block( **kw ) snv_block_id_foo = testlib.get_current_block() testlib.next_block( **kw ) testlib.next_block( **kw ) testlib.next_block( **kw ) testlib.next_block( **kw ) testlib.next_block( **kw ) bar_preorder = testlib.blockstore_name_preorder( "bar.test", wallets[4].privkey, wallets[5].addr ) testlib.next_block( **kw ) snv_serial_number_bar = "%s-%s" % (testlib.get_current_block(), 0 ) snv_txid_bar = bar_preorder['transaction_hash'] testlib.blockstore_name_register( "bar.test", wallets[4].privkey, wallets[5].addr ) testlib.next_block( **kw ) testlib.next_block( **kw ) testlib.next_block( **kw ) testlib.next_block( **kw ) testlib.next_block( **kw ) testlib.next_block( **kw ) baz_preorder = testlib.blockstore_name_preorder( "baz.test", wallets[6].privkey, wallets[7].addr ) testlib.next_block( **kw ) snv_serial_number_baz = "%s-%s" % (testlib.get_current_block(), 0 ) snv_txid_baz = baz_preorder['transaction_hash'] testlib.blockstore_name_register( "baz.test", wallets[6].privkey, wallets[7].addr ) testlib.next_block( **kw ) last_consensus = testlib.get_consensus_at( testlib.get_current_block() )
def scenario(wallets, **kw): testlib.blockstore_namespace_preorder("test", wallets[1].addr, wallets[0].privkey) testlib.next_block(**kw) testlib.blockstore_namespace_reveal( "test", wallets[1].addr, 2, 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) testlib.blockstore_namespace_ready("test", wallets[1].privkey) testlib.next_block(**kw) # preorder, register, update, expire (multiple times) for i in xrange(2, 11): resp = testlib.blockstore_name_preorder("foo.test", wallets[i].privkey, wallets[(i + 1) % 11].addr) if "error" in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) resp = testlib.blockstore_name_register("foo.test", wallets[i].privkey, wallets[(i + 1) % 11].addr) if "error" in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) resp = testlib.blockstore_name_update("foo.test", ("%02x" % i) * 20, wallets[(i + 1) % 11].privkey) if "error" in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) resp = testlib.blockstore_name_transfer("foo.test", wallets[i].addr, True, wallets[(i + 1) % 11].privkey) if "error" in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) resp = testlib.blockstore_name_renew("foo.test", wallets[i].privkey) if "error" in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) testlib.next_block(**kw) testlib.next_block(**kw) if i == 10: break testlib.next_block(**kw)
def scenario( wallets, **kw ): testlib.blockstore_namespace_preorder( "test", wallets[1].addr, wallets[0].privkey ) testlib.next_block( **kw ) # can't steal test resp = testlib.blockstore_namespace_reveal( "test", wallets[3].addr, 52595, 250, 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.blockstore_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 ) testlib.blockstore_namespace_ready( "test", wallets[1].privkey ) testlib.next_block( **kw ) # can't re-create test resp = testlib.blockstore_namespace_preorder( "test", wallets[3].addr, wallets[4].privkey ) if 'error' in resp: print json.dumps( resp, indent=4 ) testlib.next_block( **kw ) resp = testlib.blockstore_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 ) resp = testlib.blockstore_namespace_ready( "test", wallets[4].privkey ) if 'error' in resp: print json.dumps( resp, indent=4 ) testlib.next_block( **kw ) # can't re-reveal test resp = testlib.blockstore_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 ) if 'error' in resp: print json.dumps( resp, indent=4 ) testlib.next_block( **kw ) # can't re-ready test resp = testlib.blockstore_namespace_ready( "test", wallets[1].privkey ) if 'error' in resp: print json.dumps( resp, indent=4 ) testlib.next_block( **kw )
def scenario( wallets, **kw ): global final_consensus testlib.blockstore_namespace_preorder( "test", wallets[1].addr, wallets[0].privkey ) testlib.next_block( **kw ) testlib.blockstore_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 ) testlib.blockstore_namespace_ready( "test", wallets[1].privkey ) testlib.next_block( **kw ) resp = testlib.blockstore_name_preorder_multi( ["foo.test", "bar.test", "baz.test"], wallets[2].privkey, [wallets[3].addr, wallets[4].addr, wallets[5].addr] ) if 'error' in resp: print json.dumps( resp, indent=4 ) sys.exit(1) testlib.next_block( **kw ) resp = testlib.blockstore_name_register( "foo.test", wallets[2].privkey, wallets[3].addr ) if 'error' in resp: print json.dumps( resp, indent=4 ) sys.exit(1) testlib.next_block( **kw ) resp = testlib.blockstore_name_preorder( "goo.test", wallets[2].privkey, wallets[3].addr ) if 'error' in resp: print json.dumps( resp, indent=4 ) sys.exit(1) testlib.next_block( **kw ) resp = testlib.blockstore_name_register( "bar.test", wallets[2].privkey, wallets[4].addr ) if 'error' in resp: print json.dumps( resp, indent=4 ) sys.exit(1) resp = testlib.blockstore_name_register( "goo.test", wallets[2].privkey, wallets[3].addr ) if 'error' in resp: print json.dumps( resp, indent=4 ) sys.exit(1) resp = testlib.blockstore_name_register( "baz.test", wallets[2].privkey, wallets[5].addr ) if 'error' in resp: print json.dumps( resp, indent=4 ) sys.exit(1) testlib.next_block( **kw )
def scenario( wallets, **kw ): testlib.blockstore_namespace_preorder( "test", wallets[1].addr, wallets[0].privkey ) testlib.next_block( **kw ) testlib.blockstore_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 ) testlib.blockstore_name_import( "foo.test", wallets[2].addr, "11" * 20, wallets[1].privkey ) testlib.blockstore_name_import( "bar.test", wallets[3].addr, "22" * 20, wallets[1].privkey ) testlib.blockstore_name_import( "baz.test", wallets[4].addr, "33" * 20, wallets[1].privkey ) testlib.next_block( **kw ) testlib.blockstore_namespace_ready( "test", wallets[1].privkey ) testlib.next_block( **kw )
def scenario(wallets, **kw): testlib.blockstore_namespace_preorder("test", wallets[1].addr, wallets[0].privkey) testlib.next_block(**kw) testlib.blockstore_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) testlib.blockstore_namespace_ready("test", wallets[1].privkey) testlib.next_block(**kw) # try to exceed quota (currently 25) for i in xrange(0, 25): resp = testlib.blockstore_name_preorder("foo%s.test" % i, wallets[2].privkey, wallets[3].addr) if 'error' in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) for i in xrange(0, 25): resp = testlib.blockstore_name_register("foo%s.test" % i, wallets[2].privkey, wallets[3].addr) if 'error' in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) resp = testlib.blockstore_name_preorder("bar.test", wallets[2].privkey, wallets[3].addr) if 'error' in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) # should fail resp = testlib.blockstore_name_register("bar.test", wallets[2].privkey, wallets[3].addr) if 'error' in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw)
def scenario(wallets, **kw): testlib.blockstore_namespace_preorder("test", wallets[1].addr, wallets[0].privkey) testlib.next_block(**kw) testlib.blockstore_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) testlib.blockstore_namespace_ready("test", wallets[1].privkey) testlib.next_block(**kw) # try to exceed quota (currently 25) for i in xrange(0, 25): resp = testlib.blockstore_name_preorder("foo%s.test" % i, wallets[2].privkey, wallets[3].addr) if "error" in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) for i in xrange(0, 25): resp = testlib.blockstore_name_register("foo%s.test" % i, wallets[2].privkey, wallets[3].addr) if "error" in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) resp = testlib.blockstore_name_preorder("bar.test", wallets[2].privkey, wallets[3].addr) if "error" in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) # should fail resp = testlib.blockstore_name_register("bar.test", wallets[2].privkey, wallets[3].addr) if "error" in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw)
def scenario(wallets, **kw): global debug resp = testlib.blockstore_namespace_preorder("test", wallets[1].addr, wallets[0].privkey) if debug or 'error' in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) resp = testlib.blockstore_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) testlib.next_block(**kw) resp = testlib.blockstore_namespace_ready("test", wallets[1].privkey) if debug or 'error' in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) resp = testlib.blockstore_name_preorder("foo.test", wallets[2].privkey, wallets[3].addr) if debug or 'error' in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) resp = testlib.blockstore_name_register("foo.test", wallets[2].privkey, wallets[3].addr) if debug or 'error' in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) resp = testlib.blockstore_name_transfer("foo.test", wallets[4].addr, True, wallets[3].privkey) if debug or 'error' in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) resp = testlib.blockstore_name_transfer("foo.test", wallets[0].addr, True, wallets[4].privkey) if debug or 'error' in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) resp = testlib.blockstore_name_update("foo.test", "11" * 20, wallets[0].privkey) if debug or 'error' in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw)
def scenario(wallets, **kw): global final_consensus testlib.blockstore_namespace_preorder("test", wallets[1].addr, wallets[0].privkey) testlib.next_block(**kw) testlib.blockstore_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) testlib.blockstore_namespace_ready("test", wallets[1].privkey) testlib.next_block(**kw) resp = testlib.blockstore_name_preorder_multi( ["foo.test", "bar.test", "baz.test"], wallets[2].privkey, [wallets[3].addr, wallets[4].addr, wallets[5].addr]) if 'error' in resp: print json.dumps(resp, indent=4) sys.exit(1) testlib.next_block(**kw) preorder_consensus = testlib.get_consensus_at(testlib.get_current_block()) # these should all fail, since they're paired with the wrong addresses resp = testlib.blockstore_name_register("foo.test", wallets[2].privkey, wallets[5].addr) if 'error' in resp: print json.dumps(resp, indent=4) sys.exit(1) resp = testlib.blockstore_name_register("bar.test", wallets[2].privkey, wallets[3].addr) if 'error' in resp: print json.dumps(resp, indent=4) sys.exit(1) resp = testlib.blockstore_name_register("baz.test", wallets[2].privkey, wallets[4].addr) if 'error' in resp: print json.dumps(resp, indent=4) sys.exit(1) testlib.next_block(**kw)
def scenario( wallets, **kw ): testlib.blockstore_namespace_preorder( "test", wallets[1].addr, wallets[0].privkey ) testlib.next_block( **kw ) testlib.blockstore_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 ) testlib.blockstore_namespace_ready( "test", wallets[1].privkey ) testlib.next_block( **kw ) resp = testlib.blockstore_name_preorder( "foo.test", wallets[2].privkey, wallets[3].addr ) if 'error' in resp: print json.dumps(resp) testlib.next_block( **kw ) # no name operations should work on this name, except register resp = testlib.blockstore_name_update( "foo.test", "11" * 20, wallets[3].privkey ) if 'error' in resp: print json.dumps(resp) testlib.next_block( **kw ) resp = testlib.blockstore_name_renew( "foo.test", wallets[3].privkey ) if 'error' in resp: print json.dumps(resp) testlib.next_block( **kw ) resp = testlib.blockstore_name_transfer( "foo.test", wallets[4].addr, True, wallets[3].privkey ) if 'error' in resp: print json.dumps(resp) testlib.next_block( **kw ) # try both addresses (should both fail) resp = testlib.blockstore_name_revoke( "foo.test", wallets[4].privkey ) if 'error' in resp: print json.dumps(resp) testlib.next_block( **kw ) resp = testlib.blockstore_name_revoke( "foo.test", wallets[3].privkey ) if 'error' in resp: print json.dumps(resp)
def scenario( wallets, **kw ): global final_consensus testlib.blockstore_namespace_preorder( "test", wallets[1].addr, wallets[0].privkey ) testlib.next_block( **kw ) testlib.blockstore_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 ) testlib.blockstore_namespace_ready( "test", wallets[1].privkey ) testlib.next_block( **kw ) resp = testlib.blockstore_name_preorder_multi( ["foo.test", "bar.test", "baz.test"], wallets[2].privkey, [wallets[3].addr, wallets[4].addr, wallets[5].addr] ) if 'error' in resp: print json.dumps( resp, indent=4 ) sys.exit(1) testlib.next_block( **kw ) preorder_consensus = testlib.get_consensus_at( testlib.get_current_block() ) resp = testlib.blockstore_name_register( "foo.test", wallets[2].privkey, wallets[3].addr ) if 'error' in resp: print json.dumps( resp, indent=4 ) sys.exit(1) resp = testlib.blockstore_name_register( "bar.test", wallets[2].privkey, wallets[4].addr ) if 'error' in resp: print json.dumps( resp, indent=4 ) sys.exit(1) testlib.next_block( **kw ) # should cause the whole thing to fail, since we didn't preorder this separately resp = testlib.blockstore_name_register( "goo.test", wallets[2].privkey, wallets[5].addr ) if 'error' in resp: print json.dumps( resp, indent=4 ) sys.exit(1) resp = testlib.blockstore_name_register( "baz.test", wallets[2].privkey, wallets[5].addr ) if 'error' in resp: print json.dumps( resp, indent=4 ) sys.exit(1) testlib.next_block( **kw )
def scenario( wallets, **kw ): global last_consensus, snv_block_id testlib.blockstore_namespace_preorder( "test", wallets[1].addr, wallets[0].privkey ) testlib.next_block( **kw ) testlib.blockstore_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 ) testlib.blockstore_namespace_ready( "test", wallets[1].privkey ) testlib.next_block( **kw ) resp = testlib.blockstore_name_preorder_multi( ["foo.test", "bar.test", "baz.test"], wallets[2].privkey, [wallets[3].addr, wallets[4].addr, wallets[5].addr] ) if 'error' in resp: print json.dumps( resp, indent=4 ) sys.exit(1) testlib.next_block( **kw ) preorder_consensus = testlib.get_consensus_at( testlib.get_current_block() ) resp = testlib.blockstore_name_register( "foo.test", wallets[2].privkey, wallets[3].addr ) if 'error' in resp: print json.dumps( resp, indent=4 ) sys.exit(1) testlib.next_block( **kw ) resp = testlib.blockstore_name_register( "bar.test", wallets[2].privkey, wallets[4].addr ) if 'error' in resp: print json.dumps( resp, indent=4 ) sys.exit(1) resp = testlib.blockstore_name_register( "baz.test", wallets[2].privkey, wallets[5].addr ) if 'error' in resp: print json.dumps( resp, indent=4 ) sys.exit(1) testlib.next_block( **kw ) # all blocks registered here snv_block_id = testlib.get_current_block( **kw ) testlib.next_block( **kw ) last_consensus = testlib.get_consensus_at( testlib.get_current_block( **kw ), **kw )
def scenario( wallets, **kw ): testlib.blockstore_namespace_preorder( "test", wallets[1].addr, wallets[0].privkey ) testlib.next_block( **kw ) testlib.blockstore_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 ) testlib.blockstore_namespace_ready( "test", wallets[1].privkey ) testlib.next_block( **kw ) testlib.blockstore_name_preorder( "foo.test", wallets[2].privkey, wallets[3].addr ) testlib.next_block( **kw ) # only wallets[3] should get it testlib.blockstore_name_register( "foo.test", wallets[4].privkey, wallets[3].addr ) testlib.blockstore_name_register( "foo.test", wallets[2].privkey, wallets[3].addr ) testlib.next_block( **kw )
def scenario( wallets, **kw ): global snv_block_id_foo, snv_txid_bar, snv_txid_baz, last_consensus # make a test namespace resp = testlib.blockstore_namespace_preorder( "test", wallets[1].addr, wallets[0].privkey ) if debug or 'error' in resp: print json.dumps( resp, indent=4 ) testlib.next_block( **kw ) resp = testlib.blockstore_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 ) testlib.next_block( **kw ) resp = testlib.blockstore_name_import( "foo.test", wallets[3].addr, "11" * 20, wallets[1].privkey ) if 'error' in resp: print json.dumps( resp, indent=4 ) testlib.next_block( **kw ) snv_block_id_foo = testlib.get_current_block() resp = testlib.blockstore_name_import( "bar.test", wallets[5].addr, "33" * 20, wallets[1].privkey ) if 'error' in resp: print json.dumps( resp, indent=4 ) testlib.next_block( **kw ) resp = testlib.blockstore_name_import( "baz.test", wallets[6].addr, "33" * 20, wallets[1].privkey ) if 'error' in resp: print json.dumps( resp, indent=4 ) testlib.next_block( **kw ) resp = testlib.blockstore_namespace_ready( "test", wallets[1].privkey ) if debug or 'error' in resp: print json.dumps( resp, indent=4 ) testlib.next_block( **kw ) resp = testlib.blockstore_name_transfer( "bar.test", wallets[4].addr, True, wallets[5].privkey ) if 'error' in resp: print json.dumps( resp, indent=4 ) snv_txid_bar = resp['transaction_hash'] testlib.next_block( **kw ) resp = testlib.blockstore_name_update( "baz.test", "22" * 20, wallets[6].privkey ) if 'error' in resp: print json.dumps( resp, indent=4 ) testlib.next_block( **kw ) last_consensus = testlib.get_consensus_at( testlib.get_current_block() )
def scenario(wallets, **kw): global debug resp = testlib.blockstore_namespace_preorder("test", wallets[1].addr, wallets[0].privkey) if debug or "error" in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) resp = testlib.blockstore_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) testlib.next_block(**kw) resp = testlib.blockstore_namespace_ready("test", wallets[1].privkey) if debug or "error" in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) resp = testlib.blockstore_name_preorder("foo.test", wallets[2].privkey, wallets[3].addr) if debug or "error" in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) resp = testlib.blockstore_name_register("foo.test", wallets[2].privkey, wallets[3].addr) if debug or "error" in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) resp = testlib.blockstore_name_update("foo.test", "11" * 20, wallets[3].privkey) if debug or "error" in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) resp = testlib.blockstore_name_transfer("foo.test", wallets[4].addr, True, wallets[3].privkey) if debug or "error" in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw)
def scenario(wallets, **kw): global txids global consensuses testlib.blockstore_namespace_preorder("test", wallets[1].addr, wallets[0].privkey) testlib.next_block(**kw) testlib.blockstore_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) testlib.blockstore_namespace_ready("test", wallets[1].privkey) testlib.next_block(**kw) testlib.blockstore_name_preorder("foo.test", wallets[2].privkey, wallets[3].addr) testlib.next_block(**kw) testlib.blockstore_name_register("foo.test", wallets[2].privkey, wallets[3].addr) testlib.next_block(**kw) testlib.next_block(**kw) # do a sequence of updates, every other block for i in xrange(0, 20): if (i % 2) != 0: update_hash = ("%02x" % (i)) * 20 resp = testlib.blockstore_name_update("foo.test", update_hash, wallets[3].privkey) txids[update_hash] = resp['transaction_hash'] consensuses[update_hash] = testlib.get_consensus_at( testlib.get_current_block(**kw), **kw) testlib.next_block(**kw) testlib.next_block(**kw)
def scenario( wallets, **kw ): testlib.blockstore_namespace_preorder( "test", wallets[1].addr, wallets[0].privkey ) testlib.next_block( **kw ) testlib.blockstore_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 ) testlib.blockstore_namespace_ready( "test", wallets[1].privkey ) testlib.next_block( **kw ) testlib.blockstore_name_preorder( "foo.test", wallets[2].privkey, wallets[3].addr ) testlib.next_block( **kw ) testlib.blockstore_name_register( "foo.test", wallets[2].privkey, wallets[3].addr ) testlib.next_block( **kw ) resp = testlib.blockstore_name_revoke( "foo.test", wallets[3].privkey ) print json.dumps( resp, indent=4 ) testlib.next_block( **kw )
def scenario( wallets, **kw ): testlib.blockstore_namespace_preorder( "test", wallets[1].addr, wallets[0].privkey ) testlib.next_block( **kw ) # NOTE: names expire in 13 blocks testlib.blockstore_namespace_reveal( "test", wallets[1].addr, 13, 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 ) testlib.blockstore_namespace_ready( "test", wallets[1].privkey ) testlib.next_block( **kw ) testlib.blockstore_name_preorder( "foo.test", wallets[2].privkey, wallets[3].addr ) testlib.next_block( **kw ) testlib.blockstore_name_register( "foo.test", wallets[2].privkey, wallets[3].addr ) testlib.next_block( **kw ) for i in xrange(0, 15): testlib.next_block( **kw )
def scenario(wallets, **kw): testlib.blockstore_namespace_preorder("test", wallets[1].addr, wallets[0].privkey) testlib.next_block(**kw) testlib.blockstore_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) testlib.blockstore_namespace_ready("test", wallets[1].privkey) testlib.next_block(**kw) resp = testlib.blockstore_name_preorder("foo.test", wallets[2].privkey, wallets[3].addr) if 'error' in resp: print json.dumps(resp) testlib.next_block(**kw) # wait for it to expire (takes a day) for i in xrange(0, 145): testlib.next_block(**kw) # re-preorder it resp = testlib.blockstore_name_preorder("foo.test", wallets[3].privkey, wallets[4].addr) if 'error' in resp: print json.dumps(resp) testlib.next_block(**kw) # register it resp = testlib.blockstore_name_register("foo.test", wallets[3].privkey, wallets[4].addr) if 'error' in resp: print json.dumps(resp) testlib.next_block(**kw)
def scenario(wallets, **kw): # order 3 namespaces testlib.blockstore_namespace_preorder("test1", wallets[1].addr, wallets[0].privkey) testlib.blockstore_namespace_preorder("test2", wallets[3].addr, wallets[2].privkey) testlib.blockstore_namespace_preorder("test3", wallets[5].addr, wallets[4].privkey) testlib.next_block(**kw) # reveal them all testlib.blockstore_namespace_reveal( "test1", wallets[1].addr, 52595, 250, 4, [6, 5, 4, 3, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 10, 11, wallets[0].privkey) testlib.blockstore_namespace_reveal( "test2", wallets[3].addr, 52596, 251, 5, [7, 6, 5, 4, 3, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 11, 12, wallets[2].privkey) testlib.blockstore_namespace_reveal( "test3", wallets[5].addr, 52597, 252, 6, [8, 7, 6, 5, 4, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2], 12, 13, wallets[4].privkey) testlib.next_block(**kw)
def scenario(wallets, **kw): testlib.blockstore_namespace_preorder("test", wallets[1].addr, wallets[0].privkey) testlib.next_block(**kw) testlib.blockstore_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) resp = testlib.blockstore_name_import("foo.test", "1BKufFedDrueBBFBXtiATB2PSdsBGZxf3N", "11" * 20, wallets[1].privkey) # master if 'error' in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) resp = testlib.blockstore_name_import( "foo.test", "1ARVjrtKnUVWt2GNrpuFLnNCL2WGUhKdkW", "33" * 20, wallets[3].privkey) # derived child 2 if 'error' in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) resp = testlib.blockstore_name_import( "foo.test", "1PYu4vKB3g2QLDFdurxqYSJ9aJSed7tne1", "22" * 20, wallets[2].privkey) # derived child 1 if 'error' in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) testlib.blockstore_namespace_ready("test", wallets[1].privkey) testlib.next_block(**kw)
def scenario(wallets, **kw): testlib.blockstore_namespace_preorder("test", wallets[1].addr, wallets[0].privkey) testlib.next_block(**kw) testlib.blockstore_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) resp = testlib.blockstore_name_import("foo.test", wallets[2].addr, "11" * 20, wallets[1].privkey) if 'error' in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) resp = testlib.blockstore_name_import("foo.test", wallets[3].addr, "22" * 20, wallets[1].privkey) if 'error' in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) resp = testlib.blockstore_name_import("foo.test", wallets[4].addr, "44" * 20, wallets[1].privkey) resp = testlib.blockstore_name_import("foo.test", wallets[4].addr, "55" * 20, wallets[1].privkey) resp = testlib.blockstore_name_import("foo.test", wallets[4].addr, "33" * 20, wallets[1].privkey) if 'error' in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) testlib.blockstore_namespace_ready("test", wallets[1].privkey) testlib.next_block(**kw)
def scenario(wallets, **kw): global working_dir testlib.blockstore_namespace_preorder("id", wallets[1].addr, wallets[0].privkey) testlib.next_block(**kw) testlib.blockstore_namespace_reveal( "id", 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) testlib.blockstore_namespace_ready("id", wallets[1].privkey) testlib.next_block(**kw) testlib.blockstore_name_preorder("judecn.id", wallets[2].privkey, wallets[3].addr) testlib.next_block(**kw) testlib.blockstore_name_register("judecn.id", wallets[2].privkey, wallets[3].addr) testlib.next_block(**kw) resp = testlib.blockstore_announce("hello world!", wallets[3].privkey) if 'error' in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) resp = testlib.blockstore_announce("This should not appear", wallets[4].privkey) if 'error' in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) # save... working_dir = testlib.get_working_dir(**kw)
def scenario(wallets, **kw): testlib.blockstore_namespace_preorder("test", wallets[1].addr, wallets[0].privkey) testlib.next_block(**kw) testlib.blockstore_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) testlib.blockstore_namespace_ready("test", wallets[1].privkey) testlib.next_block(**kw) testlib.blockstore_name_preorder("foo.test", wallets[2].privkey, wallets[3].addr) testlib.next_block(**kw) testlib.blockstore_name_register("foo.test", wallets[2].privkey, wallets[3].addr) testlib.next_block(**kw) testlib.blockstore_name_update("foo.test", "11" * 20, wallets[3].privkey) testlib.next_block(**kw) consensus_hash = testlib.get_consensus_at(testlib.get_current_block(**kw), **kw) # lots of blocks later... for i in xrange(0, 50): testlib.next_block(**kw) # update with stale consensus hash (should fail) testlib.blockstore_name_update("foo.test", "22" * 20, wallets[3].privkey, consensus_hash=consensus_hash) testlib.next_block(**kw)
def scenario( wallets, **kw ): testlib.blockstore_namespace_preorder( "test", wallets[1].addr, wallets[0].privkey ) testlib.next_block( **kw ) testlib.blockstore_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 ) testlib.blockstore_namespace_ready( "test", wallets[1].privkey ) testlib.next_block( **kw ) testlib.blockstore_name_preorder( "foo.test", wallets[2].privkey, wallets[3].addr ) testlib.blockstore_name_preorder( "foo.test", wallets[4].privkey, wallets[5].addr ) testlib.blockstore_name_preorder( "foo.test", wallets[0].privkey, wallets[1].addr ) testlib.blockstore_name_preorder( "foo.test", wallets[5].privkey, wallets[2].addr ) testlib.next_block( **kw ) # all of these should fail, since they're in the same block testlib.blockstore_name_register( "foo.test", wallets[2].privkey, wallets[3].addr ) testlib.blockstore_name_register( "foo.test", wallets[4].privkey, wallets[5].addr ) testlib.blockstore_name_register( "foo.test", wallets[0].privkey, wallets[1].addr ) testlib.blockstore_name_register( "foo.test", wallets[5].privkey, wallets[2].addr ) testlib.next_block( **kw )
def scenario(wallets, **kw): global debug resp = testlib.blockstore_namespace_preorder("test", wallets[1].addr, wallets[0].privkey) if debug or 'error' in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) resp = testlib.blockstore_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) testlib.next_block(**kw) resp = testlib.blockstore_namespace_ready("test", wallets[1].privkey) if debug or 'error' in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) resp = testlib.blockstore_name_preorder("foo.test", wallets[2].privkey, wallets[3].addr) if debug or 'error' in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) resp = testlib.blockstore_name_register("foo.test", wallets[2].privkey, wallets[3].addr) if debug or 'error' in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) resp = testlib.blockstore_name_transfer("foo.test", wallets[4].addr, True, wallets[3].privkey) if debug or 'error' in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) global snv_consensus, snv_block_id snv_block_id = testlib.get_current_block() snv_consensus = testlib.get_consensus_at(snv_block_id)
def scenario(wallets, **kw): global last_consensus, snv_block_id # make a test namespace resp = testlib.blockstore_namespace_preorder("test", wallets[1].addr, wallets[0].privkey) if debug or 'error' in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) resp = testlib.blockstore_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) testlib.next_block(**kw) resp = testlib.blockstore_name_import("foo.test", wallets[3].addr, "11" * 20, wallets[1].privkey) if 'error' in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) snv_block_id = testlib.get_current_block() resp = testlib.blockstore_namespace_ready("test", wallets[1].privkey) if debug or 'error' in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) resp = testlib.blockstore_name_transfer("foo.test", wallets[4].addr, True, wallets[3].privkey) if 'error' in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) resp = testlib.blockstore_name_update("foo.test", "22" * 20, wallets[4].privkey) if 'error' in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) last_consensus = testlib.get_consensus_at(testlib.get_current_block())
def scenario(wallets, **kw): testlib.blockstore_namespace_preorder("test", wallets[1].addr, wallets[0].privkey) testlib.next_block(**kw) testlib.blockstore_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) # will all be rejected trivially, since the first import must come from the importer's address testlib.blockstore_name_import("foo.test", wallets[4].addr, "11" * 20, wallets[2].privkey) testlib.blockstore_name_import("bar.test", wallets[2].addr, "22" * 20, wallets[3].privkey) testlib.blockstore_name_import("baz.test", wallets[3].addr, "33" * 20, wallets[4].privkey) testlib.next_block(**kw) # will be accepted testlib.blockstore_name_import("goo.test", wallets[2].addr, "11" * 20, wallets[1].privkey) # will all be rejected because they weren't sent from a importer-derived key testlib.blockstore_name_import("foo.test", wallets[4].addr, "11" * 20, wallets[2].privkey) testlib.blockstore_name_import("bar.test", wallets[2].addr, "22" * 20, wallets[3].privkey) testlib.blockstore_name_import("baz.test", wallets[3].addr, "33" * 20, wallets[4].privkey) testlib.next_block(**kw) testlib.blockstore_namespace_ready("test", wallets[1].privkey) testlib.next_block(**kw)