Skip to content

Error in calculate_vests_to_hp

I received this error during running tests/python/functional/operation_tests/comment_tests/test_complex_scenarios.py with this revision of wax:

pip install wax==0.3.10.dev69+f3357df --index-url https://gitlab.syncad.com/api/v4/projects/419/packages/pypi/simple
1178548ms utils.hpp:52                  safe_exception_wrapp ] Caught fc::exception: 13 N5boost10wrapexceptINS_16bad_lexical_castEEE: bad lexical cast: source type value could not be interpreted as target
bad lexical cast: source type value could not be interpreted as target: 
    {"what":"bad lexical cast: source type value could not be interpreted as target"}
    asset.cpp:593 from_variant

During diagnostic I found method causing this error and similar working method.

Working:

wax.calculate_vests_to_hp(
        vests=wax.python_json_asset(amount=b"10", precision=6, nai=b"@@000000037"),
        total_vesting_fund_hive=wax.python_json_asset(amount=b"10", precision=3, nai=b"@@000000021"),
        total_vesting_shares=wax.python_json_asset(amount=b"10", precision=6, nai=b"@@000000037"),
    )

Not working:

wax.calculate_vests_to_hp(
        vests=wax.python_json_asset(amount=b"9386946707000000", precision=6, nai=b"@@000000037"),
        total_vesting_fund_hive=wax.python_json_asset(amount=b"10030159116000", precision=3, nai=b"@@000000021"),
        total_vesting_shares=wax.python_json_asset(amount=b"14881076195918636000000", precision=6, nai=b"@@000000037"),
    )