Comments (6)
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.
@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.
What's the use-case?
from demux-js-eos.
@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.
@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.
@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)
- Error while importing "demux-eos" HOT 2
- How can I get a stream of smart contract table changes?
- Restart Stuck if it's Crashed in a Fork HOT 5
- Capture contract multi-index table state HOT 1
- Hello,John,very sorry for disturbing you,You still remember the contract of the eos-escrow? HOT 1
- Random Crash when Synced on MongoActionReader HOT 1
- restart stopped when there is fork detected. HOT 1
- Does not find actions if "producer_block_id" is null in "action_traces" for MongoDB HOT 2
- How to use MongoActionReader if the DB need auth? HOT 1
- NotInitializedError: The proper initialization has not occurred. The mongodb database is missing account_controls, accounts, pub_keys, transaction_traces, transactions, blocks collections. HOT 7
- error TS2705 while running index.ts HOT 2
- NotInitializedError is thrown by MongoActionReader on startup HOT 1
- Error retrieving last irreversible block HOT 1
- How to declare Global Variable in Demux? HOT 3
- How do I configure the retry settings? HOT 5
- Capture inline actions HOT 13
- retry util does not work with Promises
- StateHistoryPostgresActionReader Issues with 1.8.1 Postgres database. HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from demux-js-eos.