Skip to content
New issue

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

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

Already on GitHub? # to your account

GasEstimateGasPremium returning "1" for a period of 7 seconds after calling MpoolPush #3427

Closed
Shatnerz opened this issue Aug 31, 2020 · 2 comments · Fixed by #3428
Closed

Comments

@Shatnerz
Copy link

Describe the bug
After calling Filecoin.MpoolPush there is a period of about 7 seconds where Filecoin.GasEstimateGasPremium will always return "1" whenever nblocksincl=1 or nblocksincl=2. When nblocksincl>2 the response seems reasonable

To Reproduce
Using lotus v0.5.4 or v0.5.6 in a localnet setup as described here: https://lotu.sh/en+setup-local-dev-net

Steps to reproduce the behavior:

  1. Start the local dev net
  2. Use Filecoin.MpoolPush to broadcast a Message
  3. Poll Filecoin.GasEstimateGasPremium every second for ~20 seconds and examine the results, using nblocksincl=1 or nblocksincl=2. If nblocksincl > 2, there seems to be no issue.

In order to help with reproducibility, here is a bash script that automates the process and can be run from the same box running the testnet

# Get Preliminary Info
TOKEN=$(lotus auth create-token --perm admin)
MINER_ADDRESS=$(lotus wallet list | head -n 1)
NONCE=$(curl -X POST -s \
    -H "Content-Type: application/json" \
    --data "{ \"jsonrpc\": \"2.0\", \"method\": \"Filecoin.MpoolGetNonce\", \"params\": [\"$MINER_ADDRESS\"], \"id\": 3 }" \
    'http://localhost:1234/rpc/v0' | jq .result)

# Sign Message
SIGNED_MESSAGE=$(curl -X POST -s \
  -H "Content-Type: application/json; charset=utf-8" \
  -H "Authorization: Bearer $TOKEN" \
  --data "{\"jsonrpc\":\"2.0\",\"method\":\"Filecoin.WalletSignMessage\",\"id\":1,\"params\":[\"$MINER_ADDRESS\", {\"version\":0,\"to\":\"t1h5bubzvwngaqhdih5hh4tcsf5qdvhlnd6o2ycra\",\"from\":\"$MINER_ADDRESS\",\"value\":\"3000000000000000000\",\"method\":0,\"nonce\":$NONCE,\"gasLimit\":10000000000,\"gasFeeCap\":\"10000000000\",\"gasPremium\":\"0\",\"params\":\"\"}]}" \
  'http://localhost:1234/rpc/v0' | jq .result)

# MpoolPush
curl -X POST -s \
  -H "Content-Type: application/json; charset=utf-8" \
  -H "Authorization: Bearer $TOKEN" \
  --data "{\"jsonrpc\":\"2.0\",\"method\":\"Filecoin.MpoolPush\",\"id\":1,\"params\":[$SIGNED_MESSAGE]}" \
  'http://localhost:1234/rpc/v0' | jq .result

for i in {1..20}
do
    echo $i
    curl -X POST -s \
        -H "Content-Type: application/json; charset=utf-8" \
        --data '{ "jsonrpc": "2.0", "method": "Filecoin.GasEstimateGasPremium", "params": [1, null, null, null], "id": 1 }' \
        'http://localhost:1234/rpc/v0' | jq .result
    sleep 1
    echo ""
done

The above script results in the following

{
  "/": "bafy2bzacebs4w22gf32rlvhpvsvbi6jm7fv5u73ub2rt2wp3ougacisopepps"
}
1
"199377"

2
"199037"

3
"199486"

4
"199029"

5
"201699"

6
"199557"

7
"200584"

8
"198892"

9
"1"

10
"1"

11
"1"

12
"1"

13
"1"

14
"1"

15
"1"

16
"1"

17
"199867"

18
"201043"

19
"200622"

20
"199763"

Expected behavior
Filecoin.GasEstimateGasPremium should not be affected by previous calls of Filecoin.MpoolPush. Responses of "1" should never happen. 1 is below the minimum

Version (run lotus version):
Daemon: 0.5.6+2k+git.606a58bc+api0.13.0
Local: lotus version 0.5.6+2k+git.606a58bc

@Shatnerz
Copy link
Author

I tried doing the same thing with MpoolPushMessage but could not reproduce the issue.

@Kubuxu
Copy link
Contributor

Kubuxu commented Aug 31, 2020

I think it might be hitting:

return types.BigAdd(price.price, big.NewInt(1)), nil

Not sure why though.

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

Successfully merging a pull request may close this issue.

2 participants