Skip to content

Commit f9a3d02

Browse files
authored
Merge pull request #6043 from EOSIO/release/1.4.x
Release 1.4.1
2 parents 2232802 + d3813bd commit f9a3d02

File tree

11 files changed

+101
-67
lines changed

11 files changed

+101
-67
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ set( CXX_STANDARD_REQUIRED ON)
2727

2828
set(VERSION_MAJOR 1)
2929
set(VERSION_MINOR 4)
30-
set(VERSION_PATCH 0)
30+
set(VERSION_PATCH 1)
3131

3232
set( CLI_CLIENT_EXECUTABLE_NAME cleos )
3333
set( NODE_EXECUTABLE_NAME nodeos )

Docker/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ cd eos/Docker
2020
docker build . -t eosio/eos
2121
```
2222

23-
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:
23+
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:
2424

2525
```bash
26-
docker build -t eosio/eos:v1.4.0 --build-arg branch=v1.4.0 .
26+
docker build -t eosio/eos:v1.4.1 --build-arg branch=v1.4.1 .
2727
```
2828

2929
By default, the symbol in eosio.system is set to SYS. You can override this using the symbol argument while building the docker image.

README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,41 @@ Block.one is neither launching nor operating any initial public blockchains base
2525

2626
There is no public testnet running currently.
2727

28+
**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.**
29+
30+
#### Mac OS X Brew Install
31+
```sh
32+
$ brew tap eosio/eosio
33+
$ brew install eosio
34+
```
35+
#### Mac OS X Brew Uninstall
36+
```sh
37+
$ brew remove eosio
38+
```
39+
#### Ubuntu 18.04 Debian Package Install
40+
```sh
41+
$ wget https://github.com/eosio/eos/releases/download/v1.4.1/eosio-1.4.1.ubuntu-18.04-x86_64.deb
42+
$ sudo apt install ./eosio-1.4.1.ubuntu-18.04-x86_64.deb
43+
```
44+
#### Ubuntu 16.04 Debian Package Install
45+
```sh
46+
$ wget https://github.com/eosio/eos/releases/download/v1.4.1/eosio-1.4.1.ubuntu-16.04-x86_64.deb
47+
$ sudo apt install ./eosio-1.4.1.ubuntu-16.04-x86_64.deb
48+
```
49+
#### Debian Package Uninstall
50+
```sh
51+
$ sudo apt remove eosio
52+
```
53+
#### RPM Package Install
54+
```sh
55+
$ wget https://github.com/eosio/eos/releases/download/v1.4.1/eosio-1.4.1.x86_64-0.x86_64.rpm
56+
$ sudo yum install ./eosio-1.4.1.x86_64-0.x86_64.rpm
57+
```
58+
#### RPM Package Uninstall
59+
```sh
60+
$ sudo yum remove eosio.cdt
61+
```
62+
2863
## Supported Operating Systems
2964
EOSIO currently supports the following operating systems:
3065
1. Amazon 2017.09 and higher

libraries/chain/authorization_manager.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,6 @@ namespace eosio { namespace chain {
3535
_db.create<permission_object>([](auto&){}); /// reserve perm 0 (used else where)
3636
}
3737

38-
void authorization_manager::calculate_integrity_hash( fc::sha256::encoder& enc ) const {
39-
authorization_index_set::walk_indices([this, &enc]( auto utils ){
40-
decltype(utils)::walk(_db, [&enc]( const auto &row ) {
41-
fc::raw::pack(enc, row);
42-
});
43-
});
44-
}
45-
4638
namespace detail {
4739
template<>
4840
struct snapshot_row_traits<permission_object> {

libraries/chain/controller.cpp

Lines changed: 11 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ struct controller_impl {
154154
}
155155

156156
if ( read_mode == db_read_mode::SPECULATIVE ) {
157-
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");
157+
EOS_ASSERT( head->block, block_validate_exception, "attempting to pop a block that was sparsely loaded from a snapshot");
158158
for( const auto& t : head->trxs )
159159
unapplied_transactions[t->signed_id] = t;
160160
}
@@ -419,23 +419,6 @@ struct controller_impl {
419419
});
420420
}
421421

422-
void calculate_contract_tables_integrity_hash( sha256::encoder& enc ) const {
423-
index_utils<table_id_multi_index>::walk(db, [this, &enc]( const table_id_object& table_row ){
424-
fc::raw::pack(enc, table_row);
425-
426-
contract_database_index_set::walk_indices([this, &enc, &table_row]( auto utils ) {
427-
using value_t = typename decltype(utils)::index_t::value_type;
428-
using by_table_id = object_to_table_id_tag_t<value_t>;
429-
430-
auto tid_key = boost::make_tuple(table_row.id);
431-
auto next_tid_key = boost::make_tuple(table_id_object::id_type(table_row.id._id + 1));
432-
decltype(utils)::template walk_range<by_table_id>(db, tid_key, next_tid_key, [&enc](const auto& row){
433-
fc::raw::pack(enc, row);
434-
});
435-
});
436-
});
437-
}
438-
439422
void add_contract_tables_to_snapshot( const snapshot_writer_ptr& snapshot ) const {
440423
snapshot->write_section("contract_tables", [this]( auto& section ) {
441424
index_utils<table_id_multi_index>::walk(db, [this, &section]( const table_id_object& table_row ){
@@ -491,28 +474,6 @@ struct controller_impl {
491474
});
492475
}
493476

494-
sha256 calculate_integrity_hash() const {
495-
sha256::encoder enc;
496-
controller_index_set::walk_indices([this, &enc]( auto utils ){
497-
using value_t = typename decltype(utils)::index_t::value_type;
498-
499-
// skip the table_id_object as its inlined with contract tables section
500-
if (std::is_same<value_t, table_id_object>::value) {
501-
return;
502-
}
503-
504-
decltype(utils)::walk(db, [&enc]( const auto &row ) {
505-
fc::raw::pack(enc, row);
506-
});
507-
});
508-
509-
calculate_contract_tables_integrity_hash(enc);
510-
511-
authorization.calculate_integrity_hash(enc);
512-
resource_limits.calculate_integrity_hash(enc);
513-
return enc.result();
514-
}
515-
516477
void add_to_snapshot( const snapshot_writer_ptr& snapshot ) const {
517478
snapshot->write_section<chain_snapshot_header>([this]( auto &section ){
518479
section.add_row(chain_snapshot_header(), db);
@@ -593,6 +554,16 @@ struct controller_impl {
593554
db.set_revision( head->block_num );
594555
}
595556

557+
sha256 calculate_integrity_hash() const {
558+
sha256::encoder enc;
559+
auto hash_writer = std::make_shared<integrity_hash_snapshot_writer>(enc);
560+
add_to_snapshot(hash_writer);
561+
hash_writer->finalize();
562+
563+
return enc.result();
564+
}
565+
566+
596567
/**
597568
* Sets fork database head to the genesis state.
598569
*/

libraries/chain/include/eosio/chain/authorization_manager.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ namespace eosio { namespace chain {
2828

2929
void add_indices();
3030
void initialize_database();
31-
void calculate_integrity_hash( fc::sha256::encoder& enc ) const;
3231
void add_to_snapshot( const snapshot_writer_ptr& snapshot ) const;
3332
void read_from_snapshot( const snapshot_reader_ptr& snapshot );
3433

libraries/chain/include/eosio/chain/resource_limits.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ namespace eosio { namespace chain { namespace resource_limits {
4444

4545
void add_indices();
4646
void initialize_database();
47-
void calculate_integrity_hash( fc::sha256::encoder& enc ) const;
4847
void add_to_snapshot( const snapshot_writer_ptr& snapshot ) const;
4948
void read_from_snapshot( const snapshot_reader_ptr& snapshot );
5049

libraries/chain/include/eosio/chain/snapshot.hpp

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ namespace eosio { namespace chain {
7474

7575
struct abstract_snapshot_row_writer {
7676
virtual void write(ostream_wrapper& out) const = 0;
77+
virtual void write(fc::sha256::encoder& out) const = 0;
7778
virtual variant to_variant() const = 0;
7879
virtual std::string row_type_name() const = 0;
7980
};
@@ -83,10 +84,19 @@ namespace eosio { namespace chain {
8384
explicit snapshot_row_writer( const T& data )
8485
:data(data) {}
8586

86-
void write(ostream_wrapper& out) const override {
87+
template<typename DataStream>
88+
void write_stream(DataStream& out) const {
8789
fc::raw::pack(out, data);
8890
}
8991

92+
void write(ostream_wrapper& out) const override {
93+
write_stream(out);
94+
}
95+
96+
void write(fc::sha256::encoder& out) const override {
97+
write_stream(out);
98+
}
99+
90100
fc::variant to_variant() const override {
91101
variant var;
92102
fc::to_variant(data, var);
@@ -356,4 +366,18 @@ namespace eosio { namespace chain {
356366
uint64_t cur_row;
357367
};
358368

369+
class integrity_hash_snapshot_writer : public snapshot_writer {
370+
public:
371+
explicit integrity_hash_snapshot_writer(fc::sha256::encoder& enc);
372+
373+
void write_start_section( const std::string& section_name ) override;
374+
void write_row( const detail::abstract_snapshot_row_writer& row_writer ) override;
375+
void write_end_section( ) override;
376+
void finalize();
377+
378+
private:
379+
fc::sha256::encoder& enc;
380+
381+
};
382+
359383
}}

libraries/chain/resource_limits.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,6 @@ void resource_limits_manager::initialize_database() {
6565
});
6666
}
6767

68-
void resource_limits_manager::calculate_integrity_hash( fc::sha256::encoder& enc ) const {
69-
resource_index_set::walk_indices([this, &enc]( auto utils ){
70-
decltype(utils)::walk(_db, [&enc]( const auto &row ) {
71-
fc::raw::pack(enc, row);
72-
});
73-
});
74-
}
75-
7668
void resource_limits_manager::add_to_snapshot( const snapshot_writer_ptr& snapshot ) const {
7769
resource_index_set::walk_indices([this, &snapshot]( auto utils ){
7870
snapshot->write_section<typename decltype(utils)::index_t::value_type>([this]( auto& section ){

libraries/chain/snapshot.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,4 +336,26 @@ void istream_snapshot_reader::clear_section() {
336336
cur_row = 0;
337337
}
338338

339+
integrity_hash_snapshot_writer::integrity_hash_snapshot_writer(fc::sha256::encoder& enc)
340+
:enc(enc)
341+
{
342+
}
343+
344+
void integrity_hash_snapshot_writer::write_start_section( const std::string& )
345+
{
346+
// no-op for structural details
347+
}
348+
349+
void integrity_hash_snapshot_writer::write_row( const detail::abstract_snapshot_row_writer& row_writer ) {
350+
row_writer.write(enc);
351+
}
352+
353+
void integrity_hash_snapshot_writer::write_end_section( ) {
354+
// no-op for structural details
355+
}
356+
357+
void integrity_hash_snapshot_writer::finalize() {
358+
// no-op for structural details
359+
}
360+
339361
}}

programs/cleos/main.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2548,10 +2548,8 @@ int main( int argc, char** argv ) {
25482548
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"));
25492549
createWallet->add_flag( "--to-console", print_console, localized("Print password to console."));
25502550
createWallet->set_callback([&wallet_name, &password_file, &print_console] {
2551-
if (password_file.empty() && !print_console) {
2552-
std::cerr << "ERROR: Either indicate a file using \"--file\" or pass \"--to-console\"" << std::endl;
2553-
return;
2554-
}
2551+
EOSC_ASSERT( !password_file.empty() ^ print_console, "ERROR: Either indicate a file using \"--file\" or pass \"--to-console\"" );
2552+
EOSC_ASSERT( password_file.empty() || !std::ofstream(password_file.c_str()).fail(), "ERROR: Failed to create file in specified path" );
25552553

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

0 commit comments

Comments
 (0)