diff --git a/RPCTests/README.md b/RPCTests/README.md deleted file mode 100644 index f6c25cd6afc..00000000000 --- a/RPCTests/README.md +++ /dev/null @@ -1,70 +0,0 @@ -See https://github.com/ethereum/cpp-ethereum/blob/7cc43bed7de890a496d7238092837c30c7e90729/scripts/runalltests.sh#L38 for how cpp-ethereum uses this. - -FAQ -=== - -Cannot find module ------------------- - -I get an error: -``` -$ node main.js $workdir/cpp-ethereum/build/eth/eth -module.js:471 - throw err; - ^ - -Error: Cannot find module '/home/yh/src/tests/RLPTests/main.js' - at Function.Module._resolveFilename (module.js:469:15) - at Function.Module._load (module.js:417:25) - at Module.runMain (module.js:604:10) - at run (bootstrap_node.js:393:7) - at startup (bootstrap_node.js:150:9) - at bootstrap_node.js:508:3 -``` - -Answer: if your `main.js` is in your current directory, use `./main.js` instead of just `main.js`. - - -Cannot find module web3 ------------------------ - -I get an error: -``` -$ node ./main.js ~/src/cpp-ethereum/build/eth/eth -(node:27647) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Cannot find module 'web3' -``` - -Answer: `npm install web3` - - -Some tests fail ---------------- - -``` -$ node ./main.js ~/src/cpp-ethereum/build/eth/eth -TEST_newAccount OK -TEST_addPeerOnNode2 OK -TEST_getPeerCountOnNode1 OK -TEST_mineBlockOnNode1 FAILED -TEST_mineBlockOnNode1 FAILED -TEST_getBlockHashOnNode2 OK -TEST_mineBlockOnNode2 FAILED -TEST_mineBlockOnNode2 FAILED -TEST_getBlockHashOnNode1 OK -(node:30406) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Callback was already called. -``` - -Answer: everybody experiences these failures now. They are being tracked in [issue 377](https://github.com/ethereum/tests/issues/377). - - -Do these failures indicate bugs in cpp-ethereum or in the test? ---------------------------------------------------------------- - -Different opinions exist -* https://github.com/ethereum/tests/pull/376#issuecomment-349799774 -* https://github.com/ethereum/tests/pull/376#issuecomment-349933405 - -Has any other clients been tested with this? --------------------------------------------- - -No. diff --git a/RPCTests/main.js b/RPCTests/main.js deleted file mode 100644 index fce4327d2c0..00000000000 --- a/RPCTests/main.js +++ /dev/null @@ -1,127 +0,0 @@ -//requires npm -//requires installed node v6 -//requires ethereum eth path on input - -var async = require("async"); -var utils = require('./modules/utils.js'); -var testutils = require('./modules/testutils.js'); -var ethconsole = require('./modules/ethconsole.js'); - -var ethpath = process.argv[2]; -var testdir = __dirname + "/dynamic"; -var workdir = __dirname; - -var dynamic = {}; - -function cb(){} -function main() -{ -if (!ethpath || !utils.fileExists(ethpath)) -{ - utils.cLog("Executable '" + ethpath + "' not found!"); - utils.cLog("Please, set eth path. Usage: node main.js "); - return; -} - -testutils.readTestsInFolder(workdir + "/scripts/tests"); -async.series([ -function(cb) { - utils.setDebug(false); - ethconsole.startNode(ethpath, testdir + "/ethnode1", testdir + "/genesis.json", 30305, cb); -}, -function(cb) { - prepareDynamicVars(cb); -}, -function(cb) { - ethconsole.stopNode(testdir + "/ethnode1", cb); -}, -function(cb) { - ethconsole.startNode(ethpath, testdir + "/ethnode1", testdir + "/genesis.json", 30305, cb); - dynamic["node1_port"] = "30305"; -}, -function(cb) { - ethconsole.startNode(ethpath, testdir + "/ethnode2", testdir + "/genesis.json", 30306, cb); - dynamic["node2_port"] = "30306"; -}, -function(cb) { - runAllTests(cb); -}, -function(cb) { - ethconsole.stopNode(testdir + "/ethnode1", cb); - ethconsole.stopNode(testdir + "/ethnode2", cb); -} -], function() { - utils.rmdir(testdir); } -) -}//main - - - -function prepareDynamicVars(finished) -{ - async.series([ - function(cb) { - ethconsole.runScriptOnNode(testdir + "/ethnode1", workdir + "/scripts/testNewAccount.js", {}, cb); - }, - function(cb) { - dynamic["account"] = ethconsole.getLastResponse(); - utils.mkdir(testdir); - testutils.generateCustomGenesis(testdir + '/genesis.json', workdir + "/scripts/genesis.json", dynamic["account"], cb); - }, - function(cb) { - ethconsole.runScriptOnNode(testdir + "/ethnode1", workdir + "/scripts/getNodeInfo.js", {}, cb); - }, - function(cb) { - dynamic["node1_ID"] = ethconsole.getLastResponse().id; - cb(); - } - ], function() { finished(); }) -} - -function runAllTests(finished) -{ - var currentTest = -1; - var updateDynamic = function(){}; - - function nextTest() - { - currentTest++; - if (currentTest == testutils.getTestCount()) - finished(); - else - { - var testObject = testutils.getTestNumber(currentTest); - var nodepath; - if (testObject.node == '01') - nodepath = testdir + "/ethnode1"; - if (testObject.node == '02') - nodepath = testdir + "/ethnode2"; - - ethconsole.runScriptOnNode(nodepath, testObject.file, dynamic, updateDynamic); - } - } - - updateDynamic = function updateDynamic() - { - async.series([ - function(cb) { - ethconsole.runScriptOnNode(testdir + "/ethnode1", workdir + "/scripts/getLastBlock.js", {}, cb); - }, - function(cb) { - dynamic["node1_lastblock"] = ethconsole.getLastResponse(); - cb(); - }, - function(cb) { - ethconsole.runScriptOnNode(testdir + "/ethnode2", workdir + "/scripts/getLastBlock.js", {}, cb); - }, - function(cb) { - dynamic["node2_lastblock"] = ethconsole.getLastResponse(); - cb(); - } - ], function() { nextTest(); }); - } - nextTest(); -} - -main(); - diff --git a/RPCTests/modules/ethconsole.js b/RPCTests/modules/ethconsole.js deleted file mode 100644 index dfc5181cd0e..00000000000 --- a/RPCTests/modules/ethconsole.js +++ /dev/null @@ -1,98 +0,0 @@ -const fs = require('fs'); -var lastResponse; -var nodes = {}; - -module.exports = { - -startNode: function startNode (nodeExec, dataDir, genesisPath, listeningPort, finished) -{ - var utils = require('./utils.js'); - var spawn = require('child_process').spawn - var options = [ - '--private', 'privatechain', - '-d', dataDir, - '--config', genesisPath, - '--ipcpath', dataDir + '/geth.ipc', - '--ipc', - '--listen', listeningPort, - '--test', - '-a', '0x1122334455667788991011121314151617181920' - ] - utils.cLog('starting node') - utils.cLog(nodeExec + ' ' + options.join(' ')) - var node = spawn(nodeExec, options) - node.stdout.on('data', (data) => { - utils.cLog(`stdout: ${data}`) - }) - node.stderr.on('data', (data) => { - utils.cLog(`stderr: ${data}`) - }) - node.on('close', (code) => { - utils.cLog(`child process exited with code ${code}`) - }) - - nodes[dataDir] = node; - utils.sleep(14000).then(() => { - utils.cLog("Node Started"); - finished(); - }); -}, - -stopNode: function stopNode(dataDir, finished) -{ - nodes[dataDir].kill(); - var utils = require('./utils.js'); - utils.sleep(1000).then(() => { - finished(); - }); -}, - - -runScriptOnNode: function runScriptOnNode(dataDir, jsScript, args, finished) -{ - var utils = require('./utils.js'); - var ipcPath = dataDir + '/geth.ipc'; - - var Web3 = require('web3'); - var web3admin = require('./web3Admin.js'); - var net = require('net'); - - utils.cLog("Connecting to node at " + ipcPath); - var web3 = new Web3(new Web3.providers.IpcProvider(ipcPath, net)); - web3admin.extend(web3); - global.web3 = web3; - - var onScriptCallback = function (err, data) - { - utils.cLog(data); - lastResponse = data; - finished(); - } - global.callback = onScriptCallback; - global.args = args; - - var vm = require('vm'); - utils.cLog("Executing " + jsScript + " ..."); - fs.readFile(jsScript, 'utf8', function (err, data) - { - if (err) - { - utils.cLog(err); - finished(); - } - else - { - var script = new vm.Script(data); - script.runInThisContext(); - } - }); -}, - - -getLastResponse: function getLastResponse() -{ - return lastResponse; -} - -}//exports - diff --git a/RPCTests/modules/testutils.js b/RPCTests/modules/testutils.js deleted file mode 100644 index 54cd6452513..00000000000 --- a/RPCTests/modules/testutils.js +++ /dev/null @@ -1,78 +0,0 @@ -const fs = require('fs'); -var utils = require('./utils.js'); -var tests = {}; -var testCount = 0; - -module.exports = { - -generateCustomGenesis: function generateCustomGenesis(path, originalPath, accountName, finished) -{ - var onFileRead = function (err, data) {}; - fs.readFile(originalPath, 'utf8', (err, data) => { onFileRead (err,data) }); - - onFileRead = function (err, data) - { - if (err) - throw err; - - data = data.replace("[ADDRESS]", accountName); - fs.writeFile(path, data, (err) => { - if (err) - throw err; - finished(); - }); - } -}, - -readTestsInFolder: function readTestsInFolder(path) -{ - var testNumber = 0; - var folders = utils.listFolders(path); - folders.forEach(function(folder) { - - var res = utils.listFiles(folder); - res.forEach(function(file) { - - var testn = file.indexOf("step"); - var slashn = file.indexOf("_"); - if (testn != -1 && slashn != -1) - { - //testNumber = parseInt(file.substring(testn + 4, slashn)); - var noden = file.indexOf("node"); - var slashn = file.indexOf("_", slashn+1); - var tmpFile = file.indexOf("~"); - if (noden != -1 && slashn != -1 && tmpFile == -1) - { - if (tests[testNumber]) - console.log("Error: dublicate test found " + file); - else - { - var testObject = {}; - testObject.file = file; - testObject.node = file.substring(noden + 4, slashn); - tests[testNumber] = testObject; - testCount++; - testNumber++; - } - } - } - }); - }); - - //console.log(tests); -}, - -getTestCount: function getTestCount() -{ - return testCount; -}, - -getTestNumber: function getTestNumber(n) -{ - if(n < testCount); - return tests[n]; -} - - -}//modules - diff --git a/RPCTests/modules/utils.js b/RPCTests/modules/utils.js deleted file mode 100644 index 0d0f2b02f79..00000000000 --- a/RPCTests/modules/utils.js +++ /dev/null @@ -1,85 +0,0 @@ -const fs = require('fs'); -var debug = true; - -module.exports = { - - sleep: function sleep(ms) { - return new Promise(resolve => setTimeout(resolve, ms)); - }, - - setDebug: function setDebug(value) { debug = value; }, - - getDebug: function getDebug() { return debug; }, - - cLog: function cLog(value) { if (debug) console.log(value); }, - - testLog: function testLog(value) { console.log(value); }, - - mkdir: function mkdir(path) { - try { - fs.mkdirSync(path); - } catch(e) { - if ( e.code != 'EEXIST' ) throw e; - } - }, - - rmdir: function rmdir(path) { - if( fs.existsSync(path) ) { - fs.readdirSync(path).forEach(function(file,index){ - var curPath = path + "/" + file; - if(fs.lstatSync(curPath).isDirectory()) { // recurse - rmdir(curPath); - } else { // delete file - fs.unlinkSync(curPath); - } - }); - fs.rmdirSync(path); - } - }, - - fileExists: function fileExists(path) - { - if(fs.existsSync(path)) - return true; - return false; - }, - - readFile: function readFile(path, callback, cb) { - fs.readFile(path, 'utf8', (err, data) => { callback (err, data, cb) }); - }, - - writeFile: function writeFile(path, data) { - fs.writeFile(path, data, (err) => { if (err) throw err;}); - }, - - listFiles: function listFiles(dir, recursive = false) { - - var results = []; - fs.readdirSync(dir).forEach(function(file) { - file = dir+'/'+file; - var stat = fs.statSync(file); - - if (stat && stat.isDirectory() && recursive) { - results = results.concat(listFiles(file, recursive)) - } else results.push(file); - }); - - return results; - }, - - listFolders: function listFolders(dir) { - - var results = []; - fs.readdirSync(dir).forEach(function(file) { - file = dir+'/'+file; - var stat = fs.statSync(file); - - if (stat && stat.isDirectory()) { - results.push(file); - } - }); - - return results; - } - -} //exports diff --git a/RPCTests/modules/web3Admin.js b/RPCTests/modules/web3Admin.js deleted file mode 100644 index 819a87f30ba..00000000000 --- a/RPCTests/modules/web3Admin.js +++ /dev/null @@ -1,320 +0,0 @@ -module.exports = { - extend: function(web3) { - - // ADMIN - web3._extend({ - property: 'admin', - methods: - [ - new web3._extend.Method({ - name: 'addPeer', - call: 'admin_addPeer', - params: 1, - inputFormatter: [web3._extend.utils.formatInputString], - outputFormatter: web3._extend.formatters.formatOutputBool - }), - new web3._extend.Method({ - name: 'exportChain', - call: 'admin_exportChain', - params: 1, - inputFormatter: [null], - outputFormatter: function(obj) { return obj; } - }), - new web3._extend.Method({ - name: 'importChain', - call: 'admin_importChain', - params: 1, - inputFormatter: [null], - outputFormatter: function(obj) { return obj; } - }), - new web3._extend.Method({ - name: 'verbosity', - call: 'admin_verbosity', - params: 1, - inputFormatter: [web3._extend.utils.formatInputInt], - outputFormatter: web3._extend.formatters.formatOutputBool - }), - new web3._extend.Method({ - name: 'setSolc', - call: 'admin_setSolc', - params: 1, - inputFormatter: [null], - outputFormatter: web3._extend.formatters.formatOutputString - }), - new web3._extend.Method({ - name: 'startRPC', - call: 'admin_startRPC', - params: 4, - inputFormatter: [null,web3._extend.utils.formatInputInteger,null,null], - outputFormatter: web3._extend.formatters.formatOutputBool - }), - new web3._extend.Method({ - name: 'stopRPC', - call: 'admin_stopRPC', - params: 0, - inputFormatter: [], - outputFormatter: web3._extend.formatters.formatOutputBool - }) - ], - properties: - [ - new web3._extend.Property({ - name: 'nodeInfo', - getter: 'admin_nodeInfo', - outputFormatter: web3._extend.formatters.formatOutputString - }), - new web3._extend.Property({ - name: 'peers', - getter: 'admin_peers', - outputFormatter: function(obj) { return obj; } - }), - new web3._extend.Property({ - name: 'datadir', - getter: 'admin_datadir', - outputFormatter: web3._extend.formatters.formatOutputString - }), - new web3._extend.Property({ - name: 'chainSyncStatus', - getter: 'admin_chainSyncStatus', - outputFormatter: function(obj) { return obj; } - }) - ] - }); - - // DEBUG - web3._extend({ - property: 'debug', - methods: - [ - new web3._extend.Method({ - name: 'printBlock', - call: 'debug_printBlock', - params: 1, - inputFormatter: [web3._extend.formatters.formatInputInt], - outputFormatter: web3._extend.formatters.formatOutputString - }), - new web3._extend.Method({ - name: 'getBlockRlp', - call: 'debug_getBlockRlp', - params: 1, - inputFormatter: [web3._extend.formatters.formatInputInt], - outputFormatter: web3._extend.formatters.formatOutputString - }), - new web3._extend.Method({ - name: 'setHead', - call: 'debug_setHead', - params: 1, - inputFormatter: [web3._extend.formatters.formatInputInt], - outputFormatter: web3._extend.formatters.formatOutputBool - }), - new web3._extend.Method({ - name: 'processBlock', - call: 'debug_processBlock', - params: 1, - inputFormatter: [web3._extend.formatters.formatInputInt], - outputFormatter: function(obj) { return obj; } - }), - new web3._extend.Method({ - name: 'seedHash', - call: 'debug_seedHash', - params: 1, - inputFormatter: [web3._extend.formatters.formatInputInt], - outputFormatter: web3._extend.formatters.formatOutputString - }), - new web3._extend.Method({ - name: 'dumpBlock', - call: 'debug_dumpBlock', - params: 1, - inputFormatter: [web3._extend.formatters.formatInputInt], - outputFormatter: function(obj) { return obj; } - }), - new web3._extend.Method({ - name: 'traceTransaction', - call: 'debug_traceTransaction', - inputFormatter: [null, null], - params: 2 - }), - new web3._extend.Method({ - name: 'storageRangeAt', - call: 'debug_storageRangeAt', - inputFormatter: [null, null, null, null, null], - params: 5 - }) - ], - properties: - [ - ] - }); - - // MINER - web3._extend({ - property: 'miner', - methods: - [ - new web3._extend.Method({ - name: 'start', - call: 'miner_start', - params: 1, - inputFormatter: [web3._extend.formatters.formatInputInt], - outputFormatter: web3._extend.formatters.formatOutputBool - }), - new web3._extend.Method({ - name: 'stop', - call: 'miner_stop', - params: 1, - inputFormatter: [web3._extend.formatters.formatInputInt], - outputFormatter: web3._extend.formatters.formatOutputBool - }), - new web3._extend.Method({ - name: 'setExtra', - call: 'miner_setExtra', - params: 1, - inputFormatter: [web3._extend.utils.formatInputString], - outputFormatter: web3._extend.formatters.formatOutputBool - }), - new web3._extend.Method({ - name: 'setGasPrice', - call: 'miner_setGasPrice', - params: 1, - inputFormatter: [web3._extend.utils.formatInputString], - outputFormatter: web3._extend.formatters.formatOutputBool - }), - new web3._extend.Method({ - name: 'startAutoDAG', - call: 'miner_startAutoDAG', - params: 0, - inputFormatter: [], - outputFormatter: web3._extend.formatters.formatOutputBool - }), - new web3._extend.Method({ - name: 'stopAutoDAG', - call: 'miner_stopAutoDAG', - params: 0, - inputFormatter: [], - outputFormatter: web3._extend.formatters.formatOutputBool - }), - new web3._extend.Method({ - name: 'makeDAG', - call: 'miner_makeDAG', - params: 1, - inputFormatter: [web3._extend.formatters.inputDefaultBlockNumberFormatter], - outputFormatter: web3._extend.formatters.formatOutputBool - }) - ], - properties: - [ - new web3._extend.Property({ - name: 'hashrate', - getter: 'miner_hashrate', - outputFormatter: web3._extend.utils.toDecimal - }) - ] - }); - - // NETWORK - web3._extend({ - property: 'network', - methods: - [ - new web3._extend.Method({ - name: 'addPeer', - call: 'net_addPeer', - params: 1, - inputFormatter: [web3._extend.utils.formatInputString], - outputFormatter: web3._extend.formatters.formatOutputBool - }), - new web3._extend.Method({ - name: 'getPeerCount', - call: 'net_peerCount', - params: 0, - inputFormatter: [], - outputFormatter: web3._extend.formatters.formatOutputString - }) - ], - properties: - [ - new web3._extend.Property({ - name: 'listening', - getter: 'net_listening', - outputFormatter: web3._extend.formatters.formatOutputBool - }), - new web3._extend.Property({ - name: 'peerCount', - getter: 'net_peerCount', - outputFormatter: web3._extend.utils.toDecimal - }), - new web3._extend.Property({ - name: 'peers', - getter: 'net_peers', - outputFormatter: function(obj) { return obj; } - }), - new web3._extend.Property({ - name: 'version', - getter: 'net_version', - outputFormatter: web3._extend.formatters.formatOutputString - }) - ] - }); - - // TX POOL - web3._extend({ - property: 'txpool', - methods: - [ - ], - properties: - [ - new web3._extend.Property({ - name: 'status', - getter: 'txpool_status', - outputFormatter: function(obj) { return obj; } - }) - ] - }); - - // TEST - web3._extend({ - property: 'test', - methods: - [ - new web3._extend.Method({ - name: 'setChainParams', - call: 'test_setChainParams', - params: 1, - outputFormatter: web3._extend.formatters.formatOutputBool - }), - new web3._extend.Method({ - name: 'mineBlocks', - call: 'test_mineBlocks', - params: 1, - inputFormatter: [web3._extend.utils.formatInputInt], - outputFormatter: web3._extend.formatters.formatOutputBool - }), - new web3._extend.Method({ - name: 'modifyTimestamp', - call: 'test_modifyTimestamp', - params: 1, - inputFormatter: [web3._extend.utils.formatInputInt], - outputFormatter: web3._extend.formatters.formatOutputBool - }), - new web3._extend.Method({ - name: 'addBlock', - call: 'test_addBlock', - params: 1, - inputFormatter: [web3._extend.utils.formatInputString], - outputFormatter: web3._extend.formatters.formatOutputBool - }), - new web3._extend.Method({ - name: 'rewindToBlock', - call: 'test_rewindToBlock', - params: 1, - inputFormatter: [web3._extend.utils.formatInputInt], - outputFormatter: web3._extend.formatters.formatOutputBool - }) - ], - properties: - [ - ] - }); - } -}; diff --git a/RPCTests/package.json b/RPCTests/package.json deleted file mode 100644 index 2e3283a2b84..00000000000 --- a/RPCTests/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "rpctests", - "version": "0.0.1", - "description": "Ethereum cpp client RPC tests", - "main": "./main.js", - "devDependencies": { - "web3": "^0.15.3", - "async": "^1.5" - }, - "scripts": { - - }, - "repository": { - - }, - "author": "cpp-ethereum team", - "license": "MIT", - "bugs": { - - }, - "homepage": "", - "standard": { - "ignore": [ - "node_modules/*", - "build/*", - "test/resources/*" - ] - } -} diff --git a/RPCTests/scripts/genesis.json b/RPCTests/scripts/genesis.json deleted file mode 100644 index aced93dabce..00000000000 --- a/RPCTests/scripts/genesis.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "sealEngine": "NoProof", - "params": { - "accountStartNonce": "0x00", - "maximumExtraDataSize": "0x0400", - "tieBreakingGas": false, - "minGasLimit": "125000", - "gasLimitBoundDivisor": "0x0400", - "minimumDifficulty": "0x020000", - "difficultyBoundDivisor": "0x0800", - "durationLimit": "0x08", - "blockReward": "0x14D1120D7B160000", - "registrar": "5e70c0bbcd5636e0f9f9316e9f8633feb64d4050", - "networkID" : "0x25" - }, - "genesis": { - "nonce": "0x000000000000002a", - "difficulty": "0x2000", - "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", - "author": "0x0000000000000000000000000000000000000000", - "timestamp": "0x00", - "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", - "extraData": "0x", - "gasLimit": "0x2fefd8" - }, - "accounts": { - "0000000000000000000000000000000000000001": { "wei": "1", "precompiled": { "name": "ecrecover", "linear": { "base": 3000, "word": 0 } } }, - "0000000000000000000000000000000000000002": { "wei": "1", "precompiled": { "name": "sha256", "linear": { "base": 60, "word": 12 } } }, - "0000000000000000000000000000000000000003": { "wei": "1", "precompiled": { "name": "ripemd160", "linear": { "base": 600, "word": 120 } } }, - "0000000000000000000000000000000000000004": { "wei": "1", "precompiled": { "name": "identity", "linear": { "base": 15, "word": 3 } } }, - "[ADDRESS]": { "wei": "100000000000000000000" } - } -} diff --git a/RPCTests/scripts/getLastBlock.js b/RPCTests/scripts/getLastBlock.js deleted file mode 100644 index 5ea2efafa9c..00000000000 --- a/RPCTests/scripts/getLastBlock.js +++ /dev/null @@ -1 +0,0 @@ -web3.eth.getBlock("latest", function(err, res){ callback(err, res); }) diff --git a/RPCTests/scripts/getNodeInfo.js b/RPCTests/scripts/getNodeInfo.js deleted file mode 100644 index 7452d9ca3d4..00000000000 --- a/RPCTests/scripts/getNodeInfo.js +++ /dev/null @@ -1 +0,0 @@ -web3.admin.getNodeInfo(function(err,res){ callback(err, res); }) diff --git a/RPCTests/scripts/testNewAccount.js b/RPCTests/scripts/testNewAccount.js deleted file mode 100644 index ae3224384bc..00000000000 --- a/RPCTests/scripts/testNewAccount.js +++ /dev/null @@ -1,12 +0,0 @@ -process.stdout.write("TEST_newAccount "); -var onResult = {}; -web3.personal.newAccount("123", function(err,res){ onResult(err,res); }) - -onResult = function (err,res) -{ - if (res.length == 42) - console.log("OK"); - else - console.log("FAILED"); - callback(err, res); -} diff --git a/RPCTests/scripts/tests/AddPeer/step00_node02_AddPeer.js b/RPCTests/scripts/tests/AddPeer/step00_node02_AddPeer.js deleted file mode 100644 index a7ffb25e6d1..00000000000 --- a/RPCTests/scripts/tests/AddPeer/step00_node02_AddPeer.js +++ /dev/null @@ -1,31 +0,0 @@ -var testname = "TEST_addPeerOnNode2 "; -process.stdout.write(testname); - -var onResult = {}; -web3.admin.addPeer("enode://" + args["node1_ID"] + "@127.0.0.1:" + args["node1_port"], function(err, res){ onResult(err, res); }) - -function sleep(ms) { - return new Promise(resolve => setTimeout(resolve, ms)); -} - -var onGetPeerCount = {}; -onResult = function (err,res) -{ - //wait for peer being added - sleep(1000).then(() => { - web3.net.getPeerCount(function(err, res){ onGetPeerCount(err, res); }) - }); -} - -onGetPeerCount = function (err, res) -{ - if (res == 1) - console.log("OK"); - else - { - console.log("FAILED"); - console.error(testname + "FAILED"); - } - callback(err, res); -} - diff --git a/RPCTests/scripts/tests/AddPeer/step01_node01_getPeerCount.js.js b/RPCTests/scripts/tests/AddPeer/step01_node01_getPeerCount.js.js deleted file mode 100644 index c6cefa71849..00000000000 --- a/RPCTests/scripts/tests/AddPeer/step01_node01_getPeerCount.js.js +++ /dev/null @@ -1,17 +0,0 @@ -var testname = "TEST_getPeerCountOnNode1 "; -process.stdout.write(testname); - -var onResult = {}; -web3.net.getPeerCount(function(err, res){ onResult(err, res); }) -onResult = function (err,res) -{ - if (res == 1) - console.log("OK"); - else - { - console.log("FAILED"); - console.error(testname + "FAILED"); - } - callback(err, res); -} - diff --git a/RPCTests/scripts/tests/MineBlocks/step00_node01_mineBlocks.js b/RPCTests/scripts/tests/MineBlocks/step00_node01_mineBlocks.js deleted file mode 100644 index efed4b538f8..00000000000 --- a/RPCTests/scripts/tests/MineBlocks/step00_node01_mineBlocks.js +++ /dev/null @@ -1,36 +0,0 @@ -var testname = "TEST_mineBlockOnNode1 "; -process.stdout.write(testname); - -var latestBlock; -web3.eth.getBlockNumber(function(err, res){ onGetBlockNumber1(err, res); }) -onGetBlockNumber1 = function (err, res) -{ - latestBlock = res; - web3.test.mineBlocks(1, function(err, res){ onResult(err, res); }) -} - - -onResult = function (err,res) -{ - function sleep(ms) { - return new Promise(resolve => setTimeout(resolve, ms)); - } - - //wait for block being mined - sleep(1000).then(() => { - web3.eth.getBlockNumber(function(err, res){ onGetBlockNumber(err, res); }) - }); -} - -onGetBlockNumber = function (err, res) -{ - if (res == latestBlock + 1) - console.log("OK"); - else - { - console.log("FAILED"); - console.error(testname + "FAILED"); - } - callback(err, res); -} - diff --git a/RPCTests/scripts/tests/MineBlocks/step01_node02_getBlockHash.js b/RPCTests/scripts/tests/MineBlocks/step01_node02_getBlockHash.js deleted file mode 100644 index 670d0649b56..00000000000 --- a/RPCTests/scripts/tests/MineBlocks/step01_node02_getBlockHash.js +++ /dev/null @@ -1,18 +0,0 @@ -var testname = "TEST_getBlockHashOnNode2 "; -process.stdout.write(testname); - -var onResult = {}; -web3.eth.getBlock("latest", function(err, res){ onResult(err, res); }) - -onResult = function (err,res) -{ - if (res.hash == args["node1_lastblock"].hash) - console.log("OK"); - else - { - console.log("FAILED"); - console.error(testname + "FAILED"); - } - callback(err, res); -} - diff --git a/RPCTests/scripts/tests/MineBlocks2/step00_node02_mineBlocks.js b/RPCTests/scripts/tests/MineBlocks2/step00_node02_mineBlocks.js deleted file mode 100644 index e29757bf5f8..00000000000 --- a/RPCTests/scripts/tests/MineBlocks2/step00_node02_mineBlocks.js +++ /dev/null @@ -1,35 +0,0 @@ -var testname = "TEST_mineBlockOnNode2 "; -process.stdout.write(testname); - -var latestBlock; -web3.eth.getBlockNumber(function(err, res){ onGetBlockNumber1(err, res); }) -onGetBlockNumber1 = function (err, res) -{ - latestBlock = res; - web3.test.mineBlocks(1, function(err, res){ onResult(err, res); }) -} - - -onResult = function (err,res) -{ - function sleep(ms) { - return new Promise(resolve => setTimeout(resolve, ms)); - } - - //wait for block being mined and propagated - sleep(1000).then(() => { - web3.eth.getBlockNumber(function(err, res){ onGetBlockNumber(err, res); }) - }); -} - -onGetBlockNumber = function (err, res) -{ - if (res == latestBlock + 1) - console.log("OK"); - else - { - console.log("FAILED"); - console.error(testname + "FAILED"); - } - callback(err, res); -} diff --git a/RPCTests/scripts/tests/MineBlocks2/step01_node01_getBlockHash.js b/RPCTests/scripts/tests/MineBlocks2/step01_node01_getBlockHash.js deleted file mode 100644 index edc94bc1c68..00000000000 --- a/RPCTests/scripts/tests/MineBlocks2/step01_node01_getBlockHash.js +++ /dev/null @@ -1,17 +0,0 @@ -var testname = "TEST_getBlockHashOnNode1 "; -process.stdout.write(testname); - -var onResult = {}; -web3.eth.getBlock("latest", function(err, res){ onResult(err, res); }) - -onResult = function (err,res) -{ - if (res.hash == args["node2_lastblock"].hash) - console.log("OK"); - else - { - console.log("FAILED "); - console.error(testname + "FAILED"); - } - callback(err, res); -}