planetarium / mimir

A backend service that provides 9c-related utility APIs.
https://nine-chronicles.dev/
GNU Affero General Public License v3.0
3 stars 17 forks source link

Sometimes arena participants appear to disappear from the leaderboard #299

Open boscohyun opened 2 months ago

boscohyun commented 2 months ago

Sometimes arena participants appear to disappear from the leaderboard in Mimir. This appears to be caused by the fact that the Arena collection in Mimir's MongoDB is being stored based on avatar address. Players can use the JoinArena action to join the next round early that hasn't started yet. This case should be considered in the Mimir walker.

Example

Mimir does not contains below:

{
  "rank": 98,
  "score": 1632,
  "avatarAddr": "0xd0643E862efA67012036D641D78Ca81978A9E487",
  "nameWithHash": "Vagiz <size=80%><color=#A68F7E>#d064</color></size>"
}

Mimir side

{
  "data": {
    "metadata": {
      "latestBlockIndex": 11615380
    },
    "arena": {
      "leaderboard": [
        ...
        {
          "address": "0x568b14B14ca95723C0d5E04D7d3F05bbFc5Fbbb1",
          "simpleAvatar": {
            "name": "MogulKahn"
          },
          "rank": 77,
          "arenaScore": {
            "score": 1634
          }
        },
        {
          "address": "0x783d38C96Eb4F53F4bb54BcB0aED9c6F3b4282ae",
          "simpleAvatar": {
            "name": "Alex"
          },
          "rank": 77,
          "arenaScore": {
            "score": 1634
          }
        },
        {
          "address": "0x053C5726B891e64DE345de217D912009C8f7f01e",
          "simpleAvatar": {
            "name": "Barm"
          },
          "rank": 97,
          "arenaScore": {
            "score": 1632
          }
        },
        {
          "address": "0x07e7724b32E0471466EfC5b51aBD350D189438dC",
          "simpleAvatar": {
            "name": "kemg"
          },
          "rank": 97,
          "arenaScore": {
            "score": 1632
          }
        },
        {
          "address": "0x1157bAC00E3992CAA40dA4bc07943B73a53bA713",
          "simpleAvatar": {
            "name": "olidalian"
          },
          "rank": 97,
          "arenaScore": {
            "score": 1632
          }
        },
        {
          "address": "0x1553193069980f3cBD0A3A7c36c4A2f8eA773005",
          "simpleAvatar": {
            "name": "Stucky"
          },
          "rank": 97,
          "arenaScore": {
            "score": 1632
          }
        },
        {
          "address": "0x53d47bE86b87e18D3e9c868D79a3a6EA62359F4A",
          "simpleAvatar": {
            "name": "Kaloudof"
          },
          "rank": 97,
          "arenaScore": {
            "score": 1632
          }
        },
        {
          "address": "0x694D9Ff8C5a2483Df21af874194fd5aC544BE608",
          "simpleAvatar": {
            "name": "WindmillGig"
          },
          "rank": 97,
          "arenaScore": {
            "score": 1632
          }
        },
        {
          "address": "0x6ACEeE8FF0f86880480D0c012Eef816818e96bAa",
          "simpleAvatar": {
            "name": "noblekid"
          },
          "rank": 97,
          "arenaScore": {
            "score": 1632
          }
        },
        {
          "address": "0x6F813Ad797823B4400ba51B7e2Bb4113466F26F9",
          "simpleAvatar": {
            "name": "Chuk"
          },
          "rank": 97,
          "arenaScore": {
            "score": 1632
          }
        },
        {
          "address": "0x778FEE17DECb8BFe02AaF33c8eDb7Ca4698a55dB",
          "simpleAvatar": {
            "name": "junhe"
          },
          "rank": 97,
          "arenaScore": {
            "score": 1632
          }
        },
        {
          "address": "0x7D9d84718c085DA968029756eE9ab41a90dFA940",
          "simpleAvatar": {
            "name": "Themur1"
          },
          "rank": 97,
          "arenaScore": {
            "score": 1632
          }
        },
        {
          "address": "0x88750df6FA45a3F12f8D0021babD355517a7DF6D",
          "simpleAvatar": {
            "name": "Diablo1"
          },
          "rank": 97,
          "arenaScore": {
            "score": 1632
          }
        },
        {
          "address": "0x8A472FD3E117090a03dc7F769AB8e93187ea984f",
          "simpleAvatar": {
            "name": "licer"
          },
          "rank": 97,
          "arenaScore": {
            "score": 1632
          }
        },
        {
          "address": "0x9A5D17D91882aff267f6fFb4A981508dA27BC7FE",
          "simpleAvatar": {
            "name": "blackJack"
          },
          "rank": 97,
          "arenaScore": {
            "score": 1632
          }
        },
        {
          "address": "0x9e4405DFd2b25d31a491Fe693f08229cd6490804",
          "simpleAvatar": {
            "name": "somaking"
          },
          "rank": 97,
          "arenaScore": {
            "score": 1632
          }
        },
        {
          "address": "0xae60c7dD31648c0A561EA5049e4859e3fCF1c16A",
          "simpleAvatar": {
            "name": "Catboy"
          },
          "rank": 97,
          "arenaScore": {
            "score": 1632
          }
        },
        {
          "address": "0xb01f6De457098901535214FBCcD3748C0d2708ed",
          "simpleAvatar": {
            "name": "Chudoezh"
          },
          "rank": 97,
          "arenaScore": {
            "score": 1632
          }
        },
        {
          "address": "0xC42D3305dCd199Aa755F1dFE859BF9238915181c",
          "simpleAvatar": {
            "name": "NeettWeet"
          },
          "rank": 97,
          "arenaScore": {
            "score": 1632
          }
        },
        {
          "address": "0xc8e28C5Cef796917B18ED002ddd31328d96dEe80",
          "simpleAvatar": {
            "name": "happpyiersbot"
          },
          "rank": 97,
          "arenaScore": {
            "score": 1632
          }
        },
        {
          "address": "0xDD21DCc1A9d393550A49999363e383c8409Ee1A2",
          "simpleAvatar": {
            "name": "freeless"
          },
          "rank": 97,
          "arenaScore": {
            "score": 1632
          }
        },
        {
          "address": "0xF88e82734d75639d04F68BB36dE99E19cF4884F7",
          "simpleAvatar": {
            "name": "PhanThanh95x"
          },
          "rank": 97,
          "arenaScore": {
            "score": 1632
          }
        },
        {
          "address": "0x02EcC8bdb7AE851cae80BCa3C2eF258fed042E50",
          "simpleAvatar": {
            "name": "Jackchen"
          },
          "rank": 129,
          "arenaScore": {
            "score": 1631
          }
        },
        {
          "address": "0x031ec5D8E0b5B68FbC48EFB8a23234ed91dEb4Cf",
          "simpleAvatar": {
            "name": "agepan"
          },
          "rank": 129,
          "arenaScore": {
            "score": 1631
          }
        },
        ...
      ]
    }
  }
}

Headless side

{
  "data": {
    "nodeStatus": {
      "tip": {
        "index": 11615380
      }
    },
    "stateQuery": {
      "arenaParticipants": [
        ...
        {
          "rank": 77,
          "score": 1634,
          "avatarAddr": "0x568b14B14ca95723C0d5E04D7d3F05bbFc5Fbbb1",
          "nameWithHash": "MogulKahn <size=80%><color=#A68F7E>#568b</color></size>"
        },
        {
          "rank": 77,
          "score": 1634,
          "avatarAddr": "0x783d38C96Eb4F53F4bb54BcB0aED9c6F3b4282ae",
          "nameWithHash": "Alex <size=80%><color=#A68F7E>#783d</color></size>"
        },
        {
          "rank": 98,
          "score": 1632,
          "avatarAddr": "0x053C5726B891e64DE345de217D912009C8f7f01e",
          "nameWithHash": "Barm <size=80%><color=#A68F7E>#053C</color></size>"
        },
        {
          "rank": 98,
          "score": 1632,
          "avatarAddr": "0x07e7724b32E0471466EfC5b51aBD350D189438dC",
          "nameWithHash": "kemg <size=80%><color=#A68F7E>#07e7</color></size>"
        },
        {
          "rank": 98,
          "score": 1632,
          "avatarAddr": "0x1157bAC00E3992CAA40dA4bc07943B73a53bA713",
          "nameWithHash": "olidalian <size=80%><color=#A68F7E>#1157</color></size>"
        },
        {
          "rank": 98,
          "score": 1632,
          "avatarAddr": "0x1553193069980f3cBD0A3A7c36c4A2f8eA773005",
          "nameWithHash": "Stucky <size=80%><color=#A68F7E>#1553</color></size>"
        },
        {
          "rank": 98,
          "score": 1632,
          "avatarAddr": "0x53d47bE86b87e18D3e9c868D79a3a6EA62359F4A",
          "nameWithHash": "Kaloudof <size=80%><color=#A68F7E>#53d4</color></size>"
        },
        {
          "rank": 98,
          "score": 1632,
          "avatarAddr": "0x694D9Ff8C5a2483Df21af874194fd5aC544BE608",
          "nameWithHash": "WindmillGig <size=80%><color=#A68F7E>#694D</color></size>"
        },
        {
          "rank": 98,
          "score": 1632,
          "avatarAddr": "0x6ACEeE8FF0f86880480D0c012Eef816818e96bAa",
          "nameWithHash": "noblekid <size=80%><color=#A68F7E>#6ACE</color></size>"
        },
        {
          "rank": 98,
          "score": 1632,
          "avatarAddr": "0x6F813Ad797823B4400ba51B7e2Bb4113466F26F9",
          "nameWithHash": "Chuk <size=80%><color=#A68F7E>#6F81</color></size>"
        },
        {
          "rank": 98,
          "score": 1632,
          "avatarAddr": "0x778FEE17DECb8BFe02AaF33c8eDb7Ca4698a55dB",
          "nameWithHash": "junhe <size=80%><color=#A68F7E>#778F</color></size>"
        },
        {
          "rank": 98,
          "score": 1632,
          "avatarAddr": "0x7D9d84718c085DA968029756eE9ab41a90dFA940",
          "nameWithHash": "Themur1 <size=80%><color=#A68F7E>#7D9d</color></size>"
        },
        {
          "rank": 98,
          "score": 1632,
          "avatarAddr": "0x88750df6FA45a3F12f8D0021babD355517a7DF6D",
          "nameWithHash": "Diablo1 <size=80%><color=#A68F7E>#8875</color></size>"
        },
        {
          "rank": 98,
          "score": 1632,
          "avatarAddr": "0x8A472FD3E117090a03dc7F769AB8e93187ea984f",
          "nameWithHash": "licer <size=80%><color=#A68F7E>#8A47</color></size>"
        },
        {
          "rank": 98,
          "score": 1632,
          "avatarAddr": "0x9A5D17D91882aff267f6fFb4A981508dA27BC7FE",
          "nameWithHash": "blackJack <size=80%><color=#A68F7E>#9A5D</color></size>"
        },
        {
          "rank": 98,
          "score": 1632,
          "avatarAddr": "0x9e4405DFd2b25d31a491Fe693f08229cd6490804",
          "nameWithHash": "somaking <size=80%><color=#A68F7E>#9e44</color></size>"
        },
        {
          "rank": 98,
          "score": 1632,
          "avatarAddr": "0xae60c7dD31648c0A561EA5049e4859e3fCF1c16A",
          "nameWithHash": "Catboy <size=80%><color=#A68F7E>#ae60</color></size>"
        },
        {
          "rank": 98,
          "score": 1632,
          "avatarAddr": "0xb01f6De457098901535214FBCcD3748C0d2708ed",
          "nameWithHash": "Chudoezh <size=80%><color=#A68F7E>#b01f</color></size>"
        },
        {
          "rank": 98,
          "score": 1632,
          "avatarAddr": "0xC42D3305dCd199Aa755F1dFE859BF9238915181c",
          "nameWithHash": "NeettWeet <size=80%><color=#A68F7E>#C42D</color></size>"
        },
        {
          "rank": 98,
          "score": 1632,
          "avatarAddr": "0xc8e28C5Cef796917B18ED002ddd31328d96dEe80",
          "nameWithHash": "happpyiersbot <size=80%><color=#A68F7E>#c8e2</color></size>"
        },
        {
          "rank": 98,
          "score": 1632,
          "avatarAddr": "0xd0643E862efA67012036D641D78Ca81978A9E487",
          "nameWithHash": "Vagiz <size=80%><color=#A68F7E>#d064</color></size>"
        },
        {
          "rank": 98,
          "score": 1632,
          "avatarAddr": "0xDD21DCc1A9d393550A49999363e383c8409Ee1A2",
          "nameWithHash": "freeless <size=80%><color=#A68F7E>#DD21</color></size>"
        },
        {
          "rank": 98,
          "score": 1632,
          "avatarAddr": "0xF88e82734d75639d04F68BB36dE99E19cF4884F7",
          "nameWithHash": "PhanThanh95x <size=80%><color=#A68F7E>#F88e</color></size>"
        },
        {
          "rank": 130,
          "score": 1631,
          "avatarAddr": "0x02EcC8bdb7AE851cae80BCa3C2eF258fed042E50",
          "nameWithHash": "Jackchen <size=80%><color=#A68F7E>#02Ec</color></size>"
        },
        {
          "rank": 130,
          "score": 1631,
          "avatarAddr": "0x031ec5D8E0b5B68FbC48EFB8a23234ed91dEb4Cf",
          "nameWithHash": "agepan <size=80%><color=#A68F7E>#031e</color></size>"
        },
        ...
      ]
    }
  },
  "extensions": {}
}
boscohyun commented 2 months ago

When processing a JoinArena action that early registers for the next round, rather than the currently active round, the current round's information is being overwritten with the next round's information. I suspect this is the cause of this issue.