Removed ptrace and improved process args handling.

This commit is contained in:
ravinsp
2019-11-22 12:23:21 +05:30
parent 95683035b9
commit 684a6bb18f
9 changed files with 44 additions and 2079 deletions

View File

@@ -218,6 +218,17 @@ int load_config()
cfg.binary = d["binary"].GetString();
cfg.binargs = d["binargs"].GetString();
// Populate runtime contract execution args.
if (!cfg.binargs.empty())
boost::split(cfg.runtime_binexec_args, cfg.binargs, boost::is_any_of(" "));
cfg.runtime_binexec_args.insert(cfg.runtime_binexec_args.begin(), cfg.binary);
// Uncomment for docker-based execution.
// std::string volumearg;
// volumearg.append("type=bind,source=").append(ctx.statedir).append(",target=/state");
// const char *dockerargs[] = {"/usr/bin/docker", "run", "--rm", "-i", "--mount", volumearg.data(), cfg.binary.data()};
// cfg.runtime_binexec_args.insert(cfg.runtime_binexec_args.begin(), std::begin(dockerargs), std::end(dockerargs));
// Storing peers in unordered map keyed by the concatenated address:port and also saving address and port
// seperately to retrieve easily when handling peer connections.
std::vector<std::string> splitted_peers;
@@ -468,13 +479,6 @@ int validate_config()
}
}
// Check whether the contract binary actually exists.
if (!boost::filesystem::exists(cfg.binary))
{
std::cout << "Contract binary does not exist: " << cfg.binary << std::endl;
return -1;
}
//Sign and verify a sample message to ensure we have a matching signing key pair.
const std::string msg = "hotpocket";
const std::string sighex = crypto::sign_hex(msg, cfg.seckeyhex);