Compare commits

...

26 Commits

Author SHA1 Message Date
Matt Witherspoon de588ce198 use consistent HTTP server header on failure responses 2022-12-05 20:22:45 -05:00
Kevin Heifner c15f84507d Merge pull request #534 from AntelopeIO/GH-430-fork-test-3.2
[3.1 -> 3.2] Test nodeos_forked_chain_test: Fix race on kill of bridge node
2022-12-05 10:22:08 -06:00
Kevin Heifner d65158aa00 Merge remote-tracking branch 'origin/release/3.1' into GH-430-fork-test-3.2 2022-12-05 09:42:09 -06:00
Kevin Heifner 0e53fc1b62 Merge pull request #533 from AntelopeIO/GH-430-fork-test
[3.1] Test nodeos_forked_chain_test: Fix race on kill of bridge node
2022-12-05 09:41:18 -06:00
Kevin Heifner ca8f031bae GH-430 Fix race on kill of bridge node at producerk. Also removed some unneeded waits on blocks. 2022-12-05 08:40:28 -06:00
Kevin Heifner 5b71d02dd2 Merge pull request #504 from AntelopeIO/deepmind-plugin-config-checks-3.2
[3.1 -> 3.2] Added validation of plugin configuration for deep-mind
2022-11-21 13:59:13 -06:00
Kevin Heifner 11a58c587d Merge remote-tracking branch 'origin/release/3.1' into deepmind-plugin-config-checks-3.2 2022-11-21 13:25:29 -06:00
Kevin Heifner b357a163ce Merge pull request #503 from eostitan/v3.1.0/deepmind-plugin-config-checks
[3.1] Added validation of plugin configuration for deep-mind
2022-11-21 13:24:09 -06:00
Guillaume Babin-Tremblay c94218fdfe Added validation of plugin configuration for deep-mind 2022-11-21 18:35:17 +00:00
Lin Huang 9efc569ae5 Merge pull request #501 from AntelopeIO/bump_3_2_0
bump Leap to 3.2.0
2022-11-21 09:36:57 -05:00
Lin Huang bee268ca10 bump Leap to 3.2.0 2022-11-21 09:05:35 -05:00
Kevin Heifner 9a15597983 Merge pull request #490 from AntelopeIO/GH-485-log-3.2
[3.1 -> 3.2] Use net_plugin_impl logger instead of default logger
2022-11-17 15:38:55 -06:00
Kevin Heifner 552aedc95c Merge remote-tracking branch 'origin/release/3.1' into GH-485-log-3.2 2022-11-17 15:04:33 -06:00
Kevin Heifner 0c08b9ed28 Merge pull request #486 from AntelopeIO/GH-485-log-3.1
[3.1] Use net_plugin_impl logger instead of default logger
2022-11-17 15:03:55 -06:00
Lin Huang b641746863 Merge pull request #483 from AntelopeIO/compute_transaction_fix
[3.2] compute_transaction: add --dry-run, deprecate --read-only, and sign a transaction only when explicitly requested
2022-11-17 14:32:03 -05:00
Kevin Heifner 8a0ed73c1a GH-485 Use net_plugin_impl logger instead of default logger 2022-11-17 13:18:39 -06:00
Lin Huang 2d2f7880ca Do not change the behavior of existing --read-only that transactions by --read-only will be signed by default 2022-11-17 14:04:54 -05:00
Lin Huang 5d6dc09dd9 compute_transaction: add --dry-run, deprecate --read-only, and sign a transaction only when --sign-with is provided 2022-11-17 10:55:09 -05:00
Kevin Heifner 87359e262a Merge pull request #443 from AntelopeIO/GH-419-trx-finality-test-3.2
[3.1 -> 3.2] Fix test failure due to trx hitting near end of block production time
2022-11-04 18:41:47 -05:00
Kevin Heifner 9b948c0150 Merge remote-tracking branch 'origin/release/3.1' into GH-419-trx-finality-test-3.2 2022-11-03 13:03:30 -05:00
Kevin Heifner ae0439ba8c Merge pull request #441 from AntelopeIO/GH-419-trx-finality-test-3.1
[3.1] Fix test failure due to trx hitting near end of block production time
2022-11-03 13:03:17 -05:00
Kevin Heifner 4dcb8318a3 GH-419 Improve assertion message by including both expected states. 2022-11-03 10:48:19 -05:00
Kevin Heifner b92b997c6b GH-419 Update to address PR comments. Revert to explicit present. 2022-11-03 10:34:48 -05:00
Kevin Heifner 59ee6ed2ee GH-419 Previous fix for test was incomplete in that the validateTrxState needed to be updated for IN_BLOCK 2022-11-03 08:27:25 -05:00
Matt Witherspoon b52647b2c9 Merge pull request #438 from AntelopeIO/http_server_header_32x
[3.2] RFC: change the HTTP Server header to be nodeos/keosd version
2022-11-02 21:40:42 -04:00
Matt Witherspoon 8d2637e6a5 change the HTTP Server header to be nodeos/keosd version 2022-11-02 16:56:59 -04:00
13 changed files with 58 additions and 18 deletions
+1 -1
View File
@@ -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}")
+7
View File
@@ -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 );
}
+2
View File
@@ -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;
};
/**
+1 -1
View File
@@ -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
View File
@@ -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);
+2 -1
View File
@@ -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)) {
+2 -1
View File
@@ -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();
+9 -1
View File
@@ -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)
+5 -2
View File
@@ -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"
+4 -3
View File
@@ -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, \