def scenario(wallets, **kw): testlib.blockstack_namespace_preorder("test", wallets[1].addr, wallets[0].privkey) testlib.next_block(**kw) testlib.blockstack_namespace_reveal( "test", wallets[1].addr, 52595, 250, 4, [6, 5, 4, 3, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 10, 10, wallets[0].privkey) testlib.next_block(**kw) testlib.blockstack_namespace_ready("test", wallets[1].privkey) testlib.next_block(**kw) # can't import once ready resp = testlib.blockstack_name_import("foo.test", wallets[1].addr, "11" * 20, wallets[0].privkey, safety_checks=False) if 'error' in resp: print json.dumps(resp, indent=4) testlib.next_block(**kw) testlib.expect_snv_fail("foo.test")
def scenario( wallets, **kw ): testlib.blockstack_namespace_preorder( "test", wallets[1].addr, wallets[0].privkey ) testlib.next_block( **kw ) testlib.blockstack_namespace_reveal( "test", wallets[1].addr, 52595, 250, 4, [6,5,4,3,2,1,0,0,0,0,0,0,0,0,0,0], 10, 10, wallets[0].privkey ) testlib.next_block( **kw ) testlib.blockstack_namespace_ready( "test", wallets[1].privkey ) testlib.next_block( **kw ) # can't import once ready resp = testlib.blockstack_name_import( "foo.test", wallets[1].addr, "11" * 20, wallets[0].privkey ) if 'error' in resp: print json.dumps( resp, indent=4 ) testlib.next_block( **kw ) testlib.expect_snv_fail("foo.test" )
def scenario(wallets, **kw): testlib.blockstack_namespace_preorder("test", wallets[1].addr, wallets[0].privkey) testlib.next_block(**kw) testlib.blockstack_namespace_reveal( "test", wallets[1].addr, 52595, 250, 4, [6, 5, 4, 3, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 10, 10, wallets[0].privkey) testlib.next_block(**kw) # will all be rejected trivially, since the first import must come from the importer's address testlib.blockstack_name_import("foo.test", wallets[4].addr, "11" * 20, wallets[2].privkey, safety_checks=False) testlib.blockstack_name_import("bar.test", wallets[2].addr, "22" * 20, wallets[3].privkey, safety_checks=False) testlib.blockstack_name_import("baz.test", wallets[3].addr, "33" * 20, wallets[4].privkey, safety_checks=False) testlib.next_block(**kw) # will be accepted testlib.blockstack_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.blockstack_name_import("foo.test", wallets[4].addr, "11" * 20, wallets[2].privkey, safety_checks=False) testlib.blockstack_name_import("bar.test", wallets[2].addr, "22" * 20, wallets[3].privkey, safety_checks=False) testlib.blockstack_name_import("baz.test", wallets[3].addr, "33" * 20, wallets[4].privkey, safety_checks=False) testlib.next_block(**kw) testlib.blockstack_namespace_ready("test", wallets[1].privkey) testlib.next_block(**kw) testlib.expect_snv_fail("foo.test") testlib.expect_snv_fail("bar.test") testlib.expect_snv_fail("baz.test")
def scenario( wallets, **kw ): testlib.blockstack_namespace_preorder( "test", wallets[1].addr, wallets[0].privkey ) testlib.next_block( **kw ) testlib.blockstack_namespace_reveal( "test", wallets[1].addr, 52595, 250, 4, [6,5,4,3,2,1,0,0,0,0,0,0,0,0,0,0], 10, 10, wallets[0].privkey ) testlib.next_block( **kw ) # will all be rejected trivially, since the first import must come from the importer's address testlib.blockstack_name_import( "foo.test", wallets[4].addr, "11" * 20, wallets[2].privkey, safety_checks=False ) testlib.blockstack_name_import( "bar.test", wallets[2].addr, "22" * 20, wallets[3].privkey, safety_checks=False ) testlib.blockstack_name_import( "baz.test", wallets[3].addr, "33" * 20, wallets[4].privkey, safety_checks=False) testlib.next_block( **kw ) # will be accepted testlib.blockstack_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.blockstack_name_import( "foo.test", wallets[4].addr, "11" * 20, wallets[2].privkey, safety_checks=False ) testlib.blockstack_name_import( "bar.test", wallets[2].addr, "22" * 20, wallets[3].privkey, safety_checks=False ) testlib.blockstack_name_import( "baz.test", wallets[3].addr, "33" * 20, wallets[4].privkey, safety_checks=False ) testlib.next_block( **kw ) testlib.blockstack_namespace_ready( "test", wallets[1].privkey ) testlib.next_block( **kw ) testlib.expect_snv_fail( "foo.test" ) testlib.expect_snv_fail( "bar.test" ) testlib.expect_snv_fail( "baz.test" )
def scenario( wallets, **kw ): testlib.ysi_namespace_preorder( "test", wallets[1].addr, wallets[0].privkey ) testlib.next_block( **kw ) testlib.ysi_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.ysi_name_import( "foo.test", wallets[2].addr, "11" * 20, wallets[1].privkey ) if 'error' in resp: print json.dumps(resp, indent=4 ) return False testlib.next_block( **kw ) print "\nImport 25 names for %s" % wallets[3].addr # try to exceed quota (currently 25): order 25, and try to register a 26th for i in xrange(0, 25): resp = testlib.ysi_name_import( "foo%s.test" % i, wallets[3].addr, "22" * 20, wallets[1].privkey ) if 'error' in resp: print json.dumps(resp, indent=4 ) return False if i % 2 == 1: testlib.next_block( **kw ) testlib.next_block( **kw ) print "\nImport 26 names for %s" % wallets[4].addr # 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, 26): resp = testlib.ysi_name_import( "bar%s.test" % i, wallets[4].addr, "33" * 20, wallets[1].privkey, safety_checks=False ) if 'error' in resp: print json.dumps(resp, indent=4 ) return False if i % 2 == 1: testlib.next_block( **kw ) testlib.next_block( **kw ) testlib.ysi_namespace_ready( "test", wallets[1].privkey ) testlib.next_block( **kw ) print wallets[3].privkey resp = testlib.ysi_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.ysi_name_register( "foofail.test",wallets[3].privkey, wallets[1].addr ) if 'error' in resp: print json.dumps( resp, indent=4 ) testlib.next_block( **kw ) testlib.expect_snv_fail_at( "foofail.test", testlib.get_current_block(**kw)) # should succeed resp = testlib.ysi_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.ysi_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.ysi_name_register( "barfail.test", wallets[4].privkey, wallets[2].addr, safety_checks=False ) if 'error' in resp: print json.dumps( resp, indent=4 ) testlib.next_block( **kw ) testlib.expect_snv_fail_at( "barfail.test", testlib.get_current_block(**kw)) # should fail (exceeded quota--have to revoke or give names away) resp = testlib.ysi_name_update( "bar0.test", '44' * 20, wallets[4].privkey, safety_checks=False ) if 'error' in resp: print json.dumps( resp, indent=4 ) testlib.next_block( **kw ) testlib.expect_snv_fail_at( "bar0.test", testlib.get_current_block(**kw)) # should succeed (give a name away) resp = testlib.ysi_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.ysi_name_update( "bar0.test", '44' * 20, wallets[4].privkey, safety_checks=False ) if 'error' in resp: print json.dumps( resp, indent=4 ) testlib.next_block( **kw ) testlib.expect_snv_fail_at( "bar0.test", testlib.get_current_block(**kw)) # should succeed (revoke a name) resp = testlib.ysi_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.ysi_name_update( "bar1.test", '66' * 20, wallets[4].privkey ) if 'error' in resp: print json.dumps( resp, indent=4 ) testlib.next_block( **kw ) testlib.expect_snv_fail( "foofail.test" ) testlib.expect_snv_fail( "barfail.test" )
def scenario( wallets, **kw ): testlib.blockstack_namespace_preorder( "test", wallets[1].addr, wallets[0].privkey ) testlib.next_block( **kw ) testlib.blockstack_namespace_reveal( "test", wallets[1].addr, 52595, 250, 4, [6,5,4,3,2,1,0,0,0,0,0,0,0,0,0,0], 10, 10, wallets[0].privkey ) testlib.next_block( **kw ) resp = testlib.blockstack_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 ) print "\nImport 25 names for %s" % wallets[3].addr # try to exceed quota (currently 25): order 25, and try to register a 26th for i in xrange(0, 25): resp = testlib.blockstack_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 ) print "\nImport 27 names for %s" % wallets[4].addr # 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.blockstack_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.blockstack_namespace_ready( "test", wallets[1].privkey ) testlib.next_block( **kw ) print wallets[3].privkey resp = testlib.blockstack_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.blockstack_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.blockstack_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.blockstack_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.blockstack_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.blockstack_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.blockstack_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.blockstack_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.blockstack_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.blockstack_name_update( "bar1.test", '66' * 20, wallets[4].privkey ) if 'error' in resp: print json.dumps( resp, indent=4 ) testlib.next_block( **kw ) testlib.expect_snv_fail( "foofail.test" ) testlib.expect_snv_fail( "barfail.test" )