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[5].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(15) # 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(15) # wait for 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(15) # 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(15) # transfer to a new address resp = testlib.blockstack_cli_transfer("foo.test", wallets[4].addr, "0123456789abcdef") if 'error' in resp: print >> sys.stderr, "transfer error: %s" % resp['error'] return False # 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 acknowledge the transfer" time.sleep(15) # regenerate the wallet, with the new owner address wallet = testlib.blockstack_client_set_wallet("0123456789abcdef", wallets[5].privkey, wallets[4].privkey, wallets[5].privkey) res = testlib.start_api("0123456789abcdef") if 'error' in res: print 'failed to start API: {}'.format(res) return False # send another update, changing the zonefile again # pay for it using the same payment address zonefile = blockstack_client.zonefile.make_empty_zonefile( "foo.test", new_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(15)
def scenario( wallets, **kw ): global zonefile_hash, final_balance, new_expire_block 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 ) # renew it resp = testlib.blockstack_cli_renew( "foo.test", "0123456789abcdef" ) if 'error' in resp: print >> sys.stderr, "Renewal 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 renewal" time.sleep(10) # wait for it to go through for i in xrange(0, 6): # 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 ) # verify that it's in the queue queue_state = testlib.blockstack_cli_info() if 'error' in queue_state: print json.dumps(queue_state) return False if not queue_state.has_key('queues'): print 'no queues' print json.dumps(queue_state) return False if not queue_state['queues'].has_key('renew'): print 'no renew queue' print json.dumps(queue_state) return False if len(queue_state['queues']['renew']) != 1: print 'wrong renew state' print json.dumps(queue_state) return False if queue_state['queues']['renew'][0]['name'] != 'foo.test': print 'wrong name' print json.dumps(queue_state) return False # wait for it to go through for i in xrange(0, 6): # 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 ) 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 new_expire_block = res['expire_block'] if old_expire_block >= new_expire_block + 12: # didn't go through print >> sys.stderr, "Renewal didn't go through: %s --> %s" % (old_expire_block, new_expire_block) return False if res['op'] != blockstack_client.config.NAME_REGISTRATION + ":": print >> sys.stderr, "Renewal didn't go through (last op is %s)" % res['op'] error = True return False final_balance = testlib.getbalance( wallets[2].addr )
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_rpc_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): testlib.next_block(**kw) print >> sys.stderr, "Waiting 10 seconds for the backend to acknowledge registration" time.sleep(10) # wait for update to get confirmed for i in xrange(0, 12): testlib.next_block(**kw) print >> sys.stderr, "Waiting 10 seconds for the backend to acknowledge update" time.sleep(10) # send an update, changing the zonefile data_pubkey = wallet['data_pubkey'] zonefile = blockstack_client.user.make_empty_user_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_rpc_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): testlib.next_block(**kw) print >> sys.stderr, "Waiting 10 seconds for the backend to acknowedge the update" time.sleep(10) # transfer to a new address resp = testlib.blockstack_rpc_transfer("foo.test", wallets[4].addr, "0123456789abcdef") if 'error' in resp: print >> sys.stderr, "transfer error: %s" % resp['error'] return False # wait for it to go through for i in xrange(0, 12): testlib.next_block(**kw) print >> sys.stderr, "Waiting 10 seconds for the backend to acknowledge the transfer" time.sleep(10) # regenerate the wallet, with the new owner address wallet = testlib.blockstack_client_set_wallet("0123456789abcdef", wallets[2].privkey, wallets[4].privkey, wallets[4].privkey) # renew it, using the same payment key resp = testlib.blockstack_rpc_renew("foo.test", "0123456789abcdef") if 'error' in resp: print >> sys.stderr, "Renewal 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 renewal" time.sleep(10) 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 new_expire_block = res['expire_block'] if old_expire_block >= new_expire_block + 12: # didn't go through print >> sys.stderr, "Renewal didn't go through: %s --> %s" % ( old_expire_block, new_expire_block) return False
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)
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_rpc_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): testlib.next_block( **kw ) print >> sys.stderr, "Waiting 10 seconds for the backend to acknowledge registration" time.sleep(10) # wait for update to get confirmed for i in xrange(0, 12): testlib.next_block( **kw ) print >> sys.stderr, "Waiting 10 seconds for the backend to acknowledge update" time.sleep(10) # send an update, changing the zonefile data_pubkey = wallet['data_pubkey'] zonefile = blockstack_client.user.make_empty_user_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_rpc_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): testlib.next_block( **kw ) print >> sys.stderr, "Waiting 10 seconds for the backend to acknowedge the update" time.sleep(10) # transfer to a new address resp = testlib.blockstack_rpc_transfer( "foo.test", wallets[4].addr, "0123456789abcdef" ) if 'error' in resp: print >> sys.stderr, "transfer error: %s" % resp['error'] return False # wait for it to go through for i in xrange(0, 12): testlib.next_block( **kw ) print >> sys.stderr, "Waiting 10 seconds for the backend to acknowledge the transfer" time.sleep(10) # regenerate the wallet, with the new owner address wallet = testlib.blockstack_client_set_wallet( "0123456789abcdef", wallets[2].privkey, wallets[4].privkey, wallets[4].privkey ) # send another update, changing the zonefile again # pay for it using the same payment address zonefile = blockstack_client.user.make_empty_user_zonefile( "foo.test", new_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_rpc_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): testlib.next_block( **kw ) print >> sys.stderr, "Waiting 10 seconds for the backend to acknowedge the update" time.sleep(10)
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_rpc_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): 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): testlib.next_block(**kw) print >> sys.stderr, "Waiting 10 seconds for the backend to acknowledge update" time.sleep(10) # send an update, changing the zonefile data_pubkey = wallet['data_pubkey'] zonefile = blockstack_client.user.make_empty_user_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_rpc_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): testlib.next_block(**kw) print >> sys.stderr, "Waiting 10 seconds for the backend to acknowedge the update" time.sleep(10)
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) # store a new zonefile data_pubkey = wallet['data_pubkey'] zonefile = blockstack_client.user.make_empty_user_zonefile( "foo.test", data_pubkey ) assert blockstack_client.user.put_immutable_data_zonefile( zonefile, "testdata", blockstack_client.get_data_hash("testdata") ) zonefile_txt = blockstack_zones.make_zone_file( zonefile ) zonefile_hash = blockstack_client.storage.get_zonefile_data_hash( zonefile_txt ) print >> sys.stderr, "\n\nzonefile hash: %s\nzonefile:\n%s\n\n" % (zonefile_hash, zonefile_txt) # will store to queue test_proxy = testlib.make_proxy() config_path = test_proxy.config_path conf = blockstack_client.config.get_config(config_path) queuedb_path = conf['queue_path'] # update the zonefile hash, but not the zonefile. resp = testlib.blockstack_cli_set_zonefile_hash( "foo.test", zonefile_hash ) if 'error' in resp: print >> sys.stderr, "\nFailed to set zonefile hash: %s\n" % resp return False txhash = resp['transaction_hash'] 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) # stop endpoint print >> sys.stderr, "\nstopping RPC daemon\n" config_dir = os.path.dirname(test_proxy.config_path) blockstack_client.rpc.local_rpc_stop(config_dir=config_dir) time.sleep(3) # store to queue res = blockstack_client.backend.queue.queue_append("update", "foo.test", txhash, payment_address=wallets[2].addr, owner_address=wallets[3].addr, config_path=test_proxy.config_path, zonefile_data=zonefile_txt, zonefile_hash=zonefile_hash, path=queuedb_path ) # verify that we can sync the zonefile, using the in-queue zonefile resp = testlib.blockstack_cli_sync_zonefile( "foo.test" ) if 'error' in resp: print >> sys.stderr, "\nfailed to sync zonefile: %s\n" % resp return False blockstack_client.backend.queue.queuedb_remove("update", "foo.test", txhash, path=queuedb_path ) print >> sys.stderr, "\nstarting RPC daemon\n" blockstack_client.actions.start_rpc_endpoint(config_dir, password="******") time.sleep(3) # store a new zonefile zonefile = blockstack_client.user.make_empty_user_zonefile( "foo.test", data_pubkey ) blockstack_client.user.put_immutable_data_zonefile( zonefile, "testdata2", blockstack_client.get_data_hash("testdata") ) zonefile_txt = blockstack_zones.make_zone_file( zonefile ) zonefile_hash = blockstack_client.storage.get_zonefile_data_hash( zonefile_txt ) # store locally res = blockstack_client.profile.store_name_zonefile("foo.test", zonefile, None, storage_drivers=['disk']) if 'error' in res: print >> sys.stderr, "\nFailed to store zonefile: %s\n" % res return False # update the zonefile hash, but not the zonefile. resp = testlib.blockstack_cli_set_zonefile_hash( "foo.test", zonefile_hash ) if 'error' in resp: print >> sys.stderr, "\nFailed to set zonefile hash: %s\n" % resp return False 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 ) # verify that we can sync the zonefile, using the on-disk zonefile resp = testlib.blockstack_cli_sync_zonefile( "foo.test" ) if 'error' in resp: print >> sys.stderr, "update error: %s" % resp['error'] return False # wait for it to go through for i in xrange(0, 12): testlib.next_block( **kw ) print >> sys.stderr, "Waiting 10 seconds for the backend to acknowedge the update" time.sleep(10)
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_rpc_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): 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): testlib.next_block( **kw ) print >> sys.stderr, "Waiting 10 seconds for the backend to acknowledge update" time.sleep(10) # store a new zonefile data_pubkey = wallet['data_pubkey'] zonefile = blockstack_client.user.make_empty_user_zonefile( "foo.test", data_pubkey ) blockstack_client.user.put_immutable_data_zonefile( zonefile, "testdata", blockstack_client.get_data_hash("testdata") ) zonefile_json = json.dumps(zonefile) zonefile_hash = blockstack_client.storage.hash_zonefile( zonefile ) # will store to queue test_proxy = testlib.make_proxy() config_path = test_proxy.config_path conf = blockstack_client.config.get_config(config_path) queuedb_path = conf['queue_path'] # update the zonefile hash, but not the zonefile. resp = testlib.blockstack_rpc_set_zonefile_hash( "foo.test", zonefile_hash ) if 'error' in resp: print >> sys.stderr, "\nFailed to set zonefile hash: %s\n" % resp return False txhash = resp['transaction_hash'] for i in xrange(0, 12): testlib.next_block( **kw ) print >> sys.stderr, "Waiting 10 seconds for the backend to acknowledge update" time.sleep(10) # stop endpoint print >> sys.stderr, "\nstopping RPC daemon\n" config_dir = os.path.dirname(test_proxy.config_path) blockstack_client.rpc.local_rpc_stop(config_dir=config_dir) time.sleep(3) # store to queue res = blockstack_client.backend.queue.queue_append("update", "foo.test", txhash, payment_address=wallets[2].addr, owner_address=wallets[3].addr, config_path=test_proxy.config_path, zonefile=zonefile, zonefile_hash=zonefile_hash, path=queuedb_path ) # verify that we can sync the zonefile, using the in-queue zonefile resp = testlib.blockstack_rpc_sync_zonefile( "foo.test" ) if 'error' in resp: print >> sys.stderr, "\nfailed to sync zonefile: %s\n" % resp return False blockstack_client.backend.queue.queuedb_remove("update", "foo.test", txhash, path=queuedb_path ) print >> sys.stderr, "\nstarting RPC daemon\n" blockstack_client.actions.start_rpc_endpoint(config_dir, password="******") time.sleep(3) # store a new zonefile zonefile = blockstack_client.user.make_empty_user_zonefile( "foo.test", data_pubkey ) blockstack_client.user.put_immutable_data_zonefile( zonefile, "testdata2", blockstack_client.get_data_hash("testdata") ) zonefile_json = json.dumps(zonefile) zonefile_hash = blockstack_client.storage.hash_zonefile( zonefile ) # store locally res = blockstack_client.profile.store_name_zonefile("foo.test", zonefile, None, storage_drivers=['disk']) if 'error' in res: print >> sys.stderr, "\nFailed to store zonefile: %s\n" % res return False # update the zonefile hash, but not the zonefile. resp = testlib.blockstack_rpc_set_zonefile_hash( "foo.test", zonefile_hash ) if 'error' in resp: print >> sys.stderr, "\nFailed to set zonefile hash: %s\n" % resp return False for i in xrange(0, 12): testlib.next_block( **kw ) # verify that we can sync the zonefile, using the on-disk zonefile resp = testlib.blockstack_rpc_sync_zonefile( "foo.test" ) if 'error' in resp: print >> sys.stderr, "update error: %s" % resp['error'] return False # wait for it to go through for i in xrange(0, 12): testlib.next_block( **kw ) print >> sys.stderr, "Waiting 10 seconds for the backend to acknowedge the update" time.sleep(10)
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) # store a new zonefile data_pubkey = wallet['data_pubkey'] zonefile = blockstack_client.zonefile.make_empty_zonefile( "foo.test", data_pubkey) assert blockstack_client.user.put_immutable_data_zonefile( zonefile, "testdata", blockstack_client.get_data_hash("testdata")) zonefile_txt = blockstack_zones.make_zone_file(zonefile) zonefile_hash = blockstack_client.storage.get_zonefile_data_hash( zonefile_txt) print >> sys.stderr, "\n\nzonefile hash: %s\nzonefile:\n%s\n\n" % ( zonefile_hash, zonefile_txt) # will store to queue test_proxy = testlib.make_proxy() config_path = test_proxy.config_path conf = blockstack_client.config.get_config(config_path) queuedb_path = conf['queue_path'] # update the zonefile hash, but not the zonefile. resp = testlib.blockstack_cli_set_zonefile_hash("foo.test", zonefile_hash) if 'error' in resp: print >> sys.stderr, "\nFailed to set zonefile hash: %s\n" % resp return False txhash = resp['transaction_hash'] 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) # stop endpoint print >> sys.stderr, "\nstopping RPC daemon\n" testlib.stop_api() time.sleep(3) # store to queue res = blockstack_client.backend.queue.queue_append( "update", "foo.test", txhash, payment_address=wallets[2].addr, owner_address=wallets[3].addr, config_path=test_proxy.config_path, zonefile_data=zonefile_txt, zonefile_hash=zonefile_hash, path=queuedb_path) # verify that we can sync the zonefile, using the in-queue zonefile resp = testlib.blockstack_cli_sync_zonefile("foo.test") if 'error' in resp: print >> sys.stderr, "\nfailed to sync zonefile: %s\n" % resp return False blockstack_client.backend.queue.queuedb_remove("update", "foo.test", txhash, path=queuedb_path) print >> sys.stderr, "\nstarting RPC daemon\n" testlib.start_api("0123456789abcdef") # store a new zonefile zonefile = blockstack_client.zonefile.make_empty_zonefile( "foo.test", data_pubkey) blockstack_client.user.put_immutable_data_zonefile( zonefile, "testdata2", blockstack_client.get_data_hash("testdata")) zonefile_txt = blockstack_zones.make_zone_file(zonefile) zonefile_hash = blockstack_client.storage.get_zonefile_data_hash( zonefile_txt) # store locally res = blockstack_client.zonefile.store_name_zonefile( "foo.test", zonefile, None, storage_drivers=['disk']) if 'error' in res: print >> sys.stderr, "\nFailed to store zonefile: %s\n" % res return False # update the zonefile hash, but not the zonefile. resp = testlib.blockstack_cli_set_zonefile_hash("foo.test", zonefile_hash) if 'error' in resp: print >> sys.stderr, "\nFailed to set zonefile hash: %s\n" % resp return False 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) # verify that we can sync the zonefile, using the on-disk zonefile resp = testlib.blockstack_cli_sync_zonefile("foo.test") if 'error' in resp: print >> sys.stderr, "update error: %s" % resp['error'] return False # wait for it to go through for i in xrange(0, 12): testlib.next_block(**kw) print >> sys.stderr, "Waiting 10 seconds for the backend to acknowedge the update" time.sleep(10)