Skip to content

Commit

Permalink
Merge pull request #1 from stoffu/aeon-upstream-2
Browse files Browse the repository at this point in the history
Aeon upstream 2 test
  • Loading branch information
BigslimVdub authored Nov 7, 2018
2 parents ccb42d3 + 1643745 commit 8f92f70
Show file tree
Hide file tree
Showing 60 changed files with 1,409 additions and 817 deletions.
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ VOLUME /root/.bitmonero
# monero-wallet-cli
VOLUME /wallet

EXPOSE 18080
EXPOSE 18081
EXPOSE 11180
EXPOSE 11181

ENTRYPOINT ["monerod", "--p2p-bind-ip=0.0.0.0", "--p2p-bind-port=18080", "--rpc-bind-ip=0.0.0.0", "--rpc-bind-port=18081", "--non-interactive", "--confirm-external-bind"]
ENTRYPOINT ["monerod", "--p2p-bind-ip=0.0.0.0", "--p2p-bind-port=11180", "--rpc-bind-ip=0.0.0.0", "--rpc-bind-port=11181", "--non-interactive", "--confirm-external-bind"]
27 changes: 21 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Aeon

[![Github All Releases](https://img.shields.io/github/downloads/aeonix/aeon/total.svg)](../../releases)
[![GitHub release](https://img.shields.io/github/release/aeonix/aeon/all.svg)](../../releases/latest)
[![GitHub Release Date](https://img.shields.io/github/release-date-pre/aeonix/aeon.svg)](../../releases/latest)
[![GitHub top language](https://img.shields.io/github/languages/top/aeonix/aeon.svg)](../../)
[![GitHub language count](https://img.shields.io/github/languages/count/aeonix/aeon.svg)](../../)
[![GitHub repo size in bytes](https://img.shields.io/github/repo-size/aeonix/aeon.svg)](../../)

[![GitHub last commit](https://img.shields.io/github/last-commit/aeonix/aeon.svg)](../../)
[![Github commits (since latest release)](https://img.shields.io/github/commits-since/aeonix/aeon/latest.svg)](../../)
[![GitHub stars](https://img.shields.io/github/stars/aeonix/aeon.svg)](../../stargazers)
[![GitHub forks](https://img.shields.io/github/forks/aeonix/aeon.svg)](../../network)
[![GitHub issues](https://img.shields.io/github/issues/aeonix/aeon.svg)](../../issues)
[![GitHub closed issues](https://img.shields.io/github/issues-closed/aeonix/aeon.svg)](../../issues)

Copyright (c) 2014-2018, AEON, The Monero Project.
Portions Copyright (c) 2012-2013 The Cryptonote developers.

Expand All @@ -10,6 +24,7 @@ Portions Copyright (c) 2012-2013 The Cryptonote developers.
- Reddit: https://www.reddit.com/r/Aeon
- GitHub: [https://github.com/aeonix/aeon](https://github.com/aeonix/aeon)
- IRC: [#aeon on Freenode](http://webchat.freenode.net/?randomnick=1&channels=%23aeon&prompt=1&uio=d4)
- Discord: https://discord.gg/TM8mEsx

## Vulnerability response

Expand Down Expand Up @@ -79,7 +94,7 @@ Dates are provided in the format YYYY-MM-DD.
| Software upgrade block height | Date | Fork version | Minimum Aeon version | Recommended Aeon version | Details |
| ------------------------------ | -----------| ----------------- | ---------------------- | -------------------------- | ---------------------------------------------------------------------------------- |
| 592000 | 2015-08-04 | v1 (exceptional, version not bumped) | v0.9.0.0 | v0.9.14.0 | blocktime = 240 seconds, CryptoNight-Lite, lower mining priority for ringsize < 3 |
| 963500 | 2018-06-03 | v7 | v0.12.0.0 | v0.12.2.1 | Rebase to Monero's latest codebase with RingCT disabled, CryptoNight-Lite variant 1, limited use of ringsize 1, ban ringsize 2 |
| 963500 | 2018-06-03 | v7 | v0.12.0.0 | v0.12.6.0-aeon | Rebase to Monero's latest codebase with RingCT disabled, CryptoNight-Lite variant 1, limited use of ringsize 1, ban ringsize 2 |

## Compiling Aeon from source

Expand Down Expand Up @@ -142,7 +157,7 @@ invokes cmake commands as needed.
* Change to the root of the source code directory, change to the most recent release tag, and build:

cd aeon
git checkout v0.12.2.1
git checkout v0.12.6.0-aeon
make

*Optional*: If your machine has several cores and enough memory, enable
Expand Down Expand Up @@ -204,7 +219,7 @@ Tested on a Raspberry Pi Zero with a clean install of minimal Raspbian Stretch (
```
git clone https://github.com/aeonix/aeon.git
cd aeon
git checkout tags/v0.12.2.1
git checkout tags/v0.12.6.0-aeon
```
* Build:
```
Expand Down Expand Up @@ -301,9 +316,9 @@ application.

cd aeon

* If you would like a specific [version/tag](https://github.com/aeonix/aeon/tags), do a git checkout for that version. eg. 'v0.12.1.0'. If you dont care about the version and just want binaries from master, skip this step:
* If you would like a specific [version/tag](https://github.com/aeonix/aeon/tags), do a git checkout for that version. eg. 'v0.12.6.0-aeon'. If you dont care about the version and just want binaries from master, skip this step:

git checkout v0.12.1.0
git checkout v0.12.6.0-aeon

* If you are on a 64-bit system, run:

Expand Down Expand Up @@ -566,7 +581,7 @@ TAILS ships with a very restrictive set of firewall rules. Therefore, you need
to add a rule to allow this connection too, in addition to telling torsocks to
allow inbound connections. Full example:

sudo iptables -I OUTPUT 2 -p tcp -d 127.0.0.1 -m tcp --dport 18081 -j ACCEPT
sudo iptables -I OUTPUT 2 -p tcp -d 127.0.0.1 -m tcp --dport 11181 -j ACCEPT
DNS_PUBLIC=tcp torsocks ./aeond --p2p-bind-ip 127.0.0.1 --no-igd --rpc-bind-ip 127.0.0.1 \
--data-dir /home/amnesia/Persistent/your/directory/to/the/blockchain

Expand Down
25 changes: 10 additions & 15 deletions contrib/epee/include/file_io_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <boost/filesystem/operations.hpp>
#ifdef WIN32
#include <windows.h>
#include "string_tools.h"
#endif

// On Windows there is a problem with non-ASCII characters in path and file names
Expand Down Expand Up @@ -72,11 +73,9 @@ namespace file_io_utils
bool save_string_to_file(const std::string& path_to_file, const std::string& str)
{
#ifdef WIN32
WCHAR wide_path[1000];
int chars = MultiByteToWideChar(CP_UTF8, 0, path_to_file.c_str(), path_to_file.size() + 1, wide_path, 1000);
if (chars == 0)
return false;
HANDLE file_handle = CreateFileW(wide_path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
std::wstring wide_path;
try { wide_path = string_tools::utf8_to_utf16(path_to_file); } catch (...) { return false; }
HANDLE file_handle = CreateFileW(wide_path.c_str(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (file_handle == INVALID_HANDLE_VALUE)
return false;
DWORD bytes_written;
Expand Down Expand Up @@ -131,11 +130,9 @@ namespace file_io_utils
bool load_file_to_string(const std::string& path_to_file, std::string& target_str, size_t max_size = 1000000000)
{
#ifdef WIN32
WCHAR wide_path[1000];
int chars = MultiByteToWideChar(CP_UTF8, 0, path_to_file.c_str(), path_to_file.size() + 1, wide_path, 1000);
if (chars == 0)
return false;
HANDLE file_handle = CreateFileW(wide_path, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
std::wstring wide_path;
try { wide_path = string_tools::utf8_to_utf16(path_to_file); } catch (...) { return false; }
HANDLE file_handle = CreateFileW(wide_path.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (file_handle == INVALID_HANDLE_VALUE)
return false;
DWORD file_size = GetFileSize(file_handle, NULL);
Expand Down Expand Up @@ -202,11 +199,9 @@ namespace file_io_utils
bool get_file_size(const std::string& path_to_file, uint64_t &size)
{
#ifdef WIN32
WCHAR wide_path[1000];
int chars = MultiByteToWideChar(CP_UTF8, 0, path_to_file.c_str(), path_to_file.size() + 1, wide_path, 1000);
if (chars == 0)
return false;
HANDLE file_handle = CreateFileW(wide_path, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
std::wstring wide_path;
try { wide_path = string_tools::utf8_to_utf16(path_to_file); } catch (...) { return false; }
HANDLE file_handle = CreateFileW(wide_path.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (file_handle == INVALID_HANDLE_VALUE)
return false;
LARGE_INTEGER file_size;
Expand Down
8 changes: 8 additions & 0 deletions contrib/epee/include/storages/portable_storage_from_bin.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ namespace epee
storage_entry load_storage_entry();
void read(section& sec);
void read(std::string& str);
void read(array_entry &ae);
private:
struct recursuion_limitation_guard
{
Expand Down Expand Up @@ -114,6 +115,7 @@ namespace epee
void throwable_buffer_reader::read(t_pod_type& pod_val)
{
RECURSION_LIMITATION();
static_assert(std::is_pod<t_pod_type>::value, "POD type expected");
read(&pod_val, sizeof(pod_val));
}

Expand Down Expand Up @@ -277,5 +279,11 @@ namespace epee
m_ptr+=len;
m_count -= len;
}
inline
void throwable_buffer_reader::read(array_entry &ae)
{
RECURSION_LIMITATION();
CHECK_AND_ASSERT_THROW_MES(false, "Reading array entry is not supported");
}
}
}
13 changes: 8 additions & 5 deletions contrib/epee/include/storages/portable_storage_from_json.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
#include "parserse_base_utils.h"
#include "file_io_utils.h"

#define EPEE_JSON_RECURSION_LIMIT_INTERNAL 100

namespace epee
{
using namespace misc_utils::parse;
Expand All @@ -44,8 +46,9 @@ namespace epee
ASSERT_MES_AND_THROW("json parse error");
}*/
template<class t_storage>
inline void run_handler(typename t_storage::hsection current_section, std::string::const_iterator& sec_buf_begin, std::string::const_iterator buf_end, t_storage& stg)
inline void run_handler(typename t_storage::hsection current_section, std::string::const_iterator& sec_buf_begin, std::string::const_iterator buf_end, t_storage& stg, unsigned int recursion)
{
CHECK_AND_ASSERT_THROW_MES(recursion < EPEE_JSON_RECURSION_LIMIT_INTERNAL, "Wrong JSON data: recursion limitation (" << EPEE_JSON_RECURSION_LIMIT_INTERNAL << ") exceeded");

std::string::const_iterator sub_element_start;
std::string name;
Expand Down Expand Up @@ -157,7 +160,7 @@ namespace epee
//sub section here
typename t_storage::hsection new_sec = stg.open_section(name, current_section, true);
CHECK_AND_ASSERT_THROW_MES(new_sec, "Failed to insert new section in json: " << std::string(it, buf_end));
run_handler(new_sec, it, buf_end, stg);
run_handler(new_sec, it, buf_end, stg, recursion + 1);
state = match_state_wonder_after_value;
}else if(*it == '[')
{//array of something
Expand Down Expand Up @@ -186,7 +189,7 @@ namespace epee
typename t_storage::hsection new_sec = nullptr;
h_array = stg.insert_first_section(name, new_sec, current_section);
CHECK_AND_ASSERT_THROW_MES(h_array&&new_sec, "failed to create new section");
run_handler(new_sec, it, buf_end, stg);
run_handler(new_sec, it, buf_end, stg, recursion + 1);
state = match_state_array_after_value;
array_md = array_mode_sections;
}else if(*it == '"')
Expand Down Expand Up @@ -260,7 +263,7 @@ namespace epee
typename t_storage::hsection new_sec = NULL;
bool res = stg.insert_next_section(h_array, new_sec);
CHECK_AND_ASSERT_THROW_MES(res&&new_sec, "failed to insert next section");
run_handler(new_sec, it, buf_end, stg);
run_handler(new_sec, it, buf_end, stg, recursion + 1);
state = match_state_array_after_value;
}else CHECK_ISSPACE();
break;
Expand Down Expand Up @@ -362,7 +365,7 @@ namespace epee
std::string::const_iterator sec_buf_begin = buff_json.begin();
try
{
run_handler(nullptr, sec_buf_begin, buff_json.end(), stg);
run_handler(nullptr, sec_buf_begin, buff_json.end(), stg, 0);
return true;
}
catch(const std::exception& ex)
Expand Down
35 changes: 35 additions & 0 deletions contrib/epee/include/string_tools.h
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,41 @@ POP_WARNINGS
res = str.substr(0, pos);
return res;
}
//----------------------------------------------------------------------------
#ifdef _WIN32
inline std::wstring utf8_to_utf16(const std::string& str)
{
if (str.empty())
return {};
int wstr_size = MultiByteToWideChar(CP_UTF8, 0, &str[0], str.size(), NULL, 0);
if (wstr_size == 0)
{
throw std::runtime_error(std::error_code(GetLastError(), std::system_category()).message());
}
std::wstring wstr(wstr_size, wchar_t{});
if (!MultiByteToWideChar(CP_UTF8, 0, &str[0], str.size(), &wstr[0], wstr_size))
{
throw std::runtime_error(std::error_code(GetLastError(), std::system_category()).message());
}
return wstr;
}
inline std::string utf16_to_utf8(const std::wstring& wstr)
{
if (wstr.empty())
return {};
int str_size = WideCharToMultiByte(CP_UTF8, 0, &wstr[0], wstr.size(), NULL, 0, NULL, NULL);
if (str_size == 0)
{
throw std::runtime_error(std::error_code(GetLastError(), std::system_category()).message());
}
std::string str(str_size, char{});
if (!WideCharToMultiByte(CP_UTF8, 0, &wstr[0], wstr.size(), &str[0], str_size, NULL, NULL))
{
throw std::runtime_error(std::error_code(GetLastError(), std::system_category()).message());
}
return str;
}
#endif
}
}
#endif //_STRING_TOOLS_H_
9 changes: 5 additions & 4 deletions src/blockchain_db/lmdb/db_lmdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1306,20 +1306,21 @@ void BlockchainLMDB::open(const std::string& filename, const int db_flags)
auto get_result = mdb_get(txn, m_properties, &k, &v);
if(get_result == MDB_SUCCESS)
{
if (*(const uint32_t*)v.mv_data > VERSION)
const uint32_t db_version = *(const uint32_t*)v.mv_data;
if (db_version > VERSION)
{
MWARNING("Existing lmdb database was made by a later version. We don't know how it will change yet.");
MWARNING("Existing lmdb database was made by a later version (" << db_version << "). We don't know how it will change yet.");
compatible = false;
}
#if VERSION > 0
else if (*(const uint32_t*)v.mv_data < VERSION)
else if (db_version < VERSION)
{
// Note that there was a schema change within version 0 as well.
// See commit e5d2680094ee15889934fe28901e4e133cda56f2 2015/07/10
// We don't handle the old format previous to that commit.
txn.commit();
m_open = true;
migrate(*(const uint32_t *)v.mv_data);
migrate(db_version);
return;
}
#endif
Expand Down
8 changes: 4 additions & 4 deletions src/blockchain_utilities/blockchain_import.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ int pop_blocks(cryptonote::core& core, int num_blocks)
return num_blocks;
}

int check_flush(cryptonote::core &core, std::list<block_complete_entry> &blocks, bool force)
int check_flush(cryptonote::core &core, std::vector<block_complete_entry> &blocks, bool force)
{
if (blocks.empty())
return 0;
Expand All @@ -176,7 +176,7 @@ int check_flush(cryptonote::core &core, std::list<block_complete_entry> &blocks,
if (!force && new_height % HASH_OF_HASHES_STEP)
return 0;

std::list<crypto::hash> hashes;
std::vector<crypto::hash> hashes;
for (const auto &b: blocks)
{
cryptonote::block block;
Expand Down Expand Up @@ -312,7 +312,7 @@ int import_from_file(cryptonote::core& core, const std::string& import_file_path
MINFO("Reading blockchain from bootstrap file...");
std::cout << ENDL;

std::list<block_complete_entry> blocks;
std::vector<block_complete_entry> blocks;

// Skip to start_height before we start adding.
{
Expand Down Expand Up @@ -437,7 +437,7 @@ int import_from_file(cryptonote::core& core, const std::string& import_file_path
{
cryptonote::blobdata block;
cryptonote::block_to_blob(bp.block, block);
std::list<cryptonote::blobdata> txs;
std::vector<cryptonote::blobdata> txs;
for (const auto &tx: bp.txs)
{
txs.push_back(cryptonote::blobdata());
Expand Down
Loading

0 comments on commit 8f92f70

Please sign in to comment.