Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/EOSIO/eos
Browse files Browse the repository at this point in the history
  • Loading branch information
nsjames committed Jun 9, 2018
2 parents 464b687 + 26ec83d commit 5c0311d
Show file tree
Hide file tree
Showing 550 changed files with 1,789 additions and 87,903 deletions.
8 changes: 4 additions & 4 deletions .buildkite/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ steps:
/usr/bin/cmake -GNinja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_COMPILER=clang++-4.0 -DCMAKE_C_COMPILER=clang-4.0 -DWASM_ROOT=/root/opt/wasm -DOPENSSL_ROOT_DIR=/usr/include/openssl -DBUILD_MONGO_DB_PLUGIN=true -DENABLE_COVERAGE_TESTING=true -DBUILD_DOXYGEN=false && \
/usr/bin/ninja
echo "--- :spiral_note_pad: Generating Code Coverage Report" && \
/usr/bin/ninja EOS_ut_coverage && \
/usr/bin/ninja EOSIO_ut_coverage && \
echo "--- :arrow_up: Publishing Code Coverage Report" && \
buildkite-agent artifact upload "EOS_ut_coverage/**/*" s3://eosio-coverage/$BUILDKITE_JOB_ID && \
buildkite-agent artifact upload "EOSIO_ut_coverage/**/*" s3://eosio-coverage/$BUILDKITE_JOB_ID && \
cp /config/.coveralls.yml . && \
/usr/local/bin/coveralls-lcov EOS_ut_coverage_filtered.info && \
/usr/local/bin/coveralls-lcov EOSIO_ut_coverage_filtered.info && \
echo "+++ View Report" && \
printf "\033]1339;url=https://eosio-coverage.s3-us-west-2.amazonaws.com/$BUILDKITE_JOB_ID/EOS_ut_coverage/index.html;content=View Full Coverage Report\a\n"
printf "\033]1339;url=https://eosio-coverage.s3-us-west-2.amazonaws.com/$BUILDKITE_JOB_ID/EOSIO_ut_coverage/index.html;content=View Full Coverage Report\a\n"
label: ":spiral_note_pad: Generate Report"
agents:
- "role=linux-coverage"
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@
[submodule "externals/magic_get"]
path = externals/magic_get
url = https://github.com/EOSIO/magic_get
[submodule "libraries/fc"]
path = libraries/fc
url = https://github.com/EOSIO/fc
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ include( GNUInstallDirs )
include( VersionMacros )
include( SetupTargetMacros )
include( InstallDirectoryPermissions )
include( MASSigning )

set( BLOCKCHAIN_NAME "EOSIO" )
set( CMAKE_CXX_STANDARD 14 )
Expand Down
22 changes: 22 additions & 0 deletions CMakeModules/MASSigning.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
macro(mas_sign target)

#example values:
# MAS_CERT_FINGERPRINT=C5139C2C4D7FA071EFBFD86CE44B652631C9376A
# MAS_BASE_APPID=5A4683969Z.com.example. <<note the trailing period on this
# MAS_PROVISIONING_PROFILE="/Users/spoon/Library/MobileDevice/Provisioning Profiles/b1d57761-e5b8-4e58-b412-f1cd0f1924a1.provisionprofile"
# MAS_KEYCHAIN_GROUP=5A4683969Z.com.example.keyz
#Given the above, the executable will be signed via the certificate in the keystore matching the fingerprint and bundled with the
# specified provisioning profile. The appid will the base plus the name of the target, 5A4683969Z.com.example.keosd for example. And
# the entitlements file will have a keychain sharing group of 5A4683969Z.com.example.keyz

if(APPLE AND MAS_CERT_FINGERPRINT AND MAS_BASE_APPID AND MAS_PROVISIONING_PROFILE AND MAS_KEYCHAIN_GROUP)

add_custom_command(TARGET ${target} POST_BUILD
COMMAND ${CMAKE_SOURCE_DIR}/tools/mas_sign.sh ${MAS_CERT_FINGERPRINT} ${MAS_BASE_APPID}$<TARGET_FILE_NAME:${target}> ${MAS_PROVISIONING_PROFILE} ${MAS_KEYCHAIN_GROUP} $<TARGET_FILE_NAME:${target}>
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
VERBATIM
)

endif()

endmacro(mas_sign)
2 changes: 1 addition & 1 deletion CMakeModules/wasm.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ macro(compile_wast)
endif()

set(WASM_COMMAND ${WASM_CLANG} -emit-llvm -O3 ${STDFLAG} --target=wasm32 -ffreestanding
-nostdlib -nostdlibinc -fno-threadsafe-statics -fno-rtti -fno-exceptions
-nostdlib -nostdlibinc -DBOOST_DISABLE_ASSERTS -DBOOST_EXCEPTION_DISABLE -fno-threadsafe-statics -fno-rtti -fno-exceptions
-c ${infile} -o ${outfile}.bc
)
if (${ARG_NOWARNINGS})
Expand Down
2 changes: 1 addition & 1 deletion Docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ cleos get account inita
Upload sample exchange contract

```bash
cleos set contract exchange contracts/exchange/exchange.wast contracts/exchange/exchange.abi
cleos set contract exchange contracts/exchange/
```

If you don't need keosd afterwards, you can stop the keosd service using
Expand Down
8 changes: 4 additions & 4 deletions Docker/builder/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ RUN echo 'APT::Install-Recommends 0;' >> /etc/apt/apt.conf.d/01norecommends \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y sudo wget curl net-tools ca-certificates unzip gnupg

RUN echo "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic main" >> /etc/apt/sources.list.d/llvm.list \
&& wget -O - http://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add - \
&& wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add - \
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y git-core automake autoconf libtool build-essential pkg-config libtool \
mpi-default-dev libicu-dev python-dev python3-dev libbz2-dev zlib1g-dev libssl-dev libgmp-dev \
Expand All @@ -19,7 +19,7 @@ RUN echo "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic main" >> /etc/ap
RUN update-alternatives --install /usr/bin/clang clang /usr/lib/llvm-4.0/bin/clang 400 \
&& update-alternatives --install /usr/bin/clang++ clang++ /usr/lib/llvm-4.0/bin/clang++ 400

RUN wget --no-check-certificate https://cmake.org/files/v3.9/cmake-3.9.6-Linux-x86_64.sh \
RUN wget https://cmake.org/files/v3.9/cmake-3.9.6-Linux-x86_64.sh \
&& bash cmake-3.9.6-Linux-x86_64.sh --prefix=/usr/local --exclude-subdir --skip-license \
&& rm cmake-3.9.6-Linux-x86_64.sh

Expand Down Expand Up @@ -53,14 +53,14 @@ RUN wget https://github.com/WebAssembly/binaryen/archive/1.37.21.tar.gz -O - | t
&& cmake --build build --target install \
&& cd .. && rm -rf binaryen-1.37.21

RUN git clone --depth 1 git://github.com/cryptonomex/secp256k1-zkp \
RUN git clone --depth 1 https://github.com/cryptonomex/secp256k1-zkp \
&& cd secp256k1-zkp \
&& ./autogen.sh \
&& ./configure --prefix=/usr/local \
&& make -j$(nproc) install \
&& cd .. && rm -rf secp256k1-zkp

RUN git clone --depth 1 -b releases/stable git://github.com/mongodb/mongo-cxx-driver \
RUN git clone --depth 1 -b releases/stable https://github.com/mongodb/mongo-cxx-driver \
&& cd mongo-cxx-driver \
&& cmake -H. -Bbuild -G Ninja -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local\
&& cmake --build build --target install \
Expand Down
3 changes: 2 additions & 1 deletion contracts/eosio.system/delegate_bandwidth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,8 @@ namespace eosiosystem {
eosio_assert( asset() <= unstake_cpu_quantity, "must unstake a positive amount" );
eosio_assert( asset() <= unstake_net_quantity, "must unstake a positive amount" );
eosio_assert( asset() < unstake_cpu_quantity + unstake_net_quantity, "must unstake a positive amount" );
eosio_assert( _gstate.total_activated_stake >= min_activated_stake, "not enough has been staked for users to unstake" );
eosio_assert( _gstate.total_activated_stake >= min_activated_stake,
"cannot undelegate bandwidth until the chain is activated (at least 15% of all tokens participate in voting)" );

changebw( from, receiver, -unstake_net_quantity, -unstake_cpu_quantity, false);
} // undelegatebw
Expand Down
15 changes: 15 additions & 0 deletions contracts/eosio.system/eosio.system.abi
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,15 @@
{"name":"base", "type":"connector"},
{"name":"quote", "type":"connector"}
]
}, {
"name": "namebid_info",
"base": "",
"fields": [
{"name":"newname", "type":"account_name"},
{"name":"high_bidder", "type":"account_name"},
{"name":"high_bid", "type":"int64"},
{"name":"last_bid_time", "type":"uint64"}
]
}
],
"actions": [{
Expand Down Expand Up @@ -559,6 +568,12 @@
"index_type": "i64",
"key_names" : ["owner"],
"key_types" : ["uint64"]
},{
"name": "namebids",
"type": "namebid_info",
"index_type": "i64",
"key_names" : ["newname"],
"key_types" : ["account_name"]
}
],
"ricardian_clauses": [],
Expand Down
13 changes: 7 additions & 6 deletions contracts/eosio.system/producer_pay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ namespace eosiosystem {
p.unpaid_blocks++;
});
}

/// only update block producers once every minute, block_timestamp is in half seconds
if( timestamp.slot - _gstate.last_producer_schedule_update.slot > 120 ) {
update_elected_producers( timestamp );

if( (timestamp.slot - _gstate.last_name_close.slot) > blocks_per_day ) {
name_bid_table bids(_self,_self);
auto idx = bids.get_index<N(highbid)>();
Expand All @@ -70,8 +70,9 @@ namespace eosiosystem {

const auto& prod = _producers.get( owner );
eosio_assert( prod.active(), "producer does not have an active key" );

eosio_assert( _gstate.total_activated_stake >= min_activated_stake, "not enough has been staked for producers to claim rewards" );

eosio_assert( _gstate.total_activated_stake >= min_activated_stake,
"cannot claim rewards until the chain is activated (at least 15% of all tokens participate in voting)" );

auto ct = current_time();

Expand Down Expand Up @@ -111,7 +112,7 @@ namespace eosiosystem {
producer_per_block_pay = (_gstate.perblock_bucket * prod.unpaid_blocks) / _gstate.total_unpaid_blocks;
}
int64_t producer_per_vote_pay = 0;
if( _gstate.total_producer_vote_weight > 0 ) {
if( _gstate.total_producer_vote_weight > 0 ) {
producer_per_vote_pay = int64_t((_gstate.pervote_bucket * prod.total_votes ) / _gstate.total_producer_vote_weight);
}
if( producer_per_vote_pay < min_pervote_daily_pay ) {
Expand All @@ -125,7 +126,7 @@ namespace eosiosystem {
p.last_claim_time = ct;
p.unpaid_blocks = 0;
});

if( producer_per_block_pay > 0 ) {
INLINE_ACTION_SENDER(eosio::token, transfer)( N(eosio.token), {N(eosio.bpay),N(active)},
{ N(eosio.bpay), owner, asset(producer_per_block_pay), std::string("producer block pay") } );
Expand Down
14 changes: 6 additions & 8 deletions contracts/eosio.system/voting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,12 @@ namespace eosiosystem {
auto prod = _producers.find( producer );

if ( prod != _producers.end() ) {
if( producer_key != prod->producer_key ) {
_producers.modify( prod, producer, [&]( producer_info& info ){
info.producer_key = producer_key;
info.is_active = true;
info.url = url;
info.location = location;
});
}
_producers.modify( prod, producer, [&]( producer_info& info ){
info.producer_key = producer_key;
info.is_active = true;
info.url = url;
info.location = location;
});
} else {
_producers.emplace( producer, [&]( producer_info& info ){
info.owner = producer;
Expand Down
7 changes: 2 additions & 5 deletions contracts/eosio.token/eosio.token.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,8 @@ namespace eosio {
account_name to,
asset quantity,
string memo );

private:

friend eosiosystem::system_contract;



inline asset get_supply( symbol_name sym )const;

inline asset get_balance( account_name owner, symbol_name sym )const;
Expand Down
4 changes: 2 additions & 2 deletions contracts/eosiolib/transaction.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ namespace eosio {
public:
transaction(time_point_sec exp = time_point_sec(now() + 60)) : transaction_header( exp ) {}

void send(uint64_t sender_id, account_name payer, bool replace_existing = false) const {
void send(const uint128_t& sender_id, account_name payer, bool replace_existing = false) const {
auto serialize = pack(*this);
send_deferred(sender_id, payer, serialize.data(), serialize.size(), replace_existing);
}

vector<action> context_free_actions;
vector<action> actions;
extensions_type transaction_extensions;
extensions_type transaction_extensions;

EOSLIB_SERIALIZE_DERIVED( transaction, transaction_header, (context_free_actions)(actions)(transaction_extensions) )
};
Expand Down
1 change: 1 addition & 0 deletions eosio_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@
printf "\\tEOSIO website: https://eos.io\\n"
printf "\\tEOSIO Telegram channel @ https://t.me/EOSProject\\n"
printf "\\tEOSIO resources: https://eos.io/resources/\\n"
printf "\\tEOSIO Stack Exchange: https://eosio.stackexchange.com\\n"
printf "\\tEOSIO wiki: https://github.com/EOSIO/eos/wiki\\n\\n\\n"

if [ "x${EOSIO_BUILD_PACKAGE}" != "x" ]; then
Expand Down
8 changes: 8 additions & 0 deletions libraries/chain/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@ target_include_directories( eosio_chain
"${CMAKE_CURRENT_SOURCE_DIR}/../../externals/binaryen/src"
)

set_target_properties( eosio_chain PROPERTIES PUBLIC_HEADER "${HEADERS}" )
install( TARGETS eosio_chain
RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR}/eosio/chain
)
install_directory_permissions( DIRECTORY ${CMAKE_INSTALL_FULL_INCLUDEDIR}/eosio/chain )
#if(MSVC)
# set_source_files_properties( db_init.cpp db_block.cpp database.cpp block_log.cpp PROPERTIES COMPILE_FLAGS "/bigobj" )
#endif(MSVC)
10 changes: 6 additions & 4 deletions libraries/chain/apply_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,19 @@ action_trace apply_context::exec_one()
privileged = a.privileged;
auto native = control.find_apply_handler(receiver, act.account, act.name);
if( native ) {
if( control.is_producing_block() ) {
if( trx_context.can_subjectively_fail && control.is_producing_block() ) {
control.check_contract_list( receiver );
control.check_action_list( act.account, act.name );
}
(*native)(*this);
}

if( a.code.size() > 0
&& !(act.account == config::system_account_name && act.name == N(setcode) && receiver == config::system_account_name) )
{
if( control.is_producing_block() ) {
if( trx_context.can_subjectively_fail && control.is_producing_block() ) {
control.check_contract_list( receiver );
control.check_action_list( act.account, act.name );
}
try {
control.get_wasm_interface().apply(a.code_version, a.code, *this);
Expand Down Expand Up @@ -375,8 +377,8 @@ int apply_context::get_action( uint32_t type, uint32_t index, char* buffer, size
return -1;
act_ptr = &trx.actions[index];
}
FC_ASSERT(act_ptr, "action is not found" );

FC_ASSERT(act_ptr, "action is not found" );

auto ps = fc::raw::pack_size( *act_ptr );
if( ps <= buffer_size ) {
Expand Down
18 changes: 14 additions & 4 deletions libraries/chain/authorization_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -399,8 +399,12 @@ namespace eosio { namespace chain {
checktime(); // TODO: this should eventually move into authority_checker instead
EOS_ASSERT( checker.satisfied( p.first, p.second ), unsatisfied_authorization,
"transaction declares authority '${auth}', "
"but does not have signatures for it under a provided delay of ${provided_delay} ms",
("auth", p.first)("provided_delay", provided_delay.count()/1000)
"but does not have signatures for it under a provided delay of ${provided_delay} ms, "
"provided permissions ${provided_permissions}, and provided keys ${provided_keys}",
("auth", p.first)
("provided_delay", provided_delay.count()/1000)
("provided_permissions", provided_permissions)
("provided_keys", provided_keys)
("delay_max_limit_ms", delay_max_limit.count()/1000)
);

Expand Down Expand Up @@ -436,8 +440,14 @@ namespace eosio { namespace chain {
);

EOS_ASSERT( checker.satisfied({account, permission}), unsatisfied_authorization,
"permission '${auth}' was not satisfied under a provided delay of ${provided_delay} ms",
("auth", permission_level{account, permission})("provided_delay", provided_delay.count()/1000) );
"permission '${auth}' was not satisfied under a provided delay of ${provided_delay} ms, "
"provided permissions ${provided_permissions}, and provided keys ${provided_keys}",
("auth", permission_level{account, permission})
("provided_delay", provided_delay.count()/1000)
("provided_permissions", provided_permissions)
("provided_keys", provided_keys)
("delay_max_limit_ms", delay_max_limit.count()/1000)
);

if( !allow_unused_keys ) {
EOS_ASSERT( checker.all_keys_used(), tx_irrelevant_sig,
Expand Down
6 changes: 5 additions & 1 deletion libraries/chain/block_log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ namespace eosio { namespace chain {
}
} // construct_index

fc::path block_log::repair_log( const fc::path& data_dir ) {
fc::path block_log::repair_log( const fc::path& data_dir, uint32_t truncate_at_block ) {
ilog("Recovering Block Log...");
FC_ASSERT( fc::is_directory(data_dir) && fc::is_regular_file(data_dir / "blocks.log"),
"Block log not found in '${blocks_dir}'", ("blocks_dir", data_dir) );
Expand Down Expand Up @@ -419,6 +419,8 @@ namespace eosio { namespace chain {
new_block_stream.write( reinterpret_cast<char*>(&pos), sizeof(pos) );
block_num = tmp.block_num();
pos = new_block_stream.tellp();
if( block_num == truncate_at_block )
break;
}

if( bad_block.valid() ) {
Expand Down Expand Up @@ -451,6 +453,8 @@ namespace eosio { namespace chain {
"has been written out to '${tail_path}'.",
("num", block_num+1)("tail_path", tail_path) );
}
} else if( block_num == truncate_at_block && pos < end_pos ) {
ilog( "Stopped recovery of block log early at specified block number: ${stop}.", ("stop", truncate_at_block) );
} else {
ilog( "Existing block log was undamaged. Recovered all irreversible blocks up to block number ${num}.", ("num", block_num) );
}
Expand Down
Loading

0 comments on commit 5c0311d

Please sign in to comment.