Skip to content

Commit

Permalink
add log and test
Browse files Browse the repository at this point in the history
  • Loading branch information
JimmyShi22 committed Apr 22, 2024
1 parent 0996b18 commit e92448b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
17 changes: 8 additions & 9 deletions bcos-scheduler/src/BlockExecutive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1581,15 +1581,14 @@ void BlockExecutive::onTxFinish(bcos::protocol::ExecutionMessage::UniquePtr outp

if (bcos::precompiled::c_systemTxsAddress.contains(output->from()))
{
if (m_scheduler->ledgerConfig().features().get(
ledger::Features::Flag::bugfix_dmc_deploy_gas_used))
{
if (output->create())
{
txGasUsed = 0;
}
}
else
// Note: We will not consume gas when EOA call sys contract directly.
// When dmc return, sys contract is from(), to() is EOA address.
// But if this tx is a deploy tx, from() is sys contract but to() is new address.
// So we need to fix this bug here: only consider output->newEVMContractAddress().empty()
// here. Leaving only EOA call sys contract here.
auto hasBugfix = m_scheduler->ledgerConfig().features().get(
ledger::Features::Flag::bugfix_dmc_deploy_gas_used);
if (!hasBugfix || (hasBugfix && output->newEVMContractAddress().empty()))
{
txGasUsed = 0;
}
Expand Down
11 changes: 11 additions & 0 deletions tools/.ci/java_sdk_demo_ci_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,17 @@ check_all_contract() {
exit 1;
fi

LOG_INFO "check block gasUsed"
local current_block_number=$(bash console.sh getBlockNumber)
LOG_INFO "check block gasUsed, current number is ${current_block_number}"
local gas_used=$(bash console.sh getBlockByNumber ${current_block_number} |grep gasUsed |awk -F "'" '{print $2}')
if [ ${gas_used} -ne 0 ]; then
LOG_INFO "check block gasUsed success, current gas is ${gas_used}"
else
LOG_ERROR "check block gasUsed failed, gas is ${gas_used}"
exit 1;
fi

LOG_INFO "addBalance to contract ${test_contract_address}"
bash console.sh addBalance ${test_contract_address} 10000000

Expand Down

0 comments on commit e92448b

Please sign in to comment.