Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ ARG GETH_SRC="https://github.com/ethereum/go-ethereum.git"
ARG NIMBUS_SRC="https://github.com/status-im/nimbus-eth1.git"
ARG EVMONE_SRC="https://github.com/ethereum/evmone.git"
ARG PYT8N_SRC="https://github.com/ethereum/execution-specs.git"
ARG NETHERMIND_SRC="https://github.com/NethermindEth/nethermind.git"

# Leave empty to disable the build, can point to commit hash as well
ARG BESU="main"
Expand All @@ -18,6 +19,7 @@ ARG RETESTETH="develop"
ARG PYSPECS="main"
ARG EVMONE="master"
ARG PYT8N="master"
ARG NETHERMIND="feature/t8n-test"

SHELL ["/bin/bash", "-c"]
ENV TZ=Etc/UTC
Expand All @@ -30,6 +32,10 @@ RUN apt-get update \
&& add-apt-repository -y ppa:deadsnakes/ppa \
&& add-apt-repository ppa:linuxuprising/java \
&& apt-get install --yes jq lsof git cmake make perl psmisc curl wget gcc-11 g++-11 python3.10 python3.10-venv python3-pip python3-dev \
&& wget https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/packages-microsoft-prod.deb -O packages-microsoft-prod.deb \

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is better to move this under condition as well. as if docker is being built for geth only no need to install nethermind pre requirements

&& dpkg -i packages-microsoft-prod.deb \
&& apt-get install -y apt-transport-https \
&& apt-get install -y dotnet-sdk-8.0 \
&& apt-get install --yes libboost-filesystem-dev libboost-system-dev libboost-program-options-dev libboost-test-dev \
&& echo oracle-java17-installer shared/accepted-oracle-license-v1-3 select true | /usr/bin/debconf-set-selections \
&& apt-get install --yes oracle-java17-installer oracle-java17-set-default \
Expand Down Expand Up @@ -58,7 +64,7 @@ RUN wget https://github.com/ethereum/solidity/releases/download/v0.8.21/solc-sta
&& chmod +x /bin/solc

# Pyspecs
RUN git clone $PYSPECS_SRC /execution-spec-tests
RUN git clone $PYSPECS_SRC /execution-spec-tests
RUN cd /execution-spec-tests && git fetch && git checkout $PYSPECS \
&& python3 -m venv ./venv/ \
&& source ./venv/bin/activate \
Expand Down Expand Up @@ -87,6 +93,16 @@ RUN test -n "$GETH" \
&& rm -rf /geth && rm -rf /usr/local/go \
|| echo "Geth is empty"

# Nethermind
RUN test -n "$NETHERMIND" \
&& git clone $NETHERMIND_SRC /nethermind \
&& cd /nethermind && git fetch && git checkout $NETHERMIND \
&& dotnet build ./src/Nethermind/Nethermind.sln \
&& dotnet build ./src/Nethermind/EthereumTests.sln \
&& dotnet build ./tools/Evm/Evm.sln \
|| echo "Nethermind is empty"
# run the following command in order to run nethermind evm tool: /nethermind/tools/Evm/Evm/bin/Debug/net8.0/Evm t8n [options]

# Nimbus
RUN test -n "$NIMBUS" \
&& apt-get update \
Expand Down
3 changes: 3 additions & 0 deletions dretesteth.sh
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ if [ "$SCRIPT_NAME" = "dtf.sh" ]; then
if [ "$var" = "nimbus" ]; then
binpath="/bin/evm_nimbus"
fi
if [ "$var" = "nethermind" ]; then
binpath="/nethermind/tools/Evm/Evm/bin/Debug/net8.0/Evm"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to save space I copy built binaries into bin folder inside docker and remove all src and build files that are no longer required for it to run. making docker image smaller.

fi
if [ "$var" = "besu" ]; then
binpath="/usr/bin/besuevm"
fi
Expand Down
4 changes: 4 additions & 0 deletions retesteth/configs/Options.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ extern std::string const t8ntool_start;
#define DECLARE_ETHJS(X) \
FOR_EACH(X, ethereumjscfg)

#define DECLARE_NETHERMIND_T8N(X) \
FOR_EACH(X, nethermindt8ncfg)

// Main Configs (T8NTOOL is the base config that puts in to default for other clients as well)
DECLARE_T8NTOOL(REGISTER)
Expand All @@ -68,6 +70,7 @@ DECLARE_OEWRAP(REGISTER)
DECLARE_ETHJS(REGISTER)
DECLARE_NIMBUS(REGISTER)
DECLARE_PYT8N(REGISTER)
DECLARE_NETHERMIND_T8N(REGISTER)

// Example configs
DECLARE_T8NTOOL_EIP(REGISTER)
Expand All @@ -88,6 +91,7 @@ class OptionsInit
DECLARE_ETHJS(INIT)
DECLARE_NIMBUS(INIT)
DECLARE_PYT8N(INIT)
DECLARE_NETHERMIND_T8N(INIT)

DECLARE_T8NTOOL_EIP(INIT)
DECLARE_ALETH(INIT)
Expand Down
382 changes: 382 additions & 0 deletions retesteth/configs/clientconfigs/nethermind.cpp

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,6 @@ void BlockchainTestEnv::initializeCommonFields(DataObject const& _data)
{
m_currentNumber = sVALUE(_data.atKey(c_number));
m_currentTimestamp = sVALUE(_data.atKey(c_timestamp));
m_previousHash = sFH32(_data.atKey(c_parentHash));
m_currentExtraData = sBYTES(_data.atKey(c_extraData));
m_currentNonce = sFH8(_data.atKey(c_nonce));
m_currentMixHash = sFH32(_data.atKey(c_mixHash));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ spDataObject formatRawDataToRPCformat(spDataObject& _data)
(*out).atKeyPointer("currentNumber") = (*_data).atKeyPointerUnsafe(c_number);
(*out).atKeyPointer("currentTimestamp") = (*_data).atKeyPointerUnsafe(c_timestamp);
(*out).atKeyPointer("currentGasLimit") = (*_data).atKeyPointerUnsafe(c_gasLimit);
(*out).atKeyPointer("previousHash") = (*_data).atKeyPointerUnsafe(c_parentHash);
if (_data->count(c_baseFeePerGas))
(*out).atKeyPointer("currentBaseFee") = (*_data).atKeyPointerUnsafe(c_baseFeePerGas);
if (_data->count(c_excessBlobGas))
Expand All @@ -199,7 +198,6 @@ void BlockchainTestFillerEnv::initializeCommonFields(spDataObject const& _data,
{
m_currentNumber = sVALUE(_data->atKey(c_number));
m_currentTimestamp = sVALUE(_data->atKey(c_timestamp));
m_previousHash = sFH32(_data->atKey(c_parentHash));
m_currentExtraData = sBYTES(_data->atKey(c_extraData));
m_currentCoinbase = sFH20(_data->atKey(c_coinbase));
m_currentGasLimit = sVALUE(_data->atKey(c_gasLimit));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ struct StateTestEnvBase : GCP_SPointerBase
BYTES const& currentExtraData() const { return m_currentExtraData; }
FH8 const& currentNonce() const { return m_currentNonce; }
FH32 const& currentMixHash() const { return m_currentMixHash; }
FH32 const& previousHash() const { return m_previousHash; }
virtual spDataObject const& asDataObject() const;
virtual ~StateTestEnvBase() {}

Expand All @@ -40,7 +39,6 @@ struct StateTestEnvBase : GCP_SPointerBase
spVALUE m_currentGasLimit;
spVALUE m_currentNumber;
spVALUE m_currentTimestamp;
spFH32 m_previousHash;
spBYTES m_currentExtraData;
spFH8 m_currentNonce;
spFH32 m_currentMixHash;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ void requireStateTestEnvScheme(DataObject const& _data)
{c_parentExcessBlobGas, {{DataType::String}, jsonField::Optional}},
{c_parentBlobGasUsed, {{DataType::String}, jsonField::Optional}},
{c_currentBeaconRoot, {{DataType::String}, jsonField::Optional}},
{"currentWithdrawalsRoot", {{DataType::String}, jsonField::Optional}},
{"previousHash", {{DataType::String}, jsonField::Required}}});
{"currentWithdrawalsRoot", {{DataType::String}, jsonField::Optional}}});
}

} // namespace
Expand All @@ -42,7 +41,6 @@ void StateTestEnv::initializeFields(DataObject const& _data)
m_currentTimestamp = sVALUE(_data.atKey("currentTimestamp"));
// Indicates zero block timestamp in StateTests
m_genesisTimestamp = sVALUE(0);
m_previousHash = sFH32(_data.atKey("previousHash"));

DataObject tmpD;
tmpD = "0x00"; // State Tests extra data is 0x00
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,14 @@ void requireStateTestsFillerEnvScheme(spDataObject const& _data)
{"currentRandom", {{DataType::String}, jsonField::Optional}},
{c_parentExcessBlobGas, {{DataType::String}, jsonField::Optional}},
{c_parentBlobGasUsed, {{DataType::String}, jsonField::Optional}},
{c_currentBeaconRoot, {{DataType::String}, jsonField::Optional}},
{"previousHash", {{DataType::String}, jsonField::Required}}});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems to be a rebase issue. can you rebase on top of develop branch?

{c_currentBeaconRoot, {{DataType::String}, jsonField::Optional}}});
}

void convertEnvDecFieldsToHex(spDataObject& _data)
{
(*_data).performModifier(mod_valueToCompactEvenHexPrefixed, DataObject::ModifierOption::RECURSIVE,
{"currentCoinbase", "previousHash", "currentRandom"});
{"currentCoinbase", "currentRandom"});
(*_data).atKeyUnsafe("currentCoinbase").performModifier(mod_valueInsertZeroXPrefix);
(*_data).atKeyUnsafe("previousHash").performModifier(mod_valueInsertZeroXPrefix);
(*_data).performModifier(mod_valueToLowerCase);
}
} // namespace
Expand Down Expand Up @@ -64,8 +62,6 @@ void StateTestFillerEnv::initializeFields(spDataObject const& _data)
// Indicates zero block timestamp in StateTests
m_genesisTimestamp = sVALUE(0);

m_previousHash = sFH32(_data->atKey("previousHash"));

spDataObject tmpD(new DataObject("0x00")); // State Tests extra data is 0x00
m_currentExtraData = sBYTES(tmpD);
m_currentNonce = spFH8(FH8::zero().copy());
Expand Down
40 changes: 40 additions & 0 deletions web/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,20 @@ if [ "$1" = "nimbus" ] || [ -z "$1" ]; then
make t8n -j2
fi

if [ "$1" = "nethermind" ] || [ "$1" = "nethermindt8ntool" ] || [ -z "$1" ]; then
echo "Fetch nethermind: "
cd $BUILDPATH/nethermind
git reset --hard HEAD~1
git fetch origin
git checkout feature/t8n-test
git pull
rm ./src/Nethermind/artifacts
rm ./tools/Evm/Evm/bin
rm ./tools/Evm/Evm/obj
NETHERMIND_HEAD=$(git rev-parse HEAD | cut -c1-7)
echo "Build nethermind: "
make all
fi

#if [ "$1" = "oewrap" ] || [ -z "$1" ]; then
# echo "Fetch open-ethereum: "
Expand Down Expand Up @@ -151,6 +165,7 @@ cleanMem() {
killall python
killall node
killall nimbus
killall nethermind
sleep 10
}

Expand Down Expand Up @@ -194,6 +209,9 @@ runCmd() {
if [ "$client" = "nimbus" ]; then
headinfo="Nimbus: #$NIMBUS_HEAD"
fi
if [ "$client" = "nethermind" ]; then
headinfo="Nethermind: #NETHERMIND_HEAD"
fi
if [ "$client" = "retesteth" ]; then
clientcfg=""
fi
Expand Down Expand Up @@ -289,6 +307,26 @@ if [ "$cname" = "t8ntool" ] || [ -z "$cname" ]; then
fi
fi

if [ "$cname" = "nethermind" ] || [ -z "$cname" ]; then
sleep 10
threads=2
client="nethermind"
CMD="-t GeneralStateTests -- --all -j$threads $arg2"
runCmd
CMD="-t BlockchainTests -- --all -j$threads $arg2"
runCmd
CMD="-t TransactionTests -- --all -j$threads $arg2"
runCmd
CMD="-t DifficultyTests -- --all -j$threads $arg2"
runCmd
if [ "$arg2" != "--filltests" ]; then
CMD="-t BCGeneralStateTests -- --all -j$threads $arg2"
runCmd
CMD="-t LegacyTests -- --all -j$threads $arg2"
runCmd
fi
fi

#if [ "$cname" = "oewrap" ] || [ -z "$cname" ]; then
# sleep 10
# threads=1
Expand Down Expand Up @@ -374,6 +412,8 @@ if [ "$cname" = "dretesteth" ] || [ -z "$cname" ]; then
client="dretesteth"
CMD="-t GeneralStateTests/stExample -- --singletest add11 --clients t8ntool -j$threads $arg2"
runCmd
CMD="-t GeneralStateTests/stExample -- --singletest add11 --clients nethermind -j$threads $arg2"
runCmd
CMD="-t GeneralStateTests/stExample -- --singletest add11 --clients besu -j$threads $arg2"
runCmd
CMD="-t GeneralStateTests/stExample -- --singletest add11 --clients ethereumjs -j$threads $arg2"
Expand Down