Skip to content

Commit

Permalink
Merge pull request #2874 from Taraxa-project/testnet
Browse files Browse the repository at this point in the history
Testnet -> develop
  • Loading branch information
kstdl authored Oct 21, 2024
2 parents 409359c + 75aec2e commit 409ac0b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,6 @@
"pillar_blocks_interval": 1000,
"bridge_contract_address": "0xcAF2b453FE8382a4B8110356DF0508f6d71F22BF"
},
"cornus_hf_block_num": 1622000
"cornus_hf_block_num": 1668000
}
}
6 changes: 3 additions & 3 deletions libraries/core_libs/consensus/src/pbft/pbft_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1388,7 +1388,7 @@ std::shared_ptr<PbftBlock> PbftManager::identifyLeaderBlock_(PbftRound round, Pb
}

PbftStateRootValidation PbftManager::validateFinalChainHash(const std::shared_ptr<PbftBlock> &pbft_block) const {
auto period = pbft_block->getPeriod();
const auto period = pbft_block->getPeriod();
const auto &pbft_block_hash = pbft_block->getBlockHash();

auto prev_final_chain_hash = final_chain_->finalChainHash(period);
Expand All @@ -1397,8 +1397,8 @@ PbftStateRootValidation PbftManager::validateFinalChainHash(const std::shared_pt
return PbftStateRootValidation::Missing;
}
if (pbft_block->getFinalChainHash() != prev_final_chain_hash) {
LOG(log_er_) << "Block " << pbft_block_hash << " state root " << pbft_block->getFinalChainHash()
<< " isn't matching actual " << prev_final_chain_hash.value();
LOG(log_er_) << "Block " << period << " hash " << pbft_block_hash << " state root "
<< pbft_block->getFinalChainHash() << " isn't matching actual " << prev_final_chain_hash.value();
return PbftStateRootValidation::Invalid;
}

Expand Down
15 changes: 3 additions & 12 deletions libraries/core_libs/network/rpc/Debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@
#include <libdevcore/CommonData.h>
#include <libdevcore/CommonJS.h>

#include <exception>

#include "common/jsoncpp.hpp"
#include "final_chain/state_api_data.hpp"
#include "network/rpc/eth/data.hpp"
#include "pbft/pbft_manager.hpp"

using namespace std;
using namespace dev;
Expand All @@ -17,19 +14,14 @@ using namespace taraxa;

namespace taraxa::net {

inline EthBlockNumber get_ctx_block_num(EthBlockNumber block_number) {
return (block_number >= 1) ? block_number - 1 : 0;
}

Json::Value Debug::debug_traceTransaction(const std::string& transaction_hash) {
Json::Value res;
auto [trx, loc] = get_transaction_with_location(transaction_hash);
if (!trx || !loc) {
throw std::runtime_error("Transaction not found");
}
if (auto node = full_node_.lock()) {
return util::readJsonFromString(
node->getFinalChain()->trace({to_eth_trx(std::move(trx))}, get_ctx_block_num(loc->period)));
return util::readJsonFromString(node->getFinalChain()->trace({to_eth_trx(std::move(trx))}, loc->period));
}
return res;
}
Expand Down Expand Up @@ -65,7 +57,7 @@ Json::Value Debug::trace_replayTransaction(const std::string& transaction_hash,
}
if (auto node = full_node_.lock()) {
return util::readJsonFromString(
node->getFinalChain()->trace({to_eth_trx(std::move(trx))}, get_ctx_block_num(loc->period), std::move(params)));
node->getFinalChain()->trace({to_eth_trx(std::move(trx))}, loc->period, std::move(params)));
}
return res;
}
Expand All @@ -83,8 +75,7 @@ Json::Value Debug::trace_replayBlockTransactions(const std::string& block_num, c
trxs.reserve(transactions->size());
std::transform(transactions->begin(), transactions->end(), std::back_inserter(trxs),
[this](auto t) { return to_eth_trx(std::move(t)); });
return util::readJsonFromString(
node->getFinalChain()->trace(std::move(trxs), get_ctx_block_num(block), std::move(params)));
return util::readJsonFromString(node->getFinalChain()->trace(std::move(trxs), block, std::move(params)));
}
return res;
}
Expand Down

0 comments on commit 409ac0b

Please sign in to comment.