Merge remote-tracking branch 'origin/main' into HEAD
required minor fixup to tester.cmakes
This commit is contained in:
@@ -68,59 +68,72 @@ if("eos-vm-oc" IN_LIST EOSIO_WASM_RUNTIMES)
|
||||
set(WRAP_MAIN "-Wl,-wrap=main")
|
||||
endif()
|
||||
|
||||
add_library(EosioChain INTERFACE)
|
||||
|
||||
target_link_libraries(EosioChain INTERFACE
|
||||
${libchain}
|
||||
${libfc}
|
||||
${libwast}
|
||||
${libwasm}
|
||||
${libir}
|
||||
${libsoftfloat}
|
||||
${libbscrypto}
|
||||
${libdecrepit}
|
||||
${liblogging}
|
||||
${libchainbase}
|
||||
${libbuiltins}
|
||||
${libsecp256k1}
|
||||
${libbn256}
|
||||
${libbls12-381}
|
||||
@GMP_LIBRARY@
|
||||
|
||||
Boost::date_time
|
||||
Boost::filesystem
|
||||
Boost::system
|
||||
Boost::chrono
|
||||
Boost::multi_index
|
||||
Boost::multiprecision
|
||||
Boost::interprocess
|
||||
Boost::asio
|
||||
Boost::signals2
|
||||
Boost::iostreams
|
||||
"-lz" # Needed by Boost iostreams
|
||||
|
||||
${LLVM_LIBS}
|
||||
|
||||
${PLATFORM_SPECIFIC_LIBS}
|
||||
|
||||
${WRAP_MAIN}
|
||||
Threads::Threads
|
||||
)
|
||||
|
||||
target_include_directories(EosioChain INTERFACE
|
||||
@OPENSSL_INCLUDE_DIR@
|
||||
@CMAKE_INSTALL_PREFIX@
|
||||
@CMAKE_INSTALL_FULL_INCLUDEDIR@
|
||||
@CMAKE_INSTALL_FULL_INCLUDEDIR@/wasm-jit
|
||||
@CMAKE_INSTALL_FULL_INCLUDEDIR@/leapboringssl
|
||||
@CMAKE_INSTALL_FULL_INCLUDEDIR@/softfloat )
|
||||
|
||||
#adds -ltr. Ubuntu eosio.contracts build breaks without this
|
||||
if(UNIX AND NOT APPLE)
|
||||
target_link_libraries(EosioChain INTERFACE ${LIBRT})
|
||||
endif()
|
||||
|
||||
add_library(EosioTester INTERFACE)
|
||||
|
||||
target_link_libraries(EosioTester INTERFACE
|
||||
${libtester}
|
||||
Boost::unit_test_framework
|
||||
EosioChain
|
||||
)
|
||||
|
||||
macro(add_eosio_test_executable test_name)
|
||||
add_executable( ${test_name} ${ARGN} )
|
||||
target_link_libraries( ${test_name}
|
||||
${libtester}
|
||||
${libchain}
|
||||
${libfc}
|
||||
${libwast}
|
||||
${libwasm}
|
||||
${libir}
|
||||
${libsoftfloat}
|
||||
${libbscrypto}
|
||||
${libdecrepit}
|
||||
${liblogging}
|
||||
${libchainbase}
|
||||
${libbuiltins}
|
||||
${libsecp256k1}
|
||||
${libbn256}
|
||||
${libbls12-381}
|
||||
@GMP_LIBRARY@
|
||||
|
||||
Boost::date_time
|
||||
Boost::filesystem
|
||||
Boost::system
|
||||
Boost::chrono
|
||||
Boost::multi_index
|
||||
Boost::multiprecision
|
||||
Boost::interprocess
|
||||
Boost::asio
|
||||
Boost::signals2
|
||||
Boost::iostreams
|
||||
"-lz" # Needed by Boost iostreams
|
||||
Boost::unit_test_framework
|
||||
|
||||
${LLVM_LIBS}
|
||||
|
||||
${PLATFORM_SPECIFIC_LIBS}
|
||||
|
||||
${WRAP_MAIN}
|
||||
Threads::Threads
|
||||
EosioTester
|
||||
)
|
||||
|
||||
#adds -ltr. Ubuntu eosio.contracts build breaks without this
|
||||
if(UNIX AND NOT APPLE)
|
||||
target_link_libraries(${test_name} ${LIBRT})
|
||||
endif()
|
||||
|
||||
target_include_directories( ${test_name} PUBLIC
|
||||
@CMAKE_INSTALL_PREFIX@
|
||||
@CMAKE_INSTALL_FULL_INCLUDEDIR@
|
||||
@CMAKE_INSTALL_FULL_INCLUDEDIR@/wasm-jit
|
||||
@CMAKE_INSTALL_FULL_INCLUDEDIR@/leapboringssl
|
||||
@CMAKE_INSTALL_FULL_INCLUDEDIR@/softfloat )
|
||||
|
||||
endmacro()
|
||||
|
||||
macro(add_eosio_test test_name)
|
||||
|
||||
@@ -65,62 +65,79 @@ if("eos-vm-oc" IN_LIST EOSIO_WASM_RUNTIMES)
|
||||
set(WRAP_MAIN "-Wl,-wrap=main")
|
||||
endif()
|
||||
|
||||
add_library(EosioChain INTERFACE)
|
||||
|
||||
target_link_libraries(EosioChain INTERFACE
|
||||
${libchain}
|
||||
${libfc}
|
||||
${libwast}
|
||||
${libwasm}
|
||||
${libir}
|
||||
${libsoftfloat}
|
||||
${libbscrypto}
|
||||
${libdecrepit}
|
||||
${liblogging}
|
||||
${libchainbase}
|
||||
${libbuiltins}
|
||||
${libsecp256k1}
|
||||
${libbn256}
|
||||
${libbls12-381}
|
||||
@GMP_LIBRARY@
|
||||
|
||||
Boost::date_time
|
||||
Boost::filesystem
|
||||
Boost::system
|
||||
Boost::chrono
|
||||
Boost::multi_index
|
||||
Boost::multiprecision
|
||||
Boost::interprocess
|
||||
Boost::asio
|
||||
Boost::signals2
|
||||
Boost::iostreams
|
||||
"-lz" # Needed by Boost iostreams
|
||||
|
||||
${LLVM_LIBS}
|
||||
|
||||
${PLATFORM_SPECIFIC_LIBS}
|
||||
|
||||
${WRAP_MAIN}
|
||||
Threads::Threads
|
||||
)
|
||||
|
||||
target_include_directories(EosioChain INTERFACE
|
||||
@OPENSSL_INCLUDE_DIR@
|
||||
@CMAKE_SOURCE_DIR@/libraries/chain/include
|
||||
@CMAKE_BINARY_DIR@/libraries/chain/include
|
||||
@CMAKE_SOURCE_DIR@/libraries/libfc/include
|
||||
@CMAKE_SOURCE_DIR@/libraries/libfc/libraries/boringssl/boringssl/src/include
|
||||
@CMAKE_SOURCE_DIR@/libraries/softfloat/source/include
|
||||
@CMAKE_SOURCE_DIR@/libraries/appbase/include
|
||||
@CMAKE_SOURCE_DIR@/libraries/chainbase/include
|
||||
@CMAKE_SOURCE_DIR@/libraries/wasm-jit/include )
|
||||
|
||||
|
||||
#adds -ltr. Ubuntu eosio.contracts build breaks without this
|
||||
if(UNIX AND NOT APPLE)
|
||||
target_link_libraries(EosioChain INTERFACE ${LIBRT})
|
||||
endif()
|
||||
|
||||
add_library(EosioTester INTERFACE)
|
||||
|
||||
target_link_libraries(EosioTester INTERFACE
|
||||
${libtester}
|
||||
Boost::unit_test_framework
|
||||
EosioChain
|
||||
)
|
||||
|
||||
target_include_directories(EosioTester INTERFACE
|
||||
@CMAKE_SOURCE_DIR@/libraries/testing/include )
|
||||
|
||||
macro(add_eosio_test_executable test_name)
|
||||
add_executable( ${test_name} ${ARGN} )
|
||||
target_link_libraries( ${test_name}
|
||||
${libtester}
|
||||
${libchain}
|
||||
${libfc}
|
||||
${libwast}
|
||||
${libwasm}
|
||||
${libir}
|
||||
${libsoftfloat}
|
||||
${libbscrypto}
|
||||
${libdecrepit}
|
||||
${liblogging}
|
||||
${libchainbase}
|
||||
${libbuiltins}
|
||||
${libsecp256k1}
|
||||
${libbn256}
|
||||
${libbls12-381}
|
||||
@GMP_LIBRARY@
|
||||
|
||||
Boost::date_time
|
||||
Boost::filesystem
|
||||
Boost::system
|
||||
Boost::chrono
|
||||
Boost::multi_index
|
||||
Boost::multiprecision
|
||||
Boost::interprocess
|
||||
Boost::asio
|
||||
Boost::signals2
|
||||
Boost::iostreams
|
||||
"-lz" # Needed by Boost iostreams
|
||||
Boost::unit_test_framework
|
||||
|
||||
${LLVM_LIBS}
|
||||
|
||||
${PLATFORM_SPECIFIC_LIBS}
|
||||
|
||||
${WRAP_MAIN}
|
||||
Threads::Threads
|
||||
EosioTester
|
||||
)
|
||||
|
||||
#adds -ltr. Ubuntu eosio.contracts build breaks without this
|
||||
if(UNIX AND NOT APPLE)
|
||||
target_link_libraries(${test_name} ${LIBRT})
|
||||
endif()
|
||||
|
||||
target_include_directories( ${test_name} PUBLIC
|
||||
@CMAKE_SOURCE_DIR@/libraries/chain/include
|
||||
@CMAKE_BINARY_DIR@/libraries/chain/include
|
||||
@CMAKE_SOURCE_DIR@/libraries/libfc/include
|
||||
@CMAKE_SOURCE_DIR@/libraries/libfc/libraries/boringssl/boringssl/src/include
|
||||
@CMAKE_SOURCE_DIR@/libraries/softfloat/source/include
|
||||
@CMAKE_SOURCE_DIR@/libraries/appbase/include
|
||||
@CMAKE_SOURCE_DIR@/libraries/chainbase/include
|
||||
@CMAKE_SOURCE_DIR@/libraries/testing/include
|
||||
@CMAKE_SOURCE_DIR@/libraries/wasm-jit/Include )
|
||||
endmacro()
|
||||
|
||||
macro(add_eosio_test test_name)
|
||||
|
||||
@@ -190,10 +190,6 @@ Config Options for eosio::chain_plugin:
|
||||
|
||||
--enable-account-queries arg (=0) enable queries to find accounts by
|
||||
various metadata.
|
||||
--max-nonprivileged-inline-action-size arg (=4096)
|
||||
maximum allowed size (in bytes) of an
|
||||
inline action for a nonprivileged
|
||||
account
|
||||
--transaction-retry-max-storage-size-gb arg
|
||||
Maximum size (in GiB) allowed to be
|
||||
allocated for the Transaction Retry
|
||||
|
||||
@@ -357,12 +357,6 @@ void apply_context::execute_inline( action&& a ) {
|
||||
control.check_actor_list( actors );
|
||||
}
|
||||
|
||||
if( !privileged && control.is_speculative_block() ) {
|
||||
const auto& chain_config = control.get_global_properties().configuration;
|
||||
EOS_ASSERT( a.data.size() < std::min(chain_config.max_inline_action_size, control.get_max_nonprivileged_inline_action_size()),
|
||||
inline_action_too_big_nonprivileged,
|
||||
"inline action too big for nonprivileged account ${account}", ("account", a.account));
|
||||
}
|
||||
// No need to check authorization if replaying irreversible blocks or contract is privileged
|
||||
if( !control.skip_auth_check() && !privileged && !trx_context.is_read_only() ) {
|
||||
try {
|
||||
@@ -417,13 +411,6 @@ void apply_context::execute_context_free_inline( action&& a ) {
|
||||
EOS_ASSERT( a.authorization.size() == 0, action_validate_exception,
|
||||
"context-free actions cannot have authorizations" );
|
||||
|
||||
if( !privileged && control.is_speculative_block() ) {
|
||||
const auto& chain_config = control.get_global_properties().configuration;
|
||||
EOS_ASSERT( a.data.size() < std::min(chain_config.max_inline_action_size, control.get_max_nonprivileged_inline_action_size()),
|
||||
inline_action_too_big_nonprivileged,
|
||||
"inline action too big for nonprivileged account ${account}", ("account", a.account));
|
||||
}
|
||||
|
||||
auto inline_receiver = a.account;
|
||||
_cfa_inline_actions.emplace_back(
|
||||
schedule_action( std::move(a), inline_receiver, true )
|
||||
|
||||
@@ -1258,8 +1258,7 @@ struct controller_impl {
|
||||
|| (code == contract_blacklist_exception::code_value)
|
||||
|| (code == action_blacklist_exception::code_value)
|
||||
|| (code == key_blacklist_exception::code_value)
|
||||
|| (code == sig_variable_size_limit_exception::code_value)
|
||||
|| (code == inline_action_too_big_nonprivileged::code_value);
|
||||
|| (code == sig_variable_size_limit_exception::code_value);
|
||||
}
|
||||
|
||||
bool scheduled_failure_is_subjective( const fc::exception& e ) const {
|
||||
@@ -2747,11 +2746,6 @@ subjective_billing& controller::get_mutable_subjective_billing() {
|
||||
}
|
||||
|
||||
|
||||
uint32_t controller::get_max_nonprivileged_inline_action_size()const
|
||||
{
|
||||
return my->conf.max_nonprivileged_inline_action_size;
|
||||
}
|
||||
|
||||
controller::controller( const controller::config& cfg, const chain_id_type& chain_id )
|
||||
:my( new controller_impl( cfg, *this, protocol_feature_set{}, chain_id ) )
|
||||
{
|
||||
|
||||
@@ -79,7 +79,6 @@ const static uint32_t default_sig_cpu_bill_pct = 50 * perc
|
||||
const static uint32_t default_block_cpu_effort_pct = 90 * percent_1; // percentage of block time used for producing block
|
||||
const static uint16_t default_controller_thread_pool_size = 2;
|
||||
const static uint32_t default_max_variable_signature_length = 16384u;
|
||||
const static uint32_t default_max_nonprivileged_inline_action_size = 4 * 1024; // 4 KB
|
||||
const static uint32_t default_max_action_return_value_size = 256;
|
||||
|
||||
const static uint32_t default_max_transaction_finality_status_success_duration_sec = 180;
|
||||
|
||||
@@ -74,7 +74,6 @@ namespace eosio { namespace chain {
|
||||
uint64_t state_guard_size = chain::config::default_state_guard_size;
|
||||
uint32_t sig_cpu_bill_pct = chain::config::default_sig_cpu_bill_pct;
|
||||
uint16_t thread_pool_size = chain::config::default_controller_thread_pool_size;
|
||||
uint32_t max_nonprivileged_inline_action_size = chain::config::default_max_nonprivileged_inline_action_size;
|
||||
bool read_only = false;
|
||||
bool force_all_checks = false;
|
||||
bool disable_replay_opts = false;
|
||||
@@ -198,7 +197,6 @@ namespace eosio { namespace chain {
|
||||
const protocol_feature_manager& get_protocol_feature_manager()const;
|
||||
const subjective_billing& get_subjective_billing()const;
|
||||
subjective_billing& get_mutable_subjective_billing();
|
||||
uint32_t get_max_nonprivileged_inline_action_size()const;
|
||||
|
||||
const flat_set<account_name>& get_actor_whitelist() const;
|
||||
const flat_set<account_name>& get_actor_blacklist() const;
|
||||
|
||||
@@ -323,8 +323,7 @@ namespace eosio { namespace chain {
|
||||
3050010, "Action attempts to increase RAM usage of account without authorization" )
|
||||
FC_DECLARE_DERIVED_EXCEPTION( restricted_error_code_exception, action_validate_exception,
|
||||
3050011, "eosio_assert_code assertion failure uses restricted error code value" )
|
||||
FC_DECLARE_DERIVED_EXCEPTION( inline_action_too_big_nonprivileged, action_validate_exception,
|
||||
3050012, "Inline action exceeds maximum size limit for a non-privileged account" )
|
||||
// Removed 3050012 - inline_action_too_big_nonprivileged, no longer needed
|
||||
FC_DECLARE_DERIVED_EXCEPTION( action_return_value_exception, action_validate_exception,
|
||||
3050014, "action return value size too big" )
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@ inline void pack( instruction_stream* stream, branchtabletype field ) {
|
||||
template <typename Field>
|
||||
struct field_specific_params {
|
||||
static constexpr int skip_ahead = sizeof(uint16_t) + sizeof(Field);
|
||||
static auto unpack( char* opcode, Field& f ) { f = *reinterpret_cast<Field*>(opcode); }
|
||||
static auto unpack( char* opcode, Field& f ) { memcpy(&f, opcode, sizeof(f)); }
|
||||
static void pack(instruction_stream* stream, Field& f) { return eosio::chain::wasm_ops::pack(stream, f); }
|
||||
static auto to_string(Field& f) { return std::string(" ")+
|
||||
eosio::chain::wasm_ops::to_string(f); }
|
||||
@@ -664,7 +664,8 @@ struct EOSIO_OperatorDecoderStream
|
||||
|
||||
instr* decodeOp() {
|
||||
EOS_ASSERT(nextByte + sizeof(IR::Opcode) <= end, wasm_exception, "");
|
||||
IR::Opcode opcode = *(IR::Opcode*)nextByte;
|
||||
IR::Opcode opcode;
|
||||
memcpy(&opcode, nextByte, sizeof(opcode));
|
||||
switch(opcode)
|
||||
{
|
||||
#define VISIT_OPCODE(opcode,name,nameString,Imm,...) \
|
||||
|
||||
@@ -5,9 +5,8 @@
|
||||
namespace eosio { namespace chain { namespace webassembly {
|
||||
int32_t interface::read_action_data(legacy_span<char> memory) const {
|
||||
auto s = context.get_action().data.size();
|
||||
if( memory.size() == 0 ) return s;
|
||||
|
||||
auto copy_size = std::min( static_cast<size_t>(memory.size()), s );
|
||||
if( copy_size == 0 ) return s;
|
||||
std::memcpy( memory.data(), context.get_action().data.data(), copy_size );
|
||||
|
||||
return copy_size;
|
||||
|
||||
@@ -156,7 +156,7 @@ namespace eosio { namespace testing {
|
||||
|
||||
virtual ~base_tester() {};
|
||||
|
||||
void init(const setup_policy policy = setup_policy::full, db_read_mode read_mode = db_read_mode::HEAD, std::optional<uint32_t> genesis_max_inline_action_size = std::optional<uint32_t>{}, std::optional<uint32_t> config_max_nonprivileged_inline_action_size = std::optional<uint32_t>{});
|
||||
void init(const setup_policy policy = setup_policy::full, db_read_mode read_mode = db_read_mode::HEAD, std::optional<uint32_t> genesis_max_inline_action_size = std::optional<uint32_t>{});
|
||||
void init(controller::config config, const snapshot_reader_ptr& snapshot);
|
||||
void init(controller::config config, const genesis_state& genesis);
|
||||
void init(controller::config config);
|
||||
@@ -395,7 +395,7 @@ namespace eosio { namespace testing {
|
||||
return genesis;
|
||||
}
|
||||
|
||||
static std::pair<controller::config, genesis_state> default_config(const fc::temp_directory& tempdir, std::optional<uint32_t> genesis_max_inline_action_size = std::optional<uint32_t>{}, std::optional<uint32_t> config_max_nonprivileged_inline_action_size = std::optional<uint32_t>{}) {
|
||||
static std::pair<controller::config, genesis_state> default_config(const fc::temp_directory& tempdir, std::optional<uint32_t> genesis_max_inline_action_size = std::optional<uint32_t>{}) {
|
||||
controller::config cfg;
|
||||
cfg.blocks_dir = tempdir.path() / config::default_blocks_dir_name;
|
||||
cfg.state_dir = tempdir.path() / config::default_state_dir_name;
|
||||
@@ -419,9 +419,6 @@ namespace eosio { namespace testing {
|
||||
if (genesis_max_inline_action_size) {
|
||||
gen.initial_configuration.max_inline_action_size = *genesis_max_inline_action_size;
|
||||
}
|
||||
if (config_max_nonprivileged_inline_action_size) {
|
||||
cfg.max_nonprivileged_inline_action_size = *config_max_nonprivileged_inline_action_size;
|
||||
}
|
||||
return {cfg, gen};
|
||||
}
|
||||
|
||||
@@ -452,8 +449,8 @@ namespace eosio { namespace testing {
|
||||
|
||||
class tester : public base_tester {
|
||||
public:
|
||||
tester(setup_policy policy = setup_policy::full, db_read_mode read_mode = db_read_mode::HEAD, std::optional<uint32_t> genesis_max_inline_action_size = std::optional<uint32_t>{}, std::optional<uint32_t> config_max_nonprivileged_inline_action_size = std::optional<uint32_t>{}) {
|
||||
init(policy, read_mode, genesis_max_inline_action_size, config_max_nonprivileged_inline_action_size);
|
||||
tester(setup_policy policy = setup_policy::full, db_read_mode read_mode = db_read_mode::HEAD, std::optional<uint32_t> genesis_max_inline_action_size = std::optional<uint32_t>{}) {
|
||||
init(policy, read_mode, genesis_max_inline_action_size);
|
||||
}
|
||||
|
||||
tester(controller::config config, const genesis_state& genesis) {
|
||||
|
||||
@@ -179,8 +179,8 @@ namespace eosio { namespace testing {
|
||||
return control->head_block_id() == other.control->head_block_id();
|
||||
}
|
||||
|
||||
void base_tester::init(const setup_policy policy, db_read_mode read_mode, std::optional<uint32_t> genesis_max_inline_action_size, std::optional<uint32_t> config_max_nonprivileged_inline_action_size) {
|
||||
auto def_conf = default_config(tempdir, genesis_max_inline_action_size, config_max_nonprivileged_inline_action_size);
|
||||
void base_tester::init(const setup_policy policy, db_read_mode read_mode, std::optional<uint32_t> genesis_max_inline_action_size) {
|
||||
auto def_conf = default_config(tempdir, genesis_max_inline_action_size);
|
||||
def_conf.first.read_mode = read_mode;
|
||||
cfg = def_conf.first;
|
||||
|
||||
|
||||
@@ -297,6 +297,7 @@ namespace IR
|
||||
});
|
||||
|
||||
// Specialize for the empty immediate structs so they don't take an extra byte of space.
|
||||
PACKED_STRUCT(
|
||||
template<>
|
||||
struct OpcodeAndImm<NoImm>
|
||||
{
|
||||
@@ -305,7 +306,8 @@ namespace IR
|
||||
Opcode opcode;
|
||||
NoImm imm;
|
||||
};
|
||||
};
|
||||
});
|
||||
PACKED_STRUCT(
|
||||
template<>
|
||||
struct OpcodeAndImm<MemoryImm>
|
||||
{
|
||||
@@ -314,7 +316,7 @@ namespace IR
|
||||
Opcode opcode;
|
||||
MemoryImm imm;
|
||||
};
|
||||
};
|
||||
});
|
||||
|
||||
// Decodes an operator from an input stream and dispatches by opcode.
|
||||
struct OperatorDecoderStream
|
||||
@@ -328,7 +330,8 @@ namespace IR
|
||||
typename Visitor::Result decodeOp(Visitor& visitor)
|
||||
{
|
||||
WAVM_ASSERT_THROW(nextByte + sizeof(Opcode) <= end);
|
||||
Opcode opcode = *(Opcode*)nextByte;
|
||||
Opcode opcode;
|
||||
memcpy(&opcode, nextByte, sizeof(opcode));
|
||||
switch(opcode)
|
||||
{
|
||||
#define VISIT_OPCODE(opcode,name,nameString,Imm,...) \
|
||||
|
||||
@@ -368,7 +368,6 @@ void chain_plugin::set_program_options(options_description& cli, options_descrip
|
||||
"'none' - EOS VM OC tier-up is completely disabled.\n")
|
||||
#endif
|
||||
("enable-account-queries", bpo::value<bool>()->default_value(false), "enable queries to find accounts by various metadata.")
|
||||
("max-nonprivileged-inline-action-size", bpo::value<uint32_t>()->default_value(config::default_max_nonprivileged_inline_action_size), "maximum allowed size (in bytes) of an inline action for a nonprivileged account")
|
||||
("transaction-retry-max-storage-size-gb", bpo::value<uint64_t>(),
|
||||
"Maximum size (in GiB) allowed to be allocated for the Transaction Retry feature. Setting above 0 enables this feature.")
|
||||
("transaction-retry-interval-sec", bpo::value<uint32_t>()->default_value(20),
|
||||
@@ -633,9 +632,6 @@ void chain_plugin_impl::plugin_initialize(const variables_map& options) {
|
||||
if( options.count( "chain-state-db-guard-size-mb" ))
|
||||
chain_config->state_guard_size = options.at( "chain-state-db-guard-size-mb" ).as<uint64_t>() * 1024 * 1024;
|
||||
|
||||
if( options.count( "max-nonprivileged-inline-action-size" ))
|
||||
chain_config->max_nonprivileged_inline_action_size = options.at( "max-nonprivileged-inline-action-size" ).as<uint32_t>();
|
||||
|
||||
if( options.count( "transaction-finality-status-max-storage-size-gb" )) {
|
||||
const uint64_t max_storage_size = options.at( "transaction-finality-status-max-storage-size-gb" ).as<uint64_t>() * 1024 * 1024 * 1024;
|
||||
if (max_storage_size > 0) {
|
||||
|
||||
@@ -1365,8 +1365,6 @@ Finally, the full detail test report for each of the determined max TPS throughp
|
||||
"_enableAccountQueriesNodeosDefault": 0,
|
||||
"_enableAccountQueriesNodeosArg": "--enable-account-queries",
|
||||
"maxNonprivilegedInlineActionSize": null,
|
||||
"_maxNonprivilegedInlineActionSizeNodeosDefault": 4096,
|
||||
"_maxNonprivilegedInlineActionSizeNodeosArg": "--max-nonprivileged-inline-action-size",
|
||||
"transactionRetryMaxStorageSizeGb": null,
|
||||
"_transactionRetryMaxStorageSizeGbNodeosDefault": null,
|
||||
"_transactionRetryMaxStorageSizeGbNodeosArg": "--transaction-retry-max-storage-size-gb",
|
||||
@@ -2033,8 +2031,6 @@ The Performance Test Basic generates, by default, a report that details results
|
||||
"_enableAccountQueriesNodeosDefault": 0,
|
||||
"_enableAccountQueriesNodeosArg": "--enable-account-queries",
|
||||
"maxNonprivilegedInlineActionSize": null,
|
||||
"_maxNonprivilegedInlineActionSizeNodeosDefault": 4096,
|
||||
"_maxNonprivilegedInlineActionSizeNodeosArg": "--max-nonprivileged-inline-action-size",
|
||||
"transactionRetryMaxStorageSizeGb": null,
|
||||
"_transactionRetryMaxStorageSizeGbNodeosDefault": null,
|
||||
"_transactionRetryMaxStorageSizeGbNodeosArg": "--transaction-retry-max-storage-size-gb",
|
||||
|
||||
@@ -269,11 +269,13 @@ def scrapeTrxGenTrxSentDataLogs(trxSent: dict, trxGenLogDirPath, quiet):
|
||||
if not quiet:
|
||||
print(f"Transaction Log Files Scraped: {filesScraped}")
|
||||
|
||||
def populateTrxSentAndAcked(trxSent: dict, trxDict: dict, notFound):
|
||||
def populateTrxSentAndAcked(trxSent: dict, data: chainData, notFound):
|
||||
trxDict = data.trxDict
|
||||
for sentTrxId in trxSent.keys():
|
||||
if (isinstance(trxSent[sentTrxId], sentTrxExtTrace)):
|
||||
trxDict[sentTrxId] = trxData(blockNum=trxSent[sentTrxId].blockNum, cpuUsageUs=trxSent[sentTrxId].cpuUsageUs, netUsageUs=trxSent[sentTrxId].netUsageWords, blockTime=trxSent[sentTrxId].blockTime, acknowledged=trxSent[sentTrxId].acked, ackRespTimeUs=trxSent[sentTrxId].ackResponseTimeUs)
|
||||
trxDict[sentTrxId].sentTimestamp = trxSent[sentTrxId].sentTime
|
||||
data.blockDict[str(trxSent[sentTrxId].blockNum)].transactions +=1
|
||||
elif sentTrxId in trxDict.keys():
|
||||
trxDict[sentTrxId].sentTimestamp = trxSent[sentTrxId].sentTime
|
||||
trxDict[sentTrxId].acknowledged = trxSent[sentTrxId].acked
|
||||
@@ -493,7 +495,7 @@ def analyzeLogResults(data: chainData, tpsTestConfig: TpsTestConfig, artifacts:
|
||||
trxAckStatsApplicable="NOT APPLICABLE" if list(trxSent.values())[0].acked == "NA" else "APPLICABLE"
|
||||
|
||||
notFound = []
|
||||
populateTrxSentAndAcked(trxSent, data.trxDict, notFound)
|
||||
populateTrxSentAndAcked(trxSent, data, notFound)
|
||||
|
||||
prodDict = {}
|
||||
getProductionWindows(prodDict, data)
|
||||
|
||||
@@ -107,6 +107,10 @@ namespace eosio::testing {
|
||||
}
|
||||
|
||||
bool http_connection::needs_response_trace_info() {
|
||||
return is_read_only_transaction();
|
||||
}
|
||||
|
||||
bool http_connection::is_read_only_transaction() {
|
||||
return _config._api_endpoint == "/v1/chain/send_read_only_transaction";
|
||||
}
|
||||
|
||||
@@ -139,6 +143,7 @@ namespace eosio::testing {
|
||||
const auto& processed = resp_json["processed"];
|
||||
const auto& block_num = processed["block_num"].as_uint64();
|
||||
const auto& block_time = processed["block_time"].as_string();
|
||||
const auto& elapsed_time = processed["elapsed"].as_uint64();
|
||||
std::string status = "failed";
|
||||
uint32_t net = 0;
|
||||
uint32_t cpu = 0;
|
||||
@@ -150,7 +155,7 @@ namespace eosio::testing {
|
||||
cpu = receipt["cpu_usage_us"].as_uint64();
|
||||
}
|
||||
if (status == "executed") {
|
||||
record_trx_info(trx_id, block_num, cpu, net, block_time);
|
||||
record_trx_info(trx_id, block_num, this->is_read_only_transaction() ? elapsed_time : cpu, net, block_time);
|
||||
} else {
|
||||
elog("async_http_request Transaction receipt status not executed: ${string}",
|
||||
("string", response.body()));
|
||||
|
||||
@@ -99,6 +99,7 @@ namespace eosio::testing {
|
||||
void connect() override final;
|
||||
void disconnect() override final;
|
||||
bool needs_response_trace_info();
|
||||
bool is_read_only_transaction();
|
||||
};
|
||||
|
||||
struct p2p_connection : public provider_connection {
|
||||
|
||||
@@ -349,6 +349,8 @@ def stepSetSystemContract():
|
||||
retry(args.cleos + 'push action eosio activate \'["35c2186cc36f7bb4aeaf4487b36e57039ccf45a9136aa856a5d569ecca55ef2b"]\' -p eosio@active')
|
||||
# CRYPTO_PRIMITIVES
|
||||
retry(args.cleos + 'push action eosio activate \'["6bcb40a24e49c26d0a60513b6aeb8551d264e4717f306b81a37a5afb3b47cedc"]\' -p eosio@active')
|
||||
# BLS_PRIMITIVES
|
||||
retry(args.cleos + 'push action eosio activate \'["98c4175db53ed27e7911a1b5adf0e7db0fc96c2cae172cf594dfa9a742ca9e88"]\' -p eosio@active')
|
||||
sleep(1)
|
||||
|
||||
# install eosio.system latest version
|
||||
|
||||
+18
-44
@@ -1435,10 +1435,16 @@ BOOST_FIXTURE_TEST_CASE(transaction_tests, validating_tester) { try {
|
||||
// test send_action_empty
|
||||
CALL_TEST_FUNCTION(*this, "test_transaction", "send_action_empty", {});
|
||||
|
||||
// test send_action_large
|
||||
BOOST_CHECK_EXCEPTION(CALL_TEST_FUNCTION(*this, "test_transaction", "send_action_large", {}), inline_action_too_big_nonprivileged,
|
||||
// test send_action_large (512k)
|
||||
CALL_TEST_FUNCTION( *this, "test_transaction", "send_action_512k", {});
|
||||
|
||||
// test send_many_actions_512k (512k)
|
||||
CALL_TEST_FUNCTION( *this, "test_transaction", "send_many_actions_512k", {});
|
||||
|
||||
// test send_action_large (512k + 1)
|
||||
BOOST_CHECK_EXCEPTION(CALL_TEST_FUNCTION(*this, "test_transaction", "send_action_large", {}), inline_action_too_big,
|
||||
[](const fc::exception& e) {
|
||||
return expect_assert_message(e, "inline action too big for nonprivileged account");
|
||||
return expect_assert_message(e, "inline action too big");
|
||||
}
|
||||
);
|
||||
|
||||
@@ -1559,12 +1565,12 @@ BOOST_FIXTURE_TEST_CASE(transaction_tests, validating_tester) { try {
|
||||
} FC_LOG_AND_RETHROW() }
|
||||
|
||||
/*************************************************************************************
|
||||
* verify subjective limit test case
|
||||
* verify objective limit test case
|
||||
*************************************************************************************/
|
||||
BOOST_AUTO_TEST_CASE(inline_action_subjective_limit) { try {
|
||||
BOOST_AUTO_TEST_CASE(inline_action_with_over_4k_limit) { try {
|
||||
const uint32_t _4k = 4 * 1024;
|
||||
tester chain(setup_policy::full, db_read_mode::HEAD, {_4k + 100}, {_4k + 1});
|
||||
tester chain2(setup_policy::full, db_read_mode::HEAD, {_4k + 100}, {_4k});
|
||||
tester chain(setup_policy::full, db_read_mode::HEAD, {_4k + 100});
|
||||
tester chain2(setup_policy::full, db_read_mode::HEAD, {_4k + 100});
|
||||
signed_block_ptr block;
|
||||
for (int n=0; n < 2; ++n) {
|
||||
block = chain.produce_block();
|
||||
@@ -1591,7 +1597,7 @@ BOOST_AUTO_TEST_CASE(inline_action_subjective_limit) { try {
|
||||
*************************************************************************************/
|
||||
BOOST_AUTO_TEST_CASE(inline_action_objective_limit) { try {
|
||||
const uint32_t _4k = 4 * 1024;
|
||||
tester chain(setup_policy::full, db_read_mode::HEAD, {_4k}, {_4k - 1});
|
||||
tester chain(setup_policy::full, db_read_mode::HEAD, {_4k});
|
||||
chain.produce_blocks(2);
|
||||
chain.create_account( "testapi"_n );
|
||||
chain.produce_blocks(100);
|
||||
@@ -1611,42 +1617,10 @@ BOOST_AUTO_TEST_CASE(inline_action_objective_limit) { try {
|
||||
|
||||
} FC_LOG_AND_RETHROW() }
|
||||
|
||||
BOOST_AUTO_TEST_CASE(deferred_inline_action_subjective_limit_failure) { try {
|
||||
BOOST_AUTO_TEST_CASE(deferred_inline_action_limit) { try {
|
||||
const uint32_t _4k = 4 * 1024;
|
||||
tester chain(setup_policy::full, db_read_mode::HEAD, {_4k + 100}, {_4k});
|
||||
chain.produce_blocks(2);
|
||||
chain.create_accounts( {"testapi"_n, "testapi2"_n, "alice"_n} );
|
||||
chain.set_code( "testapi"_n, test_contracts::test_api_wasm() );
|
||||
chain.set_code( "testapi2"_n, test_contracts::test_api_wasm() );
|
||||
chain.produce_block();
|
||||
|
||||
transaction_trace_ptr trace;
|
||||
auto c = chain.control->applied_transaction.connect([&](std::tuple<const transaction_trace_ptr&, const packed_transaction_ptr&> x) {
|
||||
auto& t = std::get<0>(x);
|
||||
if (t->scheduled) { trace = t; }
|
||||
} );
|
||||
CALL_TEST_FUNCTION(chain, "test_transaction", "send_deferred_transaction_4k_action", {} );
|
||||
BOOST_CHECK(!trace);
|
||||
BOOST_CHECK_EXCEPTION(chain.produce_block( fc::seconds(2) ), fc::exception,
|
||||
[](const fc::exception& e) {
|
||||
return expect_assert_message(e, "inline action too big for nonprivileged account");
|
||||
}
|
||||
);
|
||||
|
||||
//check that it populates exception fields
|
||||
BOOST_REQUIRE(trace);
|
||||
BOOST_REQUIRE(trace->except);
|
||||
BOOST_REQUIRE(trace->error_code);
|
||||
|
||||
BOOST_REQUIRE_EQUAL(1, trace->action_traces.size());
|
||||
c.disconnect();
|
||||
|
||||
} FC_LOG_AND_RETHROW() }
|
||||
|
||||
BOOST_AUTO_TEST_CASE(deferred_inline_action_subjective_limit) { try {
|
||||
const uint32_t _4k = 4 * 1024;
|
||||
tester chain(setup_policy::full, db_read_mode::HEAD, {_4k + 100}, {_4k + 1});
|
||||
tester chain2(setup_policy::full, db_read_mode::HEAD, {_4k + 100}, {_4k});
|
||||
tester chain(setup_policy::full, db_read_mode::HEAD, {_4k + 100});
|
||||
tester chain2(setup_policy::full, db_read_mode::HEAD, {_4k + 100});
|
||||
signed_block_ptr block;
|
||||
for (int n=0; n < 2; ++n) {
|
||||
block = chain.produce_block();
|
||||
@@ -1674,7 +1648,7 @@ BOOST_AUTO_TEST_CASE(deferred_inline_action_subjective_limit) { try {
|
||||
|
||||
//confirm printed message
|
||||
BOOST_TEST(!trace->action_traces.empty());
|
||||
BOOST_TEST(trace->action_traces.back().console == "exec 8");
|
||||
BOOST_TEST(trace->action_traces.back().console == "action size: 4096");
|
||||
c.disconnect();
|
||||
|
||||
for (int n=0; n < 10; ++n) {
|
||||
|
||||
@@ -62,6 +62,12 @@ void test_action::test_dummy_action() {
|
||||
}
|
||||
}
|
||||
|
||||
void test_action::read_action() {
|
||||
print("action size: " + std::to_string(action_data_size()));
|
||||
void* p = malloc(action_data_size());
|
||||
read_action_data(p, action_data_size());
|
||||
}
|
||||
|
||||
void test_action::read_action_to_0() {
|
||||
read_action_data( (void *)0, action_data_size() );
|
||||
}
|
||||
|
||||
@@ -49,6 +49,7 @@ extern "C" {
|
||||
|
||||
//test_action
|
||||
WASM_TEST_HANDLER ( test_action, read_action_normal );
|
||||
WASM_TEST_HANDLER ( test_action, read_action );
|
||||
WASM_TEST_HANDLER ( test_action, read_action_to_0 );
|
||||
WASM_TEST_HANDLER ( test_action, read_action_to_64k );
|
||||
WASM_TEST_HANDLER_EX( test_action, require_notice );
|
||||
@@ -118,6 +119,8 @@ extern "C" {
|
||||
WASM_TEST_HANDLER ( test_transaction, send_action_empty );
|
||||
WASM_TEST_HANDLER ( test_transaction, send_action_large );
|
||||
WASM_TEST_HANDLER ( test_transaction, send_action_4k );
|
||||
WASM_TEST_HANDLER ( test_transaction, send_action_512k );
|
||||
WASM_TEST_HANDLER ( test_transaction, send_many_actions_512k );
|
||||
WASM_TEST_HANDLER ( test_transaction, send_action_recurse );
|
||||
WASM_TEST_HANDLER ( test_transaction, test_read_transaction );
|
||||
WASM_TEST_HANDLER ( test_transaction, test_transaction_size );
|
||||
|
||||
@@ -93,6 +93,7 @@ struct test_print {
|
||||
|
||||
struct test_action {
|
||||
static void read_action_normal();
|
||||
static void read_action();
|
||||
static void read_action_to_0();
|
||||
static void read_action_to_64k();
|
||||
static void test_dummy_action();
|
||||
@@ -202,6 +203,8 @@ struct test_transaction {
|
||||
static void send_action_max();
|
||||
static void send_action_large();
|
||||
static void send_action_4k();
|
||||
static void send_action_512k();
|
||||
static void send_many_actions_512k();
|
||||
static void send_action_recurse();
|
||||
static void send_action_inline_fail();
|
||||
static void test_read_transaction();
|
||||
|
||||
Binary file not shown.
@@ -84,17 +84,15 @@ void test_transaction::send_action_empty() {
|
||||
}
|
||||
|
||||
/**
|
||||
* cause failure due to a large action payload
|
||||
* cause failure due to a large action payload, larger than max_inline_action_size of 512K
|
||||
*/
|
||||
void test_transaction::send_action_large() {
|
||||
using namespace eosio;
|
||||
static char large_message[8 * 1024];
|
||||
test_action_action<"testapi"_n.value, WASM_TEST_ACTION( "test_action", "read_action_normal" )> test_action;
|
||||
copy_data( large_message, 8*1024, test_action.data );
|
||||
test_action_action<"testapi"_n.value, WASM_TEST_ACTION( "test_action", "read_action" )> test_action;
|
||||
test_action.data.resize(512*1024+1);
|
||||
|
||||
std::vector<permission_level> permissions = { {"testapi"_n, "active"_n} };
|
||||
action act( permissions, name{"testapi"}, name{WASM_TEST_ACTION("test_action", "read_action_normal")}, test_action );
|
||||
|
||||
action act( permissions, name{"testapi"}, name{WASM_TEST_ACTION("test_action", "read_action")}, test_action );
|
||||
act.send();
|
||||
eosio_assert( false, "send_message_large() should've thrown an error" );
|
||||
}
|
||||
@@ -104,16 +102,59 @@ void test_transaction::send_action_large() {
|
||||
*/
|
||||
void test_transaction::send_action_4k() {
|
||||
using namespace eosio;
|
||||
static char large_message[4 * 1024];
|
||||
test_action_action<"testapi"_n.value, WASM_TEST_ACTION( "test_action", "test_action_ordinal4" )> test_action;
|
||||
copy_data( large_message, 4*1024, test_action.data );
|
||||
test_action_action<"testapi"_n.value, WASM_TEST_ACTION( "test_action", "read_action" )> test_action;
|
||||
test_action.data.resize(4*1024);
|
||||
|
||||
std::vector<permission_level> permissions = { {"testapi"_n, "active"_n} };
|
||||
action act( permissions, name{"testapi"}, name{WASM_TEST_ACTION("test_action", "test_action_ordinal4")}, test_action );
|
||||
action act( permissions, name{"testapi"}, name{WASM_TEST_ACTION("test_action", "read_action")}, test_action );
|
||||
|
||||
act.send();
|
||||
}
|
||||
|
||||
/**
|
||||
* send an inline action that is 512K (limit is < 512K)
|
||||
* the limit includes the size of the action
|
||||
*/
|
||||
void test_transaction::send_action_512k() {
|
||||
using namespace eosio;
|
||||
test_action_action<"testapi"_n.value, WASM_TEST_ACTION( "test_action", "read_action" )> test_action;
|
||||
|
||||
test_action.data.resize(1);
|
||||
std::vector<permission_level> permissions = { {"testapi"_n, "active"_n} };
|
||||
action temp_act( permissions, name{"testapi"}, name{WASM_TEST_ACTION("test_action", "read_action")}, test_action );
|
||||
|
||||
size_t action_size = pack_size(temp_act);
|
||||
test_action.data.resize(512*1024-action_size-2); // check is < 512K
|
||||
|
||||
// send at limit (512K - 1)
|
||||
action act( permissions, name{"testapi"}, name{WASM_TEST_ACTION("test_action", "read_action")}, test_action );
|
||||
|
||||
if (pack_size(act) != 512*1024-1) {
|
||||
std::string err = "send_action_512k action size is: " + std::to_string(action_size) + " not 512K-1";
|
||||
eosio_assert(false, err.c_str());
|
||||
}
|
||||
|
||||
act.send();
|
||||
}
|
||||
|
||||
/**
|
||||
* send many inline actions that are 512K (limit is < 512K)
|
||||
* the limit includes the size of the action
|
||||
*/
|
||||
void test_transaction::send_many_actions_512k() {
|
||||
using namespace eosio;
|
||||
test_action_action<"testapi"_n.value, WASM_TEST_ACTION( "test_transaction", "send_action_512k" )> test_action;
|
||||
|
||||
test_action.data.resize(1);
|
||||
std::vector<permission_level> permissions = { {"testapi"_n, "active"_n} };
|
||||
action act( permissions, name{"testapi"}, name{WASM_TEST_ACTION("test_transaction", "send_action_512k")}, test_action );
|
||||
|
||||
// 65 * 512K > wasm memory limit, which is ok because each gets their own wasm instantiation
|
||||
for (size_t i = 0; i < 65; ++i) {
|
||||
act.send();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* cause failure due recursive loop
|
||||
*/
|
||||
|
||||
@@ -2184,6 +2184,83 @@ BOOST_FIXTURE_TEST_CASE( negative_memory_grow, validating_tester ) try {
|
||||
|
||||
} FC_LOG_AND_RETHROW()
|
||||
|
||||
// This test is only applicable to Linux
|
||||
#if defined(__linux__)
|
||||
// Returns the number of memory mappings of the current process. Only works on Linux
|
||||
static uint32_t get_num_memory_mappings() {
|
||||
std::string maps_file = "/proc/" + std::to_string(getpid()) + "/maps";
|
||||
std::ifstream maps_ifs(maps_file);
|
||||
if (!maps_ifs.is_open()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t num_mappings = 0;
|
||||
std::string line;
|
||||
while (std::getline(maps_ifs, line)) {
|
||||
num_mappings++;
|
||||
}
|
||||
return num_mappings;
|
||||
}
|
||||
|
||||
BOOST_FIXTURE_TEST_CASE( memory_mapping_test, validating_tester ) try {
|
||||
static const std::string mem_map_wast_start = R"=====(
|
||||
(module
|
||||
(export "apply" (func $apply))
|
||||
(global i32 (i32.const
|
||||
)=====";
|
||||
static const std::string mem_map_wast_end = R"=====(
|
||||
))
|
||||
(func $apply (param i64) (param i64) (param i64)
|
||||
)
|
||||
)
|
||||
)=====";
|
||||
static const char* mem_map_abi = R"=====(
|
||||
{
|
||||
"version": "eosio::abi/1.2",
|
||||
"types": [],
|
||||
"structs": [{ "name": "dothedew", "base": "", "fields": [] }],
|
||||
"actions": [{ "name": "dothedew", "type": "dothedew", "ricardian_contract": ""}],
|
||||
"tables": [],
|
||||
"ricardian_clauses": []
|
||||
}
|
||||
)=====";
|
||||
|
||||
produce_block();
|
||||
|
||||
auto num_mappings_before = get_num_memory_mappings();
|
||||
BOOST_CHECK_GT(num_mappings_before, 0U); // must be able to get number of memory mappings
|
||||
|
||||
// number of contracts to deploy
|
||||
constexpr uint32_t num_contracts = 5000;
|
||||
|
||||
for (uint32_t i = 1; i < num_contracts; ++i) {
|
||||
std::stringstream ss;
|
||||
ss << "0x" << std::hex << i << "00000000";
|
||||
uint64_t name_value;
|
||||
ss >> name_value;
|
||||
auto acct = name(name_value);
|
||||
create_accounts({acct});
|
||||
|
||||
std::string contract_wast = mem_map_wast_start + " " + std::to_string(i) + mem_map_wast_end;
|
||||
set_code(acct, contract_wast.c_str());
|
||||
set_abi(acct, mem_map_abi);
|
||||
|
||||
push_action(acct, "dothedew"_n, "eosio"_n, {});
|
||||
|
||||
// do not put too many transactions in a single block
|
||||
if (i % 20 == 0 ) {
|
||||
produce_block();
|
||||
}
|
||||
}
|
||||
|
||||
constexpr uint32_t margin_of_changes = 50;
|
||||
auto num_mappings_now = get_num_memory_mappings();
|
||||
if (num_mappings_now > num_mappings_before) {
|
||||
BOOST_CHECK_LT(num_mappings_now - num_mappings_before, margin_of_changes);
|
||||
}
|
||||
} FC_LOG_AND_RETHROW()
|
||||
#endif // defined(__linux__)
|
||||
|
||||
BOOST_FIXTURE_TEST_CASE(net_usage_tests, tester ) try {
|
||||
int count = 0;
|
||||
auto check = [&](int coderepeat, int max_net_usage)-> bool {
|
||||
|
||||
Reference in New Issue
Block a user