Skip to content

Commit

Permalink
Merge pull request #157 from ethereum/develop
Browse files Browse the repository at this point in the history
version 0.2.2 develop
  • Loading branch information
winsvega authored Jul 30, 2022
2 parents 1ee8186 + 766b462 commit 2286dc1
Show file tree
Hide file tree
Showing 134 changed files with 4,124 additions and 1,958 deletions.
17 changes: 10 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,21 @@ set(HUNTER_JOBS_NUMBER 4 CACHE STRING "Hunter jobs number")
set(HUNTER_CACHE_SERVERS "https://github.com/ethereum/hunter-cache" CACHE STRING "Hunter cache servers")

HunterGate(
URL "https://github.com/ruslo/hunter/archive/v0.23.44.tar.gz"
SHA1 "c4cfcc0cd39fdae8de08f6205b7f34cab4a7ba79"
LOCAL
URL "https://github.com/ruslo/hunter/archive/v0.23.44.tar.gz"
SHA1 "c4cfcc0cd39fdae8de08f6205b7f34cab4a7ba79"
LOCAL
)

project(retesteth VERSION 0.2.1)
set(VERSION_SUFFIX "difficulty")
project(retesteth VERSION 0.2.2)
set(VERSION_SUFFIX "testinfo")

set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
hunter_add_package(Boost COMPONENTS filesystem program_options system)
find_package(Boost CONFIG REQUIRED filesystem program_options system)
#hunter_add_package(Boost COMPONENTS filesystem program_options system)

execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/cmake/scripts/boost.sh filesystem program_options system)
set(BOOST_ROOT ${CMAKE_CURRENT_BINARY_DIR}/dependecies/boost/boost_1_79_0/)
find_package(Boost 1.79 REQUIRED COMPONENTS filesystem program_options system)

hunter_add_package(yaml-cpp)
find_package(yaml-cpp CONFIG REQUIRED)
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ENV TZ=Etc/UTC
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

RUN apt-get update \
&& apt-get install --yes git cmake g++ make perl psmisc \
&& apt-get install --yes git cmake g++ make perl psmisc curl \
&& rm -rf /var/lib/apt/lists/*

# Retesteth
Expand Down Expand Up @@ -40,8 +40,8 @@ RUN apt-get install wget && wget https://github.com/ethereum/solidity/releases/d
# Geth
RUN git clone --depth 1 -b master https://github.com/ethereum/go-ethereum.git /geth
RUN cd /geth && apt-get install wget \
&& wget https://dl.google.com/go/go1.15.7.linux-amd64.tar.gz \
&& tar -xvf go1.15.7.linux-amd64.tar.gz \
&& wget https://dl.google.com/go/go1.18.linux-amd64.tar.gz \
&& tar -xvf go1.18.linux-amd64.tar.gz \
&& mv go /usr/local && ln -s /usr/local/go/bin/go /bin/go \
&& make all && cp /geth/build/bin/evm /bin/evm \
&& cp /geth/build/bin/geth /bin/geth \
Expand Down
67 changes: 44 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,49 +1,72 @@
# retesteth
testeth via RPC (wiki: https://github.com/ethereum/retesteth/wiki)
testeth via RPC (wiki: https://github.com/ethereum/retesteth/wiki)
tests execution/generation via transition tool (https://ethereum-tests.readthedocs.io/en/latest/t8ntool-ref.html)
(Execution stats: http://retesteth.ethdevops.io/)

* A test generaion tool for the test fillers https://github.com/ethereum/tests/tree/develop/src
* A test generation tool for the test fillers https://github.com/ethereum/tests/tree/develop/src
* Building instruction for beginners: [retesteth + solidity build](https://github.com/ethereum/retesteth#building-instructions-for-beginners)
* [Usage tutorial](https://ethereum-tests.readthedocs.io/en/latest/retesteth-tutorial.html)

# The Goal

* A test tool that would be capable of running current Blockchain tests against any client by sending rpc request to the client instatnce on either local or remote host. (using unix or TCP sockets)
* Filling existing tests (generating post state from *Filler.json instruction files) using rpc and any exisiting client
* Running rpc request - response tests with a provided client on localhost
* A test tool that would be capable of running current Blockchain/State tests against any client
* On client side use test RPC or transition tool executable which exports client core logic of transaction execution on given state
* Filling existing tests (generating post state from *Filler.json instruction files) using the above and any existing client
* Running request - response tests with a provided client on localhost
* Bunch tests execution with many clients with many threads
* A minimum set of additional rpc methods for client to negotiate with the tool: https://github.com/ethereum/retesteth/wiki/RPC-Methods
* A minimum set of additional RPC methods for client to negotiate with the tool: https://github.com/ethereum/retesteth/wiki/RPC-Methods
* Or a simple transition tool that is also usefull for transaction debugging: https://ethereum-tests.readthedocs.io/en/latest/t8ntool-ref.html

# Current progress

* done: State tests execution and filling was done as PoC on ethereum cpp client (aleth)
* done: Tests execution using threads on localhost with multimple instances of a client (geth + aleth)
* done: Develop minimum set of rpc methods that are to be implemented on other clients and could be used to run tests via rpc
* done: State tests execution and filling was done as PoC on Ethereum cpp client (aleth)
* done: Tests execution using threads on localhost with multiple instances of a client (geth + aleth)
* done: Develop minimum set of RPC methods that are to be implemented on other clients and could be used to run tests via RPC
* done: PoC Running Blockchain tests using geth client
* done: Implement a set of PoC methods in other client then aleth
* done: Refactoring and stability when generating GeneralStateTests
* done: Blockchain test generation support
* now: Use retesteth to produce fork tests with geth/besu/aleth
* now: Refactor the code, impove stability
* done: Use retesteth to produce fork tests with geth/besu
* done: Refactor the code, improve stability
* now: Support and development, support teams

# Building instructions
Ubuntu (retesteth):
```
git clone [email protected]:ethereum/retesteth.git
cd retesteth
mkdir build
cd build
cmake ..
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j4
```
Or try building instruction for begginers: [retesteth + solidity build](https://github.com/ethereum/retesteth#building-instructions-for-beginners)

MacOS (retesteth + tests + geth):
```
HOMEBREW_NO_AUTO_UPDATE=1 brew install -q cmake ninja git [email protected]
git clone --depth 1 https://github.com/ethereum/go-ethereum.git
git clone --depth 1 https://github.com/ethereum/tests.git
cd go-ethereum
make all
ln -s ./build/bin/evm /usr/local/bin/evm
cd ..
git clone https://github.com/ethereum/retesteth.git
cd retesteth
mkdir build
cd build
cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../toolchain.cmake
cmake --build .
```
Or try building instruction for beginners: [retesteth + solidity build](https://github.com/ethereum/retesteth#building-instructions-for-beginners)


# Usage
WIKI: https://github.com/ethereum/retesteth/wiki
Requres to have a client installed on your system. Read the wiki page on detailed instruction on how to configure your client to work with `retesteth`
Wiki: https://github.com/ethereum/retesteth/wiki
Requires to have a client installed on your system. Read the wiki page on detailed instruction on how to configure your client to work with `retesteth`
https://github.com/ethereum/retesteth/wiki/Add-client-configuration-to-Retesteth
```
./retesteth -t GeneralStateTests
```bash
./retesteth -t GeneralStateTests -- --testpath "your path to ethereum/tests repo"
```

# Docker instructions
Expand Down Expand Up @@ -82,11 +105,11 @@ cd build
cmake ..
```

Now you should see the successful build files generation result:
Now you should see the successful build files generation result:
```
Configuring done
-- Generating done
-- Build files have been written
-- Build files have been written
```

Run the build command to compile:
Expand All @@ -97,10 +120,10 @@ make -j4

#### Solidity

check the available boost version by
check the available boost version by
`sudo apt-cache policy libboost-all-dev`

install boost dependency boost if version >=1.65
install boost dependency boost if version >=1.65
`sudo apt-get install libboost-all-dev`

Solidity building instructions:
Expand All @@ -118,5 +141,3 @@ make lllc -j4
```

### DONE!


36 changes: 28 additions & 8 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,24 @@ defaults:
name: "ConfigureMac"
working_directory: ~/build
command: |
cmake ../project -G "$GENERATOR" -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCOVERAGE=ON $CMAKE_OPTIONS -DCMAKE_TOOLCHAIN_FILE=~/project/toolchain.cmake
cmake ../project -G "$GENERATOR" -DCMAKE_BUILD_TYPE=$BUILD_TYPE $CMAKE_OPTIONS -DCMAKE_TOOLCHAIN_FILE=~/project/toolchain.cmake
build: &build
run:
name: "Build"
working_directory: ~/build
command: cmake --build . -- -j $BUILD_PARALLEL_JOBS

test-retesteth: &test-retesteth
run:
name: "Test-retesteth"
working_directory: ~/build/retesteth
command: |
./retesteth -t GeneralStateTests/stExample -- --testpath ~/project/tests
./retesteth -t BlockchainTests/ValidBlocks/bcExample -- --testpath ~/project/tests
./retesteth -t GeneralStateTests -- --checkhash --testpath ~/project/tests
./retesteth -t BlockchainTests -- --checkhash --testpath ~/project/tests
test: &test
run:
name: "Test"
Expand All @@ -51,7 +61,11 @@ defaults:
./retesteth -t EthObjectsSuite
./retesteth -t DataObjectTestSuite
./retesteth -t OptionsSuite
./retesteth -t ExpectSectionSuite
./retesteth -t StructTest
./retesteth -t MemoryLeak
# ./retesteth -t LLLCSuite
# ./retesteth -t trDataCompileSuite
# git clone --depth 1 https://github.com/ethereum/tests.git
# export ETHEREUM_TEST_PATH=~/build/testeth/tests
# ctest --output-on-failure -j $TEST_PARALLEL_JOBS
Expand Down Expand Up @@ -149,29 +163,35 @@ jobs:
- image: ethereum/cpp-build-env:7
steps: *linux-steps

macOS-XCode11:
macOS-XCode12:
environment:
- BUILD_TYPE: Release
- CXX: clang++
- GCOV: gcov
- GENERATOR: Ninja
- BUILD_PARALLEL_JOBS: 8
- TEST_PARALLEL_JOBS: 8
macos:
xcode: "11.3.1"
xcode: "12.5.1"
steps:
- checkout
- *environment-info
- run:
name: "Install macOS dependencies"
# Python3 and requests are needed for Hunter upload.
command: |
HOMEBREW_NO_AUTO_UPDATE=1 brew install -q cmake ninja
HOMEBREW_NO_AUTO_UPDATE=1 brew install -q cmake ninja git [email protected]
git clone --depth 1 https://github.com/ethereum/go-ethereum.git
git clone --depth 1 https://github.com/ethereum/tests.git
cd go-ethereum
make all
ln -s ~/project/go-ethereum/build/bin/evm /usr/local/bin/evm
- *environment-info
- *configureMac
# - *upload-hunter-cache
# - *install-solidity-mac
- *build
- *store-retesteth
- *test
- *test-retesteth
# - *upload-coverage-data

# TODO: Run GCC6 build only in develop branch.
Expand All @@ -181,6 +201,6 @@ workflows:
version: 2
cpp-ethereum:
jobs:
- macOS-XCode11
- macOS-XCode12
- Linux-Clang6
- Linux-GCC6-Debug
5 changes: 0 additions & 5 deletions cmake/Hunter/config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ hunter_config(
HTTP_CLIENT=NO
)

hunter_config(Boost VERSION 1.65.2
URL http://retesteth.ethdevops.io/dependencies/boost_1_65_1.tar.bz2
SHA1 4a5b0c3c1b1b9a4d6cb6a6cc395e903e76f76720
)

hunter_config(ethash VERSION 0.4.0
URL https://github.com/chfast/ethash/archive/v0.4.0.tar.gz
SHA1 fd92ffadff2931877a3b68685dd8c53f0bdec539
Expand Down
43 changes: 43 additions & 0 deletions cmake/scripts/boost.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/sh
echo "Build dependencies: "
echo "BOOST 1.79"

echo "working dir: "$(pwd)
if [ ! -d "dependecies" ]; then
mkdir dependecies
cd dependecies
mkdir boost
cd boost
else
cd "dependecies/boost"
fi


FILE=boost_1_79_0.tar.gz
if test -f "$FILE"; then
echo "$FILE exists, use downloaded version..."
else
curl -L --output boost_1_79_0.tar.gz "https://boostorg.jfrog.io/artifactory/main/release/1.79.0/source/boost_1_79_0.tar.gz"
fi

if [ ! -d "boost_1_79_0" ]; then
echo "unpack $FILE..."
tar -xf $FILE
cd boost_1_79_0
mkdir build
echo "configure boost: "
echo "bootstrap.sh --prefix=$(pwd)/build"
./bootstrap.sh --prefix=$(pwd)/build
libs=""
for var in "$@"
do
libs=$libs" --with-$var"
done
./b2 $libs link=static
else
echo "found boost previous build in $(pwd)/boost_1_79_0"
fi




Empty file modified dretesteth.sh
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion libdevcore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ add_library(devcore ${sources} ${headers})
# Needed to prevent including system-level boost headers:
target_include_directories(devcore SYSTEM PUBLIC ${Boost_INCLUDE_DIR})

target_link_libraries(devcore Boost::filesystem Boost::system)
target_link_libraries(devcore ${Boost_LIBRARIES})

#find_package(LevelDB)
#target_include_directories(devcore SYSTEM PUBLIC ${LEVELDB_INCLUDE_DIRS})
Expand Down
1 change: 1 addition & 0 deletions libdevcore/CommonIO.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include "Common.h"
#include "CommonData.h"
#include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>

namespace dev
{
Expand Down
2 changes: 1 addition & 1 deletion retesteth/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ if (JSONCPP)
add_definitions(-DJSONCPP)
target_link_libraries(${PROJECT_NAME} PUBLIC Boost::filesystem Boost::program_options Boost::system jsoncpp_lib_static yaml-cpp::yaml-cpp devcore devcrypto cryptopp-static CURL::libcurl)
else()
target_link_libraries(${PROJECT_NAME} PUBLIC Boost::filesystem Boost::program_options Boost::system yaml-cpp::yaml-cpp devcore devcrypto cryptopp-static CURL::libcurl)
target_link_libraries(${PROJECT_NAME} PUBLIC ${Boost_LIBRARIES} yaml-cpp::yaml-cpp devcore devcrypto cryptopp-static CURL::libcurl)
endif()
target_include_directories(${PROJECT_NAME} PRIVATE "../")
target_include_directories(${PROJECT_NAME} PRIVATE ${PROJECT_BINARY_DIR})
Expand Down
19 changes: 15 additions & 4 deletions retesteth/EthChecks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,28 @@ namespace logmessage
void eth_warning_message(std::string const& _message, unsigned _verbosity)
{
if (Options::get().logVerbosity >= _verbosity)
std::cout << cYellow << "WARNING: " << _message << "\x1b[0m" << std::endl;
{
if (Options::get().nologcolor)
std::cout << "WARNING: " << _message << std::endl;
else
std::cout << cYellow << "WARNING: " << _message << "\x1b[0m" << std::endl;
}
}

void eth_stdout_message(std::string const& _message, std::string const& _color)
{
if (_color.empty())
if (_color.empty() || Options::get().nologcolor)
std::cout << _message << std::endl;
else
std::cout << _color << _message << "\x1b[0m" << std::endl;
}

void eth_stderror_message(std::string const& _message)
{
std::cerr << cRed << _message << "\x1b[0m" << std::endl;
if (Options::get().nologcolor)
std::cerr << _message << std::endl;
else
std::cerr << cRed << _message << "\x1b[0m" << std::endl;
}

void eth_log_message(std::string const& _message, LogColor _color)
Expand All @@ -51,7 +59,10 @@ void eth_log_message(std::string const& _message, LogColor _color)
default:
break;
}
std::cout << s_pre << _message << "\x1b[0m" << std::endl;
if (Options::get().nologcolor)
std::cout << _message << std::endl;
else
std::cout << s_pre << _message << "\x1b[0m" << std::endl;
}

void eth_error(std::string const& _message)
Expand Down
Loading

0 comments on commit 2286dc1

Please sign in to comment.