semuxproject / semux-core

Semux Core
https://www.semux.org
MIT License
76 stars 31 forks source link

VM: Should allow value to be set on CREATE/Call in API #192

Closed orogvany closed 5 years ago

orogvany commented 5 years ago

After looking a bit closer at eth spec, it's perfectly valid to send amount on create/call

We should update API to allow this.

It looks like there's a bug on CALL where if you supply an amount, it doesn't seem to execute the call, just does the transfer. Will write unit test for this case.

semuxgo commented 5 years ago

I think the issue is the local condition check below. It's null if no value is provided

https://github.com/semuxproject/semux-core/blob/0682972eb5c329ff3897fb61297bc3779c8f57f3/src/main/java/org/semux/api/v2/SemuxApiImpl.java#L768-L774

orogvany commented 5 years ago

That could be part of the problem, but I am specifying local=false, and still get odd behavior.

I can run through my tests again. My setup is as follows

Create a contract that just does a transfer of amount/to to transfer from the contract to who you choose.

Call the contract setting amount>0. Expected: sends amount to contract, and call is run sending some amount to target.

It will send amount to target if 0 is specified as amount on call, but will not if value is specified.

orogvany commented 5 years ago

It could be that the internal transaction is not calling with internal=false

semuxgo commented 5 years ago

Fixed in the develop branch