aboutsummaryrefslogtreecommitdiffstats
path: root/Godeps/_workspace/src/github.com/ethereum/ethash/js/test
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2015-03-25 02:14:20 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2015-03-25 02:14:20 +0800
commita33a325ac1eae636215aa8fda45e24b79a98b97a (patch)
tree57d737513883c5b72a35120bd9e3f733fcf03db1 /Godeps/_workspace/src/github.com/ethereum/ethash/js/test
parentc38a3b4cc7b7dc62c7fca9cd46a880b036462a27 (diff)
parentb0c4dc8df874442e8ad7bcd55dfa13d6ea75c0e1 (diff)
downloadgo-tangerine-a33a325ac1eae636215aa8fda45e24b79a98b97a.tar.gz
go-tangerine-a33a325ac1eae636215aa8fda45e24b79a98b97a.tar.zst
go-tangerine-a33a325ac1eae636215aa8fda45e24b79a98b97a.zip
Merge pull request #559 from Gustav-Simonsson/blocktests_update_ethash
Update ethash lib
Diffstat (limited to 'Godeps/_workspace/src/github.com/ethereum/ethash/js/test')
-rw-r--r--Godeps/_workspace/src/github.com/ethereum/ethash/js/test/seedHash.js48
-rw-r--r--Godeps/_workspace/src/github.com/ethereum/ethash/js/test/test.js52
2 files changed, 0 insertions, 100 deletions
diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/js/test/seedHash.js b/Godeps/_workspace/src/github.com/ethereum/ethash/js/test/seedHash.js
deleted file mode 100644
index a3666a9ed..000000000
--- a/Godeps/_workspace/src/github.com/ethereum/ethash/js/test/seedHash.js
+++ /dev/null
@@ -1,48 +0,0 @@
-var tape = require('tape');
-const ethash = require('../ethash.js');
-
-tape('seed hash', function(t) {
-
- t.test('seed should match TRUTH', function(st) {
- const seed = '290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563';
- const blockNum = 30000;
-
- var r = new Buffer(ethash.calcSeed(blockNum));
- st.equal(r.toString('hex'), seed);
-
- st.end();
- });
-
- t.test('seed should match TRUTH2', function(st) {
- const seed = '510e4e770828ddbf7f7b00ab00a9f6adaf81c0dc9cc85f1f8249c256942d61d9';
- const blockNum = 60000;
-
- var r = new Buffer(ethash.calcSeed(blockNum));
- st.equal(r.toString('hex'), seed);
-
- st.end();
- });
-
- t.test('seed should match TRUTH3', function(st) {
- const seed = '510e4e770828ddbf7f7b00ab00a9f6adaf81c0dc9cc85f1f8249c256942d61d9';
- const blockNum = 60700;
-
- var r = new Buffer(ethash.calcSeed(blockNum));
- st.equal(r.toString('hex'), seed);
-
- st.end();
- });
-
- t.test('randomized tests', function(st) {
- for (var i = 0; i < 100; i++) {
- var x = Math.floor(ethash.params.EPOCH_LENGTH * 2048 * Math.random());
- st.equal(ethash.calcSeed(x).toString('hex'), ethash.calcSeed(Math.floor(x / ethash.params.EPOCH_LENGTH) * ethash.params.EPOCH_LENGTH ).toString('hex'));
- }
- st.end();
- });
- // '510e4e770828ddbf7f7b00ab00a9f6adaf81c0dc9cc85f1f8249c256942d61d9'
- // [7:13:32 PM] Matthew Wampler-Doty: >>> x = randint(0,700000)
- //
- // >>> pyethash.get_seedhash(x).encode('hex') == pyethash.get_seedhash((x // pyethash.EPOCH_LENGTH) * pyethash.EPOCH_LENGTH).encode('hex')
-
-});
diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/js/test/test.js b/Godeps/_workspace/src/github.com/ethereum/ethash/js/test/test.js
deleted file mode 100644
index edffa268f..000000000
--- a/Godeps/_workspace/src/github.com/ethereum/ethash/js/test/test.js
+++ /dev/null
@@ -1,52 +0,0 @@
-// test.js
-// Tim Hughes <tim@twistedfury.com>
-
-/*jslint node: true, shadow:true */
-"use strict";
-
-var ethash = require('../ethash');
-var util = require('../util');
-var Keccak = require('../keccak');
-
-// sanity check hash functions
-var src = util.stringToBytes("");
-if (util.bytesToHexString(new Keccak().digest(32, src)) != "c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470") throw Error("Keccak-256 failed");
-if (util.bytesToHexString(new Keccak().digest(64, src)) != "0eab42de4c3ceb9235fc91acffe746b29c29a8c366b7c60e4e67c466f36a4304c00fa9caf9d87976ba469bcbe06713b435f091ef2769fb160cdab33d3670680e") throw Error("Keccak-512 failed");
-
-src = new Uint32Array(src.buffer);
-var dst = new Uint32Array(8);
-new Keccak().digestWords(dst, 0, dst.length, src, 0, src.length);
-if (util.wordsToHexString(dst) != "c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470") throw Error("Keccak-256 Fast failed");
-
-var dst = new Uint32Array(16);
-new Keccak().digestWords(dst, 0, dst.length, src, 0, src.length);
-if (util.wordsToHexString(dst) != "0eab42de4c3ceb9235fc91acffe746b29c29a8c366b7c60e4e67c466f36a4304c00fa9caf9d87976ba469bcbe06713b435f091ef2769fb160cdab33d3670680e") throw Error("Keccak-512 Fast failed");
-
-
-// init params
-var ethashParams = ethash.defaultParams();
-//ethashParams.cacheRounds = 0;
-
-// create hasher
-var seed = util.hexStringToBytes("9410b944535a83d9adf6bbdcc80e051f30676173c16ca0d32d6f1263fc246466")
-var startTime = new Date().getTime();
-var hasher = new ethash.Ethash(ethashParams, seed);
-console.log('Ethash startup took: ' + (new Date().getTime() - startTime) + "ms");
-console.log('Ethash cache hash: ' + util.bytesToHexString(hasher.cacheDigest()));
-
-var testHexString = "c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470";
-if (testHexString != util.bytesToHexString(util.hexStringToBytes(testHexString)))
- throw Error("bytesToHexString or hexStringToBytes broken");
-
-
-var header = util.hexStringToBytes("c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470");
-var nonce = util.hexStringToBytes("0000000000000000");
-var hash;
-
-startTime = new Date().getTime();
-var trials = 10;
-for (var i = 0; i < trials; ++i) {
- hash = hasher.hash(header, nonce);
-}
-console.log("Light client hashes averaged: " + (new Date().getTime() - startTime) / trials + "ms");
-console.log("Hash = " + util.bytesToHexString(hash));