22 if(defaultData.size() == 39 && checkData.size() == 39) {
23 for(
size_t i = 0; i < defaultData.size(); i++) {
24 uint32_t
max = defaultData[i] * 1000 > 0 ? defaultData[i] * 1000 : 1 * 1000;
25 uint32_t
min = defaultData[i] / 100 > 0 ? defaultData[i] / 100 : 1;
26 if(checkData[i] > max || checkData[i] < min) {
58 uint32_t result = DEFAULT_BLOCK_SIZE_DGP;
60 if(blockSize <= MAX_BLOCK_SIZE_DGP && blockSize >= MIN_BLOCK_SIZE_DGP) {
68 uint64_t result = DEFAULT_MIN_GAS_PRICE_DGP;
70 if(minGasPrice <= MAX_MIN_GAS_PRICE_DGP && minGasPrice >= MIN_MIN_GAS_PRICE_DGP) {
78 uint64_t result = DEFAULT_BLOCK_GAS_LIMIT_DGP;
80 uint64_t blockGasLimit =
getUint64FromDGP(blockHeight, BlockGasLimitDGP, phex);
81 if(blockGasLimit <= MAX_BLOCK_GAS_LIMIT_DGP && blockGasLimit >= MIN_BLOCK_GAS_LIMIT_DGP) {
82 result = blockGasLimit;
115 dev::h256 paramsInstanceHash =
sha3(
dev::h256(
"0000000000000000000000000000000000000000000000000000000000000000"));
118 for(
size_t i = 0; i < size_t(paramsInstanceSize); i++) {
119 std::pair<unsigned int, dev::Address> params;
121 ++paramsInstanceHash;
123 ++paramsInstanceHash;
131 if(i->first <= blockHeight)
137 static inline bool sortPairs(
const std::pair<dev::u256, dev::u256>&
a,
const std::pair<dev::u256, dev::u256>&
b) {
138 return a.first < b.first;
142 std::vector<std::pair<dev::u256, dev::u256>>
data;
143 for(
size_t i = 0; i < 5; i++) {
148 data.push_back(std::make_pair(key, value));
152 std::sort(data.begin(), data.end(), sortPairs);
154 for(std::pair<dev::u256, dev::u256>
d : data) {
156 for(
size_t i = 0; i < 4; i++) {
160 uint32Values.push_back(uint32_t(uint64Value));
161 uint64Value = uint64Value >> 32;
162 uint32Values.push_back(uint32_t(uint64Value));
169 for(
size_t i = 0; i <
size; i++) {
170 std::vector<unsigned char> value = std::vector<unsigned char>(
dataTemplate.begin() + (i * 32),
dataTemplate.begin() + ((i+1) * 32));
191 std::vector<uint32_t> uint32Values;
202 if(uint32Values.size() >= 39) {
204 uint32Values[0], uint32Values[1], uint32Values[2], uint32Values[3],
205 uint32Values[4], uint32Values[5], uint32Values[6], uint32Values[7]
208 schedule.
expGas = uint32Values[8];
210 schedule.
sha3Gas = uint32Values[10];
212 schedule.
sloadGas = uint32Values[12];
217 schedule.
logGas = uint32Values[17];
221 schedule.
callGas = uint32Values[21];
229 schedule.
txGas = uint32Values[29];
233 schedule.
copyGas = uint32Values[33];
uint64_t toUint64(T _u)
Converts given multiprecision number to standard number type.
void parseDataScheduleContract(std::vector< uint32_t > &uint32Values)
std::vector< uint32_t > dataEIP158Schedule
dev::Address templateContract
h160 right160(h256 const &_t)
Convert the given value into h160 (160-bit unsigned integer) using the right 20 bytes.
bool checkLimitSchedule(const std::vector< uint32_t > &defaultData, const std::vector< uint32_t > &checkData)
uint64_t getUint64FromDGP(unsigned int blockHeight, const dev::Address &contract, std::vector< unsigned char > data)
h160 Address
An Ethereum address: 20 bytes.
unsigned txDataNonZeroGas
void initDataTemplate(const dev::Address &addr, std::vector< unsigned char > &data)
void initStorageTemplate(const dev::Address &addr)
std::vector< std::pair< unsigned int, dev::Address > > paramsInstance
std::array< unsigned, 8 > tierStepGas
uint64_t getBlockGasLimit(unsigned int blockHeight)
unsigned suicideRefundGas
dev::eth::EVMSchedule getGasSchedule(unsigned int blockHeight)
u256 storage(Address const &_contract, u256 const &_memory) const
Get the value of a storage position of an account.
std::map< dev::h256, std::pair< dev::u256, dev::u256 > > storageTemplate
Fixed-size raw-byte array container type, with an API optimised for storing hashes.
unsigned callValueTransferGas
boost::multiprecision::number< boost::multiprecision::cpp_int_backend< 256, 256, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void >> u256
void parseStorageScheduleContract(std::vector< uint32_t > &uint32Values)
std::map< dev::h256, std::pair< dev::u256, dev::u256 > > storageDGP
std::vector< ResultExecute > CallContract(const dev::Address &addrContract, std::vector< unsigned char > opcode, const dev::Address &sender, uint64_t gasLimit)
std::vector< unsigned char > dataTemplate
void parseStorageOneUint64(uint64_t &blockSize)
uint8_t const size_t const size
dev::eth::EVMSchedule createEVMSchedule()
bool sha3(bytesConstRef _input, bytesRef o_output)
Calculate SHA3-256 hash of the given input and load it into the given output.
uint32_t getBlockSize(unsigned int blockHeight)
dev::Address getAddressForBlock(unsigned int blockHeight)
struct evm_uint160be address(struct evm_env *env)
bool initStorages(const dev::Address &addr, unsigned int blockHeight, std::vector< unsigned char > data=std::vector< unsigned char >())
void initStorageDGP(const dev::Address &addr)
void parseDataOneUint64(uint64_t &value)
unsigned callNewAccountGas
uint64_t getMinGasPrice(unsigned int blockHeight)
void createParamsInstance()
std::vector< unsigned char > ParseHex(const char *psz)