zenon-network / syrius

MIT License
18 stars 15 forks source link

syrius shows active sentinel after revoking it in syrius #71

Closed 0x3639 closed 6 months ago

0x3639 commented 6 months ago

Describe the bug When you activate a sentinel in syrius and then revoke it, syrius still shows the sentinel as still active.

To Reproduce Steps to reproduce the behavior:

  1. Create sentinel in syrius
  2. Revoke sentinel in syrius
  3. Try to recreate a sentinel in syrius on the same address
  4. Syrius returns "Sentinel detected on this address"

RPC returns false with embedded.sentinel.getByOwner

curl -X POST https://my.hc1node.com:35997 -H 'Content-Type: application/json' -d '{"jsonrpc": "2.0", "id": 4, "method": "embedded.sentinel.getByOwner", "params": ["z1qps9rgvgmtu9vsukdek2uhwye0t5zpcez4hju5"]}'

Expected behavior User should be able to create a sentinel on the address

Workaround Move funds to a different address and enable Sentinel.

Screenshots image

Desktop (please complete the following information):

Additional context Potential source of issue

if (snapshot.hasData) {
  return _getAlreadyCreatedSentinelBody(context);
} else {
  return _getCreateSentinelBody(context);
}
KingGorrin commented 6 months ago

Data of an address that never had a sentinel registered:

{
    "data": null
}

Data of an address with a registered sentinel:

{
    "data": {
        "owner": "{zts_address}",
        "registrationTimestamp": 1691513800,
        "isRevocable": true,
        "revokeCooldown": 22750,
        "active": true
    }
}

Data of an address with a revoked sentinel:

{
    "data": {
        "owner": "{zts_address}",
        "registrationTimestamp": 1691513800,
        "isRevocable": true,
        "revokeCooldown": 22750,
        "active": false
    }
}

Syrius only checks whether the rpc method embedded.sentinel.getByOwner returns data.

if (snapshot.hasData) {
  return _getAlreadyCreatedSentinelBody(context);
} else {
  return _getCreateSentinelBody(context);
}