Compare commits

..

8 Commits

Author SHA1 Message Date
Nik Bougalis
ad2383bd4b Set version to 0.30.0-hf2 2016-01-27 12:27:27 -08:00
Nik Bougalis
5b5a01989c Improve compile-time OpenSSL version check 2016-01-27 12:27:18 -08:00
seelabs
c17f7e8b37 Enforce no-ripple constraints 2016-01-26 13:52:41 -08:00
Nik Bougalis
aa4f347e7c Set version to 0.30.0-hf1 2015-11-05 16:47:41 -08:00
Vinnie Falco
0a0adaac6d Set admin privileges on websocket:
When the websocket connection is established, any configured administrative
privileges are applied to resource limits.
2015-11-05 16:45:19 -08:00
JoelKatz
3d2aae9ea5 Make close time consensus detection use montonic close time rules 2015-11-04 13:49:54 -08:00
JoelKatz
3d5ff2b4cd Prevent some missed proposals, faster consensus catch up 2015-11-04 13:49:54 -08:00
David Schwartz
d20f0d5014 Make sure LedgerHistory::builtLedger gets called 2015-11-03 14:00:28 -08:00
10 changed files with 84 additions and 41 deletions

View File

@@ -114,7 +114,13 @@ AddOption('--ninja', dest='ninja', action='store_true',
help='generate ninja build file build.ninja') help='generate ninja build file build.ninja')
def parse_time(t): def parse_time(t):
return time.strptime(t, '%a %b %d %H:%M:%S %Z %Y') l = len(t.split())
if l==5:
return time.strptime(t, '%a %b %d %H:%M:%S %Y')
elif l==3:
return time.strptime(t, '%d %b %Y')
else:
return time.strptime(t, '%a %b %d %H:%M:%S %Z %Y')
CHECK_PLATFORMS = 'Debian', 'Ubuntu' CHECK_PLATFORMS = 'Debian', 'Ubuntu'
CHECK_COMMAND = 'openssl version -a' CHECK_COMMAND = 'openssl version -a'
@@ -126,17 +132,24 @@ UNITY_BUILD_DIRECTORY = 'src/ripple/unity/'
USE_CPP_14 = os.getenv('RIPPLED_USE_CPP_14') USE_CPP_14 = os.getenv('RIPPLED_USE_CPP_14')
def check_openssl(): def check_openssl():
if Beast.system.platform in CHECK_PLATFORMS: if Beast.system.platform not in ['Debian', 'Ubuntu']:
for line in subprocess.check_output(CHECK_COMMAND.split()).splitlines(): return
if line.startswith(CHECK_LINE): line = subprocess.check_output('openssl version -b'.split()).strip()
line = line[len(CHECK_LINE):] check_line = 'built on: '
if parse_time(line) < parse_time(BUILD_TIME): if not line.startswith(check_line):
raise Exception(OPENSSL_ERROR % (line, BUILD_TIME)) raise Exception("Didn't find any '%s' line in '$ %s'" %
else: (check_line, 'openssl version -b'))
break d = line[len(check_line):]
else: if 'date unspecified' in d:
raise Exception("Didn't find any '%s' line in '$ %s'" % words = subprocess.check_output('openssl version'.split()).split()
(CHECK_LINE, CHECK_COMMAND)) if len(words)!=5:
raise Exception("Didn't find version date in '$ openssl version'")
d = ' '.join(words[-3:])
build_time = 'Mon Apr 7 20:33:19 UTC 2014'
if parse_time(d) < parse_time(build_time):
raise Exception('Your openSSL was built on %s; '
'rippled needs a version built on or after %s.'
% (line, build_time))
def set_implicit_cache(): def set_implicit_cache():

View File

@@ -298,6 +298,13 @@ LedgerConsensusImp::LedgerConsensusImp (
// update the network status table as to whether we're // update the network status table as to whether we're
// proposing/validating // proposing/validating
consensus_.setProposing (mProposing, mValidating); consensus_.setProposing (mProposing, mValidating);
playbackProposals ();
if (mPeerPositions.size () > (mPreviousProposers / 2))
{
// We may be falling behind, don't wait for the timer
timerEntry ();
}
} }
Json::Value LedgerConsensusImp::getJson (bool full) Json::Value LedgerConsensusImp::getJson (bool full)
@@ -976,8 +983,6 @@ void LedgerConsensusImp::accept (std::shared_ptr<SHAMap> set)
consensus_.takePosition (mPreviousLedger->info().seq, set); consensus_.takePosition (mPreviousLedger->info().seq, set);
assert (set->getHash () == mOurPosition->getCurrentHash ()); assert (set->getHash () == mOurPosition->getCurrentHash ());
// these are now obsolete
consensus_.peekStoredProposals ().clear ();
} }
auto closeTime = mOurPosition->getCloseTime(); auto closeTime = mOurPosition->getCloseTime();
@@ -1546,8 +1551,10 @@ void LedgerConsensusImp::updateOurPositions ()
else else
{ {
// proposal is still fresh // proposal is still fresh
++closeTimes[roundCloseTime ( ++closeTimes[std::max (
it->second->getCloseTime (), mCloseResolution)]; roundCloseTime (it->second->getCloseTime (),
mCloseResolution),
mPreviousLedger->info().closeTime + 1)];
++it; ++it;
} }
} }
@@ -1599,16 +1606,20 @@ void LedgerConsensusImp::updateOurPositions ()
{ {
// no other times // no other times
mHaveCloseTimeConsensus = true; mHaveCloseTimeConsensus = true;
closeTime = roundCloseTime ( closeTime = std::max(
mOurPosition->getCloseTime (), mCloseResolution); roundCloseTime (mOurPosition->getCloseTime (),
mCloseResolution),
mPreviousLedger->info().closeTime + 1);
} }
else else
{ {
int participants = mPeerPositions.size (); int participants = mPeerPositions.size ();
if (mProposing) if (mProposing)
{ {
++closeTimes[roundCloseTime ( ++closeTimes[std::max (
mOurPosition->getCloseTime (), mCloseResolution)]; roundCloseTime (mOurPosition->getCloseTime (),
mCloseResolution),
mPreviousLedger->info().closeTime + 1)];
++participants; ++participants;
} }
@@ -1658,8 +1669,7 @@ void LedgerConsensusImp::updateOurPositions ()
} }
if (!changes && if (!changes &&
((closeTime != roundCloseTime ( ((closeTime != mOurPosition->getCloseTime ())
mOurPosition->getCloseTime (), mCloseResolution))
|| mOurPosition->isStale (ourCutoff))) || mOurPosition->isStale (ourCutoff)))
{ {
// close time changed or our position is stale // close time changed or our position is stale

View File

@@ -972,6 +972,8 @@ public:
<< "Consensus triggered check of ledger"; << "Consensus triggered check of ledger";
checkAccept (maxLedger, maxSeq); checkAccept (maxLedger, maxSeq);
} }
mLedgerHistory.builtLedger (ledger);
} }
void advanceThread() void advanceThread()

View File

@@ -1384,6 +1384,9 @@ void NetworkOPsImp::processTrustedProposal (
bool relay = true; bool relay = true;
if (mConsensus)
mConsensus->storeProposal (proposal, nodePublic);
if (!haveConsensusObject ()) if (!haveConsensusObject ())
{ {
m_journal.info << "Received proposal outside consensus window"; m_journal.info << "Received proposal outside consensus window";
@@ -1393,8 +1396,6 @@ void NetworkOPsImp::processTrustedProposal (
} }
else else
{ {
mConsensus->storeProposal (proposal, nodePublic);
if (mLedgerConsensus->getLCL () == proposal->getPrevLedger ()) if (mLedgerConsensus->getLCL () == proposal->getPrevLedger ())
{ {
relay = mLedgerConsensus->peerPosition (proposal); relay = mLedgerConsensus->peerPosition (proposal);

View File

@@ -799,6 +799,19 @@ TER PathState::checkNoRipple (
if (terStatus != tesSUCCESS) if (terStatus != tesSUCCESS)
return terStatus; return terStatus;
} }
if (!nodes_[i - 1].isAccount() &&
nodes_[i].isAccount() &&
nodes_[i + 1].isAccount() &&
nodes_[i -1].issue_.account != nodes_[i].account_)
{ // offer -> account -> account
auto const& currencyID = nodes_[i].issue_.currency;
terStatus = checkNoRipple (
nodes_[i-1].issue_.account, nodes_[i].account_, nodes_[i+1].account_,
currencyID);
if (terStatus != tesSUCCESS)
return terStatus;
}
} }
return tesSUCCESS; return tesSUCCESS;

View File

@@ -35,7 +35,7 @@ char const* getRawVersionString ()
// //
// The build version number (edit this for each release) // The build version number (edit this for each release)
// //
"0.30.0" "0.30.0-hf2"
// //
// Must follow the format described here: // Must follow the format described here:
// //

View File

@@ -112,9 +112,6 @@ public:
Consumer newInboundEndpoint (beast::IP::Endpoint const& address) Consumer newInboundEndpoint (beast::IP::Endpoint const& address)
{ {
if (isWhitelisted (address))
return newAdminEndpoint (to_string (address));
Entry* entry (nullptr); Entry* entry (nullptr);
{ {
@@ -146,9 +143,6 @@ public:
Consumer newOutboundEndpoint (beast::IP::Endpoint const& address) Consumer newOutboundEndpoint (beast::IP::Endpoint const& address)
{ {
if (isWhitelisted (address))
return newAdminEndpoint (to_string (address));
Entry* entry (nullptr); Entry* entry (nullptr);
{ {
@@ -370,14 +364,6 @@ public:
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
bool isWhitelisted (beast::IP::Endpoint const& address)
{
if (! is_public (address))
return true;
return false;
}
// Called periodically to expire entries and groom the table. // Called periodically to expire entries and groom the table.
// //
void periodicActivity () void periodicActivity ()

View File

@@ -22,6 +22,7 @@
#include <ripple/server/Port.h> #include <ripple/server/Port.h>
#include <ripple/json/json_value.h> #include <ripple/json/json_value.h>
#include <ripple/resource/ResourceManager.h>
#include <beast/net/IPEndpoint.h> #include <beast/net/IPEndpoint.h>
#include <vector> #include <vector>
@@ -47,6 +48,11 @@ Role
requestRole (Role const& required, HTTP::Port const& port, requestRole (Role const& required, HTTP::Port const& port,
Json::Value const& jsonRPC, beast::IP::Endpoint const& remoteIp); Json::Value const& jsonRPC, beast::IP::Endpoint const& remoteIp);
Resource::Consumer
requestInboundEndpoint (Resource::Manager& manager,
beast::IP::Endpoint const& remoteAddress,
HTTP::Port const& port);
} // ripple } // ripple
#endif #endif

View File

@@ -66,4 +66,15 @@ requestRole (Role const& required, HTTP::Port const& port,
return role; return role;
} }
Resource::Consumer
requestInboundEndpoint (Resource::Manager& manager,
beast::IP::Endpoint const& remoteAddress,
HTTP::Port const& port)
{
if (requestRole (Role::GUEST, port, Json::Value(), remoteAddress) ==
Role::ADMIN)
return manager.newAdminEndpoint (to_string (remoteAddress));
return manager.newInboundEndpoint(remoteAddress);
}
} }

View File

@@ -34,6 +34,7 @@
#include <ripple/rpc/Coroutine.h> #include <ripple/rpc/Coroutine.h>
#include <ripple/rpc/RPCHandler.h> #include <ripple/rpc/RPCHandler.h>
#include <ripple/server/Port.h> #include <ripple/server/Port.h>
#include <ripple/server/Role.h>
#include <ripple/json/to_string.h> #include <ripple/json/to_string.h>
#include <ripple/rpc/RPCHandler.h> #include <ripple/rpc/RPCHandler.h>
#include <ripple/rpc/Yield.h> #include <ripple/rpc/Yield.h>
@@ -133,8 +134,8 @@ ConnectionImpl <WebSocket>::ConnectionImpl (
connection_ptr const& cpConnection, connection_ptr const& cpConnection,
beast::IP::Endpoint const& remoteAddress, beast::IP::Endpoint const& remoteAddress,
boost::asio::io_service& io_service) boost::asio::io_service& io_service)
: InfoSub (source, // usage : InfoSub (source, requestInboundEndpoint (
resourceManager.newInboundEndpoint (remoteAddress)) resourceManager, remoteAddress, handler.port()))
, app_(app) , app_(app)
, m_port (handler.port ()) , m_port (handler.port ())
, m_resourceManager (resourceManager) , m_resourceManager (resourceManager)