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

Flaky Filecoin.MarketAddBalance tests #4849

Open
LesnyRumcajs opened this issue Oct 7, 2024 · 1 comment
Open

Flaky Filecoin.MarketAddBalance tests #4849

LesnyRumcajs opened this issue Oct 7, 2024 · 1 comment
Assignees
Labels
Type: Bug Something isn't working

Comments

@LesnyRumcajs
Copy link
Member

LesnyRumcajs commented Oct 7, 2024

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

@LesnyRumcajs LesnyRumcajs added the Type: Bug Something isn't working label Oct 7, 2024
@elmattic
Copy link
Contributor

elmattic commented Oct 7, 2024

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.

@elmattic elmattic self-assigned this Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something isn't working
Projects
Status: Ready
Development

No branches or pull requests

2 participants