Skip to content

Commit

Permalink
chore: resolve discussions
Browse files Browse the repository at this point in the history
  • Loading branch information
kstdl committed May 8, 2024
1 parent d5b0ade commit 96a6717
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 30 deletions.
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"
}
}
}
}
13 changes: 6 additions & 7 deletions libraries/core_libs/consensus/src/final_chain/final_chain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class FinalChainImpl final : public FinalChain {

std::atomic<EthBlockNumber> last_block_number_;

const HardforksConfig& hardforks_config_;
const HardforksConfig& kHardforksConfig;
LOG_OBJECTS_DEFINE

public:
Expand Down Expand Up @@ -79,7 +79,7 @@ class FinalChainImpl final : public FinalChain {
dpos_is_eligible_cache_(
config.final_chain_cache_in_blocks,
[this](uint64_t blk, const addr_t& addr) { return state_api_.dpos_is_eligible(blk, addr); }),
hardforks_config_(config.genesis.state.hardforks) {
kHardforksConfig(config.genesis.state.hardforks) {
LOG_OBJECTS_CREATE("EXECUTOR");
num_executed_dag_blk_ = db_->getStatusField(taraxa::StatusDbField::ExecutedBlkCount);
num_executed_trx_ = db_->getStatusField(taraxa::StatusDbField::ExecutedTrxCount);
Expand Down Expand Up @@ -153,11 +153,10 @@ class FinalChainImpl final : public FinalChain {
EthBlockNumber delegation_delay() const override { return delegation_delay_; }

state_api::EVMTransaction make_bridge_finalization_transaction() {
// TODO: make proper constants?
const static auto finalize_method = util::EncodingSolidity::packFunctionCall("finalizeEpoch()");

auto account = get_account(kTaraxaSystemAccount).value_or(state_api::ZeroAccount);
return state_api::EVMTransaction{kTaraxaSystemAccount, 0, hardforks_config_.ficus_hf.bridge_contract_address,
return state_api::EVMTransaction{kTaraxaSystemAccount, 0, kHardforksConfig.ficus_hf.bridge_contract_address,
account.nonce, 0, kBlockGasLimit,
finalize_method};
}
Expand Down Expand Up @@ -188,7 +187,7 @@ class FinalChainImpl final : public FinalChain {

const auto blk_num = new_blk.pbft_blk->getPeriod();
auto evm_trxs = to_state_api_transactions(new_blk.transactions);
if (hardforks_config_.ficus_hf.isPillarBlockPeriod(blk_num)) {
if (kHardforksConfig.ficus_hf.isPillarBlockPeriod(blk_num)) {
evm_trxs.push_back(make_bridge_finalization_transaction());
}

Expand Down Expand Up @@ -495,8 +494,8 @@ class FinalChainImpl final : public FinalChain {
u256 dpos_total_supply(EthBlockNumber blk_num) const override { return state_api_.dpos_total_supply(blk_num); }

h256 get_bridge_root(EthBlockNumber blk_num) const override {
const auto get_bridge_root_method = util::EncodingSolidity::packFunctionCall("getBridgeRoot()");
return h256(call(state_api::EVMTransaction{dev::ZeroAddress, 1, hardforks_config_.ficus_hf.bridge_contract_address,
const static auto get_bridge_root_method = util::EncodingSolidity::packFunctionCall("getBridgeRoot()");
return h256(call(state_api::EVMTransaction{dev::ZeroAddress, 1, kHardforksConfig.ficus_hf.bridge_contract_address,
state_api::ZeroAccount.nonce, 0, 10000000, get_bridge_root_method},
blk_num)
.code_retval);
Expand Down

0 comments on commit 96a6717

Please sign in to comment.