ChainSafe / forest

🌲 Rust Filecoin Node Implementation
https://forest.chainsafe.io
Apache License 2.0
637 stars 157 forks source link

Flaky `Filecoin.MarketAddBalance` tests #4849

Open LesnyRumcajs opened 2 weeks ago

LesnyRumcajs commented 2 weeks ago

Describe the bug

Wallet tests fail repeatedly, causing merges to get evicted from the merge queue. There is either a bug in the implementation, or assumptions in the tests are incorrect.

To reproduce

The following test is failing: https://github.com/ChainSafe/forest/blob/6b4f26d2b94b4a33a35764cc3dfa565ae178ac4d/scripts/tests/calibnet_wallet_check.sh#L28-L78

Log output

job-logs.txt

+ : Begin Filecoin.MarketAddBalance test
+ FOREST_URL=http://127.0.0.1:2345/rpc/v1
+ MARKET_FIL_AMT=23
++ tail -1
++ forest-wallet --remote-wallet list
++ cut -d ' ' -f1
+ REMOTE_ADDR=t1ac6ndwj6nghqbmtbovvnwcqo577p6ox2pt52q2y
+++ jq -n --arg addr t1ac6ndwj6nghqbmtbovvnwcqo577p6ox2pt52q2y --arg amt 23 '{jsonrpc: "2.0", id: 1, method: "Filecoin.MarketAddBalance", params: [$addr, $addr, $amt]}'
++ curl -s -X POST http://127.0.0.1:2345/rpc/v1 --header 'Accept: application/json' --header 'Content-Type: application/json' --header 'Authorization: ***' --data '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "Filecoin.MarketAddBalance",
  "params": [
    "t1ac6ndwj6nghqbmtbovvnwcqo577p6ox2pt52q2y",
    "t1ac6ndwj6nghqbmtbovvnwcqo577p6ox2pt52q2y",
    "23"
  ]
}'
+ JSON='{"jsonrpc":"2.0","id":1,"result":{"/":"bafy2bzacedv4os6xyuqyqjlzhbnlweqssratjd2a4ggd4as5kvastygesdt5m"}}'
{"jsonrpc":"2.0","id":1,"result":{"/":"bafy2bzacedv4os6xyuqyqjlzhbnlweqssratjd2a4ggd4as5kvastygesdt5m"}}
+ echo '{"jsonrpc":"2.0","id":1,"result":{"/":"bafy2bzacedv4os6xyuqyqjlzhbnlweqssratjd2a4ggd4as5kvastygesdt5m"}}'
++ echo '{"jsonrpc":"2.0","id":1,"result":{"/":"bafy2bzacedv4os6xyuqyqjlzhbnlweqssratjd2a4ggd4as5kvastygesdt5m"}}'
++ jq -e .result
+ [[ {
  "/": "bafy2bzacedv4os6xyuqyqjlzhbnlweqssratjd2a4ggd4as5kvastygesdt5m"
} == \n\u\l\l ]]
++ echo '{"jsonrpc":"2.0","id":1,"result":{"/":"bafy2bzacedv4os6xyuqyqjlzhbnlweqssratjd2a4ggd4as5kvastygesdt5m"}}'
++ jq -r '.result["/"]'
+ MSG_CID=bafy2bzacedv4os6xyuqyqjlzhbnlweqssratjd2a4ggd4as5kvastygesdt5m
Message cid: bafy2bzacedv4os6xyuqyqjlzhbnlweqssratjd2a4ggd4as5kvastygesdt5m
+ echo 'Message cid: bafy2bzacedv4os6xyuqyqjlzhbnlweqssratjd2a4ggd4as5kvastygesdt5m'
+ for i in {1..30}
+ sleep 5s
+ echo 'Attempt 1:'
Attempt 1:
+++ jq -n --arg cid bafy2bzacedv4os6xyuqyqjlzhbnlweqssratjd2a4ggd4as5kvastygesdt5m '{jsonrpc: "2.0", id: 1, method: "Filecoin.StateSearchMsg", params: [[], {"/": $cid}, 800, true]}'
++ curl -s -X POST http://127.0.0.1:2345/rpc/v1 --header 'Content-Type: application/json' --data '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "Filecoin.StateSearchMsg",
  "params": [
    [],
    {
      "/": "bafy2bzacedv4os6xyuqyqjlzhbnlweqssratjd2a4ggd4as5kvastygesdt5m"
    },
    800,
    true
  ]
}'
+ JSON='{"jsonrpc":"2.0","id":1,"error":{"code":-32603,"message":"Can'\''t create a valid state tree from the given root. This error may indicate unsupported version. state_root_cid=bafy2bzacebor42fwgwclotlolh6okmye5ikys4plkhjdpwzvwi6ytsnhx75r2, state_root_version=unknown"}}'
+ echo '{"jsonrpc":"2.0","id":1,"error":{"code":-32603,"message":"Can'\''t create a valid state tree from the given root. This error may indicate unsupported version. state_root_cid=bafy2bzacebor42fwgwclotlolh6okmye5ikys4plkhjdpwzvwi6ytsnhx75r2, state_root_version=unknown"}}'
+ jq -e .result
+ echo '{"jsonrpc":"2.0","id":1,"error":{"code":-32603,"message":"Can'\''t create a valid state tree from the given root. This error may indicate unsupported version. state_root_cid=bafy2bzacebor42fwgwclotlolh6okmye5ikys4plkhjdpwzvwi6ytsnhx75r2, state_root_version=unknown"}}'
{"jsonrpc":"2.0","id":1,"error":{"code":-32603,"message":"Can't create a valid state tree from the given root. This error may indicate unsupported version. state_root_cid=bafy2bzacebor42fwgwclotlolh6okmye5ikys4plkhjdpwzvwi6ytsnhx75r2, state_root_version=unknown"}}

Expected behaviour

The test doesn't fail but the implementation is still tested.

Screenshots

Environment (please complete the following information):

Other information and links

Test disabled in https://github.com/ChainSafe/forest/issues/4849

elmattic commented 2 weeks ago

The AddBalance message was successfully mined with 23 attoFIL:

https://calibration.filfox.info/en/message/bafy2bzacedv4os6xyuqyqjlzhbnlweqssratjd2a4ggd4as5kvastygesdt5m?t=1

Probably the issue lies in the way we're testing the method.