XLNT / gnarly

🤙 A blockchain ETL tool to make your life better. Now that’s fuckin’ gnarly.
https://xlnt.co
Apache License 2.0
119 stars 11 forks source link

Resuming from persisted state is broken in feat/only-json-patch #5

Closed shrugs closed 6 years ago

shrugs commented 6 years ago

This is probably an off-by-one error somehow, but here's the logs:

...
[applyPatch] 0xbcc76e0137d7da8477142bf407e62a442c3470a75a332b446f043fec9dcbdf09 24
[applyPatch] 0x2fd113b6652b5e7d79090b1f74836763af086fbfc341241fa7faf66dd46a6054 18
[applyPatch] 0x93ebcc2b5a4bcc4dae8635d168e3d41b1cc44458c15ef7b0dd6739180814c86d 6
[applyPatch] 0xaafc3a054d0b9748dc6e703bc9fa75f92cd395e2738a6909237f7f164146b942 30
[applyPatch] 0x13c96b78eb8ac3bad8d83e5f646cfaeff711717806ec36b8fa333cde7bfa102f 16
[applyPatch] 0xb6401524d42fe5f0a603710e874afe4b0f7abb2cbe5330822acbaf5ba09e979c 48
[fast-forward] Starting from 4676308 to 5641672
[fast-forward] block 0x475ad4 (0xd9b3b3ab9f3a3ec043edf4ec7cf24728d017e81b586fa6989985189365109f1b)
[onBlockAdd] 0x475ad4 (0xd9b3b3ab9f3a3ec043edf4ec7cf24728d017e81b586fa6989985189365109f1b)
[op] transferring token 69155 to 0xdb595932F2d278E80eA7Bad9bD50ec22B5E84844
[op] transferring token 57421 to 0x42cEC1Efe742be293CDf8df2a89F48814Cf084ff
[op] transferring token 46335 to 0x00Ce0cEa39FfeB12a89824266689dF9A96b28870
[op] transferring token 68867 to 0xC7af99Fe5513eB6710e6D5f44F9989dA40F27F26
[op] transferring token 69010 to 0x48bf0f9c84d3E449c7b1cc09C95FcbA1F8bb948c
[op] transferring token 50757 to 0x94482Bf9d292c84ad190D5FBEc45D325130005a7
[op] transferring token 69134 to 0xC7af99Fe5513eB6710e6D5f44F9989dA40F27F26
[op] transferring token 50719 to 0xb1690C08E213a35Ed9bAb7B318DE14420FB57d8C
[op] transferring token 66930 to 0x4B43041E418b16BB7dcf94A09F721cC73574FC04
[op] transferring token 41250 to 0xb1690C08E213a35Ed9bAb7B318DE14420FB57d8C
[op] transferring token 68445 to 0xa1C975e2Fb60F50c669c21B2e32274faCB1e807c
[op] transferring token 69122 to 0xb1690C08E213a35Ed9bAb7B318DE14420FB57d8C
[op] transferring token 53752 to 0x04141983Eb7EE3Bb81aEDdED4c4CDc8cEF06817F
[op] transferring token 42222 to 0xb1690C08E213a35Ed9bAb7B318DE14420FB57d8C
[op] transferring token 56063 to 0xC7af99Fe5513eB6710e6D5f44F9989dA40F27F26
[op] transferring token 50759 to 0x08209fF57752Cd1931c420245ADcEB29bf991E21
[op] transferring token 68394 to 0xb1690C08E213a35Ed9bAb7B318DE14420FB57d8C
[op] transferring token 53350 to 0xC7af99Fe5513eB6710e6D5f44F9989dA40F27F26
[op] transferring token 33839 to 0xb1690C08E213a35Ed9bAb7B318DE14420FB57d8C
[op] transferring token 69303 to 0x1D7384D546De28D682eC9A73c2aBA056C72364Cb
{ SequelizeUniqueConstraintError: Validation error
    at Query.formatError (/snapshot/gnarly/node_modules/sequelize/lib/dialects/postgres/query.js:325:18)
    at AbstractQuery.run.query.catch.err (/snapshot/gnarly/node_modules/sequelize/lib/dialects/postgres/query.js:86:18)
    at tryCatcher (/snapshot/gnarly/node_modules/bluebird/js/release/util.js:16:23)
    at Promise.module.exports.Promise._settlePromiseFromHandler (/snapshot/gnarly/node_modules/bluebird/js/release/promise.js:512:31)
    at Promise.module.exports.Promise._settlePromise (/snapshot/gnarly/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise.module.exports.Promise._settlePromise0 (/snapshot/gnarly/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise.module.exports.Promise._settlePromises (/snapshot/gnarly/node_modules/bluebird/js/release/promise.js:689:18)
    at Async._drainQueue (/snapshot/gnarly/node_modules/bluebird/js/release/async.js:133:16)
    at Async._drainQueues (/snapshot/gnarly/node_modules/bluebird/js/release/async.js:143:10)
    at Immediate.__dirname.Async.drainQueues [as _onImmediate] (/snapshot/gnarly/node_modules/bluebird/js/release/async.js:17:14)
    at runCallback (timers.js:800:20)
    at tryOnImmediate (timers.js:762:5)
    at processImmediate [as _immediateCallback] (timers.js:733:5)
  name: 'SequelizeUniqueConstraintError',
  errors:
   [ ValidationErrorItem {
       message: 'tokenId must be unique',
       type: 'unique violation',
       path: 'tokenId',
       value: '69155',
       origin: 'DB',
       instance: [cryptoKitties_tokens],
       validatorKey: 'not_unique',
       validatorName: null,
       validatorArgs: [] } ],
  fields: { tokenId: '69155' },
  parent:
   { error: duplicate key value violates unique constraint "cryptoKitties_tokens_pkey"
    at Connection.parseE (/snapshot/gnarly/node_modules/pg/lib/connection.js:553:11)
    at Connection.parseMessage (/snapshot/gnarly/node_modules/pg/lib/connection.js:378:19)
    at Socket.<anonymous> (/snapshot/gnarly/node_modules/pg/lib/connection.js:119:22)

aka we resumed from state but then ingested a duplicate block and violated a unique key constraint.