FactomProject / factomd

Factom Daemon
https://www.factomprotocol.org/
Other
201 stars 92 forks source link

ChainID hash / ChainID Commit Hash random in `pending-entries` response #1004

Open ilzheev opened 4 years ago

ilzheev commented 4 years ago

I noticed, that pending-entries response returns unexpected hashes.

  1. I created 10 chains with the following ChainIDs, making commit+reveal without delay at minute 1-2:

    9a537ed1dcec1a748ef73f904e6e6ab8707fc12d6282ad2530cc818db247da08
    e04ba28465b3c1fb1683c209d22c71d62abd03cc1febee96186b94d30b695792
    cd82adb83b7745c7bb156cc572552adfe6105fa2ced8010c99bdb9d114f76393
    4a28163928f0bdb7ffefa0a49b2a6e500bc646c1b80d9b0ca7576bc14b999c71
    dc28b23f9e3794c79031c1c59b7107c386d2821dc795c952bcdf105412d91caf
    f3147b6d1e90814a8b1c4aabcda42fc177be8815a789120d55899fcaa8b4cd6c
    628ea4bbf07d6597a62ad0bff7b013534ce8aa38533071db032e851f47e0a9e5
    9c08d705595eff57f87782c21647ba51bdc033013e91e65c94aef74e20c101db
    2a5be728efa4e49c967d64c879aa38b055b393931a40f794cacfb247f579d8c5
    7e29d0ad60539b290a80f5bd77d9596f88b5e3fdf391e229ed40841261a20ef3
  2. While checking pending-entries API response (multiple times at minutes 3-9), I saw all 10 entries objects, but 3 of them had Chain ID hash, and other 7 had Chain ID commit hash (sha256d of ChainID).

The pending-entries API response (for this 10 created chains) was the same for several requests, that were made with minutes interval.

{"jsonrpc":"2.0","id":0,"result":[{"entryhash":"723d05977f40ad93b3fddec0d39f5680c53eb9046e1bc31f9d4ee9cf2aad2dd4","chainid":"7e29d0ad60539b290a80f5bd77d9596f88b5e3fdf391e229ed40841261a20ef3","status":"TransactionACK"},{"entryhash":"4ccda7a5ee0cec4099f42279f79dc5add94843d4f6a1c343e05c3002ebb0dc6a","chainid":"cd82adb83b7745c7bb156cc572552adfe6105fa2ced8010c99bdb9d114f76393","status":"TransactionACK"},{"entryhash":"64bc402ab9d460e9f09ebfa79d85118f0e07bda28944f752e3fc0114c41219f3","chainid":"cffce0f409ebba4ed236d49d89c70e4bd1f1367d86402a3363366683265a242d","status":"TransactionACK"},{"entryhash":"00392600e7f53d935574e030b28133616f683effbecb5bb2d756efdd8c4e1706","chainid":"cffce0f409ebba4ed236d49d89c70e4bd1f1367d86402a3363366683265a242d","status":"TransactionACK"},{"entryhash":"8ab96fcdfb83d01f0c5f97537365d96121428d6a997190e742f620786dbf032d","chainid":"bcd213147da4b50bab4fc469c2ac94b5ac52a230fcb331703d20b2380f80279a","status":"TransactionACK"},{"entryhash":"d38bf055072e6bc008985daece6c0f54c73d1ac69239bb30f5515c948b814a3d","chainid":"cffce0f409ebba4ed236d49d89c70e4bd1f1367d86402a3363366683265a242d","status":"TransactionACK"},{"entryhash":"175c30f599d89506211e2645a2d71490a7b2f178147cb1c663c249e5ee7b0716","chainid":"cffce0f409ebba4ed236d49d89c70e4bd1f1367d86402a3363366683265a242d","status":"TransactionACK"},{"entryhash":"cce6b5b43025ee9c77022502059eeb2a83d3914d23b571423b1bab65e4002c2a","chainid":"cffce0f409ebba4ed236d49d89c70e4bd1f1367d86402a3363366683265a242d","status":"TransactionACK"},{"entryhash":"10858fc7ddd07b51ebec920a35d6d70642f7775ea307b7ce6e8581e7c9bab1d8","chainid":"cffce0f409ebba4ed236d49d89c70e4bd1f1367d86402a3363366683265a242d","status":"TransactionACK"},{"entryhash":"af217f2359a6c9e9cff5afa22377c902cd628bc04b3555e7b73ee6c77cca7719","chainid":"cffce0f409ebba4ed236d49d89c70e4bd1f1367d86402a3363366683265a242d","status":"TransactionACK"},{"entryhash":"d41493dede6385ac88a83b0fdba0746f58903ab787d5350eb1cf12e26d24a57f","chainid":"cffce0f409ebba4ed236d49d89c70e4bd1f1367d86402a3363366683265a242d","status":"TransactionACK"},{"entryhash":"273fdf6ae41a1083c43422efba805dcb9b2670ee8efd106c256a84504f029d15","chainid":"cffce0f409ebba4ed236d49d89c70e4bd1f1367d86402a3363366683265a242d","status":"TransactionACK"},{"entryhash":"70b7f4fb4b7bfb1bdfa0a1775412b83486ba3f8e658c46fffedf636aea750907","chainid":"e04ba28465b3c1fb1683c209d22c71d62abd03cc1febee96186b94d30b695792","status":"TransactionACK"},{"entryhash":"b16850ec483162a9ffbe97b6aba7a937bd448598853ab12c7e60cebc12a4cefe","chainid":"6e4540d08d5ac6a1a394e982fb6a2ab8b516ee751c37420055141b94fe070bfe","status":"TransactionACK"},{"entryhash":"9e3b559c179c6d33c2bf09dc51f14b30cd6fc443e2282b9f15134892b8b8c1c6","chainid":"a642a8674f46696cc47fdb6b65f9c87b2a19c5ea8123b3d2f0c13b6f33a9d5ef","status":"TransactionACK"},{"entryhash":"9d8544e44ef011e567d7ea221060014094a509c4422f5d03addcbacf69c8e918","chainid":"843dbee7a49a9b9510d399759fbce24b1f700268c94508085abce352d70ed1f6","status":"TransactionACK"},{"entryhash":"819d822283f772f5c2bdf7a933521cc8d9752a943d8750305e41019f5395185f","chainid":"843dbee7a49a9b9510d399759fbce24b1f700268c94508085abce352d70ed1f6","status":"TransactionACK"},{"entryhash":"67cfb253d770a450936a76ff4a715dae1c5c5e3ad7be0819ee7e36b0ba035ccd","chainid":"a642a8674f46696cc47fdb6b65f9c87b2a19c5ea8123b3d2f0c13b6f33a9d5ef","status":"TransactionACK"},{"entryhash":"dde3c2993c938cc110afa2457d9623194b49c4c2984dd4173fabcf49fde92692","chainid":"a642a8674f46696cc47fdb6b65f9c87b2a19c5ea8123b3d2f0c13b6f33a9d5ef","status":"TransactionACK"},{"entryhash":"506df17eb8021ca2b31b34f0e8029d7c20ae9f0075c13bad32f0e47e9b485807","chainid":"843dbee7a49a9b9510d399759fbce24b1f700268c94508085abce352d70ed1f6","status":"TransactionACK"},{"entryhash":"7540c43dd7cfa7d4e4fcd4c70784c05c89b7809a159470aaac2324aaad9b9080","chainid":"a642a8674f46696cc47fdb6b65f9c87b2a19c5ea8123b3d2f0c13b6f33a9d5ef","status":"TransactionACK"},{"entryhash":"5d23d35b992476a077dec4855504c2fe932fd1b974d665d20b4f2c6cbd67b0ca","chainid":"f099df181b9ad52c772b39a2a7cdcbf3953838ca2bbf1d0f659323ab1874f8e2","status":"TransactionACK"},{"entryhash":"09205763cc094f21bc9a5c9ce95b676ec925ca2c16bc9282a979552b0f391885","chainid":"bb12009f78c8f9c97a7e4645705409f76117f4e8a61cb68de1e9c5f921199e5c","status":"TransactionACK"},{"entryhash":"32966ba1025c6e49077037b7209c3ab3f7daac003a2302b1f087d2da3c81fb81","chainid":"e443bc7dd5f053c75429f4781bb476196134f275ae1d5f951f253a818e79babf","status":"TransactionACK"},{"entryhash":"a2f6f7a6ba4267d94388f883b27c6036e013bc012c4773149392d57f7f0261e3","chainid":"ae08a403da0ae659762838964c63b09854cfc72b74687fda0f912b7af5185411","status":"TransactionACK"},{"entryhash":"761a8072decae50a15ab569b56c9d026d4dbf53352e4ffcb325f25602132e9ed","chainid":"a642a8674f46696cc47fdb6b65f9c87b2a19c5ea8123b3d2f0c13b6f33a9d5ef","status":"TransactionACK"},{"entryhash":"df530965f8d2201e15702f66ab16fde0cf6f1b6a1749289c8030395eefd7cdc6","chainid":"d5058285ddb3e3a6b678fe957b7146c40ed9ea4f3960d088b60859445cabd71b","status":"TransactionACK"},{"entryhash":"0610873f0f09fc0ce330ad0ace0e08d4da6b8252d737df4b4702d48a627cbf84","chainid":"a642a8674f46696cc47fdb6b65f9c87b2a19c5ea8123b3d2f0c13b6f33a9d5ef","status":"TransactionACK"},{"entryhash":"53f7321961dfcb0925d6d61fee4fc2d0a0db98445b6084ff41a8c3474f2fd617","chainid":"a642a8674f46696cc47fdb6b65f9c87b2a19c5ea8123b3d2f0c13b6f33a9d5ef","status":"TransactionACK"},{"entryhash":"f2473540419dae868b8a2ae62c7bb0ae704d030f59c915bc50599c583d25f88b","chainid":"af57362bba1868f8a829fd1388292d4536976e6b76e982a6b8069e7bf92e9f9e","status":"TransactionACK"},{"entryhash":"829c6085c30a7d5688d7822d0da84ac08f62ca54974b730d833bac8ef980ec11","chainid":"843dbee7a49a9b9510d399759fbce24b1f700268c94508085abce352d70ed1f6","status":"TransactionACK"},{"entryhash":"bb0ff91e2802a6fb37eb1101243d4e898409399aa9a2d5be687ab4d2841b4c03","chainid":"a642a8674f46696cc47fdb6b65f9c87b2a19c5ea8123b3d2f0c13b6f33a9d5ef","status":"TransactionACK"},{"entryhash":"c10c44dff014c8541f7ff34efaf78749c52cb27e3e8c29c501269ff4f7aa76a5","chainid":"a642a8674f46696cc47fdb6b65f9c87b2a19c5ea8123b3d2f0c13b6f33a9d5ef","status":"TransactionACK"},{"entryhash":"d18afbea19fc56a26be416ef1fbcd9f9468d647b294ae880aac79e6de57327a1","chainid":"a642a8674f46696cc47fdb6b65f9c87b2a19c5ea8123b3d2f0c13b6f33a9d5ef","status":"TransactionACK"},{"entryhash":"3cd0455167b316fb72aa51eaaa6a8efa57aadb40fbbc42f3f9711503471871c2","chainid":"a642a8674f46696cc47fdb6b65f9c87b2a19c5ea8123b3d2f0c13b6f33a9d5ef","status":"TransactionACK"},{"entryhash":"135d2e2b3344c2836ad2f6e96d73bd9fcdeefb0ace071aafb8f4add0d2b6de8e","chainid":"843dbee7a49a9b9510d399759fbce24b1f700268c94508085abce352d70ed1f6","status":"TransactionACK"},{"entryhash":"5aedc09e5802759ff5a667234dec54868b91223df1177bd728a6255f8165e2d2","chainid":"a642a8674f46696cc47fdb6b65f9c87b2a19c5ea8123b3d2f0c13b6f33a9d5ef","status":"TransactionACK"},{"entryhash":"1f244456842517a30931ba1667c5ea8b988feb67ad2badc163530586a00253b7","chainid":"a642a8674f46696cc47fdb6b65f9c87b2a19c5ea8123b3d2f0c13b6f33a9d5ef","status":"TransactionACK"},{"entryhash":"5f1ca151a02ead5c06fbdf662a7e952143e082e799aa3e0d70e8b66ef1a4963e","chainid":"a642a8674f46696cc47fdb6b65f9c87b2a19c5ea8123b3d2f0c13b6f33a9d5ef","status":"TransactionACK"},{"entryhash":"3d6d1a8dbb85c2023a03e70461e7adf3b185358cbda1da93155f9ad677f8df50","chainid":"a642a8674f46696cc47fdb6b65f9c87b2a19c5ea8123b3d2f0c13b6f33a9d5ef","status":"TransactionACK"},{"entryhash":"810343b2645fdaf8783391207f6c233becd7ceefb04b6915a4249704a773dd62","chainid":"a642a8674f46696cc47fdb6b65f9c87b2a19c5ea8123b3d2f0c13b6f33a9d5ef","status":"TransactionACK"},{"entryhash":"83670451c59f86193363558aacae7bda7e035dcfac4a079e3faecaebabde5871","chainid":"843dbee7a49a9b9510d399759fbce24b1f700268c94508085abce352d70ed1f6","status":"TransactionACK"},{"entryhash":"d4a7f8563e9a318851bee848a7d397459593c13dbef1d5beb5d6917e45b8fda2","chainid":"a642a8674f46696cc47fdb6b65f9c87b2a19c5ea8123b3d2f0c13b6f33a9d5ef","status":"TransactionACK"},{"entryhash":"176f918275434dc28cd89236dc46efb554d6c2b7ad155fdc72300c0d5f449e6f","chainid":"843dbee7a49a9b9510d399759fbce24b1f700268c94508085abce352d70ed1f6","status":"TransactionACK"},{"entryhash":"0cb00d4e18b54d94154b758775d24b84d4cb7835a89804decaf6a25a5a4dd3cb","chainid":"a642a8674f46696cc47fdb6b65f9c87b2a19c5ea8123b3d2f0c13b6f33a9d5ef","status":"TransactionACK"},{"entryhash":"9e0ab687e48ae3072a1d67487f0b857fce12ea2fd926bb6cf80e6638c02809b1","chainid":"a642a8674f46696cc47fdb6b65f9c87b2a19c5ea8123b3d2f0c13b6f33a9d5ef","status":"TransactionACK"}]}

@carryforward @WhoSoup

ilzheev commented 4 years ago

Besides this bug, from a user side I would like that pending entries API works with this logic:

1. entry commit (no reveal yet) / chain commit (no reveal yet) Returns entryhash: XXXX, chainid: null

2. entry reveal / chain reveal Returns entryhash: XXXX, chainid: XXXX

IMO, no need to return chain commit hash as chainID, it's inconsistent and misleading. What do you think about this logic?

WhoSoup commented 4 years ago

There are some applications that depend on pending-entries (mainly FAT), so I think it would make sense to add a new API call (maybe just pending), which returns data in a more accessible format and can also return things like transactions / admin block entries in addition to just entries.

ilzheev commented 4 years ago
  1. Response format is not changed
  2. Moreover, entry commits / reveals are unaffected at all

How fixing API without changing request params and response format may hurt in this situation? The fix will bring only correct Chain IDs for chain reveals, rather than unusable random IDs right now.

WhoSoup commented 4 years ago

How fixing API without changing request params and response format may hurt in this situation?

It's more along the lines of we don't know who is using the API and which parts of the data they're using, so introducing fixes that alter the data being returned has the potential of breaking those applications. In this case, I know that FAT is relying on pending entries in their syncing process and it's a possibility that might break. @AdamSLevy might be able to offer some insight on whether or not it would affect FAT.

PaulSnow commented 4 years ago

I can make a branch that modifies the API for your use, @ilzheev. And if we can get some time from someone over at FAT we can verify that the fix either breaks them or not.

sigrlami commented 4 years ago

@PaulSnow @WhoSoup we're working at Kompendium on FAT codebase now, I can check this for you guys. FAT has some functionality based on pending entries, we can apply patch if required.

ilzheev commented 4 years ago

@PaulSnow @sigrlami thank you gentlemen. I don’t need a separate branch as Explorer is connected to Open Node (so I need the patch to be the part of future official factomd release, that will be installed on Open Node).