Browse Source

Target minimum of 3141592 gas limit, use the same as the minimum.

cl-refactor
Gav Wood 10 years ago
parent
commit
f3b063e33a
  1. 4
      alethzero/MainWin.cpp
  2. 10
      libethcore/BlockInfo.cpp
  3. 2
      libethcore/BlockInfo.h
  4. 2
      libethcore/Common.cpp
  5. 2
      libethcore/Params.cpp
  6. 2
      libethereum/CanonBlockChain.cpp
  7. 2
      mix/MixClient.cpp

4
alethzero/MainWin.cpp

@ -532,7 +532,7 @@ static string directICAP(dev::Address _a)
std::string d = toBase36<Address::size>(_a);
while (d.size() < 30)
d = "0" + d;
return iban("XT", d);
return iban("XE", d);
}
static Address fromICAP(std::string const& _s)
@ -542,7 +542,7 @@ static Address fromICAP(std::string const& _s)
std::tie(country, data) = fromIban(_s);
if (country.empty())
return Address();
if (country == "XT" && data.size() == 30)
if (country == "XE" && data.size() == 30)
// Direct ICAP
return fromBase36<Address::size>(data);
// TODO: Indirect ICAP

10
libethcore/BlockInfo.cpp

@ -192,17 +192,18 @@ void BlockInfo::populateFromParent(BlockInfo const& _parent)
stateRoot = _parent.stateRoot;
parentHash = _parent.hash;
number = _parent.number + 1;
gasLimit = calculateGasLimit(_parent);
gasLimit = selectGasLimit(_parent);
gasUsed = 0;
difficulty = calculateDifficulty(_parent);
}
u256 BlockInfo::calculateGasLimit(BlockInfo const& _parent) const
u256 BlockInfo::selectGasLimit(BlockInfo const& _parent) const
{
if (!parentHash)
return c_genesisGasLimit;
else
return max<u256>(c_minGasLimit, (_parent.gasLimit * (c_gasLimitBoundDivisor - 1) + (_parent.gasUsed * 6 / 5)) / c_gasLimitBoundDivisor);
// target minimum of 3141592
return max<u256>(max<u256>(c_minGasLimit, 3141592), (_parent.gasLimit * (c_gasLimitBoundDivisor - 1) + (_parent.gasUsed * 6 / 5)) / c_gasLimitBoundDivisor);
}
u256 BlockInfo::calculateDifficulty(BlockInfo const& _parent) const
@ -219,7 +220,8 @@ void BlockInfo::verifyParent(BlockInfo const& _parent) const
if (difficulty != calculateDifficulty(_parent))
BOOST_THROW_EXCEPTION(InvalidDifficulty() << RequirementError((bigint)calculateDifficulty(_parent), (bigint)difficulty));
if (gasLimit < _parent.gasLimit * (c_gasLimitBoundDivisor - 1) / c_gasLimitBoundDivisor ||
if (gasLimit < c_minGasLimit ||
gasLimit < _parent.gasLimit * (c_gasLimitBoundDivisor - 1) / c_gasLimitBoundDivisor ||
gasLimit > _parent.gasLimit * (c_gasLimitBoundDivisor + 1) / c_gasLimitBoundDivisor)
BOOST_THROW_EXCEPTION(InvalidGasLimit() << errinfo_min((bigint)_parent.gasLimit * (c_gasLimitBoundDivisor - 1) / c_gasLimitBoundDivisor) << errinfo_got((bigint)gasLimit) << errinfo_max((bigint)_parent.gasLimit * (c_gasLimitBoundDivisor + 1) / c_gasLimitBoundDivisor));

2
libethcore/BlockInfo.h

@ -127,7 +127,7 @@ public:
void populateFromParent(BlockInfo const& parent);
u256 calculateDifficulty(BlockInfo const& _parent) const;
u256 calculateGasLimit(BlockInfo const& _parent) const;
u256 selectGasLimit(BlockInfo const& _parent) const;
h256 seedHash() const;
/// sha3 of the header only.

2
libethcore/Common.cpp

@ -32,7 +32,7 @@ namespace dev
namespace eth
{
const unsigned c_protocolVersion = 57;
const unsigned c_protocolVersion = 58;
const unsigned c_databaseBaseVersion = 8;
#if ETH_FATDB
const unsigned c_databaseVersionModifier = 1000;

2
libethcore/Params.cpp

@ -31,7 +31,7 @@ namespace eth
u256 const c_genesisDifficulty = 131072;
u256 const c_maximumExtraDataSize = 1024;
u256 const c_epochDuration = 3000;
u256 const c_genesisGasLimit = 1000000;
u256 const c_genesisGasLimit = 3141592;
u256 const c_minGasLimit = 125000;
u256 const c_gasLimitBoundDivisor = 1024;
u256 const c_minimumDifficulty = 131072;

2
libethereum/CanonBlockChain.cpp

@ -86,7 +86,7 @@ bytes CanonBlockChain::createGenesisBlock()
}
block.appendList(15)
<< h256() << EmptyListSHA3 << h160() << stateRoot << EmptyTrie << EmptyTrie << LogBloom() << c_genesisDifficulty << 0 << 1000000 << 0 << (unsigned)0 << string() << h256() << Nonce(u64(42));
<< h256() << EmptyListSHA3 << h160() << stateRoot << EmptyTrie << EmptyTrie << LogBloom() << c_genesisDifficulty << 0 << c_genesisGasLimit << 0 << (unsigned)0 << string() << h256() << Nonce(u64(42));
block.appendRaw(RLPEmptyList);
block.appendRaw(RLPEmptyList);
return block.out();

2
mix/MixClient.cpp

@ -56,7 +56,7 @@ public:
RLPStream block(3);
block.appendList(15)
<< h256() << EmptyListSHA3 << h160() << _stateRoot << EmptyTrie << EmptyTrie
<< LogBloom() << c_mixGenesisDifficulty << 0 << 1000000 << 0 << (unsigned)0
<< LogBloom() << c_mixGenesisDifficulty << 0 << c_genesisGasLimit << 0 << (unsigned)0
<< std::string() << h256() << h64(u64(42));
block.appendRaw(RLPEmptyList);
block.appendRaw(RLPEmptyList);

Loading…
Cancel
Save