So I wanted to do delegatebw in my contract as a deferred transaction:

eosio::transaction out;
out.actions.emplace_back(eosio::permission_level{_self, N(active) }, N(eosio), N(delegatebw), std::make_tuple(_self, someone, stake_net_quantity, stake_cpu_quantity, false));
out.delay_sec = 1;
out.send(id + N(delegate) + current_time(), _self, false);

The values for stake_net_quantity and stake_cpu_quantity are definitely 120 and 80 respectively, however when the code is executed, I get the following error:

2018-08-15T18:09:19.506 thread-0   wasm_interface.cpp:929        eosio_assert         ] message: addition overflow 
2018-08-15T18:09:19.506 thread-0   controller.cpp:612            push_scheduled_trans ] 3050003 eosio_assert_message_exception: eosio_assert_message assertion failure
assertion failure with message: addition overflow
    {"s":"addition overflow"}
    thread-0  wasm_interface.cpp:930 eosio_assert
pending console output: 
    thread-0  apply_context.cpp:61 exec_one
2018-08-15T18:09:19.507 thread-0   apply_context.cpp:28          print_debug          ] 

I looked deep in the code, but there is no way that 120+80 is an addition overflow. Does anyone have any idea what could be happening here?

  • probably the overflow is here id + N(delegate) + current_time()
    – confused00
    Commented Aug 15, 2018 at 18:57
  • I checked by changing the ID to a fixed number, i.e. 1. The error is still present Commented Aug 15, 2018 at 19:11
  • maybe N(delegate) + current_time() still overflows
    – confused00
    Commented Aug 15, 2018 at 19:14
  • No, I mean I changed it to the following: out.send(1, _self, false); Commented Aug 15, 2018 at 19:15
  • 1
    I'm totally stumped by this. I've opened an issue on Github: github.com/EOSIO/eos/issues/5290 Commented Aug 16, 2018 at 16:52

1 Answer 1


I have found a solution to my problem.

The problem was caused by the fact that the delegatebw function implicitly calls the transfer function from the contract to the receiver. This, combined with the fact that we have a listening function that waits for transfers to occur and doesn't distinguish between transfers to the account and transfers from the account, caused the listening function to try to parse a gibberish memo. The gibberish memo was placed into assets that were then added together, leading to the addition overflow.

In short, unless you intend to perform actions when you transfer from your account as well as when transfers are received at your account, you should add this in your transfer listening function:

if(transfer.from == _self) return;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.