Skip to content

Flaky Filecoin.MarketAddBalance tests #4849

@LesnyRumcajs

Description

@LesnyRumcajs

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:

: Begin Filecoin.MarketAddBalance test
FOREST_URL='http://127.0.0.1:2345/rpc/v1'
# Amount to add to the Market actor (in attoFIL)
MARKET_FIL_AMT="23"
# The preloaded address
REMOTE_ADDR=$($FOREST_WALLET_PATH --remote-wallet list | tail -1 | cut -d ' ' -f1)
JSON=$(curl -s -X POST "$FOREST_URL" \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer $ADMIN_TOKEN" \
--data "$(jq -n --arg addr "$REMOTE_ADDR" --arg amt "$MARKET_FIL_AMT" '{jsonrpc: "2.0", id: 1, method: "Filecoin.MarketAddBalance", params: [$addr, $addr, $amt]}')")
echo "$JSON"
if [[ $(echo "$JSON" | jq -e '.result') == "null" ]]; then
echo "Error while sending message."
exit 1
fi
MSG_CID=$(echo "$JSON" | jq -r '.result["/"]')
echo "Message cid: $MSG_CID"
# Try 30 times (in other words wait for 5 tipsets)
for i in {1..30}
do
sleep 5s
echo "Attempt $i:"
JSON=$(curl -s -X POST "$FOREST_URL" \
--header 'Content-Type: application/json' \
--data "$(jq -n --arg cid "$MSG_CID" '{jsonrpc: "2.0", id: 1, method: "Filecoin.StateSearchMsg", params: [[], {"/": $cid}, 800, true]}')")
echo "$JSON"
# Check if the message has been mined.
if echo "$JSON" | jq -e '.result' > /dev/null; then
echo "Message found, exiting."
break
fi
echo -e "\n"
done
if [[ $(echo "$JSON" | jq -e '.result') == "null" ]]; then
echo "Error while sending message."
exit 1
fi

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):

  • OS: GH runner's ubuntu-latest
  • Branch/commit main 6b4f26d
  • Hardware GH runner

Other information and links

Test disabled in #4849

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: BugSomething isn't working

    Type

    No type

    Projects

    Status

    Frozen

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions