Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
mschoenebeck authored May 1, 2023
2 parents 9b42070 + 57d5546 commit c48c675
Show file tree
Hide file tree
Showing 96 changed files with 1,490 additions and 1,412 deletions.
27 changes: 14 additions & 13 deletions .cicd/platforms/ubuntu20.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
FROM ubuntu:focal

ENV TZ="America/New_York"
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get upgrade -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential \
cmake \
git \
jq \
libboost-all-dev \
libcurl4-openssl-dev \
libgmp-dev \
libssl-dev \
llvm-11-dev \
ninja-build \
python3-numpy \
zstd
apt-get install -y build-essential \
cmake \
git \
jq \
libboost-all-dev \
libcurl4-openssl-dev \
libgmp-dev \
libssl-dev \
llvm-11-dev \
ninja-build \
python3-numpy \
zstd
27 changes: 14 additions & 13 deletions .cicd/platforms/ubuntu22.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
FROM ubuntu:jammy

ENV TZ="America/New_York"
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get upgrade -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential \
cmake \
git \
jq \
libboost-all-dev \
libcurl4-openssl-dev \
libgmp-dev \
libssl-dev \
llvm-11-dev \
ninja-build \
python3-numpy \
zstd
apt-get install -y build-essential \
cmake \
git \
jq \
libboost-all-dev \
libcurl4-openssl-dev \
libgmp-dev \
libssl-dev \
llvm-11-dev \
ninja-build \
python3-numpy \
zstd
2 changes: 1 addition & 1 deletion .github/actions/parallel-ctest-containers/dist/index.mjs

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions .github/actions/parallel-ctest-containers/main.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ try {
stream.pipe(packer.entry(header, next));
}).on('finish', () => {packer.finalize()});

child_process.spawn("docker", ["export", tests[i]]).stdout.pipe(extractor);
stream.promises.pipeline(packer, zlib.createGzip(), fs.createWriteStream(`${log_tarball_prefix}-${tests[i]}-logs.tar.gz`));
child_process.spawn("docker", ["export", tests[i].name]).stdout.pipe(extractor);
stream.promises.pipeline(packer, zlib.createGzip(), fs.createWriteStream(`${log_tarball_prefix}-${tests[i].name}-logs.tar.gz`));
}
} catch(e) {
core.setFailed(`Uncaught exception ${e.message}`);
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,18 @@ jobs:
zstdcat build.tar.zst | tar x
cd build
cpack
- name: Install dev package
run: |
apt update && apt upgrade -y
apt install -y ./build/leap_*.deb ./build/leap-dev*.deb
- name: Test using TestHarness
run: |
python3 -c "from TestHarness import Cluster"
- name: Upload dev package
uses: actions/upload-artifact@v3
with:
name: leap-dev-ubuntu20-amd64
path: build/leap-dev*.deb

tests:
name: Tests
needs: [d, Build]
Expand Down
1 change: 1 addition & 0 deletions libraries/chain/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ add_library( eosio_chain
abi_serializer.cpp
asset.cpp
snapshot.cpp
snapshot_scheduler.cpp
deep_mind.cpp

${CHAIN_EOSVMOC_SOURCES}
Expand Down
29 changes: 20 additions & 9 deletions libraries/chain/apply_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,26 @@ namespace eosio { namespace chain {

static inline void print_debug(account_name receiver, const action_trace& ar) {
if (!ar.console.empty()) {
auto prefix = fc::format_string(
"\n[(${a},${n})->${r}]",
fc::mutable_variant_object()
("a", ar.act.account)
("n", ar.act.name)
("r", receiver));
dlog(prefix + ": CONSOLE OUTPUT BEGIN =====================\n"
+ ar.console
+ prefix + ": CONSOLE OUTPUT END =====================" );
if (fc::logger::get(DEFAULT_LOGGER).is_enabled( fc::log_level::debug )) {
std::string prefix;
prefix.reserve(3 + 13 + 1 + 13 + 3 + 13 + 1);
prefix += "\n[(";
prefix += ar.act.account.to_string();
prefix += ",";
prefix += ar.act.name.to_string();
prefix += ")->";
prefix += receiver.to_string();
prefix += "]";

std::string output;
output.reserve(512);
output += prefix;
output += ": CONSOLE OUTPUT BEGIN =====================\n";
output += ar.console;
output += prefix;
output += ": CONSOLE OUTPUT END =====================";
dlog( std::move(output) );
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions libraries/chain/authorization_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -559,8 +559,8 @@ namespace eosio { namespace chain {

}

if( !allow_unused_keys || check_but_dont_fail) {
EOS_ASSERT( checker.all_keys_used(), tx_irrelevant_sig,
if( !allow_unused_keys ) {
EOS_ASSERT( checker.all_keys_used() || check_but_dont_fail, tx_irrelevant_sig,
"transaction bears irrelevant signatures from these keys: ${keys}",
("keys", checker.unused_keys()) );
}
Expand Down
11 changes: 11 additions & 0 deletions libraries/chain/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <eosio/chain/protocol_feature_manager.hpp>
#include <eosio/chain/authorization_manager.hpp>
#include <eosio/chain/resource_limits.hpp>
#include <eosio/chain/subjective_billing.hpp>
#include <eosio/chain/chain_snapshot.hpp>
#include <eosio/chain/thread_utils.hpp>
#include <eosio/chain/platform_timer.hpp>
Expand Down Expand Up @@ -232,6 +233,7 @@ struct controller_impl {
block_state_ptr head;
fork_database fork_db;
resource_limits_manager resource_limits;
subjective_billing subjective_bill;
authorization_manager authorization;
protocol_feature_manager protocol_features;
controller::config conf;
Expand Down Expand Up @@ -2769,6 +2771,15 @@ const protocol_feature_manager& controller::get_protocol_feature_manager()const
return my->protocol_features;
}

const subjective_billing& controller::get_subjective_billing()const {
return my->subjective_bill;
}

subjective_billing& controller::get_mutable_subjective_billing() {
return my->subjective_bill;
}


uint32_t controller::get_max_nonprivileged_inline_action_size()const
{
return my->conf.max_nonprivileged_inline_action_size;
Expand Down
3 changes: 3 additions & 0 deletions libraries/chain/include/eosio/chain/controller.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ namespace eosio { namespace chain {
class permission_object;
class account_object;
class deep_mind_handler;
class subjective_billing;
using resource_limits::resource_limits_manager;
using apply_handler = std::function<void(apply_context&)>;
using forked_branch_callback = std::function<void(const branch_type&)>;
Expand Down Expand Up @@ -197,6 +198,8 @@ namespace eosio { namespace chain {
const authorization_manager& get_authorization_manager()const;
authorization_manager& get_mutable_authorization_manager();
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;
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 @@ -603,6 +603,8 @@ namespace eosio { namespace chain {
3170014, "Snapshot request not found" )
FC_DECLARE_DERIVED_EXCEPTION( invalid_snapshot_request, producer_exception,
3170015, "Invalid snapshot request" )
FC_DECLARE_DERIVED_EXCEPTION( snapshot_execution_exception, producer_exception,
3170016, "Snapshot execution exception" )

FC_DECLARE_DERIVED_EXCEPTION( reversible_blocks_exception, chain_exception,
3180000, "Reversible Blocks exception" )
Expand Down
61 changes: 61 additions & 0 deletions libraries/chain/include/eosio/chain/pending_snapshot.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#pragma once

#include <eosio/chain/controller.hpp>
#include <eosio/chain/types.hpp>

#include <string>

namespace eosio::chain {

namespace fs = std::filesystem;

template<typename T>
class pending_snapshot {
public:
using next_t = eosio::chain::next_function<T>;

pending_snapshot(const chain::block_id_type& block_id, const next_t& next, std::string pending_path, std::string final_path)
: block_id(block_id), next(next), pending_path(std::move(pending_path)), final_path(std::move(final_path)) {}

uint32_t get_height() const {
return chain::block_header::num_from_id(block_id);
}

static fs::path get_final_path(const chain::block_id_type& block_id, const fs::path& snapshots_dir) {
return snapshots_dir / fc::format_string("snapshot-${id}.bin", fc::mutable_variant_object()("id", block_id));
}

static fs::path get_pending_path(const chain::block_id_type& block_id, const fs::path& snapshots_dir) {
return snapshots_dir / fc::format_string(".pending-snapshot-${id}.bin", fc::mutable_variant_object()("id", block_id));
}

static fs::path get_temp_path(const chain::block_id_type& block_id, const fs::path& snapshots_dir) {
return snapshots_dir / fc::format_string(".incomplete-snapshot-${id}.bin", fc::mutable_variant_object()("id", block_id));
}

T finalize(const chain::controller& chain) const {
auto block_ptr = chain.fetch_block_by_id(block_id);
auto in_chain = (bool) block_ptr;
std::error_code ec;

if(!in_chain) {
fs::remove(fs::path(pending_path), ec);
EOS_THROW(chain::snapshot_finalization_exception,
"Snapshotted block was forked out of the chain. ID: ${block_id}",
("block_id", block_id));
}

fs::rename(fs::path(pending_path), fs::path(final_path), ec);
EOS_ASSERT(!ec, chain::snapshot_finalization_exception,
"Unable to finalize valid snapshot of block number ${bn}: [code: ${ec}] ${message}",
("bn", get_height())("ec", ec.value())("message", ec.message()));

return {block_id, block_ptr->block_num(), block_ptr->timestamp, chain::chain_snapshot_header::current_version, final_path};
}

chain::block_id_type block_id;
next_t next;
std::string pending_path;
std::string final_path;
};
}// namespace eosio::chain
Loading

0 comments on commit c48c675

Please sign in to comment.