Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
orogvany opened this issue Jul 4, 2019 · 4 comments
Closed

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

orogvany opened this issue Jul 4, 2019 · 4 comments

Comments

@orogvany
Copy link
Collaborator

orogvany commented Jul 4, 2019

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.

@orogvany orogvany self-assigned this Jul 4, 2019
@orogvany orogvany changed the title Should allow value to be set on CREATE/CALL in API Should allow value to be set on CREATE in API Jul 4, 2019
@orogvany orogvany changed the title Should allow value to be set on CREATE in API Should allow value to be set on CREATE/Call in API Jul 4, 2019
@orogvany orogvany removed their assignment Jul 4, 2019
@orogvany orogvany changed the title Should allow value to be set on CREATE/Call in API VM: Should allow value to be set on CREATE/Call in API Jul 4, 2019
@orogvany orogvany added the VM label Jul 4, 2019
@semuxgo
Copy link
Contributor

semuxgo commented Jul 4, 2019

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

public Response call(String from, String to, String value, String gasPrice, String gas,
String nonce, String data, Boolean local) {
if (local) {
Transaction tx = getTransaction(TransactionType.CALL, from, to, value, "0", nonce, data,
gasPrice, gas);
SemuxTransaction transaction = new SemuxTransaction(tx);

semuxgo pushed a commit to semuxgo/semux-core that referenced this issue Jul 4, 2019
@orogvany
Copy link
Collaborator Author

orogvany commented Jul 4, 2019

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
Copy link
Collaborator Author

orogvany commented Jul 4, 2019

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

semuxgo added a commit that referenced this issue Jul 4, 2019
@semuxgo
Copy link
Contributor

semuxgo commented Jul 4, 2019

Fixed in the develop branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants