Skip to content

Commit

Permalink
Merge pull request EOSIO#96 from enumivo/staging
Browse files Browse the repository at this point in the history
Staging
  • Loading branch information
Enumivo authored May 14, 2018
2 parents da1cf1a + 5cc2ee8 commit f5fe353
Show file tree
Hide file tree
Showing 47 changed files with 1,495 additions and 1,194 deletions.
2 changes: 1 addition & 1 deletion .buildkite/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ steps:
- WASM_ROOT=/root/opt/wasm
- PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/opt/wasm/bin
- CI=true
timeout: 30
timeout: 60
230 changes: 230 additions & 0 deletions .buildkite/debug.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,230 @@
steps:
- command: |
echo "--- Creating symbolic link to job directory :file_folder:" && \
sleep 5 && ln -s "$(pwd)" /data/job && cd /data/job && \
echo "+++ Building :hammer:" && \
echo 1 | ./eosio_build.sh -o Debug && \
echo "--- Compressing build directory :compression:" && \
tar -pczf build.tar.gz build/
label: ":darwin: Build"
agents:
- "role=macos-builder"
artifact_paths: "build.tar.gz"
timeout: 30
- command: |
echo "+++ :hammer: Building" && \
echo 1 | ./eosio_build.sh -o Debug && \
echo "--- :compression: Compressing build directory" && \
tar -pczf build.tar.gz build/
label: ":ubuntu: Build"
agents:
- "role=linux-builder"
artifact_paths: "build.tar.gz"
plugins:
docker#v1.1.1:
image: "eosio/ci:ubuntu"
workdir: /data/job
timeout: 30
- command: |
echo "+++ :hammer: Building" && \
echo 1 | ./eosio_build.sh -o Debug && \
echo "--- :compression: Compressing build directory" && \
tar -pczf build.tar.gz build/
label: ":ubuntu: 18.04 Build"
agents:
- "role=linux-builder"
artifact_paths: "build.tar.gz"
plugins:
docker#v1.1.1:
image: "eosio/ci:ubuntu18"
workdir: /data/job
timeout: 30
- command: |
echo "+++ :hammer: Building" && \
echo 1 | ./eosio_build.sh -o Debug && \
echo "--- :compression: Compressing build directory" && \
tar -pczf build.tar.gz build/
label: ":fedora: Build"
agents:
- "role=linux-builder"
artifact_paths: "build.tar.gz"
plugins:
docker#v1.1.1:
image: "eosio/ci:fedora"
workdir: /data/job
timeout: 30
- command: |
echo "+++ :hammer: Building" && \
echo 1 | ./eosio_build.sh -o Debug && \
echo "--- :compression: Compressing build directory" && \
tar -pczf build.tar.gz build/
label: ":centos: Build"
agents:
- "role=linux-builder"
artifact_paths: "build.tar.gz"
plugins:
docker#v1.1.1:
image: "eosio/ci:centos"
workdir: /data/job
timeout: 30
- command: |
echo "+++ :hammer: Building" && \
echo 1 | ./eosio_build.sh -o Debug && \
echo "--- :compression: Compressing build directory" && \
tar -pczf build.tar.gz build/
label: ":aws: Build"
agents:
- "role=linux-builder"
artifact_paths: "build.tar.gz"
plugins:
docker#v1.1.1:
image: "eosio/ci:amazonlinux"
workdir: /data/job
timeout: 30
- wait

- command: |
echo "--- :arrow_down: Downloading build directory" && \
buildkite-agent artifact download "build.tar.gz" . --step ":darwin: Build" &&
tar -zxf build.tar.gz && \
echo "--- :m: Starting MongoDB" && \
$(which mongod) --fork --logpath "$(pwd)"/mongod.log && \
echo "+++ :microscope: Running tests" && \
ln -s "$(pwd)" /data/job && cd /data/job/build && ctest --output-on-failure
retry:
automatic:
limit: 1
label: ":darwin: Tests"
agents:
- "role=macos-tester"
artifact_paths:
- "mongod.log"
- "build/genesis.json"
- "build/config.ini"
timeout: 30
- command: |
echo "--- :arrow_down: Downloading build directory" && \
buildkite-agent artifact download "build.tar.gz" . --step ":ubuntu: Build" &&
tar -zxf build.tar.gz && \
echo "--- :m: Starting MongoDB" && \
$(which mongod) --fork --logpath "$(pwd)"/mongod.log && \
echo "+++ :microscope: Running tests" && \
cd /data/job/build && ctest --output-on-failure
retry:
automatic:
limit: 1
label: ":ubuntu: Tests"
agents:
- "role=linux-tester"
artifact_paths:
- "mongod.log"
- "build/genesis.json"
- "build/config.ini"
plugins:
docker#v1.1.1:
image: "eosio/ci:ubuntu"
workdir: /data/job
timeout: 30
- command: |
echo "--- :arrow_down: Downloading build directory" && \
buildkite-agent artifact download "build.tar.gz" . --step ":ubuntu: 18.04 Build" &&
tar -zxf build.tar.gz && \
echo "--- :m: Starting MongoDB" && \
$(which mongod) --fork --logpath "$(pwd)"/mongod.log && \
echo "+++ :microscope: Running tests" && \
cd /data/job/build && ctest --output-on-failure
retry:
automatic:
limit: 1
label: ":ubuntu: 18.04 Tests"
agents:
- "role=linux-tester"
artifact_paths:
- "mongod.log"
- "build/genesis.json"
- "build/config.ini"
plugins:
docker#v1.1.1:
image: "eosio/ci:ubuntu18"
workdir: /data/job
timeout: 30
- command: |
echo "--- :arrow_down: Downloading build directory" && \
buildkite-agent artifact download "build.tar.gz" . --step ":fedora: Build" &&
tar -zxf build.tar.gz && \
echo "--- :m: Starting MongoDB" && \
$(which mongod) --fork --logpath "$(pwd)"/mongod.log && \
echo "+++ :microscope: Running tests" && \
cd /data/job/build && ctest --output-on-failure
retry:
automatic:
limit: 1
label: ":fedora: Tests"
agents:
- "role=linux-tester"
artifact_paths:
- "mongod.log"
- "build/genesis.json"
- "build/config.ini"
plugins:
docker#v1.1.1:
image: "eosio/ci:fedora"
workdir: /data/job
timeout: 30
- command: |
echo "--- :arrow_down: Downloading build directory" && \
buildkite-agent artifact download "build.tar.gz" . --step ":centos: Build" &&
tar -zxf build.tar.gz && \
echo "--- :m: Starting MongoDB" && \
$(which mongod) --fork --logpath "$(pwd)"/mongod.log && \
echo "+++ :microscope: Running tests" && \
cd /data/job/build && ctest --output-on-failure
retry:
automatic:
limit: 1
label: ":centos: Tests"
agents:
- "role=linux-tester"
artifact_paths:
- "mongod.log"
- "build/genesis.json"
- "build/config.ini"
plugins:
docker#v1.1.1:
image: "eosio/ci:centos"
workdir: /data/job
timeout: 30
- command: |
echo "--- :arrow_down: Downloading build directory" && \
buildkite-agent artifact download "build.tar.gz" . --step ":aws: Build" &&
tar -zxf build.tar.gz && \
echo "--- :m: Starting MongoDB" && \
$(which mongod) --fork --logpath "$(pwd)"/mongod.log && \
echo "+++ :microscope: Running tests" && \
cd /data/job/build && ctest --output-on-failure
retry:
automatic:
limit: 1
label: ":aws: Tests"
agents:
- "role=linux-tester"
artifact_paths:
- "mongod.log"
- "build/genesis.json"
- "build/config.ini"
plugins:
docker#v1.1.1:
image: "eosio/ci:amazonlinux"
workdir: /data/job
timeout: 30
6 changes: 3 additions & 3 deletions Docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
FROM eosio/builder as builder
ARG branch=master

RUN git clone -b $branch --depth 1 https://github.com/EOSIO/eos.git --recursive \
RUN git clone -b $branch https://github.com/EOSIO/eos.git --recursive \
&& cd eos && echo "$branch:$(git rev-parse HEAD)" > /etc/eosio-version \
&& cmake -H. -B"/tmp/build" -GNinja -DCMAKE_BUILD_TYPE=Release -DWASM_ROOT=/opt/wasm -DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_C_COMPILER=clang -DCMAKE_INSTALL_PREFIX=/tmp/build -DSecp256k1_ROOT_DIR=/usr/local -DBUILD_MONGO_DB_PLUGIN=true \
&& cmake --build /tmp/build --target install


FROM ubuntu:16.04
FROM ubuntu:18.04

RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install openssl && rm -rf /var/lib/apt/lists/*
COPY --from=builder /usr/local/lib/* /usr/local/lib/
COPY --from=builder /tmp/build/bin /opt/eosio/bin
COPY --from=builder /tmp/build/contracts /contracts
COPY --from=builder /eos/Docker/config.ini /
COPY --from=builder /etc/eosio-version /etc
COPY nodeosd.sh /opt/eosio/bin/nodeosd.sh
COPY --from=builder /eos/Docker/nodeosd.sh /opt/eosio/bin/nodeosd.sh
ENV EOSIO_ROOT=/opt/eosio
RUN chmod +x /opt/eosio/bin/nodeosd.sh
ENV LD_LIBRARY_PATH /usr/local/lib
Expand Down
26 changes: 26 additions & 0 deletions contracts/enumivolib/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <enumivolib/types.h>
#include <functional>
#include <tuple>
#include <string>

namespace eosio {

Expand Down Expand Up @@ -77,8 +78,33 @@ namespace eosio {
struct name {
operator uint64_t()const { return value; }

// keep in sync with name::operator string() in eosio source code definition for name
std::string to_string() const {
static const char* charmap = ".12345abcdefghijklmnopqrstuvwxyz";

std::string str(13,'.');

uint64_t tmp = value;
for( uint32_t i = 0; i <= 12; ++i ) {
char c = charmap[tmp & (i == 0 ? 0x0f : 0x1f)];
str[12-i] = c;
tmp >>= (i == 0 ? 4 : 5);
}

trim_right_if( str, []( char c ){ return c == '.'; } );
return str;
}

friend bool operator==( const name& a, const name& b ) { return a.value == b.value; }
account_name value = 0;

private:
template<typename Lambda>
static void trim_right_if(std::string& str, Lambda&& l ) {
const auto last = str.find_last_not_of('.');
if (last != std::string::npos)
str = str.substr(0, last + 1);
}
};
/// @}

Expand Down
13 changes: 8 additions & 5 deletions contracts/eosio.system/delegate_bandwidth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,16 @@ namespace eosiosystem {
* an amount equal to the current new account creation fee.
*/
void native::newaccount( account_name creator,
account_name newact
/* no need to parse authorites
const authority& owner,
const authority& active,
const authority& recovery*/ ) {
account_name newact
/* no need to parse authorites
const authority& owner,
const authority& active*/ ) {
auto name_str = eosio::name{newact}.to_string();
eosio::print( eosio::name{creator}, " created ", eosio::name{newact}, "\n");

eosio_assert( name_str.size() == 12, "account names must be 12 chars long" );
eosio_assert( name_str.find_first_of('.') == std::string::npos, "account names cannot contain '.' character");

user_resources_table userres( _self, newact);

userres.emplace( newact, [&]( auto& res ) {
Expand Down
7 changes: 3 additions & 4 deletions contracts/eosio.system/native.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,9 @@ namespace eosiosystem {
*/
void newaccount( account_name creator,
account_name newact
/* no need to parse authorites
const authority& owner,
const authority& active,
const authority& recovery*/ );
/* no need to parse authorites
const authority& owner,
const authority& active*/ );


void updateauth( /*account_name account,
Expand Down
14 changes: 5 additions & 9 deletions libraries/chain/apply_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ void apply_context::execute_inline( action&& a ) {
{},
{{receiver, config::eosio_code_name}},
control.pending_block_time() - trx_context.published,
std::bind(&apply_context::checktime, this, std::placeholders::_1),
std::bind(&transaction_context::checktime, &this->trx_context),
false
);

Expand Down Expand Up @@ -248,7 +248,7 @@ void apply_context::schedule_deferred_transaction( const uint128_t& sender_id, a
{},
{{receiver, config::eosio_code_name}},
delay,
std::bind(&apply_context::checktime, this, std::placeholders::_1),
std::bind(&transaction_context::checktime, &this->trx_context),
false
);
}
Expand Down Expand Up @@ -283,7 +283,7 @@ void apply_context::schedule_deferred_transaction( const uint128_t& sender_id, a
}

trx_context.add_ram_usage( payer, (config::billable_size_v<generated_transaction_object> + trx_size) );
checktime( trx_size * 4 ); /// 4 instructions per byte of packed generated trx (estimated)
trx_context.checktime();
}

void apply_context::cancel_deferred_transaction( const uint128_t& sender_id, account_name sender ) {
Expand All @@ -295,7 +295,7 @@ void apply_context::cancel_deferred_transaction( const uint128_t& sender_id, acc

trx_context.add_ram_usage( gto->payer, -(config::billable_size_v<generated_transaction_object> + gto->packed_trx.size()) );
generated_transaction_idx.remove(*gto);
checktime( 100 );
trx_context.checktime();
}

const table_id_object* apply_context::find_table( name code, name scope, name table ) {
Expand Down Expand Up @@ -338,13 +338,9 @@ void apply_context::reset_console() {
_pending_console_output.setf( std::ios::scientific, std::ios::floatfield );
}

void apply_context::checktime(uint32_t instruction_count) {
trx_context.check_time();
}

bytes apply_context::get_packed_transaction() {
auto r = fc::raw::pack( static_cast<const transaction&>(trx_context.trx) );
checktime( r.size() );
trx_context.checktime();
return r;
}

Expand Down
Loading

0 comments on commit f5fe353

Please sign in to comment.