Files
tendermint/master/assets/js/264.8a841edd.js

1 line
4.3 KiB
JavaScript

(window.webpackJsonp=window.webpackJsonp||[]).push([[264],{839:function(e,t,n){"use strict";n.r(t);var s=n(1),a=Object(s.a)({},(function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("ContentSlotsDistributor",{attrs:{"slot-key":e.$parent.slotKey}},[n("p",[e._v("State sync allows new nodes to rapidly bootstrap and join the network by discovering, fetching,\nand restoring state machine snapshots. For more information, see the "),n("a",{attrs:{href:"https://docs.tendermint.com/master/spec/abci/abci.html#state-sync",target:"_blank",rel:"noopener noreferrer"}},[e._v("state sync ABCI section"),n("OutboundLink")],1),e._v(").")]),e._v(" "),n("p",[e._v("The state sync reactor has two main responsibilities:")]),e._v(" "),n("ul",[n("li",[n("p",[e._v("Serving state machine snapshots taken by the local ABCI application to new nodes joining the\nnetwork.")])]),e._v(" "),n("li",[n("p",[e._v("Discovering existing snapshots and fetching snapshot chunks for an empty local application\nbeing bootstrapped.")])])]),e._v(" "),n("p",[e._v("The state sync process for bootstrapping a new node is described in detail in the section linked\nabove. While technically part of the reactor (see "),n("code",[e._v("statesync/syncer.go")]),e._v(" and related components),\nthis document will only cover the P2P reactor component.")]),e._v(" "),n("p",[e._v("For details on the ABCI methods and data types, see the "),n("a",{attrs:{href:"https://docs.tendermint.com/master/spec/abci/",target:"_blank",rel:"noopener noreferrer"}},[e._v("ABCI documentation"),n("OutboundLink")],1),e._v(".")]),e._v(" "),n("p",[e._v("Information on how to configure state sync is located in the "),n("RouterLink",{attrs:{to:"/nodes/state-sync.html"}},[e._v("nodes section")])],1),e._v(" "),n("h2",{attrs:{id:"state-sync-p2p-protocol"}},[n("a",{staticClass:"header-anchor",attrs:{href:"#state-sync-p2p-protocol"}},[e._v("#")]),e._v(" State Sync P2P Protocol")]),e._v(" "),n("p",[e._v("When a new node begin state syncing, it will ask all peers it encounters if it has any\navailable snapshots:")]),e._v(" "),n("tm-code-block",{staticClass:"codeblock",attrs:{language:"go",base64:"dHlwZSBzbmFwc2hvdHNSZXF1ZXN0TWVzc2FnZSBzdHJ1Y3R7fQo="}}),e._v(" "),n("p",[e._v("The receiver will query the local ABCI application via "),n("code",[e._v("ListSnapshots")]),e._v(", and send a message\ncontaining snapshot metadata (limited to 4 MB) for each of the 10 most recent snapshots:")]),e._v(" "),n("tm-code-block",{staticClass:"codeblock",attrs:{language:"go",base64:"dHlwZSBzbmFwc2hvdHNSZXNwb25zZU1lc3NhZ2Ugc3RydWN0IHsKIEhlaWdodCAgIHVpbnQ2NAogRm9ybWF0ICAgdWludDMyCiBDaHVua3MgICB1aW50MzIKIEhhc2ggICAgIFtdYnl0ZQogTWV0YWRhdGEgW11ieXRlCn0K"}}),e._v(" "),n("p",[e._v("The node running state sync will offer these snapshots to the local ABCI application via\n"),n("code",[e._v("OfferSnapshot")]),e._v(" ABCI calls, and keep track of which peers contain which snapshots. Once a snapshot\nis accepted, the state syncer will request snapshot chunks from appropriate peers:")]),e._v(" "),n("tm-code-block",{staticClass:"codeblock",attrs:{language:"go",base64:"dHlwZSBjaHVua1JlcXVlc3RNZXNzYWdlIHN0cnVjdCB7CiBIZWlnaHQgdWludDY0CiBGb3JtYXQgdWludDMyCiBJbmRleCAgdWludDMyCn0K"}}),e._v(" "),n("p",[e._v("The receiver will load the requested chunk from its local application via "),n("code",[e._v("LoadSnapshotChunk")]),e._v(",\nand respond with it (limited to 16 MB):")]),e._v(" "),n("tm-code-block",{staticClass:"codeblock",attrs:{language:"go",base64:"dHlwZSBjaHVua1Jlc3BvbnNlTWVzc2FnZSBzdHJ1Y3QgewogSGVpZ2h0ICB1aW50NjQKIEZvcm1hdCAgdWludDMyCiBJbmRleCAgIHVpbnQzMgogQ2h1bmsgICBbXWJ5dGUKIE1pc3NpbmcgYm9vbAp9Cg=="}}),e._v(" "),n("p",[e._v("Here, "),n("code",[e._v("Missing")]),e._v(" is used to signify that the chunk was not found on the peer, since an empty\nchunk is a valid (although unlikely) response.")]),e._v(" "),n("p",[e._v("The returned chunk is given to the ABCI application via "),n("code",[e._v("ApplySnapshotChunk")]),e._v(" until the snapshot\nis restored. If a chunk response is not returned within some time, it will be re-requested,\npossibly from a different peer.")]),e._v(" "),n("p",[e._v("The ABCI application is able to request peer bans and chunk refetching as part of the ABCI protocol.")]),e._v(" "),n("p",[e._v("If no state sync is in progress (i.e. during normal operation), any unsolicited response messages\nare discarded.")])],1)}),[],!1,null,null,null);t.default=a.exports}}]);