graphprotocol / allocation-optimizer

Agents and algorithms for optimizing Indexer decision problems.
MIT License
13 stars 14 forks source link

Total Proposed Allocation Amount Exceeds Available Stake #19

Closed kaiwetlesen closed 1 year ago

kaiwetlesen commented 1 year ago

Bug Description AllocationOpt generates actions which are not executable due to the optimiser allocating fractionally more tokens than those which are in available stake.

To Reproduce Steps to reproduce the behavior:

  1. Run 'allocationopt actionqueue 0xd75c4dbcb215a6cf9097cfbcc70aab2596b96a9c 1 whitelist.csv 100 24 20 0.3 http://localhost:8000 https://gateway.thegraph.com/network' where "whitelist.csv" contains a list of pre-indexed subgraphs.
  2. Julia version: 1.7.3
  3. Istalled packages:
    (@v1.7) pkg> status
      Status `~/.julia/environments/v1.7/Project.toml`
    [c8d4fa36] AllocationOpt v1.9.0 `https://github.com/graphprotocol/AllocationOpt.jl#main`
    [863f3e99] Comonicon v1.0.0

Expected behavior AllocationOpt generates optimal rules which are actionable based on the premise that the total of all allocations is less than or equal to the total available stake.

Desktop (please complete the following information):

Additional context Logs from Indexer Agent after executing actions proposed by the Allocation Optimiser:

{"level":20,"time":1666127548016,"pid":1,"hostname":"indexer-agent-0","name":"IndexerAgent","component":"IndexerManagementServer","msg":"POST / 200 48 - 189.948 ms"}
{"level":20,"time":1666127550220,"pid":1,"hostname":"indexer-agent-0","name":"IndexerAgent","component":"IndexerManagementClient","msg":"Execute 'executeApprovedActions' mutation"}
{"level":30,"time":1666127550227,"pid":1,"hostname":"indexer-agent-0","name":"IndexerAgent","action":91,"deployment":"QmcpX4ScNaWfSE1ZmfEFM3mPSCz5frk6edwsYMAvfGtrXV","amount":"4495710291212000000000000","msg":"Preparing to allocate"}
{"level":30,"time":1666127550227,"pid":1,"hostname":"indexer-agent-0","name":"IndexerAgent","action":92,"deployment":"QmVQdzeGdPUiLiACeqXRpKAYpyj8Z1yfWLMUq7A7WundUf","amount":"6538176653363000000000000","msg":"Preparing to allocate"}
{"level":30,"time":1666127550228,"pid":1,"hostname":"indexer-agent-0","name":"IndexerAgent","action":93,"deployment":"QmWkVS3Uzr2WsTwvxtte2dpHbSYJSQ1bTQMVciKXCWx7TM","amount":"1440996064083000000000000","msg":"Preparing to allocate"}
{"level":30,"time":1666127550228,"pid":1,"hostname":"indexer-agent-0","name":"IndexerAgent","action":94,"deployment":"QmaaDA7XVVktfxCLMgfwG1z3KM8DSMoLkbemkTt9mQT8Qf","amount":"4157018748012000000000000","msg":"Preparing to allocate"}
{"level":40,"time":1666127550248,"pid":1,"hostname":"indexer-agent-0","name":"IndexerAgent","msg":"No Active allocations found for indexer '0xd75C4Dbcb215A6cf9097cfbCc70aAB2596B96a9C'"}
{"level":40,"time":1666127550313,"pid":1,"hostname":"indexer-agent-0","name":"IndexerAgent","msg":"No Active allocations found for indexer '0xd75C4Dbcb215A6cf9097cfbCc70aAB2596B96a9C'"}
{"level":40,"time":1666127550316,"pid":1,"hostname":"indexer-agent-0","name":"IndexerAgent","msg":"No Active allocations found for indexer '0xd75C4Dbcb215A6cf9097cfbCc70aAB2596B96a9C'"}
{"level":40,"time":1666127550317,"pid":1,"hostname":"indexer-agent-0","name":"IndexerAgent","msg":"No Active allocations found for indexer '0xd75C4Dbcb215A6cf9097cfbCc70aAB2596B96a9C'"}
{"level":30,"time":1666127550424,"pid":1,"hostname":"indexer-agent-0","name":"IndexerAgent","action":92,"name":"QmVQdzeGdPUiLiACeqXRpKA/Ypyj8Z1yfWLMUq7A7WundUf","msg":"Create subgraph name"}
{"level":30,"time":1666127550428,"pid":1,"hostname":"indexer-agent-0","name":"IndexerAgent","action":93,"name":"QmWkVS3Uzr2WsTwvxtte2dp/HbSYJSQ1bTQMVciKXCWx7TM","msg":"Create subgraph name"}
{"level":30,"time":1666127550437,"pid":1,"hostname":"indexer-agent-0","name":"IndexerAgent","action":91,"name":"QmcpX4ScNaWfSE1ZmfEFM3m/PSCz5frk6edwsYMAvfGtrXV","msg":"Create subgraph name"}
{"level":30,"time":1666127550440,"pid":1,"hostname":"indexer-agent-0","name":"IndexerAgent","action":94,"name":"QmaaDA7XVVktfxCLMgfwG1z/3KM8DSMoLkbemkTt9mQT8Qf","msg":"Create subgraph name"}
{"level":30,"time":1666127550512,"pid":1,"hostname":"indexer-agent-0","name":"IndexerAgent","action":93,"name":"QmWkVS3Uzr2WsTwvxtte2dp/HbSYJSQ1bTQMVciKXCWx7TM","msg":"Successfully created subgraph name"}
{"level":30,"time":1666127550512,"pid":1,"hostname":"indexer-agent-0","name":"IndexerAgent","action":93,"name":"QmWkVS3Uzr2WsTwvxtte2dp/HbSYJSQ1bTQMVciKXCWx7TM","deployment":{"bytes32":"0x7cf8f2026b1f49a36f29293fb9545ce31ac3f71c40009c7e038d42ccea1b2b98","ipfsHash":"QmWkVS3Uzr2WsTwvxtte2dpHbSYJSQ1bTQMVciKXCWx7TM"},"targetNode":"index-node-0","msg":"Deploy subgraph"}
{"level":30,"time":1666127550513,"pid":1,"hostname":"indexer-agent-0","name":"IndexerAgent","action":92,"name":"QmVQdzeGdPUiLiACeqXRpKA/Ypyj8Z1yfWLMUq7A7WundUf","msg":"Successfully created subgraph name"}
{"level":30,"time":1666127550514,"pid":1,"hostname":"indexer-agent-0","name":"IndexerAgent","action":92,"name":"QmVQdzeGdPUiLiACeqXRpKA/Ypyj8Z1yfWLMUq7A7WundUf","deployment":{"bytes32":"0x690752ca4c6cd7a89792e10f681e28631fa4e28ab84cb445be2ece9eea9dd8bc","ipfsHash":"QmVQdzeGdPUiLiACeqXRpKAYpyj8Z1yfWLMUq7A7WundUf"},"targetNode":"index-node-1","msg":"Deploy subgraph"}
{"level":30,"time":1666127550514,"pid":1,"hostname":"indexer-agent-0","name":"IndexerAgent","action":91,"name":"QmcpX4ScNaWfSE1ZmfEFM3m/PSCz5frk6edwsYMAvfGtrXV","msg":"Successfully created subgraph name"}
{"level":30,"time":1666127550515,"pid":1,"hostname":"indexer-agent-0","name":"IndexerAgent","action":91,"name":"QmcpX4ScNaWfSE1ZmfEFM3m/PSCz5frk6edwsYMAvfGtrXV","deployment":{"bytes32":"0xd7273afdea0346c07136953546b1cc95e919083a625ab3ab69b8a6d58e745634","ipfsHash":"QmcpX4ScNaWfSE1ZmfEFM3mPSCz5frk6edwsYMAvfGtrXV"},"targetNode":"index-node-0","msg":"Deploy subgraph"}
{"level":30,"time":1666127550515,"pid":1,"hostname":"indexer-agent-0","name":"IndexerAgent","action":94,"name":"QmaaDA7XVVktfxCLMgfwG1z/3KM8DSMoLkbemkTt9mQT8Qf","msg":"Successfully created subgraph name"}
{"level":30,"time":1666127550516,"pid":1,"hostname":"indexer-agent-0","name":"IndexerAgent","action":94,"name":"QmaaDA7XVVktfxCLMgfwG1z/3KM8DSMoLkbemkTt9mQT8Qf","deployment":{"bytes32":"0xb5c57baf86e39e2a837634f5dcab48a536f3b29397d36eb165a821bd080146d8","ipfsHash":"QmaaDA7XVVktfxCLMgfwG1z3KM8DSMoLkbemkTt9mQT8Qf"},"targetNode":"index-node-0","msg":"Deploy subgraph"}
{"level":30,"time":1666127550537,"pid":1,"hostname":"indexer-agent-0","name":"IndexerAgent","action":94,"name":"QmaaDA7XVVktfxCLMgfwG1z/3KM8DSMoLkbemkTt9mQT8Qf","deployment":{"bytes32":"0xb5c57baf86e39e2a837634f5dcab48a536f3b29397d36eb165a821bd080146d8","ipfsHash":"QmaaDA7XVVktfxCLMgfwG1z3KM8DSMoLkbemkTt9mQT8Qf"},"endpoints":{"playground":":8000/subgraphs/name/QmaaDA7XVVktfxCLMgfwG1z/3KM8DSMoLkbemkTt9mQT8Qf/graphql","queries":":8000/subgraphs/name/QmaaDA7XVVktfxCLMgfwG1z/3KM8DSMoLkbemkTt9mQT8Qf","subscriptions":":8001/subgraphs/name/QmaaDA7XVVktfxCLMgfwG1z/3KM8DSMoLkbemkTt9mQT8Qf"},"msg":"Successfully deployed subgraph"}
{"level":30,"time":1666127550538,"pid":1,"hostname":"indexer-agent-0","name":"IndexerAgent","action":94,"deployment":{"bytes32":"0xb5c57baf86e39e2a837634f5dcab48a536f3b29397d36eb165a821bd080146d8","ipfsHash":"QmaaDA7XVVktfxCLMgfwG1z3KM8DSMoLkbemkTt9mQT8Qf"},"targetNode":"index-node-2","msg":"Reassign subgraph deployment"}
{"level":20,"time":1666127550546,"pid":1,"hostname":"indexer-agent-0","name":"IndexerAgent","action":94,"msg":"Obtain a unique Allocation ID"}
{"level":30,"time":1666127550914,"pid":1,"hostname":"indexer-agent-0","name":"IndexerAgent","action":92,"name":"QmVQdzeGdPUiLiACeqXRpKA/Ypyj8Z1yfWLMUq7A7WundUf","deployment":{"bytes32":"0x690752ca4c6cd7a89792e10f681e28631fa4e28ab84cb445be2ece9eea9dd8bc","ipfsHash":"QmVQdzeGdPUiLiACeqXRpKAYpyj8Z1yfWLMUq7A7WundUf"},"endpoints":{"playground":":8000/subgraphs/name/QmVQdzeGdPUiLiACeqXRpKA/Ypyj8Z1yfWLMUq7A7WundUf/graphql","queries":":8000/subgraphs/name/QmVQdzeGdPUiLiACeqXRpKA/Ypyj8Z1yfWLMUq7A7WundUf","subscriptions":":8001/subgraphs/name/QmVQdzeGdPUiLiACeqXRpKA/Ypyj8Z1yfWLMUq7A7WundUf"},"msg":"Successfully deployed subgraph"}
{"level":30,"time":1666127550914,"pid":1,"hostname":"indexer-agent-0","name":"IndexerAgent","action":92,"deployment":{"bytes32":"0x690752ca4c6cd7a89792e10f681e28631fa4e28ab84cb445be2ece9eea9dd8bc","ipfsHash":"QmVQdzeGdPUiLiACeqXRpKAYpyj8Z1yfWLMUq7A7WundUf"},"targetNode":"index-node-1","msg":"Reassign subgraph deployment"}
{"level":20,"time":1666127550924,"pid":1,"hostname":"indexer-agent-0","name":"IndexerAgent","action":92,"msg":"Obtain a unique Allocation ID"}
{"level":30,"time":1666127551326,"pid":1,"hostname":"indexer-agent-0","name":"IndexerAgent","action":91,"name":"QmcpX4ScNaWfSE1ZmfEFM3m/PSCz5frk6edwsYMAvfGtrXV","deployment":{"bytes32":"0xd7273afdea0346c07136953546b1cc95e919083a625ab3ab69b8a6d58e745634","ipfsHash":"QmcpX4ScNaWfSE1ZmfEFM3mPSCz5frk6edwsYMAvfGtrXV"},"endpoints":{"playground":":8000/subgraphs/name/QmcpX4ScNaWfSE1ZmfEFM3m/PSCz5frk6edwsYMAvfGtrXV/graphql","queries":":8000/subgraphs/name/QmcpX4ScNaWfSE1ZmfEFM3m/PSCz5frk6edwsYMAvfGtrXV","subscriptions":":8001/subgraphs/name/QmcpX4ScNaWfSE1ZmfEFM3m/PSCz5frk6edwsYMAvfGtrXV"},"msg":"Successfully deployed subgraph"}
{"level":30,"time":1666127551326,"pid":1,"hostname":"indexer-agent-0","name":"IndexerAgent","action":91,"deployment":{"bytes32":"0xd7273afdea0346c07136953546b1cc95e919083a625ab3ab69b8a6d58e745634","ipfsHash":"QmcpX4ScNaWfSE1ZmfEFM3mPSCz5frk6edwsYMAvfGtrXV"},"targetNode":"index-node-1","msg":"Reassign subgraph deployment"}
{"level":20,"time":1666127551331,"pid":1,"hostname":"indexer-agent-0","name":"IndexerAgent","action":94,"newAllocationSigner":{"_isSigner":true,"address":"0xFc4cEfDc740d99edE6485dD3dfcccB04f807c7CE","provider":null},"newAllocationID":"0xFc4cEfDc740d99edE6485dD3dfcccB04f807c7CE","indexerAddress":"0xd75C4Dbcb215A6cf9097cfbCc70aAB2596B96a9C","msg":"Generating new allocation ID proof"}
{"level":20,"time":1666127551333,"pid":1,"hostname":"indexer-agent-0","name":"IndexerAgent","action":94,"allocationIDProof":"0xe5e876174d79ad0f1aabf48791b2ecdba1e98f5bbafae2a8c22d24efb695574452002c21203baf92cb2d838b0143037bcdcd31a40293aeef5c68164360a3e69a1c","msg":"Successfully generated allocation ID proof"}
{"level":20,"time":1666127551333,"pid":1,"hostname":"indexer-agent-0","name":"IndexerAgent","action":94,"indexer":"0xd75C4Dbcb215A6cf9097cfbCc70aAB2596B96a9C","subgraphDeployment":"0xb5c57baf86e39e2a837634f5dcab48a536f3b29397d36eb165a821bd080146d8","amount":"4157018.748012","allocation":"0xFc4cEfDc740d99edE6485dD3dfcccB04f807c7CE","proof":"0xe5e876174d79ad0f1aabf48791b2ecdba1e98f5bbafae2a8c22d24efb695574452002c21203baf92cb2d838b0143037bcdcd31a40293aeef5c68164360a3e69a1c","msg":"Populating allocateFrom transaction"}
{"level":30,"time":1666127551414,"pid":1,"hostname":"indexer-agent-0","name":"IndexerAgent","action":93,"name":"QmWkVS3Uzr2WsTwvxtte2dp/HbSYJSQ1bTQMVciKXCWx7TM","deployment":{"bytes32":"0x7cf8f2026b1f49a36f29293fb9545ce31ac3f71c40009c7e038d42ccea1b2b98","ipfsHash":"QmWkVS3Uzr2WsTwvxtte2dpHbSYJSQ1bTQMVciKXCWx7TM"},"endpoints":{"playground":":8000/subgraphs/name/QmWkVS3Uzr2WsTwvxtte2dp/HbSYJSQ1bTQMVciKXCWx7TM/graphql","queries":":8000/subgraphs/name/QmWkVS3Uzr2WsTwvxtte2dp/HbSYJSQ1bTQMVciKXCWx7TM","subscriptions":":8001/subgraphs/name/QmWkVS3Uzr2WsTwvxtte2dp/HbSYJSQ1bTQMVciKXCWx7TM"},"msg":"Successfully deployed subgraph"}
{"level":30,"time":1666127551414,"pid":1,"hostname":"indexer-agent-0","name":"IndexerAgent","action":93,"deployment":{"bytes32":"0x7cf8f2026b1f49a36f29293fb9545ce31ac3f71c40009c7e038d42ccea1b2b98","ipfsHash":"QmWkVS3Uzr2WsTwvxtte2dpHbSYJSQ1bTQMVciKXCWx7TM"},"targetNode":"index-node-1","msg":"Reassign subgraph deployment"}
{"level":20,"time":1666127551415,"pid":1,"hostname":"indexer-agent-0","name":"IndexerAgent","action":92,"newAllocationSigner":{"_isSigner":true,"address":"0x114E194fa29c67d0d88756b0a1800B20ECDB78F0","provider":null},"newAllocationID":"0x114E194fa29c67d0d88756b0a1800B20ECDB78F0","indexerAddress":"0xd75C4Dbcb215A6cf9097cfbCc70aAB2596B96a9C","msg":"Generating new allocation ID proof"}
{"level":20,"time":1666127551418,"pid":1,"hostname":"indexer-agent-0","name":"IndexerAgent","action":92,"allocationIDProof":"0x37494466a4d21f824ac10a19420561f65b728f2e707c605673f8ebfdfbe492bd429b66d202333b8b3c8d91607e8ec0454d7d74d670997a34602712d06f1e803f1b","msg":"Successfully generated allocation ID proof"}
{"level":20,"time":1666127551418,"pid":1,"hostname":"indexer-agent-0","name":"IndexerAgent","action":92,"indexer":"0xd75C4Dbcb215A6cf9097cfbCc70aAB2596B96a9C","subgraphDeployment":"0x690752ca4c6cd7a89792e10f681e28631fa4e28ab84cb445be2ece9eea9dd8bc","amount":"6538176.653363","allocation":"0x114E194fa29c67d0d88756b0a1800B20ECDB78F0","proof":"0x37494466a4d21f824ac10a19420561f65b728f2e707c605673f8ebfdfbe492bd429b66d202333b8b3c8d91607e8ec0454d7d74d670997a34602712d06f1e803f1b","msg":"Populating allocateFrom transaction"}
{"level":20,"time":1666127551420,"pid":1,"hostname":"indexer-agent-0","name":"IndexerAgent","action":91,"msg":"Obtain a unique Allocation ID"}
{"level":20,"time":1666127551738,"pid":1,"hostname":"indexer-agent-0","name":"IndexerAgent","action":93,"msg":"Obtain a unique Allocation ID"}
{"level":20,"time":1666127552125,"pid":1,"hostname":"indexer-agent-0","name":"IndexerAgent","action":91,"newAllocationSigner":{"_isSigner":true,"address":"0x6D2F55dEEaCC907438f87a87fc6D506ceEEEC08D","provider":null},"newAllocationID":"0x6D2F55dEEaCC907438f87a87fc6D506ceEEEC08D","indexerAddress":"0xd75C4Dbcb215A6cf9097cfbCc70aAB2596B96a9C","msg":"Generating new allocation ID proof"}
{"level":20,"time":1666127552127,"pid":1,"hostname":"indexer-agent-0","name":"IndexerAgent","action":91,"allocationIDProof":"0x5277091191ba895ee8e3ea7675670f776209f4328ad686fb920faaebe91607650687e9233077bb2044500dd6ab39fbdea6a3f7f6ccc3c6ef70c20c67d8fb1d481b","msg":"Successfully generated allocation ID proof"}
{"level":20,"time":1666127552127,"pid":1,"hostname":"indexer-agent-0","name":"IndexerAgent","action":91,"indexer":"0xd75C4Dbcb215A6cf9097cfbCc70aAB2596B96a9C","subgraphDeployment":"0xd7273afdea0346c07136953546b1cc95e919083a625ab3ab69b8a6d58e745634","amount":"4495710.291212","allocation":"0x6D2F55dEEaCC907438f87a87fc6D506ceEEEC08D","proof":"0x5277091191ba895ee8e3ea7675670f776209f4328ad686fb920faaebe91607650687e9233077bb2044500dd6ab39fbdea6a3f7f6ccc3c6ef70c20c67d8fb1d481b","msg":"Populating allocateFrom transaction"}
{"level":20,"time":1666127552138,"pid":1,"hostname":"indexer-agent-0","name":"IndexerAgent","action":93,"newAllocationSigner":{"_isSigner":true,"address":"0x10665221a1C9e8a2898E8Bd1A8EBc6594E2640eA","provider":null},"newAllocationID":"0x10665221a1C9e8a2898E8Bd1A8EBc6594E2640eA","indexerAddress":"0xd75C4Dbcb215A6cf9097cfbCc70aAB2596B96a9C","msg":"Generating new allocation ID proof"}
{"level":20,"time":1666127552141,"pid":1,"hostname":"indexer-agent-0","name":"IndexerAgent","action":93,"allocationIDProof":"0x1bac397c4bad7fb2ae3a4cfea6c15e76c9072ed74a985f37a7c55b78bddb58db2a18ed822986bc94b181ef06ae4d583e71d097fe228b100773d16b84ff38e2641b","msg":"Successfully generated allocation ID proof"}
{"level":20,"time":1666127552212,"pid":1,"hostname":"indexer-agent-0","name":"IndexerAgent","action":93,"indexer":"0xd75C4Dbcb215A6cf9097cfbCc70aAB2596B96a9C","subgraphDeployment":"0x7cf8f2026b1f49a36f29293fb9545ce31ac3f71c40009c7e038d42ccea1b2b98","amount":"1440996.064083","allocation":"0x10665221a1C9e8a2898E8Bd1A8EBc6594E2640eA","proof":"0x1bac397c4bad7fb2ae3a4cfea6c15e76c9072ed74a985f37a7c55b78bddb58db2a18ed822986bc94b181ef06ae4d583e71d097fe228b100773d16b84ff38e2641b","msg":"Populating allocateFrom transaction"}
Failure point >>> {"level":50,"time":1666127552302,"pid":1,"hostname":"indexer-agent-0","name":"IndexerAgent","msg":"Failed to execute batch tx on staking contract: Error: cannot estimate gas; transaction may fail or may require manual gas limit [ See: https://links.ethers.org/v5-errors-UNPREDICTABLE_GAS_LIMIT ] (error={\"reason\":\"processing response error\",\"code\":\"SERVER_ERROR\",\"body\":\"{\\\"jsonrpc\\\":\\\"2.0\\\",\\\"id\\\":558015,\\\"error\\\":{\\\"code\\\":3,\\\"message\\\":\\\"execution reverted: !capacity\\\",\\\"data\\\":\\\"0x08c379a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000092163617061636974790000000000000000000000000000000000000000000000\\\"}}\\n\",\"error\":{\"code\":3,\"data\":\"0x08c379a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000092163617061636974790000000000000000000000000000000000000000000000\"},\"requestBody\":\"{\\\"method\\\":\\\"eth_estimateGas\\\",\\\"params\\\":[{\\\"from\\\":\\\"0xf945dfbffe3865e8cb58abfea90466bdcbc615d9\\\",\\\"to\\\":\\\"0xf55041e37e12cd407ad00ce2910b8269b01263b9\\\",\\\"data\\\":\\\"0xac9650d8000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000003800000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000014423477e48000000000000000000000000d75c4dbcb215a6cf9097cfbcc70aab2596b96a9cd7273afdea0346c07136953546b1cc95e919083a625ab3ab69b8a6d58e74563400000000000000000000000000000000000000000003b800f1778357a10cc0000000000000000000000000006d2f55deeacc907438f87a87fc6d506ceeeec08d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000415277091191ba895ee8e3ea7675670f776209f4328ad686fb920faaebe91607650687e9233077bb2044500dd6ab39fbdea6a3f7f6ccc3c6ef70c20c67d8fb1d481b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000014423477e48000000000000000000000000d75c4dbcb215a6cf9097cfbcc70aab2596b96a9c690752ca4c6cd7a89792e10f681e28631fa4e28ab84cb445be2ece9eea9dd8bc000000000000000000000000000000000000000000056883443ed11a8b623000000000000000000000000000114e194fa29c67d0d88756b0a1800b20ecdb78f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000004137494466a4d21f824ac10a19420561f65b728f2e707c605673f8ebfdfbe492bd429b66d202333b8b3c8d91607e8ec0454d7d74d670997a34602712d06f1e803f1b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000014423477e48000000000000000000000000d75c4dbcb215a6cf9097cfbcc70aab2596b96a9c7cf8f2026b1f49a36f29293fb9545ce31ac3f71c40009c7e038d42ccea1b2b980000000000000000000000000000000000000000000131248d9bf721a834300000000000000000000000000010665221a1c9e8a2898e8bd1a8ebc6594e2640ea000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000411bac397c4bad7fb2ae3a4cfea6c15e76c9072ed74a985f37a7c55b78bddb58db2a18ed822986bc94b181ef06ae4d583e71d097fe228b100773d16b84ff38e2641b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000014423477e48000000000000000000000000d75c4dbcb215a6cf9097cfbcc70aab2596b96a9cb5c57baf86e39e2a837634f5dcab48a536f3b29397d36eb165a821bd080146d8000000000000000000000000000000000000000000037048701917a53ce2c000000000000000000000000000fc4cefdc740d99ede6485dd3dfcccb04f807c7ce000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000041e5e876174d79ad0f1aabf48791b2ecdba1e98f5bbafae2a8c22d24efb695574452002c21203baf92cb2d838b0143037bcdcd31a40293aeef5c68164360a3e69a1c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\\\"}],\\\"id\\\":558015,\\\"jsonrpc\\\":\\\"2.0\\\"}\",\"requestMethod\":\"POST\",\"url\":\"http://erigon.c.graph-indexer-semiotic.internal:8545/\"}, method=\"estimateGas\", transaction={\"from\":\"0xf945DFbFfE3865e8Cb58ABfeA90466bDcBc615D9\",\"to\":\"0xF55041E37E12cD407ad00CE2910B8269B01263b9\",\"data\":\"0xac9650d8000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000003800000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000014423477e48000000000000000000000000d75c4dbcb215a6cf9097cfbcc70aab2596b96a9cd7273afdea0346c07136953546b1cc95e919083a625ab3ab69b8a6d58e74563400000000000000000000000000000000000000000003b800f1778357a10cc0000000000000000000000000006d2f55deeacc907438f87a87fc6d506ceeeec08d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000415277091191ba895ee8e3ea7675670f776209f4328ad686fb920faaebe91607650687e9233077bb2044500dd6ab39fbdea6a3f7f6ccc3c6ef70c20c67d8fb1d481b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000014423477e48000000000000000000000000d75c4dbcb215a6cf9097cfbcc70aab2596b96a9c690752ca4c6cd7a89792e10f681e28631fa4e28ab84cb445be2ece9eea9dd8bc000000000000000000000000000000000000000000056883443ed11a8b623000000000000000000000000000114e194fa29c67d0d88756b0a1800b20ecdb78f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000004137494466a4d21f824ac10a19420561f65b728f2e707c605673f8ebfdfbe492bd429b66d202333b8b3c8d91607e8ec0454d7d74d670997a34602712d06f1e803f1b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000014423477e48000000000000000000000000d75c4dbcb215a6cf9097cfbcc70aab2596b96a9c7cf8f2026b1f49a36f29293fb9545ce31ac3f71c40009c7e038d42ccea1b2b980000000000000000000000000000000000000000000131248d9bf721a834300000000000000000000000000010665221a1c9e8a2898e8bd1a8ebc6594e2640ea000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000411bac397c4bad7fb2ae3a4cfea6c15e76c9072ed74a985f37a7c55b78bddb58db2a18ed822986bc94b181ef06ae4d583e71d097fe228b100773d16b84ff38e2641b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000014423477e48000000000000000000000000d75c4dbcb215a6cf9097cfbcc70aab2596b96a9cb5c57baf86e39e2a837634f5dcab48a536f3b29397d36eb165a821bd080146d8000000000000000000000000000000000000000000037048701917a53ce2c000000000000000000000000000fc4cefdc740d99ede6485dd3dfcccb04f807c7ce000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000041e5e876174d79ad0f1aabf48791b2ecdba1e98f5bbafae2a8c22d24efb695574452002c21203baf92cb2d838b0143037bcdcd31a40293aeef5c68164360a3e69a1c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\",\"accessList\":null}, code=UNPREDICTABLE_GAS_LIMIT, version=providers/5.6.2)"}
{"level":20,"time":1666127552317,"pid":1,"hostname":"indexer-agent-0","name":"IndexerAgent","component":"IndexerManagementServer","msg":"POST / 200 52 - 2120.177 ms"}
kaiwetlesen commented 1 year ago

It would seem indeed that the allocation optimiser is rounding the optimal allocation somewhere that it should not:

Python 3.10.7
>>> self_stake = 10000000100000000000000000
>>> delegated_tokens = 6631901656669909529623937
>>> total_stake = self_stake + delegated_tokens
>>> print(total_stake)
16631901756669909529623937
>>> import math
>>> fp_total_stake = total_stake / math.pow(10,18)
>>> print(fp_total_stake)
16631901.756669909
>>> allocations = [4495710291212000000000000, 6538176653363000000000000, 1440996064083000000000000, 4157018748012000000000000]
>>> total_allocations = sum(allocations)
>>> print(total_allocations)
16631901756670000000000000
>>> fp_total_allocations = total_allocations / math.pow(10,18)
>>> print(fp_total_allocations)
16631901.75667
>>> if total_stake < total_allocations:
...     print('No way Jose!')
... 
No way Jose!
>>> 

Values taken from the resultant actions as noted in the log above.

kaiwetlesen commented 1 year ago

Values for self_stake and delegated_tokens may be obtained via this GraphQL query:

query($addr: String) {
  indexer(id: $addr) {
    indexer_id: id
    indexer_name: defaultDisplayName
    self_stake: stakedTokens
    delegated_stake: delegatedTokens
  }
}

Variants:

{"addr":"0xd75c4dbcb215a6cf9097cfbcc70aab2596b96a9c"}
kaiwetlesen commented 1 year ago

Contents of whitelist.csv:

whitelist,blacklist,pinnedlist,frozenlist
QmQDGVhAjCh3gkdMznBMUkSUhPZEK5mwdjYqJUukdeJsee,,,
QmbHg6vAJRD9ZWz5GTP9oMrfDyetnGTr5KWJBYAq59fm1W,,,
QmWkVS3Uzr2WsTwvxtte2dpHbSYJSQ1bTQMVciKXCWx7TM,,,
QmcpX4ScNaWfSE1ZmfEFM3mPSCz5frk6edwsYMAvfGtrXV,,,
QmYDgkkfE3d9y1C5RPmVLmoxayWpFZDuiAiQYqUpFnHFiE,,,
QmVQdzeGdPUiLiACeqXRpKAYpyj8Z1yfWLMUq7A7WundUf,,,
QmeUiEKEDTJ5gPRoN5FcUZn2tp1cBdae5DMbFDiL8UPxrZ,,,
QmfUeMt1bhS5mGmBQWABkJAsVG1mBmZjfrrtUX5Ce9NSA5,,,
QmZXc689BRN9ZDRc6EBfT1QvU9c56ewkiZJ9uXgvN8wd2X,,,
QmRDGLp6BHwiH9HAE2NYEE3f7LrKuRqziHBv76trT4etgU,,,
QmaaDA7XVVktfxCLMgfwG1z3KM8DSMoLkbemkTt9mQT8Qf,,,
QmeQ69NF8EWnaBCV9VaNhEBcAtie82Px64qEF8MpPCiEGS,,,
QmTKXLEdMD6Vq7Nwxo8XAfnHpG6H1TzL1AGwiqLpoae3Pb,,,
QmdemKB9KFeuDcCxRn2iBuRE35LSZ63vDBCdKaBtaw2Qm9,,,
Qmaz1R8vcv9v3gUfksqiS9JUz7K9G8S5By3JYn8kTiiP5K,,,
QmeqmxPhWWNb9Piboswf92LmzspSxN8ZV7UkK5c9yJoc4B,,,
QmZDfRpakj4BTNaRUDiCAknzE5rbXQcQm2hRYzX8kNSpx6,,,
hopeyen commented 1 year ago

should be resolved here: b16af80b2a03466f54929bf8f88ef18267df1a35