def scenario( wallets, **kw ): global zonefile_hash 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 ) wallet = testlib.blockstack_client_initialize_wallet( "0123456789abcdef", wallets[2].privkey, wallets[3].privkey, wallets[4].privkey ) resp = testlib.blockstack_cli_register( "foo.test", "0123456789abcdef" ) if 'error' in resp: print >> sys.stderr, json.dumps(resp, indent=4, sort_keys=True) return False # wait for the preorder to get confirmed for i in xrange(0, 12): testlib.next_block( **kw ) # wait for the poller to pick it up print >> sys.stderr, "Waiting 10 seconds for the backend to submit the register" time.sleep(10) # wait for the register to get confirmed for i in xrange(0, 12): # warn the serialization checker that this changes behavior from 0.13 print "BLOCKSTACK_SERIALIZATION_CHECK_IGNORE value_hash" sys.stdout.flush() testlib.next_block( **kw ) print >> sys.stderr, "Waiting 10 seconds for the backend to acknowledge registration" time.sleep(10) # wait for initial update to get confirmed for i in xrange(0, 12): # warn the serialization checker that this changes behavior from 0.13 print "BLOCKSTACK_SERIALIZATION_CHECK_IGNORE value_hash" sys.stdout.flush() testlib.next_block( **kw ) print >> sys.stderr, "Waiting 10 seconds for the backend to acknowledge update" time.sleep(10) # what's the name's renewal block? proxy = testlib.make_proxy() res = blockstack_client.get_name_blockchain_record( "foo.test", proxy=proxy ) if 'error' in res: print >> sys.stderr, json.dumps(res, indent=4, sort_keys=True) return False old_expire_block = res['expire_block'] # send an update, changing the zonefile data_pubkey = wallet['data_pubkey'] zonefile = blockstack_client.zonefile.make_empty_zonefile( "foo.test", data_pubkey ) blockstack_client.user.put_immutable_data_zonefile( zonefile, "testdata", blockstack_client.get_data_hash("testdata"), data_url="file:///testdata") zonefile_json = json.dumps(zonefile) resp = testlib.blockstack_cli_update( "foo.test", zonefile_json, "0123456789abcdef" ) if 'error' in resp: print >> sys.stderr, "update error: %s" % resp['error'] return False zonefile_hash = resp['zonefile_hash'] # wait for it to go through for i in xrange(0, 12): # warn the serialization checker that this changes behavior from 0.13 print "BLOCKSTACK_SERIALIZATION_CHECK_IGNORE value_hash" sys.stdout.flush() testlib.next_block( **kw ) print >> sys.stderr, "Waiting 10 seconds for the backend to acknowedge the update" time.sleep(10) # wait for it to go through for i in xrange(0, 12): # warn the serialization checker that this changes behavior from 0.13 print "BLOCKSTACK_SERIALIZATION_CHECK_IGNORE value_hash" sys.stdout.flush() testlib.next_block( **kw ) # revoke it resp = testlib.blockstack_cli_revoke( "foo.test", "0123456789abcdef" ) if 'error' in resp: print >> sys.stderr, "Revoke request failed:\n%s" % json.dumps(resp, indent=4, sort_keys=True) return False print >> sys.stderr, "Waiting 10 seconds for the backend to acknowledge the revoke" time.sleep(10) # wait for it to go through for i in xrange(0, 12): testlib.next_block( **kw )
def scenario(wallets, **kw): global zonefile_hash 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) wallet = testlib.blockstack_client_initialize_wallet( "0123456789abcdef", wallets[2].privkey, wallets[3].privkey, wallets[4].privkey) resp = testlib.blockstack_cli_register("foo.test", "0123456789abcdef") if 'error' in resp: print >> sys.stderr, json.dumps(resp, indent=4, sort_keys=True) return False # wait for the preorder to get confirmed for i in xrange(0, 12): testlib.next_block(**kw) # wait for the poller to pick it up print >> sys.stderr, "Waiting 10 seconds for the backend to submit the register" time.sleep(10) # wait for the register to get confirmed for i in xrange(0, 12): # warn the serialization checker that this changes behavior from 0.13 print "BLOCKSTACK_SERIALIZATION_CHECK_IGNORE value_hash" sys.stdout.flush() testlib.next_block(**kw) print >> sys.stderr, "Waiting 10 seconds for the backend to acknowledge registration" time.sleep(10) # wait for initial update to get confirmed for i in xrange(0, 12): # warn the serialization checker that this changes behavior from 0.13 print "BLOCKSTACK_SERIALIZATION_CHECK_IGNORE value_hash" sys.stdout.flush() testlib.next_block(**kw) print >> sys.stderr, "Waiting 10 seconds for the backend to acknowledge update" time.sleep(10) # wait for zonefile posting for i in xrange(0, 12): # warn the serialization checker that this changes behavior from 0.13 print "BLOCKSTACK_SERIALIZATION_CHECK_IGNORE value_hash" sys.stdout.flush() testlib.next_block(**kw) print >> sys.stderr, "Waiting 10 seconds for the backend to send zonefile" time.sleep(10) # what's the name's renewal block? proxy = testlib.make_proxy() res = blockstack_client.get_name_blockchain_record("foo.test", proxy=proxy) if 'error' in res: print >> sys.stderr, json.dumps(res, indent=4, sort_keys=True) return False old_expire_block = res['expire_block'] # send an update, changing the zonefile data_pubkey = wallet['data_pubkey'] zonefile = blockstack_client.zonefile.make_empty_zonefile( "foo.test", data_pubkey) blockstack_client.user.put_immutable_data_zonefile( zonefile, "testdata", blockstack_client.get_data_hash("testdata"), data_url="file:///testdata") zonefile_json = json.dumps(zonefile) resp = testlib.blockstack_cli_update("foo.test", zonefile_json, "0123456789abcdef") if 'error' in resp: print >> sys.stderr, "update error: %s" % resp['error'] return False zonefile_hash = resp['zonefile_hash'] # wait for it to go through for i in xrange(0, 12): # warn the serialization checker that this changes behavior from 0.13 print "BLOCKSTACK_SERIALIZATION_CHECK_IGNORE value_hash" sys.stdout.flush() testlib.next_block(**kw) print >> sys.stderr, "Waiting 10 seconds for the backend to acknowedge the update" time.sleep(10) # wait for it to go through for i in xrange(0, 12): # warn the serialization checker that this changes behavior from 0.13 print "BLOCKSTACK_SERIALIZATION_CHECK_IGNORE value_hash" sys.stdout.flush() testlib.next_block(**kw) # revoke it resp = testlib.blockstack_cli_revoke("foo.test", "0123456789abcdef") if 'error' in resp: print >> sys.stderr, "Revoke request failed:\n%s" % json.dumps( resp, indent=4, sort_keys=True) return False print >> sys.stderr, "Waiting 10 seconds for the backend to acknowledge the revoke" time.sleep(10) # wait for it to go through for i in xrange(0, 12): testlib.next_block(**kw)