   [store ids n]
   (let [prefix (-> (block/list store :limit 1) first :id multihash/hex (subs 0 4))]
     (dotimes [i n]
-      (let [after (str prefix (hex/encode (abc/random-bytes 6)))
+      (let [after (str prefix (hex/encode (bytes/random-bytes 6)))
             limit (inc (rand-int 100))
             stats (block/list store :after after :limit limit)
             expected (->> ids

(defn test-batch-ops
  "Tests the batch functionality of a store."
  [store]
  (let [blocks (take 10 (random-blocks 512))]
    (testing "put-batch!"
      (let [block-batch (block/put-batch! store blocks)]
        (is (= (count blocks) (count block-batch)))

    blocks.data.PersistentBytes))


(defn random-block
  "Creates a new block with random content at most `max-size` bytes long."
  [max-size]
  (block/read!
    (bytes/random-bytes (inc (rand-int max-size)))
    (rand-nth (keys digest/functions))))


(defn generate-blocks!
  "Generates some test blocks and returns a map of the ids to the blocks."
  [n max-size]
  (->> (repeatedly #(random-block max-size))
       (take n)
       (map (juxt :id identity))
       (into (sorted-map))))


(defn populate-blocks!
  "Generates random blocks and puts them into the given store. Returns a map
  of multihash ids to blocks."
  [store & {:keys [n max-size], :or {n 10, max-size 1024}}]
  (let [blocks (generate-blocks! n max-size)]
    (block/put-batch! store (vals blocks))
    blocks))



;; ## Generators

(defn random-blocks
