Git Product home page Git Product logo

Comments (6)

chris-allnutt avatar chris-allnutt commented on May 22, 2024

In the specific implementation, Postgres, for instance, you can look at the rollback functionality that occurs when a fork has occurred. Going to mention @flux627 he will know if we store any state data in the event of a fork to reference that it happened.

from demux-js-eos.

crazybits avatar crazybits commented on May 22, 2024

@chris-allnutt ,thanks ,follow your advice to debug,seems the rollback can only get the fallback block number, can we get the full block, include the producer infor?

from demux-js-eos.

flux627 avatar flux627 commented on May 22, 2024

What's the use-case?

from demux-js-eos.

crazybits avatar crazybits commented on May 22, 2024

@flux627 we would like to know which producer cause the fork, this infor could help producer to self-check their bp node.

from demux-js-eos.

fallshuang avatar fallshuang commented on May 22, 2024

@flux627 we would like to know which producer cause the fork, this infor could help producer to self-check their bp node.

I got a fork issue just now , this is the output of my demux-eos program :

26101980 - 018e48dc92695aea1705f9321180969759db4dd2b40299a7e6410e97f7dedecf - Fri Nov 09 2018 22:01:04 GMT-0500 (EST)
26101981 - 018e48dd9a1f0ef227a8f3271435718c02d61086dd0d2944a51854f7a0d20efd - Fri Nov 09 2018 22:01:04 GMT-0500 (EST)
26101982 - 018e48de6919beaadce5ca538515f5caeed4ce7914ced2880a7b2cba272b27a5 - Fri Nov 09 2018 22:01:05 GMT-0500 (EST)
26101983 - 018e48df2cb8f354f41598c193cf44f836a4feed2121f3a0f1c169b4b450f0b1 - Fri Nov 09 2018 22:01:05 GMT-0500 (EST)
!! FORK DETECTED !!
MISMATCH:
✓ NEW Block 26101984 previous: 018e48df11abcf1db5213200d798a3081ab298523305dc87c901059d8edc093b
✕ OLD Block 26101983 id: 018e48df2cb8f354f41598c193cf44f836a4feed2121f3a0f1c169b4b450f0b1
Refetching Block 26101983...
MISMATCH:
✓ NEW Block 26101983 previous: 018e48de46439e4341b05c702160be32b6f34d1fd97a7a51e4aa299ad7342ae6
✕ OLD Block 26101982 id: 018e48de6919beaadce5ca538515f5caeed4ce7914ced2880a7b2cba272b27a5
Refetching Block 26101982...
MATCH:
✓ NEW Block 26101982 previous: 018e48dd9a1f0ef227a8f3271435718c02d61086dd0d2944a51854f7a0d20efd
✓ OLD Block 26101981 id: 018e48dd9a1f0ef227a8f3271435718c02d61086dd0d2944a51854f7a0d20efd
!! FORK RESOLVED !!
26101982 - 018e48de46439e4341b05c702160be32b6f34d1fd97a7a51e4aa299ad7342ae6 - Fri Nov 09 2018 22:01:06 GMT-0500 (EST)
Rolling back 2 blocks to block 26101981...
(node:19478) UnhandledPromiseRejectionWarning: TypeError: this.rollbackTo is not a function
at ObjectActionHandler. (/home/falls/work/eos-gserv/node_modules/_demux@2.0.0@demux/dist/AbstractActionHandler.js:34:28)
at Generator.next ()
at /home/falls/work/eos-gserv/node_modules/_demux@2.0.0@demux/dist/AbstractActionHandler.js:7:71
at new Promise ()
at __awaiter (/home/falls/work/eos-gserv/node_modules/_demux@2.0.0@demux/dist/AbstractActionHandler.js:3:12)
at ObjectActionHandler.handleBlock (/home/falls/work/eos-gserv/node_modules/_demux@2.0.0@demux/dist/AbstractActionHandler.js:28:16)
at ObjectActionHandler.handleBlock (/home/falls/work/eos-gserv/ObjectActionHandler.js:21:18)
at BaseActionWatcher. (/home/falls/work/eos-gserv/node_modules/_demux@2.0.0@demux/dist/BaseActionWatcher.js:59:75)
at Generator.next ()
at fulfilled (/home/falls/work/eos-gserv/node_modules/_demux@2.0.0@demux/dist/BaseActionWatcher.js:4:58)
(node:19478) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 4)
(node:19478) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

from demux-js-eos.

flux627 avatar flux627 commented on May 22, 2024

@crazybits Sorry on the delayed reply. I think this functionality might be outside the scope of what Demux is made for- accumulating state based on blockchain events. Forks are not really events. Forks change what the events are (from the perspective of Demux), but are not events themselves.

That said, you could do this via Effects. Create a new ActionReader that emits a newblock action at the beginning of every block that contains your required information, and subscribe an effect that saves this information somewhere. If you ever get repeat blocks, you know there was a rollback and can analyze accordingly.

Closing this, but feel free to continue the conversation with any followup questions.

from demux-js-eos.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.