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): 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 ): global snv_block_id, last_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 ) 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() resp = testlib.blockstore_name_revoke( "foo.test", wallets[3].privkey ) 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) 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) resp = testlib.blockstore_name_revoke("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 ) 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 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_revoke("foo.test", wallets[4].privkey) if debug or '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_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_revoke( "foo.test", wallets[3].privkey ) if debug or 'error' in resp: print json.dumps( resp, indent=4 ) testlib.next_block( **kw ) # should fail 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 ): 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[4].privkey ) testlib.next_block( **kw )
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_namespace_ready( "test", wallets[1].privkey ) if debug or 'error' in resp: print json.dumps( resp, indent=4 ) testlib.next_block( **kw ) # preorder 3 names in the same block: foo.test, bar.test, baz.test names = ['foo.test', 'bar.test', 'baz.test'] name_preorder_wallets = [wallets[2], wallets[3], wallets[4]] name_register_wallets = [wallets[5], wallets[6], wallets[7]] name_transfer_wallets = [wallets[6], wallets[7], wallets[5]] resp = testlib.blockstore_name_preorder_multi( names, wallets[2].privkey, [wallets[5].addr, wallets[6].addr, wallets[7].addr]) if 'error' in resp: print json.dumps( resp, indent=4 ) sys.exit(1) testlib.next_block( **kw ) # regster 3 names in the same block for i in xrange(0, len(names)): name = names[i] preorder_wallet = name_preorder_wallets[i] register_wallet = name_register_wallets[i] resp = testlib.blockstore_name_register( name, wallets[2].privkey, register_wallet.addr ) if debug or 'error' in resp: print json.dumps( resp, indent=4 ) testlib.next_block( **kw ) snv_block_id = testlib.get_current_block( **kw ) # update 3 names in the same block for i in xrange(0, len(names)): name = names[i] register_wallet = name_register_wallets[i] resp = testlib.blockstore_name_update( name, str(i + 1) * 40, register_wallet.privkey ) if debug or 'error' in resp: print json.dumps( resp, indent=4 ) testlib.next_block( **kw ) # transfer 3 names in the same block for i in xrange(0, len(names)): name = names[i] register_wallet = name_register_wallets[i] transfer_wallet = name_transfer_wallets[i] resp = testlib.blockstore_name_transfer( name, transfer_wallet.addr, True, register_wallet.privkey ) if debug or 'error' in resp: print json.dumps( resp, indent=4 ) testlib.next_block( **kw ) # exchange after transfer... tmp = name_register_wallets name_register_wallets = name_transfer_wallets name_transfer_wallets = tmp # renew 3 names in the same block for i in xrange(0, len(names)): name = names[i] register_wallet = name_register_wallets[i] resp = testlib.blockstore_name_renew( name, register_wallet.privkey ) if debug or 'error' in resp: print json.dumps( resp, indent=4 ) testlib.next_block( **kw ) # revoke 3 names in the same block for i in xrange(0, len(names)): name = names[i] register_wallet = name_register_wallets[i] resp = testlib.blockstore_name_revoke( name, register_wallet.privkey ) if debug or 'error' in resp: print json.dumps( resp, indent=4 ) # iterate the blocks a few times for i in xrange(0, 5): testlib.next_block( **kw ) last_consensus = testlib.get_consensus_at( testlib.get_current_block( **kw ), **kw )
def scenario(wallets, **kw): # 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) # import 3 names in the same block: foo.test, bar.test, baz.test names = ['foo.test', 'bar.test', 'baz.test'] name_preorder_wallets = [wallets[2], wallets[3], wallets[4]] name_register_wallets = [wallets[5], wallets[6], wallets[7]] name_transfer_wallets = [wallets[6], wallets[7], wallets[5]] for i in xrange(0, len(names)): name = names[i] register_wallet = name_register_wallets[i] resp = testlib.blockstore_name_import(name, register_wallet.addr, str(9 - i) * 40, wallets[1].privkey) if debug or 'error' in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) # namespace ready... 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) # update 3 names in the same block for i in xrange(0, len(names)): name = names[i] register_wallet = name_register_wallets[i] resp = testlib.blockstore_name_update(name, str(i + 1) * 40, register_wallet.privkey) if debug or 'error' in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) # transfer 3 names in the same block for i in xrange(0, len(names)): name = names[i] register_wallet = name_register_wallets[i] transfer_wallet = name_transfer_wallets[i] resp = testlib.blockstore_name_transfer(name, transfer_wallet.addr, True, register_wallet.privkey) if debug or 'error' in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) # exchange after transfer... tmp = name_register_wallets name_register_wallets = name_transfer_wallets name_transfer_wallets = tmp # revoke 3 names in the same block for i in xrange(0, len(names)): name = names[i] register_wallet = name_register_wallets[i] resp = testlib.blockstore_name_revoke(name, register_wallet.privkey) if debug or 'error' in resp: print json.dumps(resp, indent=4) # iterate the blocks a few times for i in xrange(0, 5): testlib.next_block(**kw)
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_namespace_ready("test", wallets[1].privkey) if debug or 'error' in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) # preorder 3 names in the same block: foo.test, bar.test, baz.test names = ['foo.test', 'bar.test', 'baz.test'] name_preorder_wallets = [wallets[2], wallets[3], wallets[4]] name_register_wallets = [wallets[5], wallets[6], wallets[7]] name_transfer_wallets = [wallets[6], wallets[7], wallets[5]] resp = testlib.blockstore_name_preorder_multi( names, wallets[2].privkey, [wallets[5].addr, wallets[6].addr, wallets[7].addr]) if 'error' in resp: print json.dumps(resp, indent=4) sys.exit(1) testlib.next_block(**kw) # regster 3 names in the same block for i in xrange(0, len(names)): name = names[i] preorder_wallet = name_preorder_wallets[i] register_wallet = name_register_wallets[i] resp = testlib.blockstore_name_register(name, wallets[2].privkey, register_wallet.addr) if debug or 'error' in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) snv_block_id = testlib.get_current_block(**kw) # update 3 names in the same block for i in xrange(0, len(names)): name = names[i] register_wallet = name_register_wallets[i] resp = testlib.blockstore_name_update(name, str(i + 1) * 40, register_wallet.privkey) if debug or 'error' in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) # transfer 3 names in the same block for i in xrange(0, len(names)): name = names[i] register_wallet = name_register_wallets[i] transfer_wallet = name_transfer_wallets[i] resp = testlib.blockstore_name_transfer(name, transfer_wallet.addr, True, register_wallet.privkey) if debug or 'error' in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) # exchange after transfer... tmp = name_register_wallets name_register_wallets = name_transfer_wallets name_transfer_wallets = tmp # renew 3 names in the same block for i in xrange(0, len(names)): name = names[i] register_wallet = name_register_wallets[i] resp = testlib.blockstore_name_renew(name, register_wallet.privkey) if debug or 'error' in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) # revoke 3 names in the same block for i in xrange(0, len(names)): name = names[i] register_wallet = name_register_wallets[i] resp = testlib.blockstore_name_revoke(name, register_wallet.privkey) if debug or 'error' in resp: print json.dumps(resp, indent=4) # iterate the blocks a few times for i in xrange(0, 5): 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 ) 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 ) # try to exceed quota (currently 25): order 25, and try to register a 26th for i in xrange(0, 25): resp = testlib.blockstore_name_import( "foo%s.test" % i, wallets[3].addr, "22" * 20, wallets[1].privkey ) if 'error' in resp: print json.dumps(resp, indent=4 ) testlib.next_block( **kw ) # try to exceed quota (currently 25): order 26, and try to update one of them (and try to transfer one too). for i in xrange(0, 27): resp = testlib.blockstore_name_import( "bar%s.test" % i, 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 ) print wallets[3].privkey resp = testlib.blockstore_name_preorder( "foofail.test", wallets[3].privkey, wallets[1].addr ) if 'error' in resp: print json.dumps( resp, indent=4 ) testlib.next_block( **kw ) # should fail resp = testlib.blockstore_name_register( "foofail.test",wallets[3].privkey, wallets[1].addr ) if 'error' in resp: print json.dumps( resp, indent=4 ) testlib.next_block( **kw ) # should succeed resp = testlib.blockstore_name_update( "foo0.test", '55' * 20, wallets[3].privkey ) if 'error' in resp: print json.dumps( resp, indent=4 ) testlib.next_block( **kw ) resp = testlib.blockstore_name_preorder( "barfail.test", wallets[4].privkey, wallets[2].addr ) if 'error' in resp: print json.dumps( resp, indent=4 ) testlib.next_block( **kw ) # should fail (exceeded quota) resp = testlib.blockstore_name_register( "barfail.test", wallets[4].privkey, wallets[2].addr ) if 'error' in resp: print json.dumps( resp, indent=4 ) testlib.next_block( **kw ) # should fail (exceeded quota--have to revoke or give names away) resp = testlib.blockstore_name_update( "bar0.test", '44' * 20, wallets[4].privkey ) if 'error' in resp: print json.dumps( resp, indent=4 ) testlib.next_block( **kw ) # should succeed (give a name away) resp = testlib.blockstore_name_transfer( "bar0.test", wallets[1].addr, True, wallets[4].privkey ) if 'error' in resp: print json.dumps( resp, indent=4 ) testlib.next_block( **kw ) # should fail (exceeded quota--have to revoke or give names away) resp = testlib.blockstore_name_update( "bar0.test", '44' * 20, wallets[4].privkey ) if 'error' in resp: print json.dumps( resp, indent=4 ) testlib.next_block( **kw ) # should succeed (revoke a name) resp = testlib.blockstore_name_revoke( "bar2.test", wallets[4].privkey ) if 'error' in resp: print json.dumps( resp, indent=4 ) testlib.next_block( **kw ) # should succeed (now under quota) resp = testlib.blockstore_name_update( "bar1.test", '66' * 20, wallets[4].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, 10, 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_revoke( "foo.test", wallets[3].privkey ) testlib.next_block( **kw ) # can't do anything with the name for another 10 blocks resp = testlib.blockstore_name_update( "foo.test", "11" * 20, wallets[3].privkey ) if 'error' in resp: print json.dumps( resp, indent=4 ) testlib.next_block( **kw ) # should fail 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 ) # should fail resp = testlib.blockstore_name_renew( "foo.test", wallets[3].privkey ) if 'error' in resp: print json.dumps( resp, indent=4 ) testlib.next_block( **kw ) # wait for it to expire... for i in xrange(0, 8): testlib.next_block( **kw ) # verify that operations continue to fail resp = testlib.blockstore_name_update( "foo.test", "11" * 20, wallets[3].privkey ) if 'error' in resp: print json.dumps( resp, indent=4 ) testlib.next_block( **kw ) # should fail 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 ) # should fail resp = testlib.blockstore_name_renew( "foo.test", wallets[3].privkey ) if 'error' in resp: print json.dumps( resp, indent=4 ) testlib.next_block( **kw ) # re-preorder... 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 ) # re-register 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 )
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, 10, 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_revoke( "foo.test", wallets[3].privkey ) testlib.next_block( **kw ) # can't do anything with the name for another 10 blocks resp = testlib.blockstore_name_update( "foo.test", "11" * 20, wallets[3].privkey ) if 'error' in resp: print json.dumps( resp, indent=4 ) testlib.next_block( **kw ) # should fail 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 ) # should fail resp = testlib.blockstore_name_renew( "foo.test", wallets[3].privkey ) if 'error' in resp: print json.dumps( resp, indent=4 ) testlib.next_block( **kw ) # wait for it to expire... for i in xrange(0, 8): testlib.next_block( **kw ) # verify that operations continue to fail resp = testlib.blockstore_name_update( "foo.test", "11" * 20, wallets[3].privkey ) if 'error' in resp: print json.dumps( resp, indent=4 ) testlib.next_block( **kw ) # should fail 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 ) # should fail resp = testlib.blockstore_name_renew( "foo.test", wallets[3].privkey ) if 'error' in resp: print json.dumps( resp, indent=4 ) testlib.next_block( **kw )
def scenario(wallets, **kw): # 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) # import 3 names in the same block: foo.test, bar.test, baz.test names = ["foo.test", "bar.test", "baz.test"] name_preorder_wallets = [wallets[2], wallets[3], wallets[4]] name_register_wallets = [wallets[5], wallets[6], wallets[7]] name_transfer_wallets = [wallets[6], wallets[7], wallets[5]] for i in xrange(0, len(names)): name = names[i] register_wallet = name_register_wallets[i] resp = testlib.blockstore_name_import(name, register_wallet.addr, str(9 - i) * 40, wallets[1].privkey) if debug or "error" in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) # namespace ready... 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) # update 3 names in the same block for i in xrange(0, len(names)): name = names[i] register_wallet = name_register_wallets[i] resp = testlib.blockstore_name_update(name, str(i + 1) * 40, register_wallet.privkey) if debug or "error" in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) # transfer 3 names in the same block for i in xrange(0, len(names)): name = names[i] register_wallet = name_register_wallets[i] transfer_wallet = name_transfer_wallets[i] resp = testlib.blockstore_name_transfer(name, transfer_wallet.addr, True, register_wallet.privkey) if debug or "error" in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) # exchange after transfer... tmp = name_register_wallets name_register_wallets = name_transfer_wallets name_transfer_wallets = tmp # revoke 3 names in the same block for i in xrange(0, len(names)): name = names[i] register_wallet = name_register_wallets[i] resp = testlib.blockstore_name_revoke(name, register_wallet.privkey) if debug or "error" in resp: print json.dumps(resp, indent=4) # iterate the blocks a few times for i in xrange(0, 5): testlib.next_block(**kw)
def scenario( wallets, **kw ): subsidy_wallet = wallets[5] print json.dumps( testlib.getrawtransaction( "28f78fbae22d2273341af231a2ac049d74958e1e6ce6ae622cd48d8f0fef591e", 1 ), indent=4 ) 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 ) # subsidized transactions... resp = testlib.blockstore_name_preorder( "foo.test", None, wallets[3].addr, subsidy_key=subsidy_wallet.privkey ) if debug or 'error' in resp: print json.dumps( resp, indent=4 ) # (already subsidized...) send_subsidized( None, resp, **kw ) testlib.next_block( **kw ) resp = testlib.blockstore_name_register( "foo.test", None, wallets[3].addr, subsidy_key=subsidy_wallet.privkey ) if debug or 'error' in resp: print json.dumps( resp, indent=4 ) # (already subsidized...) send_subsidized( None, resp, **kw ) testlib.next_block( **kw ) resp = testlib.blockstore_name_update( "foo.test", "11" * 20, None, user_public_key=wallets[3].pubkey_hex, subsidy_key=subsidy_wallet.privkey ) if debug or 'error' in resp: print json.dumps( resp, indent=4 ) send_subsidized( wallets[3].privkey, resp, **kw ) testlib.next_block( **kw ) resp = testlib.blockstore_name_transfer( "foo.test", wallets[4].addr, True, None, user_public_key=wallets[3].pubkey_hex, subsidy_key=subsidy_wallet.privkey ) if debug or 'error' in resp: print json.dumps( resp, indent=4 ) send_subsidized( wallets[3].privkey, resp, **kw ) testlib.next_block( **kw ) resp = testlib.blockstore_name_revoke( "foo.test", None, user_public_key=wallets[4].pubkey_hex, subsidy_key=subsidy_wallet.privkey ) if debug or 'error' in resp: print json.dumps( resp, indent=4 ) send_subsidized( wallets[4].privkey, resp, **kw ) # advance a bit for i in xrange(0, 5): 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) # try to exceed quota (currently 25): order 25, and try to register a 26th for i in xrange(0, 25): resp = testlib.blockstore_name_import("foo%s.test" % i, wallets[3].addr, "22" * 20, wallets[1].privkey) if 'error' in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) # try to exceed quota (currently 25): order 26, and try to update one of them (and try to transfer one too). for i in xrange(0, 27): resp = testlib.blockstore_name_import("bar%s.test" % i, 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) print wallets[3].privkey resp = testlib.blockstore_name_preorder("foofail.test", wallets[3].privkey, wallets[1].addr) if 'error' in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) # should fail resp = testlib.blockstore_name_register("foofail.test", wallets[3].privkey, wallets[1].addr) if 'error' in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) # should succeed resp = testlib.blockstore_name_update("foo0.test", '55' * 20, wallets[3].privkey) if 'error' in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) resp = testlib.blockstore_name_preorder("barfail.test", wallets[4].privkey, wallets[2].addr) if 'error' in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) # should fail (exceeded quota) resp = testlib.blockstore_name_register("barfail.test", wallets[4].privkey, wallets[2].addr) if 'error' in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) # should fail (exceeded quota--have to revoke or give names away) resp = testlib.blockstore_name_update("bar0.test", '44' * 20, wallets[4].privkey) if 'error' in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) # should succeed (give a name away) resp = testlib.blockstore_name_transfer("bar0.test", wallets[1].addr, True, wallets[4].privkey) if 'error' in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) # should fail (exceeded quota--have to revoke or give names away) resp = testlib.blockstore_name_update("bar0.test", '44' * 20, wallets[4].privkey) if 'error' in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) # should succeed (revoke a name) resp = testlib.blockstore_name_revoke("bar2.test", wallets[4].privkey) if 'error' in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) # should succeed (now under quota) resp = testlib.blockstore_name_update("bar1.test", '66' * 20, wallets[4].privkey) if 'error' in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw)