mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Initial poc to test via ipc.
This commit is contained in:
parent
2ccfea8b54
commit
5aca97af0d
@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
|
#include <fstream>
|
||||||
#include "../TestHelper.h"
|
#include "../TestHelper.h"
|
||||||
#include <libethcore/ABI.h>
|
#include <libethcore/ABI.h>
|
||||||
#include <libethcore/SealEngine.h>
|
#include <libethcore/SealEngine.h>
|
||||||
@ -54,6 +55,33 @@ public:
|
|||||||
if (g_logVerbosity != -1)
|
if (g_logVerbosity != -1)
|
||||||
g_logVerbosity = 0;
|
g_logVerbosity = 0;
|
||||||
//m_state.resetCurrent();
|
//m_state.resetCurrent();
|
||||||
|
m_ipcSocket.open("/home/christian/.ethereum/geth.ipc");
|
||||||
|
rpcCall("personal_createAccount", {});
|
||||||
|
}
|
||||||
|
|
||||||
|
void rpcCall(std::string const& _methodName, std::vector<std::string> const& _args)
|
||||||
|
{
|
||||||
|
if (!m_ipcSocket)
|
||||||
|
BOOST_FAIL("Ethereum node unavailable.");
|
||||||
|
m_ipcSocket <<
|
||||||
|
"{\"jsonrpc\": \"2.0\", \"method\": \"" <<
|
||||||
|
_methodName <<
|
||||||
|
"\" \"params\": [";
|
||||||
|
for (size_t i = 0; i < _args.size(); ++i)
|
||||||
|
{
|
||||||
|
m_ipcSocket << "\"" << _args[i] << "\"";
|
||||||
|
if (i + 1 != _args.size())
|
||||||
|
m_ipcSocket << ", ";
|
||||||
|
}
|
||||||
|
m_ipcSocket << "], \"id\": \"" << m_rpcSequence << "\"}" << std::endl;
|
||||||
|
++m_rpcSequence;
|
||||||
|
|
||||||
|
if (!m_ipcSocket)
|
||||||
|
BOOST_FAIL("Ethereum node unavailable.");
|
||||||
|
|
||||||
|
std::string reply;
|
||||||
|
std::getline(m_ipcSocket, reply);
|
||||||
|
std::cout << "Reply: " << reply << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
bytes const& compileAndRunWithoutCheck(
|
bytes const& compileAndRunWithoutCheck(
|
||||||
@ -292,6 +320,9 @@ protected:
|
|||||||
m_logs = executive.logs();
|
m_logs = executive.logs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::fstream m_ipcSocket;
|
||||||
|
size_t m_rpcSequence = 1;
|
||||||
|
|
||||||
std::unique_ptr<eth::SealEngineFace> m_sealEngine;
|
std::unique_ptr<eth::SealEngineFace> m_sealEngine;
|
||||||
size_t m_optimizeRuns = 200;
|
size_t m_optimizeRuns = 200;
|
||||||
bool m_optimize = false;
|
bool m_optimize = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user