Compare commits
26 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| de588ce198 | |||
| c15f84507d | |||
| d65158aa00 | |||
| 0e53fc1b62 | |||
| ca8f031bae | |||
| 5b71d02dd2 | |||
| 11a58c587d | |||
| b357a163ce | |||
| c94218fdfe | |||
| 9efc569ae5 | |||
| bee268ca10 | |||
| 9a15597983 | |||
| 552aedc95c | |||
| 0c08b9ed28 | |||
| b641746863 | |||
| 8a0ed73c1a | |||
| 2d2f7880ca | |||
| 5d6dc09dd9 | |||
| 87359e262a | |||
| 9b948c0150 | |||
| ae0439ba8c | |||
| 4dcb8318a3 | |||
| b92b997c6b | |||
| 59ee6ed2ee | |||
| b52647b2c9 | |||
| 8d2637e6a5 |
+1
-1
@@ -16,7 +16,7 @@ set( CXX_STANDARD_REQUIRED ON)
|
||||
set(VERSION_MAJOR 3)
|
||||
set(VERSION_MINOR 2)
|
||||
set(VERSION_PATCH 0)
|
||||
set(VERSION_SUFFIX rc2)
|
||||
#set(VERSION_SUFFIX rc2)
|
||||
|
||||
if(VERSION_SUFFIX)
|
||||
set(VERSION_FULL "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}-${VERSION_SUFFIX}")
|
||||
|
||||
@@ -1138,6 +1138,13 @@ void chain_plugin::plugin_initialize(const variables_map& options) {
|
||||
// For the time being, when `deep-mind = true` is activated, we set `stdout` here to
|
||||
// be an unbuffered I/O stream.
|
||||
setbuf(stdout, NULL);
|
||||
|
||||
//verify configuration is correct
|
||||
EOS_ASSERT( options.at("api-accept-transactions").as<bool>() == false, plugin_config_exception,
|
||||
"api-accept-transactions must be set to false in order to enable deep-mind logging.");
|
||||
|
||||
EOS_ASSERT( options.at("p2p-accept-transactions").as<bool>() == false, plugin_config_exception,
|
||||
"p2p-accept-transactions must be set to false in order to enable deep-mind logging.");
|
||||
|
||||
my->chain->enable_deep_mind( &_deep_mind_log );
|
||||
}
|
||||
|
||||
@@ -359,6 +359,8 @@ class http_plugin_impl : public std::enable_shared_from_this<http_plugin_impl> {
|
||||
}
|
||||
}
|
||||
|
||||
my->plugin_state->server_header = current_http_plugin_defaults.server_header;
|
||||
|
||||
|
||||
//watch out for the returns above when adding new code here
|
||||
} FC_LOG_AND_RETHROW()
|
||||
|
||||
@@ -106,7 +106,8 @@ protected:
|
||||
res_->version(req.version());
|
||||
res_->set(http::field::content_type, "application/json");
|
||||
res_->keep_alive(req.keep_alive());
|
||||
res_->set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||
if(plugin_state_->server_header.size())
|
||||
res_->set(http::field::server, plugin_state_->server_header);
|
||||
|
||||
// Request path must be absolute and not contain "..".
|
||||
if(req.target().empty() || req.target()[0] != '/' || req.target().find("..") != beast::string_view::npos) {
|
||||
@@ -342,9 +343,7 @@ public:
|
||||
|
||||
|
||||
if(is_send_exception_response_) {
|
||||
res_->set(http::field::content_type, "application/json");
|
||||
res_->keep_alive(false);
|
||||
res_->set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||
|
||||
send_response(std::move(err_str), static_cast<unsigned int>(http::status::internal_server_error));
|
||||
derived().do_eof();
|
||||
|
||||
@@ -130,6 +130,8 @@ struct http_plugin_state {
|
||||
bool validate_host = true;
|
||||
set<string> valid_hosts;
|
||||
|
||||
string server_header;
|
||||
|
||||
url_handlers_type url_handlers;
|
||||
bool keep_alive = false;
|
||||
|
||||
|
||||
@@ -45,6 +45,8 @@ namespace eosio {
|
||||
//If non 0, HTTP will be enabled by default on the given port number. If
|
||||
// 0, HTTP will not be enabled by default
|
||||
uint16_t default_http_port{0};
|
||||
//If set, a Server header will be added to the HTTP reply with this value
|
||||
string server_header;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -2686,7 +2686,7 @@ namespace eosio {
|
||||
my_impl->producer_plug->log_failed_transaction(ptr->id(), ptr, reason);
|
||||
if (fc::time_point::now() - fc::seconds(1) >= last_dropped_trx_msg_time) {
|
||||
last_dropped_trx_msg_time = fc::time_point::now();
|
||||
wlog(reason);
|
||||
peer_wlog(this, reason);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
+19
-5
@@ -173,6 +173,7 @@ bool tx_skip_sign = false;
|
||||
bool tx_print_json = false;
|
||||
bool tx_rtn_failure_trace = true;
|
||||
bool tx_read_only = false;
|
||||
bool tx_dry_run = false;
|
||||
bool tx_retry_lib = false;
|
||||
uint16_t tx_retry_num_blocks = 0;
|
||||
bool tx_use_old_rpc = false;
|
||||
@@ -441,7 +442,7 @@ fc::variant push_transaction( signed_transaction& trx, const std::vector<public_
|
||||
trx.delay_sec = delaysec;
|
||||
}
|
||||
|
||||
if (!tx_skip_sign) {
|
||||
auto sign_trx = [&] () {
|
||||
fc::variant required_keys;
|
||||
if (signing_keys.size() > 0) {
|
||||
required_keys = fc::variant(signing_keys);
|
||||
@@ -450,6 +451,16 @@ fc::variant push_transaction( signed_transaction& trx, const std::vector<public_
|
||||
required_keys = determine_required_keys(trx);
|
||||
}
|
||||
sign_transaction(trx, required_keys, info.chain_id);
|
||||
};
|
||||
if (!tx_skip_sign) {
|
||||
// sign dry-run transactions only when explcitly requested
|
||||
if ( tx_dry_run ) {
|
||||
if ( signing_keys.size() > 0 ) {
|
||||
sign_trx();
|
||||
}
|
||||
} else {
|
||||
sign_trx();
|
||||
}
|
||||
}
|
||||
|
||||
packed_transaction::compression_type compression = to_compression_type( tx_compression );
|
||||
@@ -458,12 +469,14 @@ fc::variant push_transaction( signed_transaction& trx, const std::vector<public_
|
||||
EOSC_ASSERT( !(tx_retry_lib && tx_retry_num_blocks > 0), "ERROR: --retry-irreversible and --retry-num-blocks are mutually exclusive" );
|
||||
if (tx_use_old_rpc) {
|
||||
EOSC_ASSERT( !tx_read_only, "ERROR: --read-only can not be used with --use-old-rpc" );
|
||||
EOSC_ASSERT( !tx_dry_run, "ERROR: --dry-run can not be used with --use-old-rpc" );
|
||||
EOSC_ASSERT( !tx_rtn_failure_trace, "ERROR: --return-failure-trace can not be used with --use-old-rpc" );
|
||||
EOSC_ASSERT( !tx_retry_lib, "ERROR: --retry-irreversible can not be used with --use-old-rpc" );
|
||||
EOSC_ASSERT( !tx_retry_num_blocks, "ERROR: --retry-num-blocks can not be used with --use-old-rpc" );
|
||||
return call( push_txn_func, packed_transaction( trx, compression ) );
|
||||
} else if (tx_use_old_send_rpc) {
|
||||
EOSC_ASSERT( !tx_read_only, "ERROR: --read-only can not be used with --use-old-send-rpc" );
|
||||
EOSC_ASSERT( !tx_dry_run, "ERROR: --dry-run can not be used with --use-old-send-rpc" );
|
||||
EOSC_ASSERT( !tx_rtn_failure_trace, "ERROR: --return-failure-trace can not be used with --use-old-send-rpc" );
|
||||
EOSC_ASSERT( !tx_retry_lib, "ERROR: --retry-irreversible can not be used with --use-old-send-rpc" );
|
||||
EOSC_ASSERT( !tx_retry_num_blocks, "ERROR: --retry-num-blocks can not be used with --use-old-send-rpc" );
|
||||
@@ -474,9 +487,9 @@ fc::variant push_transaction( signed_transaction& trx, const std::vector<public_
|
||||
throw;
|
||||
}
|
||||
} else {
|
||||
if( tx_read_only ) {
|
||||
EOSC_ASSERT( !tx_retry_lib, "ERROR: --retry-irreversible can not be used with --read-only" );
|
||||
EOSC_ASSERT( !tx_retry_num_blocks, "ERROR: --retry-num-blocks can not be used with --read-only" );
|
||||
if( tx_dry_run || tx_read_only ) {
|
||||
EOSC_ASSERT( !tx_retry_lib, "ERROR: --retry-irreversible can not be used with --dry-run or --read-only" );
|
||||
EOSC_ASSERT( !tx_retry_num_blocks, "ERROR: --retry-num-blocks can not be used with --dry-run or --read-only" );
|
||||
try {
|
||||
auto compute_txn_arg = fc::mutable_variant_object ("transaction",
|
||||
packed_transaction(trx,compression));
|
||||
@@ -3912,7 +3925,8 @@ int main( int argc, char** argv ) {
|
||||
trxSubcommand->add_option("transaction", trx_to_push, localized("The JSON string or filename defining the transaction to push"))->required();
|
||||
trxSubcommand->add_option("--signature", extra_sig_opt_callback, localized("append a signature to the transaction; repeat this option to append multiple signatures"))->type_size(0, 1000);
|
||||
add_standard_transaction_options_plus_signing(trxSubcommand);
|
||||
trxSubcommand->add_flag("-o,--read-only", tx_read_only, localized("Specify a transaction is read-only"));
|
||||
trxSubcommand->add_flag("-o,--read-only", tx_read_only, localized("Deprecated, use --dry-run instead"));
|
||||
trxSubcommand->add_flag("--dry-run", tx_dry_run, localized("Specify a transaction is dry-run"));
|
||||
|
||||
trxSubcommand->callback([&] {
|
||||
fc::variant trx_var = json_from_file_or_string(trx_to_push);
|
||||
|
||||
@@ -81,7 +81,8 @@ int main(int argc, char** argv)
|
||||
app().set_default_config_dir(home / "eosio-wallet");
|
||||
http_plugin::set_defaults({
|
||||
.default_unix_socket_path = keosd::config::key_store_executable_name + ".sock",
|
||||
.default_http_port = 0
|
||||
.default_http_port = 0,
|
||||
.server_header = keosd::config::key_store_executable_name + "/" + app().version_string()
|
||||
});
|
||||
app().register_plugin<wallet_api_plugin>();
|
||||
if(!app().initialize<wallet_plugin, wallet_api_plugin, http_plugin>(argc, argv)) {
|
||||
|
||||
@@ -120,7 +120,8 @@ int main(int argc, char** argv)
|
||||
app().set_default_config_dir(root / "eosio" / nodeos::config::node_executable_name / "config" );
|
||||
http_plugin::set_defaults({
|
||||
.default_unix_socket_path = "",
|
||||
.default_http_port = 8888
|
||||
.default_http_port = 8888,
|
||||
.server_header = nodeos::config::node_executable_name + "/" + app().version_string()
|
||||
});
|
||||
if(!app().initialize<chain_plugin, net_plugin, producer_plugin, resource_monitor_plugin>(argc, argv)) {
|
||||
const auto& opts = app().get_options();
|
||||
|
||||
@@ -115,6 +115,8 @@ try:
|
||||
|
||||
results = node.pushTransaction(trx, opts='--read-only', permissions=account1.name)
|
||||
assert(results[0])
|
||||
results = node.pushTransaction(trx, opts='--dry-run', permissions=account1.name)
|
||||
assert(results[0])
|
||||
node.waitForLibToAdvance(30)
|
||||
|
||||
postBalances = node.getEosBalances([account1, account2])
|
||||
@@ -122,6 +124,8 @@ try:
|
||||
|
||||
results = node.pushTransaction(trx, opts='--read-only --skip-sign')
|
||||
assert(results[0])
|
||||
results = node.pushTransaction(trx, opts='--dry-run --skip-sign')
|
||||
assert(results[0])
|
||||
node.waitForLibToAdvance(30)
|
||||
|
||||
postBalances = node.getEosBalances([account1, account2])
|
||||
@@ -141,6 +145,8 @@ try:
|
||||
|
||||
results = npnode.pushTransaction(trx2, opts="--read-only")
|
||||
assert(not results[0])
|
||||
results = npnode.pushTransaction(trx2, opts="--dry-run")
|
||||
assert(not results[0])
|
||||
|
||||
# Verify that no subjective billing was charged
|
||||
acct2 = npnode.getAccountSubjectiveInfo("account2")
|
||||
@@ -174,10 +180,12 @@ try:
|
||||
}
|
||||
results = npnode.pushTransaction(trx3, opts="--read-only")
|
||||
assert(results[0])
|
||||
results = npnode.pushTransaction(trx3, opts="--dry-run")
|
||||
assert(results[0])
|
||||
|
||||
testSuccessful = True
|
||||
finally:
|
||||
TestHelper.shutdown(cluster, walletMgr, testSuccessful, killEosInstances, killWallet, keepLogs, killAll, dumpErrorDetails)
|
||||
|
||||
errorCode = 0 if testSuccessful else 1
|
||||
exit(errorCode)
|
||||
exit(errorCode)
|
||||
|
||||
@@ -230,7 +230,7 @@ try:
|
||||
transferAmount="100000000.0000 {0}".format(CORE_SYMBOL)
|
||||
Print("Transfer funds %s from account %s to %s" % (transferAmount, cluster.eosioAccount.name, account.name))
|
||||
node.transferFunds(cluster.eosioAccount, account, transferAmount, "test transfer", waitForTransBlock=True)
|
||||
trans=node.delegatebw(account, 20000000.0000, 20000000.0000, waitForTransBlock=True, exitOnError=True)
|
||||
trans=node.delegatebw(account, 20000000.0000, 20000000.0000, waitForTransBlock=False, exitOnError=True)
|
||||
|
||||
|
||||
# *** vote using accounts ***
|
||||
@@ -240,7 +240,7 @@ try:
|
||||
index=0
|
||||
for account in accounts:
|
||||
Print("Vote for producers=%s" % (producers))
|
||||
trans=prodNodes[index % len(prodNodes)].vote(account, producers, waitForTransBlock=True)
|
||||
trans=prodNodes[index % len(prodNodes)].vote(account, producers, waitForTransBlock=False)
|
||||
index+=1
|
||||
|
||||
|
||||
@@ -372,6 +372,9 @@ try:
|
||||
# block number to start expecting node killed after
|
||||
preKillBlockNum=nonProdNode.getBlockNum()
|
||||
preKillBlockProducer=nonProdNode.getBlockProducerByNum(preKillBlockNum)
|
||||
if preKillBlockProducer == "defproducerj" or preKillBlockProducer == "defproducerk":
|
||||
# wait for defproduceri so there is plenty of time to send kill before defproducerk
|
||||
nonProdNode.waitForProducer("defproduceri")
|
||||
Print("preKillBlockProducer = {}".format(preKillBlockProducer))
|
||||
# kill at last block before defproducerl, since the block it is killed on will get propagated
|
||||
killAtProducer="defproducerk"
|
||||
|
||||
@@ -142,7 +142,7 @@ try:
|
||||
state = getState(retStatus)
|
||||
|
||||
assert (state == localState or state == inBlockState), \
|
||||
f"ERROR: getTransactionStatus didn't return \"{localState}\" state.\n\nstatus: {json.dumps(retStatus, indent=1)}"
|
||||
f"ERROR: getTransactionStatus didn't return \"{localState}\" or \"{inBlockState}\" state.\n\nstatus: {json.dumps(retStatus, indent=1)}"
|
||||
status.append(copy.copy(retStatus))
|
||||
startingBlockNum=testNode.getInfo()["head_block_num"]
|
||||
|
||||
@@ -150,12 +150,13 @@ try:
|
||||
bnPresent = "block_number" in status
|
||||
biPresent = "block_id" in status
|
||||
btPresent = "block_timestamp" in status
|
||||
desc = "" if present else "not "
|
||||
desc = "" if present else " not"
|
||||
group = bnPresent and biPresent and btPresent if present else not bnPresent and not biPresent and not btPresent
|
||||
assert group, \
|
||||
f"ERROR: getTransactionStatus should{desc} contain \"block_number\", \"block_id\", or \"block_timestamp\" since state was \"{getState(status)}\".\nstatus: {json.dumps(status, indent=1)}"
|
||||
|
||||
validateTrxState(status[0], present=False)
|
||||
present = True if state == inBlockState else False
|
||||
validateTrxState(status[0], present)
|
||||
|
||||
def validate(status, knownTrx=True):
|
||||
assert "head_number" in status and "head_id" in status and "head_timestamp" in status, \
|
||||
|
||||
Reference in New Issue
Block a user