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

Commit

Permalink
Merge pull request #6043 from EOSIO/release/1.4.x
Browse files Browse the repository at this point in the history
Release 1.4.1
  • Loading branch information
b1bart authored Oct 17, 2018
2 parents 2232802 + d3813bd commit f9a3d02
Show file tree
Hide file tree
Showing 11 changed files with 101 additions and 67 deletions.
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 4)
set(VERSION_PATCH 0)
set(VERSION_PATCH 1)

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.4.0 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.4.1 tag, you could do the following:

```bash
docker build -t eosio/eos:v1.4.0 --build-arg branch=v1.4.0 .
docker build -t eosio/eos:v1.4.1 --build-arg branch=v1.4.1 .
```

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
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,41 @@ Block.one is neither launching nor operating any initial public blockchains base

There is no public testnet running currently.

**If you have previously installed EOSIO, please run the `eosio_uninstall` script (it is in the directory where you cloned EOSIO) before downloading and using the binary releases.**

#### Mac OS X Brew Install
```sh
$ brew tap eosio/eosio
$ brew install eosio
```
#### Mac OS X Brew Uninstall
```sh
$ brew remove eosio
```
#### Ubuntu 18.04 Debian Package Install
```sh
$ wget https://github.com/eosio/eos/releases/download/v1.4.1/eosio-1.4.1.ubuntu-18.04-x86_64.deb
$ sudo apt install ./eosio-1.4.1.ubuntu-18.04-x86_64.deb
```
#### Ubuntu 16.04 Debian Package Install
```sh
$ wget https://github.com/eosio/eos/releases/download/v1.4.1/eosio-1.4.1.ubuntu-16.04-x86_64.deb
$ sudo apt install ./eosio-1.4.1.ubuntu-16.04-x86_64.deb
```
#### Debian Package Uninstall
```sh
$ sudo apt remove eosio
```
#### RPM Package Install
```sh
$ wget https://github.com/eosio/eos/releases/download/v1.4.1/eosio-1.4.1.x86_64-0.x86_64.rpm
$ sudo yum install ./eosio-1.4.1.x86_64-0.x86_64.rpm
```
#### RPM Package Uninstall
```sh
$ sudo yum remove eosio.cdt
```

## Supported Operating Systems
EOSIO currently supports the following operating systems:
1. Amazon 2017.09 and higher
Expand Down
8 changes: 0 additions & 8 deletions libraries/chain/authorization_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,6 @@ namespace eosio { namespace chain {
_db.create<permission_object>([](auto&){}); /// reserve perm 0 (used else where)
}

void authorization_manager::calculate_integrity_hash( fc::sha256::encoder& enc ) const {
authorization_index_set::walk_indices([this, &enc]( auto utils ){
decltype(utils)::walk(_db, [&enc]( const auto &row ) {
fc::raw::pack(enc, row);
});
});
}

namespace detail {
template<>
struct snapshot_row_traits<permission_object> {
Expand Down
51 changes: 11 additions & 40 deletions libraries/chain/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ struct controller_impl {
}

if ( read_mode == db_read_mode::SPECULATIVE ) {
EOS_ASSERT( head->block && head->block->transactions.size() == head->trxs.size(), block_validate_exception, "attempting to pop a block that was sparsely loaded from a snapshot");
EOS_ASSERT( head->block, block_validate_exception, "attempting to pop a block that was sparsely loaded from a snapshot");
for( const auto& t : head->trxs )
unapplied_transactions[t->signed_id] = t;
}
Expand Down Expand Up @@ -419,23 +419,6 @@ struct controller_impl {
});
}

void calculate_contract_tables_integrity_hash( sha256::encoder& enc ) const {
index_utils<table_id_multi_index>::walk(db, [this, &enc]( const table_id_object& table_row ){
fc::raw::pack(enc, table_row);

contract_database_index_set::walk_indices([this, &enc, &table_row]( auto utils ) {
using value_t = typename decltype(utils)::index_t::value_type;
using by_table_id = object_to_table_id_tag_t<value_t>;

auto tid_key = boost::make_tuple(table_row.id);
auto next_tid_key = boost::make_tuple(table_id_object::id_type(table_row.id._id + 1));
decltype(utils)::template walk_range<by_table_id>(db, tid_key, next_tid_key, [&enc](const auto& row){
fc::raw::pack(enc, row);
});
});
});
}

void add_contract_tables_to_snapshot( const snapshot_writer_ptr& snapshot ) const {
snapshot->write_section("contract_tables", [this]( auto& section ) {
index_utils<table_id_multi_index>::walk(db, [this, &section]( const table_id_object& table_row ){
Expand Down Expand Up @@ -491,28 +474,6 @@ struct controller_impl {
});
}

sha256 calculate_integrity_hash() const {
sha256::encoder enc;
controller_index_set::walk_indices([this, &enc]( auto utils ){
using value_t = typename decltype(utils)::index_t::value_type;

// skip the table_id_object as its inlined with contract tables section
if (std::is_same<value_t, table_id_object>::value) {
return;
}

decltype(utils)::walk(db, [&enc]( const auto &row ) {
fc::raw::pack(enc, row);
});
});

calculate_contract_tables_integrity_hash(enc);

authorization.calculate_integrity_hash(enc);
resource_limits.calculate_integrity_hash(enc);
return enc.result();
}

void add_to_snapshot( const snapshot_writer_ptr& snapshot ) const {
snapshot->write_section<chain_snapshot_header>([this]( auto &section ){
section.add_row(chain_snapshot_header(), db);
Expand Down Expand Up @@ -593,6 +554,16 @@ struct controller_impl {
db.set_revision( head->block_num );
}

sha256 calculate_integrity_hash() const {
sha256::encoder enc;
auto hash_writer = std::make_shared<integrity_hash_snapshot_writer>(enc);
add_to_snapshot(hash_writer);
hash_writer->finalize();

return enc.result();
}


/**
* Sets fork database head to the genesis state.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ namespace eosio { namespace chain {

void add_indices();
void initialize_database();
void calculate_integrity_hash( fc::sha256::encoder& enc ) const;
void add_to_snapshot( const snapshot_writer_ptr& snapshot ) const;
void read_from_snapshot( const snapshot_reader_ptr& snapshot );

Expand Down
1 change: 0 additions & 1 deletion libraries/chain/include/eosio/chain/resource_limits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ namespace eosio { namespace chain { namespace resource_limits {

void add_indices();
void initialize_database();
void calculate_integrity_hash( fc::sha256::encoder& enc ) const;
void add_to_snapshot( const snapshot_writer_ptr& snapshot ) const;
void read_from_snapshot( const snapshot_reader_ptr& snapshot );

Expand Down
26 changes: 25 additions & 1 deletion libraries/chain/include/eosio/chain/snapshot.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ namespace eosio { namespace chain {

struct abstract_snapshot_row_writer {
virtual void write(ostream_wrapper& out) const = 0;
virtual void write(fc::sha256::encoder& out) const = 0;
virtual variant to_variant() const = 0;
virtual std::string row_type_name() const = 0;
};
Expand All @@ -83,10 +84,19 @@ namespace eosio { namespace chain {
explicit snapshot_row_writer( const T& data )
:data(data) {}

void write(ostream_wrapper& out) const override {
template<typename DataStream>
void write_stream(DataStream& out) const {
fc::raw::pack(out, data);
}

void write(ostream_wrapper& out) const override {
write_stream(out);
}

void write(fc::sha256::encoder& out) const override {
write_stream(out);
}

fc::variant to_variant() const override {
variant var;
fc::to_variant(data, var);
Expand Down Expand Up @@ -356,4 +366,18 @@ namespace eosio { namespace chain {
uint64_t cur_row;
};

class integrity_hash_snapshot_writer : public snapshot_writer {
public:
explicit integrity_hash_snapshot_writer(fc::sha256::encoder& enc);

void write_start_section( const std::string& section_name ) override;
void write_row( const detail::abstract_snapshot_row_writer& row_writer ) override;
void write_end_section( ) override;
void finalize();

private:
fc::sha256::encoder& enc;

};

}}
8 changes: 0 additions & 8 deletions libraries/chain/resource_limits.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,6 @@ void resource_limits_manager::initialize_database() {
});
}

void resource_limits_manager::calculate_integrity_hash( fc::sha256::encoder& enc ) const {
resource_index_set::walk_indices([this, &enc]( auto utils ){
decltype(utils)::walk(_db, [&enc]( const auto &row ) {
fc::raw::pack(enc, row);
});
});
}

void resource_limits_manager::add_to_snapshot( const snapshot_writer_ptr& snapshot ) const {
resource_index_set::walk_indices([this, &snapshot]( auto utils ){
snapshot->write_section<typename decltype(utils)::index_t::value_type>([this]( auto& section ){
Expand Down
22 changes: 22 additions & 0 deletions libraries/chain/snapshot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,4 +336,26 @@ void istream_snapshot_reader::clear_section() {
cur_row = 0;
}

integrity_hash_snapshot_writer::integrity_hash_snapshot_writer(fc::sha256::encoder& enc)
:enc(enc)
{
}

void integrity_hash_snapshot_writer::write_start_section( const std::string& )
{
// no-op for structural details
}

void integrity_hash_snapshot_writer::write_row( const detail::abstract_snapshot_row_writer& row_writer ) {
row_writer.write(enc);
}

void integrity_hash_snapshot_writer::write_end_section( ) {
// no-op for structural details
}

void integrity_hash_snapshot_writer::finalize() {
// no-op for structural details
}

}}
10 changes: 5 additions & 5 deletions programs/cleos/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2548,10 +2548,8 @@ int main( int argc, char** argv ) {
createWallet->add_option("-f,--file", password_file, localized("Name of file to write wallet password output to. (Must be set, unless \"--to-console\" is passed"));
createWallet->add_flag( "--to-console", print_console, localized("Print password to console."));
createWallet->set_callback([&wallet_name, &password_file, &print_console] {
if (password_file.empty() && !print_console) {
std::cerr << "ERROR: Either indicate a file using \"--file\" or pass \"--to-console\"" << std::endl;
return;
}
EOSC_ASSERT( !password_file.empty() ^ print_console, "ERROR: Either indicate a file using \"--file\" or pass \"--to-console\"" );
EOSC_ASSERT( password_file.empty() || !std::ofstream(password_file.c_str()).fail(), "ERROR: Failed to create file in specified path" );

const auto& v = call(wallet_url, wallet_create, wallet_name);
std::cout << localized("Creating wallet: ${wallet_name}", ("wallet_name", wallet_name)) << std::endl;
Expand All @@ -2561,8 +2559,10 @@ int main( int argc, char** argv ) {
std::cout << fc::json::to_pretty_string(v) << std::endl;
} else {
std::cerr << localized("saving password to ${filename}", ("filename", password_file)) << std::endl;
auto password_str = fc::json::to_pretty_string(v);
boost::replace_all(password_str, "\"", "");
std::ofstream out( password_file.c_str() );
out << fc::json::to_pretty_string(v);
out << password_str;
}
});

Expand Down

0 comments on commit f9a3d02

Please sign in to comment.