Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge changes from EOSIO master #43

Merged
merged 38 commits into from
Jul 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
4eed1d4
singleton fix
laqiguy Jun 22, 2018
00308d1
Install libs and headers
larryk85 Jun 25, 2018
3b65f20
Updated tester to read wasm and abi files, and updated submodules
larryk85 Jun 25, 2018
7d4e37d
Update eosio_build.sh
larryk85 Jun 26, 2018
9bcf93f
updated submodule
larryk85 Jun 26, 2018
9c18ceb
merge
larryk85 Jun 26, 2018
0889e84
Merge branch 'master' into fix-singleton
moskvanaft Jun 26, 2018
b44a138
Merge branch 'master' into fix-singleton
moskvanaft Jun 26, 2018
fb499c2
more precise exception
noisy Jun 26, 2018
92fec6a
Missing $ in inline action error message
Jun 27, 2018
7a2f94e
implement eosio.sudo contract and add related unit tests #4142
arhag Jun 27, 2018
ddf4631
Merge pull request #4354 from EOSIO/4313
jgiszczak Jun 27, 2018
5c477a1
Show the linked action inside deleting linked authority error message
Jun 28, 2018
2eb718f
bios-boot-tutorial: fix --max-irreversible-block-age
tbfleming Jun 28, 2018
3a88ef7
Merge pull request #4400 from EOSIO/bios-boot-tutorial-block-age2
tbfleming Jun 28, 2018
95fb08f
relax abi_serializer limit for cleos #4395
arhag Jun 28, 2018
679addb
Merge pull request #4403 from EOSIO/4395-abi_serializer-cleos-time-limit
arhag Jun 28, 2018
a3cf1de
cleos multisig transaction (bad naming, but allows keep cleos multisi…
moskvanaft Jun 20, 2018
722927b
cleos: some messages changed to go back to stdout #4249
moskvanaft Jun 20, 2018
6837e46
cleos: multisig transaction renamed to multisig proposer_trx, added o…
moskvanaft Jun 20, 2018
cbf3793
cleos: small bugfix #4249
moskvanaft Jun 20, 2018
34be89b
Merge branch 'release/1.0.x' into 4142-eosio-sudo-simple
arhag Jun 29, 2018
a53efe7
Update tester.hpp
larryk85 Jun 29, 2018
740cece
Update tester.cpp
larryk85 Jun 29, 2018
d86b30b
add guide to deploying and using eosio.sudo contract #4142
arhag Jun 30, 2018
21e50ea
Merge pull request #4378 from EOSIO/link-auth-err-message
b1bart Jul 2, 2018
27c8d17
Merge pull request #4278 from laqiguy/fix-singleton
b1bart Jul 2, 2018
a93debf
fixed tests in light of new exception
b1bart Jul 2, 2018
5906ce5
fix mistake in eosio.sudo contract from @moskvanaft's review of #4429
arhag Jul 2, 2018
c3161af
Merge pull request #4346 from noisy/account_name_exists_exception
b1bart Jul 3, 2018
8d69a6e
Merge pull request #4318 from larryk85/install_libs
b1bart Jul 3, 2018
f2b3507
Merge branch 'release/1.0.x' into 4142-eosio-sudo-simple
arhag Jul 3, 2018
7e74df6
Merge pull request #4429 from EOSIO/4142-eosio-sudo-simple
arhag Jul 3, 2018
af02ebb
Consolidated Security Patches for 1.0.8
b1bart Jul 3, 2018
dc9d41e
bump version to 1.0.8
b1bart Jul 3, 2018
9037496
Merge pull request #4472 from EOSIO/feature/1.0.8-security-omnibus
b1bart Jul 3, 2018
2dcde59
Merge pull request #4473 from EOSIO/feature/bump-version-to-1.0.8
b1bart Jul 3, 2018
5875549
Merge pull request #4475 from EOSIO/release/1.0.x
b1bart Jul 3, 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 @@ -20,7 +20,7 @@ set( CXX_STANDARD_REQUIRED ON)

set(VERSION_MAJOR 1)
set(VERSION_MINOR 0)
set(VERSION_PATCH 7)
set(VERSION_PATCH 8)

set( CLI_CLIENT_EXECUTABLE_NAME cleos )
set( GUI_CLIENT_EXECUTABLE_NAME eosio )
Expand Down
6 changes: 3 additions & 3 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.0.7 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.0.8 tag, you could do the following:

```bash
docker build -t eosio/eos:v1.0.7 --build-arg branch=v1.0.7 .
docker build -t eosio/eos:v1.0.8 --build-arg branch=v1.0.8 .
```

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 Expand Up @@ -181,7 +181,7 @@ Note: if you want to use the mongo db plugin, you have to enable it in your `dat

```
# pull images
docker pull eosio/eos:v1.0.7
docker pull eosio/eos:v1.0.8

# create volume
docker volume create --name=nodeos-data-volume
Expand Down
4 changes: 2 additions & 2 deletions Docker/docker-compose-eosio1.0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: "3"

services:
nodeosd:
image: eosio/eos:v1.0.7
image: eosio/eos:v1.0.8
command: /opt/eosio/bin/nodeosd.sh --data-dir /opt/eosio/bin/data-dir -e
hostname: nodeosd
ports:
Expand All @@ -14,7 +14,7 @@ services:
- nodeos-data-volume:/opt/eosio/bin/data-dir

keosd:
image: eosio/eos:v1.0.7
image: eosio/eos:v1.0.8
command: /opt/eosio/bin/keosd --wallet-dir /opt/eosio/bin/data-dir --http-server-address=127.0.0.1:8900
hostname: keosd
links:
Expand Down
1 change: 1 addition & 0 deletions contracts/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ add_subdirectory(libc++)
add_subdirectory(simple.token)
add_subdirectory(eosio.token)
add_subdirectory(eosio.msig)
add_subdirectory(eosio.sudo)
add_subdirectory(multi_index_test)
add_subdirectory(eosio.system)
add_subdirectory(identity)
Expand Down
9 changes: 9 additions & 0 deletions contracts/eosio.sudo/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

file(GLOB ABI_FILES "*.abi")
configure_file("${ABI_FILES}" "${CMAKE_CURRENT_BINARY_DIR}" COPYONLY)

add_wast_executable(TARGET eosio.sudo
INCLUDE_FOLDERS "${STANDARD_INCLUDE_FOLDERS}"
LIBRARIES libc++ libc eosiolib
DESTINATION_FOLDER ${CMAKE_CURRENT_BINARY_DIR}
)
886 changes: 886 additions & 0 deletions contracts/eosio.sudo/README.md

Large diffs are not rendered by default.

73 changes: 73 additions & 0 deletions contracts/eosio.sudo/eosio.sudo.abi
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"version": "eosio::abi/1.0",
"types": [{
"new_type_name": "account_name",
"type": "name"
},{
"new_type_name": "permission_name",
"type": "name"
},{
"new_type_name": "action_name",
"type": "name"
}],
"structs": [{
"name": "permission_level",
"base": "",
"fields": [
{"name": "actor", "type": "account_name"},
{"name": "permission", "type": "permission_name"}
]
},{
"name": "action",
"base": "",
"fields": [
{"name": "account", "type": "account_name"},
{"name": "name", "type": "action_name"},
{"name": "authorization", "type": "permission_level[]"},
{"name": "data", "type": "bytes"}
]
},{
"name": "transaction_header",
"base": "",
"fields": [
{"name": "expiration", "type": "time_point_sec"},
{"name": "ref_block_num", "type": "uint16"},
{"name": "ref_block_prefix", "type": "uint32"},
{"name": "max_net_usage_words", "type": "varuint32"},
{"name": "max_cpu_usage_ms", "type": "uint8"},
{"name": "delay_sec", "type": "varuint32"}
]
},{
"name": "extension",
"base": "",
"fields": [
{"name": "type", "type" : "uint16" },
{"name": "data", "type": "bytes"}
]
},{
"name": "transaction",
"base": "transaction_header",
"fields": [
{"name": "context_free_actions", "type": "action[]"},
{"name": "actions", "type": "action[]"},
{"name": "transaction_extensions", "type": "extension[]"}
]
},{
"name": "exec",
"base": "",
"fields": [
{"name":"executer", "type":"account_name"},
{"name":"trx", "type":"transaction"}
]
}
],
"actions": [{
"name": "exec",
"type": "exec",
"ricardian_contract": ""
}
],
"tables": [],
"ricardian_clauses": [],
"abi_extensions": []
}
37 changes: 37 additions & 0 deletions contracts/eosio.sudo/eosio.sudo.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#include <eosio.sudo/eosio.sudo.hpp>
#include <eosiolib/transaction.hpp>

namespace eosio {

/*
exec function manually parses input data (instead of taking parsed arguments from dispatcher)
because parsing data in the dispatcher uses too much CPU if the included transaction is very big

If we use dispatcher the function signature should be:

void sudo::exec( account_name executer,
transaction trx )
*/

void sudo::exec() {
require_auth( _self );

constexpr size_t max_stack_buffer_size = 512;
size_t size = action_data_size();
char* buffer = (char*)( max_stack_buffer_size < size ? malloc(size) : alloca(size) );
read_action_data( buffer, size );

account_name executer;

datastream<const char*> ds( buffer, size );
ds >> executer;

require_auth( executer );

size_t trx_pos = ds.tellp();
send_deferred( (uint128_t(executer) << 64) | current_time(), executer, buffer+trx_pos, size-trx_pos );
}

} /// namespace eosio

EOSIO_ABI( eosio::sudo, (exec) )
15 changes: 15 additions & 0 deletions contracts/eosio.sudo/eosio.sudo.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#pragma once

#include <eosiolib/eosio.hpp>

namespace eosio {

class sudo : public contract {
public:
sudo( account_name self ):contract(self){}

void exec();

};

} /// namespace eosio
2 changes: 1 addition & 1 deletion contracts/eosiolib/singleton.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ namespace eosio {
T get_or_create( account_name bill_to_account, const T& def = T() ) {
auto itr = _t.find( pk_value );
return itr != _t.end() ? itr->value
: _t.emplace(bill_to_account, [&](row& r) { r.value = def; });
: _t.emplace(bill_to_account, [&](row& r) { r.value = def; })->value;
}

void set( const T& value, account_name bill_to_account ) {
Expand Down
2 changes: 0 additions & 2 deletions eosio_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@

export BOOST_ROOT="${HOME}/opt/boost"
OPENSSL_ROOT_DIR=/usr/include/openssl
WASM_ROOT="${HOME}/opt/wasm"
fi

if [ "$ARCH" == "Darwin" ]; then
Expand All @@ -207,7 +206,6 @@
C_COMPILER=clang
MONGOD_CONF=/usr/local/etc/mongod.conf
OPENSSL_ROOT_DIR=/usr/local/opt/openssl
WASM_ROOT=/usr/local/wasm
fi

. "$FILE"
Expand Down
2 changes: 1 addition & 1 deletion externals/binaryen
Submodule binaryen updated 1 files
+15 −0 CMakeLists.txt
3 changes: 3 additions & 0 deletions libraries/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ add_subdirectory( appbase )
add_subdirectory( chain )
add_subdirectory( testing )
add_subdirectory( abi_generator )

install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/chainbase/include/chainbase DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR})
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/softfloat/source/include DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR}/eosio/softfloat)
11 changes: 9 additions & 2 deletions libraries/chain/abi_serializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,12 @@ namespace eosio { namespace chain {
}
}

bool abi_serializer::_is_type(const type_name& rtype, size_t recursion_depth)const {
bool abi_serializer::_is_type(const type_name& rtype, size_t recursion_depth, const fc::time_point& deadline)const {
FC_ASSERT( fc::time_point::now() < deadline, "serialization time limit ${t}us exceeded", ("t", max_serialization_time) );
if( ++recursion_depth > max_recursion_depth) return false;
auto type = fundamental_type(rtype);
if( built_in_types.find(type) != built_in_types.end() ) return true;
if( typedefs.find(type) != typedefs.end() ) return _is_type(typedefs.find(type)->second, recursion_depth);
if( typedefs.find(type) != typedefs.end() ) return _is_type(typedefs.find(type)->second, recursion_depth, deadline);
if( structs.find(type) != structs.end() ) return true;
return false;
}
Expand All @@ -193,10 +194,12 @@ namespace eosio { namespace chain {
}

void abi_serializer::validate()const {
const fc::time_point deadline = fc::time_point::now() + max_serialization_time;
for( const auto& t : typedefs ) { try {
vector<type_name> types_seen{t.first, t.second};
auto itr = typedefs.find(t.second);
while( itr != typedefs.end() ) {
FC_ASSERT( fc::time_point::now() < deadline, "serialization time limit ${t}us exceeded", ("t", max_serialization_time) );
FC_ASSERT( find(types_seen.begin(), types_seen.end(), itr->second) == types_seen.end(), "Circular reference in type ${type}", ("type",t.first) );
types_seen.emplace_back(itr->second);
itr = typedefs.find(itr->second);
Expand All @@ -210,21 +213,25 @@ namespace eosio { namespace chain {
struct_def current = s.second;
vector<type_name> types_seen{current.name};
while( current.base != type_name() ) {
FC_ASSERT( fc::time_point::now() < deadline, "serialization time limit ${t}us exceeded", ("t", max_serialization_time) );
const auto& base = get_struct(current.base); //<-- force struct to inherit from another struct
FC_ASSERT( find(types_seen.begin(), types_seen.end(), base.name) == types_seen.end(), "Circular reference in struct ${type}", ("type",s.second.name) );
types_seen.emplace_back(base.name);
current = base;
}
}
for( const auto& field : s.second.fields ) { try {
FC_ASSERT( fc::time_point::now() < deadline, "serialization time limit ${t}us exceeded", ("t", max_serialization_time) );
FC_ASSERT(is_type(field.type) );
} FC_CAPTURE_AND_RETHROW( (field) ) }
} FC_CAPTURE_AND_RETHROW( (s) ) }
for( const auto& a : actions ) { try {
FC_ASSERT( fc::time_point::now() < deadline, "serialization time limit ${t}us exceeded", ("t", max_serialization_time) );
FC_ASSERT(is_type(a.second), "", ("type",a.second) );
} FC_CAPTURE_AND_RETHROW( (a) ) }

for( const auto& t : tables ) { try {
FC_ASSERT( fc::time_point::now() < deadline, "serialization time limit ${t}us exceeded", ("t", max_serialization_time) );
FC_ASSERT(is_type(t.second), "", ("type",t.second) );
} FC_CAPTURE_AND_RETHROW( (t) ) }
}
Expand Down
2 changes: 1 addition & 1 deletion libraries/chain/apply_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ void apply_context::execute_inline( action&& a ) {
EOS_ASSERT( actor != nullptr, action_validate_exception,
"inline action's authorizing actor ${account} does not exist", ("account", auth.actor) );
EOS_ASSERT( control.get_authorization_manager().find_permission(auth) != nullptr, action_validate_exception,
"inline action's authorizations include a non-existent permission: {permission}",
"inline action's authorizations include a non-existent permission: ${permission}",
("permission", auth) );
}

Expand Down
43 changes: 27 additions & 16 deletions libraries/chain/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -395,29 +395,40 @@ struct controller_impl {



/**
* @post regardless of the success of commit block there is no active pending block
*/
void commit_block( bool add_to_fork_db ) {
if( add_to_fork_db ) {
pending->_pending_block_state->validated = true;
auto new_bsp = fork_db.add( pending->_pending_block_state );
emit( self.accepted_block_header, pending->_pending_block_state );
head = fork_db.head();
FC_ASSERT( new_bsp == head, "committed block did not become the new head in fork database" );
auto reset_pending_on_exit = fc::make_scoped_exit([this]{
pending.reset();
});

}
try {
if (add_to_fork_db) {
pending->_pending_block_state->validated = true;
auto new_bsp = fork_db.add(pending->_pending_block_state);
emit(self.accepted_block_header, pending->_pending_block_state);
head = fork_db.head();
FC_ASSERT(new_bsp == head, "committed block did not become the new head in fork database");
}

// ilog((fc::json::to_pretty_string(*pending->_pending_block_state->block)));
emit( self.accepted_block, pending->_pending_block_state );
if( !replaying ) {
reversible_blocks.create<reversible_block_object>( [&]( auto& ubo ) {
ubo.blocknum = pending->_pending_block_state->block_num;
ubo.set_block( pending->_pending_block_state->block );
});
}

if( !replaying ) {
reversible_blocks.create<reversible_block_object>( [&]( auto& ubo ) {
ubo.blocknum = pending->_pending_block_state->block_num;
ubo.set_block( pending->_pending_block_state->block );
});
emit( self.accepted_block, pending->_pending_block_state );
} catch (...) {
// dont bother resetting pending, instead abort the block
reset_pending_on_exit.cancel();
abort_block();
throw;
}

// push the state for pending.
pending->push();
pending.reset();

}

// The returned scoped_exit should not exceed the lifetime of the pending which existed when make_block_restore_point was called.
Expand Down
5 changes: 3 additions & 2 deletions libraries/chain/eosio_contract.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ void apply_eosio_newaccount(apply_context& context) {
}

auto existing_account = db.find<account_object, by_name>(create.name);
EOS_ASSERT(existing_account == nullptr, action_validate_exception,
EOS_ASSERT(existing_account == nullptr, account_name_exists_exception,
"Cannot create account named ${name}, as that name is already taken",
("name", create.name));

Expand Down Expand Up @@ -282,7 +282,8 @@ void apply_eosio_deleteauth(apply_context& context) {
const auto& index = db.get_index<permission_link_index, by_permission_name>();
auto range = index.equal_range(boost::make_tuple(remove.account, remove.permission));
EOS_ASSERT(range.first == range.second, action_validate_exception,
"Cannot delete a linked authority. Unlink the authority first");
"Cannot delete a linked authority. Unlink the authority first. This authority is linked to ${code}::${type}.",
("code", string(range.first->code))("type", string(range.first->message_type)));
}

const auto& permission = authorization.get_permission({remove.account, remove.permission});
Expand Down
4 changes: 2 additions & 2 deletions libraries/chain/include/eosio/chain/abi_serializer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ struct abi_serializer {
bool is_array(const type_name& type)const;
bool is_optional(const type_name& type)const;
bool is_type(const type_name& type)const {
return _is_type(type, 0);
return _is_type(type, 0, fc::time_point::now() + max_serialization_time);
}
bool is_builtin_type(const type_name& type)const;
bool is_integer(const type_name& type) const;
Expand Down Expand Up @@ -126,7 +126,7 @@ struct abi_serializer {
void _binary_to_variant(const type_name& type, fc::datastream<const char*>& stream, fc::mutable_variant_object& obj,
size_t recursion_depth, const fc::time_point& deadline)const;

bool _is_type(const type_name& type, size_t recursion_depth)const;
bool _is_type(const type_name& type, size_t recursion_depth, const fc::time_point& deadline)const;

friend struct impl::abi_from_variant;
friend struct impl::abi_to_variant;
Expand Down
4 changes: 2 additions & 2 deletions libraries/chain/include/eosio/chain/wast_to_wasm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
namespace eosio { namespace chain {

std::vector<uint8_t> wast_to_wasm( const std::string& wast );
std::string wasm_to_wast( const std::vector<uint8_t>& wasm );
std::string wasm_to_wast( const uint8_t* data, uint64_t size );
std::string wasm_to_wast( const std::vector<uint8_t>& wasm, bool strip_names );
std::string wasm_to_wast( const uint8_t* data, uint64_t size, bool strip_names );

} } /// eosio::chain
Loading