Skip to content

Commit

Permalink
Merge pull request #2746 from Taraxa-project/add_bridge_root
Browse files Browse the repository at this point in the history
feat: add bridge_root to the pillar block
  • Loading branch information
kstdl authored May 15, 2024
2 parents f452c6d + 96a6717 commit 5b594e7
Show file tree
Hide file tree
Showing 17 changed files with 196 additions and 139 deletions.
30 changes: 16 additions & 14 deletions libraries/cli/include/cli/config_jsons/default/default_genesis.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,13 @@
},
"initial_balances": {
"2cd4da7d3b345e022ca7e997c2bb3276a4d3d2e9": "0x1027e72f1f12813088000000",
"7e4aa664f71de4e9d0b4a6473d796372639bdcde": "0x1027e72f1f12813088000000"
"7e4aa664f71de4e9d0b4a6473d796372639bdcde": "0x27e72f1f12813088000000",
"fF310642f352E0b6b5266CE492e91D6af1241F41": "0x27e72f1f12813088000000"
},
"gas_price": {
"blocks": 200,
"percentile": 60,
"minimum_price" : 1
"minimum_price": 1
},
"pbft": {
"committee_size": "0x3e8",
Expand Down Expand Up @@ -100,25 +101,26 @@
"hardforks": {
"fix_redelegate_block_num": 0,
"rewards_distribution_frequency": {
"0" : 100
"0": 100
},
"magnolia_hf" : {
"block_num" : 0,
"magnolia_hf": {
"block_num": 0,
"jail_time": 163459
},
"phalaenopsis_hf_block_num": 0,
"fix_claim_all_block_num": -1,
"aspen_hf" : {
"block_num_part_one" : 0,
"block_num_part_two" : 0,
"aspen_hf": {
"block_num_part_one": 0,
"block_num_part_two": 0,
"max_supply": "0x26C62AD77DC602DAE0000000",
"generated_rewards": "0x0"
},
"ficus_hf" : {
"block_num" : 0,
"pillar_blocks_interval" : 100,
"pillar_chain_sync_interval" : 25,
"pbft_inclusion_delay": 6
"ficus_hf": {
"block_num": 200,
"pillar_blocks_interval": 100,
"pillar_chain_sync_interval": 25,
"pbft_inclusion_delay": 6,
"bridge_contract_address": "0xf7CEfBBcc0fF61eB99A9174cA9072fFABB889453"
}
}
}
}
19 changes: 10 additions & 9 deletions libraries/cli/include/cli/config_jsons/devnet/devnet_genesis.json
Original file line number Diff line number Diff line change
Expand Up @@ -274,17 +274,18 @@
},
"phalaenopsis_hf_block_num": 0,
"fix_claim_all_block_num": -1,
"aspen_hf" : {
"block_num_part_one" : 0,
"block_num_part_two" : 0,
"aspen_hf": {
"block_num_part_one": 0,
"block_num_part_two": 0,
"max_supply": "0x26C62AD77DC602DAE0000000",
"generated_rewards": "0x16E59F7481A7EC1F60"
},
"ficus_hf" : {
"block_num" : -1,
"pillar_blocks_interval" : 100,
"pillar_chain_sync_interval" : 25,
"pbft_inclusion_delay": 6
"ficus_hf": {
"block_num": -1,
"pillar_blocks_interval": 100,
"pillar_chain_sync_interval": 25,
"pbft_inclusion_delay": 6,
"bridge_contract_address": "0xf7CEfBBcc0fF61eB99A9174cA9072fFABB889453"
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1643,17 +1643,18 @@
},
"phalaenopsis_hf_block_num": 6943000,
"fix_claim_all_block_num": 7600000,
"aspen_hf" : {
"block_num_part_one" : 8118000,
"block_num_part_two" : 8572000,
"aspen_hf": {
"block_num_part_one": 8118000,
"block_num_part_two": 8572000,
"max_supply": "0x26C62AD77DC602DAE0000000",
"generated_rewards": "0x105674788D280AE305A6EC0"
},
"ficus_hf" : {
"block_num" : -1,
"pillar_blocks_interval" : 100,
"pillar_chain_sync_interval" : 25,
"pbft_inclusion_delay": 6
"ficus_hf": {
"block_num": -1,
"pillar_blocks_interval": 100,
"pillar_chain_sync_interval": 25,
"pbft_inclusion_delay": 6,
"bridge_contract_address": "0x0000000000000000000000000000000000000000"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,12 @@
"max_supply": "0x26C62AD77DC602DAE0000000",
"generated_rewards": "0x0"
},
"ficus_hf" : {
"block_num" : -1,
"pillar_blocks_interval" : 100,
"pillar_chain_sync_interval" : 25,
"pbft_inclusion_delay": 6
"ficus_hf": {
"block_num": -1,
"pillar_blocks_interval": 100,
"pillar_chain_sync_interval": 25,
"pbft_inclusion_delay": 6,
"bridge_contract_address": "0x0000000000000000000000000000000000000000"
}
}
}
}
1 change: 0 additions & 1 deletion libraries/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ set(HEADERS
include/common/functional.hpp
include/common/jsoncpp.hpp
include/common/lazy.hpp
include/common/range_view.hpp
include/common/thread_pool.hpp
include/common/util.hpp
)
Expand Down
1 change: 1 addition & 0 deletions libraries/common/include/common/constants.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,5 @@ static const u256 kOneTara = dev::exp10<18>();
// static const u256 kShannon = dev::exp10<9>();
// static const u256 kWei = exp10<0>();

static const addr_t kTaraxaSystemAccount = addr_t("0x0054617261786153797374656d4163636f756e74");
} // namespace taraxa
7 changes: 0 additions & 7 deletions libraries/common/include/common/encoding_rlp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include <unordered_map>
#include <vector>

#include "common/range_view.hpp"
#include "common/util.hpp"

namespace taraxa::util {
Expand Down Expand Up @@ -62,12 +61,6 @@ void rlp(RLPEncoderRef encoding, std::shared_ptr<Param> const& target) {
}
}

template <typename Param>
void rlp(RLPEncoderRef encoding, RangeView<Param> const& target) {
encoding.appendList(target.size);
target.for_each([&](auto const& el) { rlp(encoding, el); });
}

template <typename T1, typename T2>
void rlp(RLPEncoderRef encoding, std::pair<T1, T2> const& target) {
rlp_tuple(encoding, target.first, target.second);
Expand Down
75 changes: 0 additions & 75 deletions libraries/common/include/common/range_view.hpp

This file was deleted.

1 change: 1 addition & 0 deletions libraries/config/include/config/hardfork.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ struct FicusHardforkConfig {
// previous pillar blocks and 2t+1 signatures for latest pillar block)
uint64_t pbft_inclusion_delay{
6}; // [periods] how many periods after the pillar block is created it is included in pbft block
taraxa::addr_t bridge_contract_address; // [address] of the bridge contract

bool isFicusHardfork(taraxa::PbftPeriod period) const;

Expand Down
4 changes: 3 additions & 1 deletion libraries/config/src/hardfork.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ Json::Value enc_json(const FicusHardforkConfig& obj) {
json["pillar_blocks_interval"] = dev::toJS(obj.pillar_blocks_interval);
json["pillar_chain_sync_interval"] = dev::toJS(obj.pillar_chain_sync_interval);
json["pbft_inclusion_delay"] = dev::toJS(obj.pbft_inclusion_delay);
json["bridge_contract_address"] = dev::toJS(obj.bridge_contract_address);
return json;
}

Expand All @@ -103,9 +104,10 @@ void dec_json(const Json::Value& json, FicusHardforkConfig& obj) {
obj.pillar_blocks_interval = dev::getUInt(json["pillar_blocks_interval"]);
obj.pillar_chain_sync_interval = dev::getUInt(json["pillar_chain_sync_interval"]);
obj.pbft_inclusion_delay = dev::getUInt(json["pbft_inclusion_delay"]);
obj.bridge_contract_address = taraxa::addr_t(json["bridge_contract_address"].asString());
}
RLP_FIELDS_DEFINE(FicusHardforkConfig, block_num, pillar_blocks_interval, pillar_chain_sync_interval,
pbft_inclusion_delay)
pbft_inclusion_delay, bridge_contract_address)

Json::Value enc_json(const HardforksConfig& obj) {
Json::Value json(Json::objectValue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include <future>

#include "common/event.hpp"
#include "common/range_view.hpp"
#include "common/types.hpp"
#include "config/config.hpp"
#include "final_chain/data.hpp"
Expand Down Expand Up @@ -250,6 +249,12 @@ class FinalChain {
*/
virtual u256 dpos_total_supply(EthBlockNumber blk_num) const = 0;

/**
* @param blk_num
* @return bridge root
*/
virtual h256 get_bridge_root(EthBlockNumber blk_num) const = 0;

// TODO move out of here:

std::pair<val_t, bool> getBalance(addr_t const& addr) const {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

#include <functional>

#include "common/range_view.hpp"
#include "final_chain/state_api_data.hpp"
#include "rewards/block_stats.hpp"
#include "storage/storage.hpp"
Expand Down Expand Up @@ -45,7 +44,7 @@ class StateAPI {
StateDescriptor get_last_committed_state_descriptor() const;

const TransactionsExecutionResult& execute_transactions(const EVMBlock& block,
const util::RangeView<EVMTransaction>& transactions);
const std::vector<EVMTransaction>& transactions);
const RewardsDistributionResult& distribute_rewards(const std::vector<rewards::BlockStats>& rewards_stats);
void transition_state_commit();

Expand Down
Loading

0 comments on commit 5b594e7

Please sign in to comment.