Lagrange-Labs / lsc-state-verifier

0 stars 2 forks source link

Committee root computed by the demo app doesn't match the api committee root #4

Closed Inkvi closed 8 months ago

Inkvi commented 8 months ago

In the program I use

OPTIMISM = "11155420"
BLOCK_NUMBER := "8412644"

req, err := http.NewRequest("GET", fmt.Sprintf("https://querylayer.lagrange.dev/blocks/block-data?chain_id=%s&block_number=%s", OPTIMISM, BLOCK_NUMBER), nil)

and the logs produce

Committee Root: e20a29a9293a44e6408bbbe8a7a82975c376a98b37b664cf010def814715c375

The api through returns a different result (28a4754819df7e2a456d8517ecd4a1c0bc1f1dffbe8e2458a6e8aa73e2e90b38) The query I used:

curl --location 'https://querylayer.lagrange.dev/blocks/block-data?chain_id=11155420&block_number=8412644' --header 'x-api-key:<key>'  | jq

The result:

{
  "address": [
    "0x482FB1fEd4E69A4494FA8be2ea72f1b6727AbbB1",
    "0x790747c66266F950924339B56e19174f57288ce8",
    "0x88de6bA9c3c6463a4d1CEC7a625D180Dc03d0235",
    "0x76d293DB2330Bd1Eb94239ebAB80E8894D5c92D2",
    "0x001a43c4da6481cBa4b5baBe67382b1c3b513684",
    "0x7627e924F5e74aeeE246E701cd23F5B038b3c5cD"
  ],
  "agg_signature": "cdde2c775fcef1d30e25c31aacb94f00414edda8d62e52df237b093fedcb185a0e9393b3ccad52601bce4dd0acf0fbbdf484daf75c033ddf62d2d99c304361cd",
  "aggregationBits": [
    1,
    1,
    1,
    1,
    1,
    0
  ],
  "chain_header": {
    "block_hash": "0xcc5089a2d0215f47a2b1620fc68870086214fdf252e9ac846e33d61431374a48",
    "block_number": 8412644,
    "chain_id": 11155420
  },
  "currentCommitteeeRoot": "28a4754819df7e2a456d8517ecd4a1c0bc1f1dffbe8e2458a6e8aa73e2e90b38",
  "nextCommitteeRoot": "28a4754819df7e2a456d8517ecd4a1c0bc1f1dffbe8e2458a6e8aa73e2e90b38",
  "pubkeys": [
    "d1d3df54f2b1a0eac84d76b0844fb34f78364e667bb9589086edbbf83b2c6ec9",
    "9f1c2ac7420289fc10c2b05403dfa41a5805c0d8513930cdc19fed05763cc84b",
    "989807d19f1be4c5bf155e3539b975a7fb5be1533e04223d7ec9802b953cec5e",
    "a4d76a9660c765001128a3558f79ee3d517cb3c9e2e362ad6c67e14e4fc12b22",
    "86a6f688787a19b885b07a22e95bffaca6073cfccc67a625695a5b2d12f936a5",
    "9f3a74effd16970b4de9403008b2534085ca1ab1b181ccfab065e5dadc27026d"
  ],
  "totalNumberOfCurrentSigners": 6,
  "totalVotingPower": 46500000,
  "votingPower": [
    8100000,
    10200000,
    10300000,
    10400000,
    6500000,
    1000000
  ]
}

Are they actually matching and I am missing some kind of data conversion or there is a bug?

kashishshah commented 8 months ago

Thanks for bringing this to attention. There was some issue with the configuration of one of the test client nodes which was causing the mismatch in computation. We have taken care of this and updated go-main branch with the default block_number for ARBITRUM.

You can use the other API routes to get more information and then compute committee_root for blocks of supported chains.

GetBlockByBlockNumber: curl --location 'https://querylayer.lagrange.dev/blocks/block?chain_id=<CHAIN_ID>&block_number=<BLOCK_NUMBER>' \
--header 'x-api-key: <API_KEY>'

GetBlockByBlockHash: curl --location 'https://querylayer.lagrange.dev/blocks/block-hash?chain_id=<CHAIN_ID>&block_hash=<BLOCK_HASH>' \
--header 'x-api-key: <API_KEY>'

GetLastFinalizedBlock: curl --location 'https://querylayer.lagrange.dev/blocks/last-finalized-block?chain_id=<CHAIN_ID>' \
--header 'x-api-key: <API_KEY>'
Inkvi commented 8 months ago

Perfect, thanks for fixing.