chainweb-node icon indicating copy to clipboard operation
chainweb-node copied to clipboard

Problem with Gas Limit check

Open ggobugi27 opened this issue 6 years ago • 3 comments

I have encountered a behavior that the sender in meta section of the transaction need a bigger account balance than gas limit of the transaction rather than (gas price * gas limit) of the transaction.

I ran a transaction with an account with account balance of 15.0 with gas limit of 18.0, which is bigger than the account balance, and transaction would not process and the result was not able to be polled. (step 2) Then, I ran a transaction with gas limit of 12.0, which is lower than the account balance and I was able to poll the expected result. (step 3)

Another behavior I have encountered is that the transaction in step 2 was processed when the account was funded and had a balance than the gas limit transaction in step 2. Is this an expected behavior? (step 4)

Steps to reproduce:

  1. create new test-account and transfer 15.0 coins (have sender account with bigger than gas limit sign)
(coin.create-and-transfer 'sender-account 'test-account (read-keyset 'test-keyset) 15.0)
  1. set sender to "test-account", gas price to 0.0001, gas limit to 18.0 and run simple code (have sender account with bigger than gas limit sign)
(+ 1 2)

Expected behavior - returns a requestkey and can poll result of 3.0 Actual behavior - returns a requestkey and cannot poll result

  1. set sender to "test-account", gas price to 0.0001, gas limit to 12.0 and run simple code (sign with public key of "test-account")
(+ 1 2)

Expected behavior - returns a requestkey and can poll result of 3.0 with gas usage of 0.0001 Actual behavior - returns a requestkey and can poll result of 3.0 with gas usage of 0.0001

  1. transfer 5.0 coins (have sender account with bigger than gas limit and sign with the account)
(coin.transfer 'sender-account 'test-account 5.0)

Expected behavior - funds test account to 19.999 Actual behavior - funds test account to 19.999 and can poll result from step 2.

ggobugi27 avatar Aug 30 '19 18:08 ggobugi27

Pinging @gregorycollins. This sounds like a mempool issue.

mightybyte avatar Sep 03 '19 19:09 mightybyte

I'm getting some feedback that this may still be broken. Reopening for now until while we do more investigation to come up with a definitive set of repo steps.

Is it possible that the check needs to be flipped on this line?

https://github.com/kadena-io/chainweb-node/blob/master/src/Chainweb/Pact/PactService.hs#L442

mightybyte avatar Sep 17 '19 18:09 mightybyte

I'm getting some feedback that this may still be broken. Reopening for now until while we do more investigation to come up with a definitive set of repo steps.

Is it possible that the check needs to be flipped on this line?

https://github.com/kadena-io/chainweb-node/blob/master/src/Chainweb/Pact/PactService.hs#L442

That check looks correct. The account needs to have more coin in it than the maximum tx cost. This issue may be caused by the payload meta encoding issue that Emmanuel found (and is fixing) -- but we'll keep it open for now. I'll dig into it further later today or tomorrow.

gregorycollins avatar Sep 26 '19 15:09 gregorycollins