Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Version 1.2.3 #5466

Merged
merged 36 commits into from
Aug 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
5b114ad
Added contract build path to eosiocpp -g include paths
xJonathanLEI Aug 23, 2018
b9831d1
Fix framework casing for case sensitive MacOS builds
jgiszczak Aug 23, 2018
4b8ac5f
Merge pull request #5403 from EOSIO/fix-framework-casing-macosx
heifner Aug 23, 2018
4655c8f
Slight change
larryk85 Aug 24, 2018
efe5fdb
do not apply transaction optimizations on light-nodes when speculating
b1bart Aug 24, 2018
9c711b4
actually return the value...
b1bart Aug 24, 2018
be26f5f
Revert "on_accepted_block_header and on_accepted_block merged into on…
heifner Aug 24, 2018
b41930d
Add thread safe id()
heifner Aug 24, 2018
43e6a30
Use thread safe get_uncached_id()
heifner Aug 24, 2018
f2b49e8
Add missing id variable
heifner Aug 24, 2018
c8f88db
Change log to debug for exceptions as they are expected
heifner Aug 25, 2018
93bd826
dlog is on by default, remove call for accept_transaction for excepti…
heifner Aug 27, 2018
0442485
subjectively fail transaction if unprivileged code bills RAM to an ac…
arhag Aug 27, 2018
9a77456
Add support in config.ini to disable the RAM billing soft-fix in noti…
arhag Aug 27, 2018
5c378a9
Merge pull request #5401 from xJonathanLEI/fix_eosiocpp_g
jgiszczak Aug 27, 2018
a1dffae
add unit test for RAM billing soft-fix in notify context
arhag Aug 27, 2018
4313676
don't change transaction data in cleos push signed transaction
taokayan Aug 28, 2018
5e01987
should not change txn content if already signed
taokayan Aug 28, 2018
e6633a5
Fixed ignored action name in ABI generation
xJonathanLEI Aug 28, 2018
5566754
suppress greylist related exception loggings
taokayan Aug 27, 2018
2732be0
cleanup of greylisting variables
arhag Aug 28, 2018
431c8ee
Merge pull request #5423 from EOSIO/net_plugin-reduce-noise
arhag Aug 28, 2018
89b9022
Merge branch 'release/1.2.x' into cpu-greylist
arhag Aug 28, 2018
e8bf908
Merge pull request #5451 from EOSIO/notify-ram-charging-soft-fix
arhag Aug 28, 2018
083935e
added test case involving a deferred transaction canceling itself
arhag Aug 28, 2018
5383224
changed exception message
larryk85 Aug 28, 2018
1978a79
distinguish exception messages of greylisted vs non-greylisted resour…
arhag Aug 28, 2018
fad9e17
Merge branch 'cpu-greylist' of https://github.com/eosio/eos into cpu-…
arhag Aug 28, 2018
a15a02a
Merge pull request #5461 from EOSIO/cleos-sign
heifner Aug 28, 2018
ac44213
Merge pull request #5417 from EOSIO/bnet-fix
heifner Aug 28, 2018
8399f32
Merge pull request #5415 from EOSIO/feature/5408-fix-light-validation…
heifner Aug 28, 2018
a4096cb
Merge pull request #5459 from xJonathanLEI/abi_action_name
heifner Aug 28, 2018
dc5f5d0
Merge pull request #5464 from EOSIO/cancel-self-bug-unit-test
heifner Aug 28, 2018
34e848a
Merge pull request #5462 from EOSIO/cpu-greylist
heifner Aug 28, 2018
281ab1a
bump version to 1.2.3
arhag Aug 28, 2018
181cae3
Merge pull request #5465 from EOSIO/feature/bump-version-to-1.2.3
arhag Aug 28, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ set( CXX_STANDARD_REQUIRED ON)

set(VERSION_MAJOR 1)
set(VERSION_MINOR 2)
set(VERSION_PATCH 2)
set(VERSION_PATCH 3)

set( CLI_CLIENT_EXECUTABLE_NAME cleos )
set( NODE_EXECUTABLE_NAME nodeos )
Expand Down
4 changes: 2 additions & 2 deletions Docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ cd eos/Docker
docker build . -t eosio/eos
```

The above will build off the most recent commit to the master branch by default. If you would like to target a specific branch/tag, you may use a build argument. For example, if you wished to generate a docker image based off of the v1.2.2 tag, you could do the following:
The above will build off the most recent commit to the master branch by default. If you would like to target a specific branch/tag, you may use a build argument. For example, if you wished to generate a docker image based off of the v1.2.3 tag, you could do the following:

```bash
docker build -t eosio/eos:v1.2.2 --build-arg branch=v1.2.2 .
docker build -t eosio/eos:v1.2.3 --build-arg branch=v1.2.3 .
```

By default, the symbol in eosio.system is set to SYS. You can override this using the symbol argument while building the docker image.
Expand Down
25 changes: 25 additions & 0 deletions contracts/test_api/test_action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,3 +225,28 @@ void test_action::test_assert_code() {
eosio_assert( total == sizeof(uint64_t), "total == sizeof(uint64_t)");
eosio_assert_code( false, code );
}

void test_action::test_ram_billing_in_notify(uint64_t receiver, uint64_t code, uint64_t action) {
uint128_t tmp = 0;
uint32_t total = read_action_data(&tmp, sizeof(uint128_t));
eosio_assert( total == sizeof(uint128_t), "total == sizeof(uint128_t)");

uint64_t to_notify = tmp >> 64;
uint64_t payer = tmp & 0xFFFFFFFFFFFFFFFFULL;

if( code == receiver ) {
eosio::require_recipient( to_notify );
} else {
eosio_assert( to_notify == receiver, "notified recipient other than the one specified in to_notify" );

// Remove main table row if it already exists.
int itr = db_find_i64( receiver, N(notifytest), N(notifytest), N(notifytest) );
if( itr >= 0 )
db_remove_i64( itr );

// Create the main table row simply for the purpose of charging code more RAM.
if( payer != 0 )
db_store_i64(N(notifytest), N(notifytest), payer, N(notifytest), &to_notify, sizeof(to_notify) );
}

}
2 changes: 2 additions & 0 deletions contracts/test_api/test_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ extern "C" {
WASM_TEST_HANDLER_EX(test_action, test_current_receiver);
WASM_TEST_HANDLER(test_action, test_publication_time);
WASM_TEST_HANDLER(test_action, test_assert_code);
WASM_TEST_HANDLER_EX(test_action, test_ram_billing_in_notify);

// test named actions
// We enforce action name matches action data type name, so name mangling will not work for these tests.
Expand Down Expand Up @@ -147,6 +148,7 @@ extern "C" {
WASM_TEST_HANDLER(test_transaction, context_free_api);
WASM_TEST_HANDLER(test_transaction, new_feature);
WASM_TEST_HANDLER(test_transaction, active_new_feature);
WASM_TEST_HANDLER_EX(test_transaction, repeat_deferred_transaction);

//test chain
WASM_TEST_HANDLER(test_chain, test_activeprods);
Expand Down
3 changes: 2 additions & 1 deletion contracts/test_api/test_api.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ struct test_print {
};

struct test_action {

static void read_action_normal();
static void read_action_to_0();
static void read_action_to_64k();
Expand All @@ -73,6 +72,7 @@ struct test_action {
static void test_current_receiver(uint64_t receiver, uint64_t code, uint64_t action);
static void test_publication_time();
static void test_assert_code();
static void test_ram_billing_in_notify(uint64_t receiver, uint64_t code, uint64_t action);
};

struct test_db {
Expand Down Expand Up @@ -181,6 +181,7 @@ struct test_transaction {
static void context_free_api();
static void new_feature();
static void active_new_feature();
static void repeat_deferred_transaction(uint64_t receiver, uint64_t code, uint64_t action);
};

struct test_chain {
Expand Down
20 changes: 20 additions & 0 deletions contracts/test_api/test_transaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,3 +317,23 @@ void test_transaction::new_feature() {
void test_transaction::active_new_feature() {
activate_feature((int64_t)N(newfeature));
}

void test_transaction::repeat_deferred_transaction(uint64_t receiver, uint64_t code, uint64_t action) {
using namespace eosio;

uint128_t sender_id = 0;

uint32_t payload = unpack_action_data<uint32_t>();
print( "repeat_deferred_transaction called: payload = ", payload );

bool res = cancel_deferred( sender_id );

print( "\nrepeat_deferred_transaction cancelled trx with sender_id = ", sender_id, ", result is ", res );

if( payload == 0 ) return;

--payload;
transaction trx;
trx.actions.emplace_back( permission_level{receiver, N(active)}, code, action, payload );
trx.send( sender_id, receiver );
}
10 changes: 8 additions & 2 deletions libraries/abi_generator/abi_generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,19 @@ bool abi_generator::inspect_type_methods_for_actions(const Decl* decl) { try {

// Try to get "action" annotation from method comment
bool raw_comment_is_action = false;
string action_name_from_comment;
const RawComment* raw_comment = ast_context->getRawCommentForDeclNoCache(method);
if(raw_comment != nullptr) {
SourceManager& source_manager = ast_context->getSourceManager();
string raw_text = raw_comment->getRawText(source_manager);
regex r(R"(@abi (action)((?: [a-z0-9]+)*))");
regex r(R"(@abi (action) ?((?:[a-z0-9]+)*))");
smatch smatch;
regex_search(raw_text, smatch, r);
raw_comment_is_action = smatch.size() == 3;

if (raw_comment_is_action) {
action_name_from_comment = smatch[2];
}
}

// Check if current method is listed the EOSIO_ABI macro
Expand Down Expand Up @@ -156,7 +161,8 @@ bool abi_generator::inspect_type_methods_for_actions(const Decl* decl) { try {

full_types[method_name] = method_name;

output->actions.push_back({method_name, method_name, rc[method_name]});
string action_name = action_name_from_comment.empty() ? method_name : action_name_from_comment;
output->actions.push_back({action_name, method_name, rc[method_name]});
at_least_one_action = true;
};

Expand Down
4 changes: 4 additions & 0 deletions libraries/chain/apply_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,8 @@ void apply_context::schedule_deferred_transaction( const uint128_t& sender_id, a
});
}

EOS_ASSERT( control.is_ram_billing_in_notify_allowed() || (receiver == act.account) || (receiver == payer) || privileged,
subjective_block_production_exception, "Cannot charge RAM to other accounts during notify." );
trx_context.add_ram_usage( payer, (config::billable_size_v<generated_transaction_object> + trx_size) );
}

Expand Down Expand Up @@ -362,6 +364,8 @@ bytes apply_context::get_packed_transaction() {
void apply_context::update_db_usage( const account_name& payer, int64_t delta ) {
if( delta > 0 ) {
if( !(privileged || payer == account_name(receiver)) ) {
EOS_ASSERT( control.is_ram_billing_in_notify_allowed() || (receiver == act.account),
subjective_block_production_exception, "Cannot charge RAM to other accounts during notify." );
require_authorization( payer );
}
}
Expand Down
42 changes: 24 additions & 18 deletions libraries/chain/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,7 @@ struct controller_impl {
|| (code == block_net_usage_exceeded::code_value)
|| (code == greylist_net_usage_exceeded::code_value)
|| (code == block_cpu_usage_exceeded::code_value)
|| (code == greylist_cpu_usage_exceeded::code_value)
|| (code == deadline_exception::code_value)
|| (code == leeway_deadline_exception::code_value)
|| (code == actor_whitelist_exception::code_value)
Expand Down Expand Up @@ -714,7 +715,7 @@ struct controller_impl {
auto& rl = self.get_mutable_resource_limits_manager();
rl.update_account_usage( trx_context.bill_to_accounts, block_timestamp_type(self.pending_block_time()).slot );
int64_t account_cpu_limit = 0;
std::tie( std::ignore, account_cpu_limit, std::ignore ) = trx_context.max_bandwidth_billed_accounts_can_pay( true );
std::tie( std::ignore, account_cpu_limit, std::ignore, std::ignore ) = trx_context.max_bandwidth_billed_accounts_can_pay( true );

cpu_time_to_bill_us = static_cast<uint32_t>( std::min( std::min( static_cast<int64_t>(cpu_time_to_bill_us),
account_cpu_limit ),
Expand Down Expand Up @@ -1651,16 +1652,25 @@ optional<producer_schedule_type> controller::proposed_producers()const {
return gpo.proposed_schedule;
}

bool controller::skip_auth_check() const {
// replaying
bool consider_skipping = my->replaying;
bool controller::light_validation_allowed(bool replay_opts_disabled_by_policy) const {
if (!my->pending || my->in_trx_requiring_checks) {
return false;
}

// OR in light validation mode
consider_skipping = consider_skipping || my->conf.block_validation_mode == validation_mode::LIGHT;
auto pb_status = my->pending->_block_status;

return consider_skipping
&& !my->conf.force_all_checks
&& !my->in_trx_requiring_checks;
// in a pending irreversible or previously validated block and we have forcing all checks
bool consider_skipping_on_replay = (pb_status == block_status::irreversible || pb_status == block_status::validated) && !replay_opts_disabled_by_policy;

// OR in a signed block and in light validation mode
bool consider_skipping_on_validate = (pb_status == block_status::complete && my->conf.block_validation_mode == validation_mode::LIGHT);

return consider_skipping_on_replay || consider_skipping_on_validate;
}


bool controller::skip_auth_check() const {
return light_validation_allowed(my->conf.force_all_checks);
}

bool controller::skip_db_sessions( block_status bs ) const {
Expand All @@ -1679,15 +1689,7 @@ bool controller::skip_db_sessions( ) const {
}

bool controller::skip_trx_checks() const {
// in a pending irreversible or previously validated block
bool consider_skipping = my->pending && ( my->pending->_block_status == block_status::irreversible || my->pending->_block_status == block_status::validated );

// OR in light validation mode
consider_skipping = consider_skipping || my->conf.block_validation_mode == validation_mode::LIGHT;

return consider_skipping
&& !my->conf.disable_replay_opts
&& !my->in_trx_requiring_checks;
return light_validation_allowed(my->conf.disable_replay_opts);
}

bool controller::contracts_console()const {
Expand Down Expand Up @@ -1776,6 +1778,10 @@ bool controller::is_producing_block()const {
return (my->pending->_block_status == block_status::incomplete);
}

bool controller::is_ram_billing_in_notify_allowed()const {
return !is_producing_block() || my->conf.allow_ram_billing_in_notify;
}

void controller::validate_referenced_accounts( const transaction& trx )const {
for( const auto& a : trx.context_free_actions ) {
auto* code = my->db.find<account_object, by_name>(a.account);
Expand Down
4 changes: 4 additions & 0 deletions libraries/chain/include/eosio/chain/controller.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ namespace eosio { namespace chain {
bool force_all_checks = false;
bool disable_replay_opts = false;
bool contracts_console = false;
bool allow_ram_billing_in_notify = false;

genesis_state genesis;
wasm_interface::vm_type wasm_runtime = chain::config::default_wasm_runtime;
Expand Down Expand Up @@ -204,6 +205,8 @@ namespace eosio { namespace chain {
void check_key_list( const public_key_type& key )const;
bool is_producing_block()const;

bool is_ram_billing_in_notify_allowed()const;

void add_resource_greylist(const account_name &name);
void remove_resource_greylist(const account_name &name);
bool is_resource_greylisted(const account_name &name) const;
Expand All @@ -219,6 +222,7 @@ namespace eosio { namespace chain {

int64_t set_proposed_producers( vector<producer_key> producers );

bool light_validation_allowed(bool replay_opts_disabled_by_policy) const;
bool skip_auth_check()const;
bool skip_db_sessions( )const;
bool skip_db_sessions( block_status bs )const;
Expand Down
2 changes: 2 additions & 0 deletions libraries/chain/include/eosio/chain/exceptions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,8 @@ namespace eosio { namespace chain {
3080006, "Transaction took too long" )
FC_DECLARE_DERIVED_EXCEPTION( greylist_net_usage_exceeded, resource_exhausted_exception,
3080007, "Transaction exceeded the current greylisted account network usage limit" )
FC_DECLARE_DERIVED_EXCEPTION( greylist_cpu_usage_exceeded, resource_exhausted_exception,
3080008, "Transaction exceeded the current greylisted account CPU usage limit" )
FC_DECLARE_DERIVED_EXCEPTION( leeway_deadline_exception, deadline_exception,
3081001, "Transaction reached the deadline set due to leeway on account CPU limits" )

Expand Down
3 changes: 2 additions & 1 deletion libraries/chain/include/eosio/chain/transaction.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ namespace eosio { namespace chain {

time_point_sec expiration()const;
transaction_id_type id()const;
bytes get_raw_transaction()const;
transaction_id_type get_uncached_id()const; // thread safe
bytes get_raw_transaction()const; // thread safe
vector<bytes> get_context_free_data()const;
transaction get_transaction()const;
signed_transaction get_signed_transaction()const;
Expand Down
4 changes: 3 additions & 1 deletion libraries/chain/include/eosio/chain/transaction_context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ namespace eosio { namespace chain {

uint32_t update_billed_cpu_time( fc::time_point now );

std::tuple<int64_t, int64_t, bool> max_bandwidth_billed_accounts_can_pay( bool force_elastic_limits = false )const;
std::tuple<int64_t, int64_t, bool, bool> max_bandwidth_billed_accounts_can_pay( bool force_elastic_limits = false )const;

private:

Expand Down Expand Up @@ -98,6 +98,8 @@ namespace eosio { namespace chain {
uint64_t eager_net_limit = 0;
uint64_t& net_usage; /// reference to trace->net_usage

bool cpu_limit_due_to_greylist = false;

fc::microseconds initial_objective_duration_limit;
fc::microseconds objective_duration_limit;
fc::time_point _deadline = fc::time_point::maximum();
Expand Down
6 changes: 6 additions & 0 deletions libraries/chain/transaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,12 @@ transaction_id_type packed_transaction::id()const
return get_transaction().id();
}

transaction_id_type packed_transaction::get_uncached_id()const
{
const auto raw = get_raw_transaction();
return fc::raw::unpack<transaction>( raw ).id();
}

void packed_transaction::local_unpack()const
{
if (!unpacked_trx) {
Expand Down
Loading