docker多机离线部署BCOS+WeBASE-Front
立即下载
资源介绍:
docker多机离线部署BCOS+WeBASE-Front
/*
This file is part of cpp-ethereum.
cpp-ethereum is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
cpp-ethereum is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with cpp-ethereum. If not, see .
*/
/** @file PrecompiledTest.cpp
* Preompiled contract implemetations testing.
*/
#include
#include
#include
#include
#include
using namespace std;
using namespace dev;
using namespace dev::eth;
using namespace dev::test;
namespace ut = boost::unit_test;
BOOST_FIXTURE_TEST_SUITE(PrecompiledTests, TestOutputHelperFixture)
BOOST_AUTO_TEST_CASE(modexpFermatTheorem)
{
PrecompiledExecutor exec = PrecompiledRegistrar::executor("modexp");
bytes in = fromHex(
"0000000000000000000000000000000000000000000000000000000000000001"
"0000000000000000000000000000000000000000000000000000000000000020"
"0000000000000000000000000000000000000000000000000000000000000020"
"03"
"fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2e"
"fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f");
auto res = exec(bytesConstRef(in.data(), in.size()));
BOOST_REQUIRE(res.first);
bytes expected = fromHex("0000000000000000000000000000000000000000000000000000000000000001");
BOOST_REQUIRE_EQUAL_COLLECTIONS(
res.second.begin(), res.second.end(), expected.begin(), expected.end());
}
BOOST_AUTO_TEST_CASE(modexpZeroBase)
{
PrecompiledExecutor exec = PrecompiledRegistrar::executor("modexp");
bytes in = fromHex(
"0000000000000000000000000000000000000000000000000000000000000000"
"0000000000000000000000000000000000000000000000000000000000000020"
"0000000000000000000000000000000000000000000000000000000000000020"
"fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2e"
"fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f");
auto res = exec(bytesConstRef(in.data(), in.size()));
BOOST_REQUIRE(res.first);
bytes expected = fromHex("0000000000000000000000000000000000000000000000000000000000000000");
BOOST_REQUIRE_EQUAL_COLLECTIONS(
res.second.begin(), res.second.end(), expected.begin(), expected.end());
}
BOOST_AUTO_TEST_CASE(modexpExtraByteIgnored)
{
PrecompiledExecutor exec = PrecompiledRegistrar::executor("modexp");
bytes in = fromHex(
"0000000000000000000000000000000000000000000000000000000000000001"
"0000000000000000000000000000000000000000000000000000000000000002"
"0000000000000000000000000000000000000000000000000000000000000020"
"03"
"ffff"
"8000000000000000000000000000000000000000000000000000000000000000"
"07");
auto res = exec(bytesConstRef(in.data(), in.size()));
BOOST_REQUIRE(res.first);
bytes expected = fromHex("3b01b01ac41f2d6e917c6d6a221ce793802469026d9ab7578fa2e79e4da6aaab");
BOOST_REQUIRE_EQUAL_COLLECTIONS(
res.second.begin(), res.second.end(), expected.begin(), expected.end());
}
BOOST_AUTO_TEST_CASE(modexpRightPadding)
{
PrecompiledExecutor exec = PrecompiledRegistrar::executor("modexp");
bytes in = fromHex(
"0000000000000000000000000000000000000000000000000000000000000001"
"0000000000000000000000000000000000000000000000000000000000000002"
"0000000000000000000000000000000000000000000000000000000000000020"
"03"
"ffff"
"80");
auto res = exec(bytesConstRef(in.data(), in.size()));
BOOST_REQUIRE(res.first);
bytes expected = fromHex("3b01b01ac41f2d6e917c6d6a221ce793802469026d9ab7578fa2e79e4da6aaab");
BOOST_REQUIRE_EQUAL_COLLECTIONS(
res.second.begin(), res.second.end(), expected.begin(), expected.end());
}
BOOST_AUTO_TEST_CASE(modexpMissingValues)
{
PrecompiledExecutor exec = PrecompiledRegistrar::executor("modexp");
bytes in = fromHex(
"0000000000000000000000000000000000000000000000000000000000000001"
"0000000000000000000000000000000000000000000000000000000000000002"
"0000000000000000000000000000000000000000000000000000000000000020"
"03");
auto res = exec(bytesConstRef(in.data(), in.size()));
BOOST_REQUIRE(res.first);
bytes expected = fromHex("0000000000000000000000000000000000000000000000000000000000000000");
BOOST_REQUIRE_EQUAL_COLLECTIONS(
res.second.begin(), res.second.end(), expected.begin(), expected.end());
}
BOOST_AUTO_TEST_CASE(modexpEmptyValue)
{
PrecompiledExecutor exec = PrecompiledRegistrar::executor("modexp");
bytes in = fromHex(
"0000000000000000000000000000000000000000000000000000000000000001"
"0000000000000000000000000000000000000000000000000000000000000000"
"0000000000000000000000000000000000000000000000000000000000000020"
"03"
"8000000000000000000000000000000000000000000000000000000000000000");
auto res = exec(bytesConstRef(in.data(), in.size()));
BOOST_REQUIRE(res.first);
bytes expected = fromHex("0000000000000000000000000000000000000000000000000000000000000001");
BOOST_REQUIRE_EQUAL_COLLECTIONS(
res.second.begin(), res.second.end(), expected.begin(), expected.end());
}
BOOST_AUTO_TEST_CASE(modexpZeroPowerZero)
{
PrecompiledExecutor exec = PrecompiledRegistrar::executor("modexp");
bytes in = fromHex(
"0000000000000000000000000000000000000000000000000000000000000001"
"0000000000000000000000000000000000000000000000000000000000000001"
"0000000000000000000000000000000000000000000000000000000000000020"
"00"
"00"
"80");
auto res = exec(bytesConstRef(in.data(), in.size()));
BOOST_REQUIRE(res.first);
bytes expected = fromHex("0000000000000000000000000000000000000000000000000000000000000001");
BOOST_REQUIRE_EQUAL_COLLECTIONS(
res.second.begin(), res.second.end(), expected.begin(), expected.end());
}
BOOST_AUTO_TEST_CASE(modexpZeroPowerZeroModZero)
{
PrecompiledExecutor exec = PrecompiledRegistrar::executor("modexp");
bytes in = fromHex(
"0000000000000000000000000000000000000000000000000000000000000001"
"0000000000000000000000000000000000000000000000000000000000000001"
"0000000000000000000000000000000000000000000000000000000000000020"
"00"
"00"
"00");
auto res = exec(bytesConstRef(in.data(), in.size()));
BOOST_REQUIRE(res.first);
bytes expected = fromHex("0000000000000000000000000000000000000000000000000000000000000000");
BOOST_REQUIRE_EQUAL_COLLECTIONS(
res.second.begin(), res.second.end(), expected.begin(), expected.end());
}
BOOST_AUTO_TEST_CASE(modexpModLengthZero)
{
PrecompiledExecutor exec = PrecompiledRegistrar::executor("modexp");
bytes in = fromHex(
"0000000000000000000000000000000000000000000000000000000000000001"
"0000000000000000000000000000000000000000000000000000000000000001"
"0000000000000000000000000000000000000000000000000000000000000000"
"01"
"01");
auto res = exec(bytesConstRef(in.data(), in.size()));
BOOST_REQUIRE(res.first);
BOOST_REQUIRE(res.second.empty());
}
BOOST_AUTO_TEST_CASE(modexpCostFermatTheorem)
{
PrecompiledPricer cost = PrecompiledRegistrar::pricer("modexp");
bytes in = fromHex(
"0000000000000000000000000000000000000000000000000000000000000001"
"000000000
资源文件列表:
FISCO-BCOS-2.9.1.zip 大约有858个文件