summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/v1.erl12
-rw-r--r--test/config/frontend-1.config1
-rw-r--r--test/config/signing-1.config2
-rwxr-xr-xtools/merge.py15
-rwxr-xr-xtools/testcase1.py7
5 files changed, 21 insertions, 16 deletions
diff --git a/src/v1.erl b/src/v1.erl
index d9796fa..006990d 100644
--- a/src/v1.erl
+++ b/src/v1.erl
@@ -39,16 +39,8 @@ request(post, "ct/v1/add-pre-chain", _Input) ->
niy();
request(get, "ct/v1/get-sth", _Query) ->
- { Treesize,
- Timestamp,
- Roothash,
- Signature} = plop:sth(),
- R = [{tree_size, Treesize},
- {timestamp, Timestamp},
- {sha256_root_hash, base64:encode(Roothash)},
- {tree_head_signature, base64:encode(
- plop:serialise(Signature))}],
- success({R});
+ R = plop:sth(),
+ success(R);
request(get, "ct/v1/get-sth-consistency", Query) ->
case lists:sort(Query) of
diff --git a/test/config/frontend-1.config b/test/config/frontend-1.config
index 585efd8..e7e8af2 100644
--- a/test/config/frontend-1.config
+++ b/test/config/frontend-1.config
@@ -30,6 +30,7 @@
{entryhash_root_path, "tests/machine/machine-1/db/entryhash/"},
{treesize_path, "tests/machine/machine-1/db/treesize"},
{indexforhash_root_path, "tests/machine/machine-1/db/certindex/"},
+ {sth_path, "tests/machine/machine-1/db/sth"},
{storage_nodes, ["https://127.0.0.1:8081/ct/storage/"]},
{storage_nodes_quorum, 1},
{publickey_path, "publickeys"},
diff --git a/test/config/signing-1.config b/test/config/signing-1.config
index 189843b..a11bdeb 100644
--- a/test/config/signing-1.config
+++ b/test/config/signing-1.config
@@ -30,6 +30,6 @@
{log_public_key, "test/eckey-public.pem"},
{own_key, {"signing-1", "privatekeys/signing-1-private.pem"}},
{allowed_clients, [{"/ct/signing/sct", ["frontend-1"]},
- {"/ct/signing/sth", ["frontend-1", "merge-1"]}
+ {"/ct/signing/sth", ["merge-1"]}
]}
]}].
diff --git a/tools/merge.py b/tools/merge.py
index 0996ec9..c137f4b 100755
--- a/tools/merge.py
+++ b/tools/merge.py
@@ -239,7 +239,10 @@ for frontendnode in frontendnodes:
print "current position", curpos
entries = [base64.b64encode(entry) for entry in logorder[curpos:]]
for chunk in chunks(entries, 1000):
- sendlog(frontendnode, {"start": curpos, "hashes": chunk})
+ sendlogresult = sendlog(frontendnode, {"start": curpos, "hashes": chunk})
+ if sendlogresult["result"] != "ok":
+ print "sendlog:", sendlogresult
+ sys.exit(1)
curpos += len(chunk)
print curpos,
sys.stdout.flush()
@@ -250,8 +253,14 @@ for frontendnode in frontendnodes:
print "missing entries:", len(missingentries)
for missingentry in missingentries:
hash = base64.b64decode(missingentry)
- sendentry(frontendnode, read_chain(hash), hash)
+ sendentryresult = sendentry(frontendnode, read_chain(hash), hash)
+ if sendentryresult["result"] != "ok":
+ print "send sth:", sendentryresult
+ sys.exit(1)
timing_point(timing, "send missing")
- sendsth(frontendnode, sth)
+ sendsthresult = sendsth(frontendnode, sth)
+ if sendsthresult["result"] != "ok":
+ print "send sth:", sendsthresult
+ sys.exit(1)
timing_point(timing, "send sth")
print timing["deltatimes"]
diff --git a/tools/testcase1.py b/tools/testcase1.py
index 0c0f728..73613fb 100755
--- a/tools/testcase1.py
+++ b/tools/testcase1.py
@@ -138,11 +138,11 @@ def get_and_check_entry(timestamp, chain, leaf_index):
def merge():
return subprocess.call(["./merge.py", "--baseurl", "https://127.0.0.1:8080/", "--frontend", "https://127.0.0.1:8082/", "--storage", "https://127.0.0.1:8081/", "--mergedb", "../rel/mergedb", "--signing", "https://127.0.0.1:8088/", "--own-keyname", "merge-1", "--own-keyfile", "../rel/privatekeys/merge-1-private.pem"])
-print_and_check_tree_size(0)
-
mergeresult = merge()
assert_equal(mergeresult, 0, "merge", quiet=True)
+print_and_check_tree_size(0)
+
testgroup("cert1")
result1 = do_add_chain(cc1)
@@ -230,6 +230,9 @@ get_and_validate_proof(result4["timestamp"], cc3, 2, 3)
get_and_validate_proof(result5["timestamp"], cc4, 3, 3)
get_and_validate_proof(result6["timestamp"], cc5, 4, 1)
+mergeresult = merge()
+assert_equal(mergeresult, 0, "merge", quiet=True)
+
for first_size in range(1, 5):
for second_size in range(first_size + 1, 6):
get_and_validate_consistency_proof(size_sth[first_size], size_sth[second_size], first_size, second_size)