mit-dci / opencbdc-tx

A transaction processor for a hypothetical, general-purpose, central bank digital currency
Other
895 stars 200 forks source link

Instantiation of evmc::uint256be using int flagged as error by clang-tidy #215

Closed AlexRamRam closed 10 months ago

AlexRamRam commented 1 year ago

Affected Branch

programmability

Basic Diagnostics

Description

In order to reproduce the issue, follow these steps:

  1. In file tests/integration/threepc_evm_end_to_end_test.cpp, test element TEST_F(threepc_evm_end_to_end_test, erc20_all), create instance of evmc::uint256be object using int (e.g. evmc::uint256be(0)) instead of using cbdc::threepc::agent::runner::uint256be_from_hex() or evmc::uint256be{}
  2. run CI lint workflow which leads to a failure on the file element that may look like:
    | /usr/local/include/evmc/evmc.hpp:131:51: error: The left operand of '<<' is a garbage value [clang-analyzer-core.UndefinedBinaryOperatorResult,-warnings-as-errors]
    |     return uint64_t{data[0]} | (uint64_t{data[1]} << 8) | (uint64_t{data[2]} << 16) |

This odd behavior can only observed in TEST_F(threepc_evm_end_to_end_test, erc20_all).

Code of Conduct

AlexRamRam commented 10 months ago

No longer reproducible after PR #233