mirror of
https://github.com/Xahau/xahaud.git
synced 2025-11-16 16:45:50 +00:00
rework logic for bootstrap ips, parsing correctly inline comments
This commit is contained in:
@@ -509,7 +509,8 @@ Change::activateXahauGenesis()
|
|||||||
|
|
||||||
hookDef->setFieldH256(sfHookHash, hookHash);
|
hookDef->setFieldH256(sfHookHash, hookHash);
|
||||||
hookDef->setFieldH256(sfHookOn, hookOn);
|
hookDef->setFieldH256(sfHookOn, hookOn);
|
||||||
hookDef->setFieldH256(sfHookNamespace, UINT256_BIT[hookCount++]);
|
hookDef->setFieldH256(sfHookNamespace,
|
||||||
|
ripple::uint256("0000000000000000000000000000000000000000000000000000000000000000"));
|
||||||
|
|
||||||
// parameters
|
// parameters
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -470,6 +470,7 @@ OverlayImpl::remove(std::shared_ptr<PeerFinder::Slot> const& slot)
|
|||||||
void
|
void
|
||||||
OverlayImpl::start()
|
OverlayImpl::start()
|
||||||
{
|
{
|
||||||
|
|
||||||
PeerFinder::Config config = PeerFinder::Config::makeConfig(
|
PeerFinder::Config config = PeerFinder::Config::makeConfig(
|
||||||
app_.config(),
|
app_.config(),
|
||||||
serverHandler_.setup().overlay.port,
|
serverHandler_.setup().overlay.port,
|
||||||
@@ -479,58 +480,50 @@ OverlayImpl::start()
|
|||||||
m_peerFinder->setConfig(config);
|
m_peerFinder->setConfig(config);
|
||||||
m_peerFinder->start();
|
m_peerFinder->start();
|
||||||
|
|
||||||
// Populate our boot cache: if there are no entries in [ips] then we use
|
auto addIps = [&](std::vector<std::string> bootstrapIps) -> void
|
||||||
// the entries in [ips_fixed].
|
|
||||||
auto bootstrapIps =
|
|
||||||
app_.config().IPS.empty() ? app_.config().IPS_FIXED : app_.config().IPS;
|
|
||||||
|
|
||||||
if (bootstrapIps.empty())
|
|
||||||
// bootstrapIps.push_back("0.0.0.0 21337");
|
|
||||||
bootstrapIps.push_back("bacab.alloy.ee 21337");
|
|
||||||
|
|
||||||
m_resolver.resolve(
|
|
||||||
bootstrapIps,
|
|
||||||
[this](
|
|
||||||
std::string const& name,
|
|
||||||
std::vector<beast::IP::Endpoint> const& addresses) {
|
|
||||||
std::vector<std::string> ips;
|
|
||||||
ips.reserve(addresses.size());
|
|
||||||
for (auto const& addr : addresses)
|
|
||||||
{
|
|
||||||
if (addr.port() == 0)
|
|
||||||
ips.push_back(to_string(addr.at_port(DEFAULT_PEER_PORT)));
|
|
||||||
else
|
|
||||||
ips.push_back(to_string(addr));
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string const base("config: ");
|
|
||||||
if (!ips.empty())
|
|
||||||
m_peerFinder->addFallbackStrings(base + name, ips);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Add the ips_fixed from the rippled.cfg file
|
|
||||||
if (!app_.config().standalone() && !app_.config().IPS_FIXED.empty())
|
|
||||||
{
|
{
|
||||||
|
|
||||||
|
beast::Journal const& j = app_.journal("Overlay");
|
||||||
|
for (auto& ip : bootstrapIps)
|
||||||
|
{
|
||||||
|
std::size_t pos = ip.find('#');
|
||||||
|
if (pos != std::string::npos)
|
||||||
|
ip.erase(pos);
|
||||||
|
|
||||||
|
JLOG(j.trace()) << "Found boostrap IP: " << ip;
|
||||||
|
}
|
||||||
|
|
||||||
m_resolver.resolve(
|
m_resolver.resolve(
|
||||||
app_.config().IPS_FIXED,
|
bootstrapIps,
|
||||||
[this](
|
[&](
|
||||||
std::string const& name,
|
std::string const& name,
|
||||||
std::vector<beast::IP::Endpoint> const& addresses) {
|
std::vector<beast::IP::Endpoint> const& addresses) {
|
||||||
std::vector<beast::IP::Endpoint> ips;
|
std::vector<std::string> ips;
|
||||||
ips.reserve(addresses.size());
|
ips.reserve(addresses.size());
|
||||||
|
beast::Journal const& j = app_.journal("Overlay");
|
||||||
for (auto& addr : addresses)
|
for (auto const& addr : addresses)
|
||||||
{
|
{
|
||||||
if (addr.port() == 0)
|
std::string addrStr =
|
||||||
ips.emplace_back(addr.address(), DEFAULT_PEER_PORT);
|
addr.port() == 0
|
||||||
else
|
? to_string(addr.at_port(DEFAULT_PEER_PORT))
|
||||||
ips.emplace_back(addr);
|
: to_string(addr);
|
||||||
|
JLOG(j.trace()) << "Parsed boostrap IP: " << addrStr;
|
||||||
|
ips.push_back(addrStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string const base("config: ");
|
||||||
if (!ips.empty())
|
if (!ips.empty())
|
||||||
m_peerFinder->addFixedPeer(name, ips);
|
m_peerFinder->addFallbackStrings(base + name, ips);
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
|
if (!app_.config().IPS.empty())
|
||||||
|
addIps(app_.config().IPS);
|
||||||
|
|
||||||
|
if (!app_.config().IPS_FIXED.empty())
|
||||||
|
addIps(app_.config().IPS_FIXED);
|
||||||
|
|
||||||
auto const timer = std::make_shared<Timer>(*this);
|
auto const timer = std::make_shared<Timer>(*this);
|
||||||
std::lock_guard lock(mutex_);
|
std::lock_guard lock(mutex_);
|
||||||
list_.emplace(timer.get(), timer);
|
list_.emplace(timer.get(), timer);
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ struct XahauGenesis_test : public beast::unit_test::suite
|
|||||||
ripple::uint256("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFFFFFFFFFFFFFBFFFFF"));
|
ripple::uint256("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFFFFFFFFFFFFFBFFFFF"));
|
||||||
std::cout << "06\n";
|
std::cout << "06\n";
|
||||||
BEAST_EXPECT(govSLE->getFieldH256(sfHookNamespace) ==
|
BEAST_EXPECT(govSLE->getFieldH256(sfHookNamespace) ==
|
||||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000000001"));
|
ripple::uint256("0000000000000000000000000000000000000000000000000000000000000000"));
|
||||||
std::cout << "07\n";
|
std::cout << "07\n";
|
||||||
BEAST_EXPECT(govSLE->getFieldU16(sfHookApiVersion) == 0);
|
BEAST_EXPECT(govSLE->getFieldU16(sfHookApiVersion) == 0);
|
||||||
auto const govFee = govSLE->getFieldAmount(sfFee);
|
auto const govFee = govSLE->getFieldAmount(sfFee);
|
||||||
@@ -154,9 +154,9 @@ struct XahauGenesis_test : public beast::unit_test::suite
|
|||||||
std::cout << "15\n";
|
std::cout << "15\n";
|
||||||
BEAST_EXPECT(rwdSLE->getFieldH256(sfHookOn) ==
|
BEAST_EXPECT(rwdSLE->getFieldH256(sfHookOn) ==
|
||||||
ripple::uint256("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBFFFFFFFFFFFFFFFFFFBFFFFF"));
|
ripple::uint256("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBFFFFFFFFFFFFFFFFFFBFFFFF"));
|
||||||
std::cout << "16\n";
|
std::cout << "16 :: " << rwdSLE->getFieldH256(sfHookNamespace) << "\n";
|
||||||
BEAST_EXPECT(rwdSLE->getFieldH256(sfHookNamespace) ==
|
BEAST_EXPECT(rwdSLE->getFieldH256(sfHookNamespace) ==
|
||||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000000010"));
|
ripple::uint256("0000000000000000000000000000000000000000000000000000000000000000"));
|
||||||
std::cout << "17\n";
|
std::cout << "17\n";
|
||||||
BEAST_EXPECT(rwdSLE->getFieldU16(sfHookApiVersion) == 0);
|
BEAST_EXPECT(rwdSLE->getFieldU16(sfHookApiVersion) == 0);
|
||||||
auto const rwdFee = rwdSLE->getFieldAmount(sfFee);
|
auto const rwdFee = rwdSLE->getFieldAmount(sfFee);
|
||||||
@@ -171,9 +171,52 @@ struct XahauGenesis_test : public beast::unit_test::suite
|
|||||||
|
|
||||||
// RH TODO:
|
// RH TODO:
|
||||||
// check hookparameters
|
// check hookparameters
|
||||||
// check wasm hash
|
|
||||||
// check gensis hooks array
|
// check gensis hooks array
|
||||||
// check start ledger
|
// check start ledger
|
||||||
|
|
||||||
|
// governance hook tests:
|
||||||
|
// last member tries to remove themselves
|
||||||
|
// try to add more than 20 members
|
||||||
|
// add a member normally
|
||||||
|
// remove a member normally
|
||||||
|
// add a member normally then re-action by adding another vote
|
||||||
|
// add a member normally then ensure it's not undone by removing one of the votes
|
||||||
|
// remove a member normally then re-action by adding another vote
|
||||||
|
// remove a member normally then ensure it's not undone when removing one of the votes
|
||||||
|
// action a hook change
|
||||||
|
// action a hook change to a non-existent hook
|
||||||
|
// action a reward rate change
|
||||||
|
// action a reward delay change
|
||||||
|
// L2 versions of all of the above
|
||||||
|
|
||||||
|
// reward hook tests:
|
||||||
|
// test claim reward before time
|
||||||
|
// test claim reward after time
|
||||||
|
// test claim reward when UNL report empty
|
||||||
|
// test claim reward when UNL report full
|
||||||
|
|
||||||
|
// genesis mint tests:
|
||||||
|
// test send from non-genesis account emitted txn
|
||||||
|
// test send from non-genesis account non-emitted txn
|
||||||
|
// test send from genesis account emitted txn
|
||||||
|
// test send from genesis account non-emitted txn
|
||||||
|
// test send to account that doesn't exist
|
||||||
|
// test send an overflow amount
|
||||||
|
// test set governance flags
|
||||||
|
// test no-destinations specified
|
||||||
|
|
||||||
|
// unl report test:
|
||||||
|
// test several validators all get on the list
|
||||||
|
// test several validators all vote different vl import keys
|
||||||
|
// test badly behaved validators dont get on the list
|
||||||
|
// test no validators on list
|
||||||
|
// test whole unl on list
|
||||||
|
|
||||||
|
// account counter
|
||||||
|
// test import created accounts get a sequence
|
||||||
|
// test payment created accounts get a sequence
|
||||||
|
// test genesis mint created accounts get a sequence
|
||||||
|
// test rpc
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
Reference in New Issue
Block a user