Protocol Options KO - k-p2p-lab/kpl-v3 GitHub Wiki
Wiki home โบ ํ๊ตญ์ด ๋ฌธ์ ยท ์์ด ์๋ฌธ
๋ฌธ์ ์๋ด ยท ์์ค ์ ์ฅ์
์ด ๋ฌธ์๋ ๊ณ ์ ์์กด์ฑ go-libp2p-pubsub v0.13.1, go-libp2p-kad-dht v0.31.0์ ๋ํ ์ ์ธํ ๋
ธ๋ ์ค์ ์ ์ค๋ช
ํฉ๋๋ค. ๊ฐ ๋ธ๋ก์ ์๋๋ฆฌ์ค profile ๋๋ join phase์ node์ ์์ฑํฉ๋๋ค. ์๋๋ฆฌ์ค ์ค์ ๊ณผ ํ๋กํ ์ฝ ์์ ๋ฅผ ์ฐธ๊ณ ํ์ญ์์ค. ์คํ์ Swarm์์ ์คํํ๋ฉฐ ๋ฐฐํฌ ์ ์ kpl validate --scenario FILE๋ก YAML์ ๊ฒ์ฆํฉ๋๋ค.
Duration์๋ 250ms, 1s, 5m ๊ฐ์ Go ๋ฌธ์์ด์ ์ฌ์ฉํฉ๋๋ค. ํฌ์ธํฐ๋ก ํํํ๋ ์ซ์ยทboolean ์ค์ ์ ์ ํจํ ๋ฒ์์์ ๋ช
์์ ์ธ 0ยทfalse๋ฅผ ๋ณด์กดํฉ๋๋ค. List์ map์ ์์๋ listยทmap ์ ์ฒด๋ฅผ ๊ต์ฒดํฉ๋๋ค. score, peerGater, discovery ๊ฐ์ ์ ํ์ ๊ฐ์ฒด ๋ธ๋ก๋ ์์๋ ๊ฐ์ฒด ์ ์ฒด๋ฅผ ๊ต์ฒดํ๋ฏ๋ก ์ ์งํ๋ ค๋ ์ค์ ์ ๋ค์ ์์ฑํด์ผ ํฉ๋๋ค. enabled: true๊ฐ ์๋ score ๋ธ๋ก์ ํ์ฑ profile score๋ฅผ ๊ต์ฒดํ ๊ฒฝ์ฐ์๋ ๋นํ์ฑ์
๋๋ค.
Version 3์ profile schedules๋ ์ ํํ ๊ธฐ์กดยท์ดํ ์ ์ฅ Peer์ ์ ํด์ง routing parameter์ ๋คํธ์ํฌ ์กฐ๊ฑด์ ๋ฐ๊ฟ ์ ์์ต๋๋ค. ์์ฑ ์์๋ง ์ค์ ํ๋ ๊ฐ์ ์ ์งํฉ๋๋ค. ์ง์ ํ๋ยท์๊ฐ ๊ธฐ์คยท๋์ ์ ํยท์คํจ ๋์์ schedule ๋ ํผ๋ฐ์ค๋ฅผ ๊ธฐ์ค์ผ๋ก ํฉ๋๋ค.
์ด ์ ์ ํ๋๋ ๋ชจ๋ gossipsub ์๋์ ๋ก๋๋ค. ์๋ตํ ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์ ํ ์ค์ ์ ๊ณ ์ ๋ฒ์ ์ ๊ธฐ๋ณธ๊ฐ์ ์ ์งํฉ๋๋ค. ๊ธฐ๋ณธ ๋
ธ๋ preset์ ์๋์์ ์ค๋ช
ํ๋ ๋ณ๋ mesh ์ค์ ์ ์ ๊ณตํ ์ ์์ต๋๋ค.
| ํ๋ | ๋์ |
|---|---|
enabled |
PubSub ํ์ฑํ. ๊ธฐ๋ณธ true์ด๋ฉฐ boot preset์ ๋ช
์์ ์ผ๋ก ์ฌ์ค์ ํ์ง ์์ผ๋ฉด ๋นํ์ฑ์
๋๋ค. |
router |
gossipsub(๊ธฐ๋ณธ), floodsub, randomsub. |
hopwave |
์ ํ์ HopWave ์ ๋ฌ. ๊ธฐ๋ณธ ๋นํ์ฑ์ด๋ฉฐ true๋ก๋ง ์ผญ๋๋ค. GossipSub router์์๋ง ์ง์ํฉ๋๋ค. |
meshFreeze |
์คํ ์ค ๋ฉ์ ํ๋ฆฌ์ฆ ๋ช ๋ น์ ํ์ฉํฉ๋๋ค. ๊ธฐ๋ณธ false์ด๋ฉฐ GossipSub๊ฐ ํ์ฑํ๋์ด์ผ ํฉ๋๋ค. true๋ ์ดํ ๋๊ฒฐ์ ํ์ฉํ๋ ์ค์ ์ผ๋ก, ๋ช ๋ น ์ ๊น์ง ์ ์ ๋ฉ์ ํ์ฑ์ ์ ์งํฉ๋๋ค. |
topics |
์ฐธ์ฌ topic ์ด๋ฆ. ๊ธฐ๋ณธ [kpl/default]์ด๋ฉฐ topic๋ณ ์ค์ ์ ์ ํํ ๊ฐ์ ๋ฌธ์์ด์ ์ฌ์ฉํฉ๋๋ค. |
topicMode |
subscribe(๊ธฐ๋ณธ), relay, publish. Relay๋ ์ ํ๋ฆฌ์ผ์ด์
๊ตฌ๋
์์ด ์ ๋ฌํ๋ฉฐ publish๋ ์ฐธ์ฌํ๋ ๊ตฌ๋
ํ์ง ์์ต๋๋ค. |
subscribe |
ํธํ ์ค์ . topicMode๊ฐ ์์ ๋ false๋ publish ๋ชจ๋๋ฅผ ์ ํํฉ๋๋ค. |
allowPublish |
์ ํ๋ฆฌ์ผ์ด์ ๋ฐํ ์์ฒญ ํ์ฉ. ๊ธฐ๋ณธ true. |
randomDegree, randomNetworkSize
|
์์์ธ RandomSub degree ๋ชฉํ์ ์ถ์ ์ ์ฒด ๋คํธ์ํฌ ํฌ๊ธฐ. ๊ฐ Peer ์ปจํ ์ด๋์๋ ๋ ๋ฆฝ๋ process-global degree๊ฐ ์ ์ฉ๋ฉ๋๋ค. |
floodPublish, peerExchange
|
GossipSub flood ๋ฐํ๊ณผ PRUNE peer exchange. ๋ช ์์ ์ธ false๋ฅผ ๋ณด์กดํฉ๋๋ค. |
maxMessageSize |
์ง๋ ฌํ๋ PubSub RPC ์ต๋ ๋ฐ์ดํธ ์. ๊ธฐ๋ณธ 1 MiB์ด๋ฉฐ 0๋ ์ค์ ์ ํ๊ฐ์ผ๋ก ์ ๋ฌํฉ๋๋ค. |
peerOutboundQueueSize |
์์์ธ Peer๋ณ ์ก์ RPC ํ ํฌ๊ธฐ. ๋ผ์ด๋ธ๋ฌ๋ฆฌ ๊ธฐ๋ณธ 32. |
validateQueueSize |
์์์ธ ์์ ๊ฒ์ฆ ํ ํฌ๊ธฐ. ๋ผ์ด๋ธ๋ฌ๋ฆฌ ๊ธฐ๋ณธ 32. |
validateThrottle |
๋์ ๋น๋๊ธฐ ๊ฒ์ฆ ํ๋. ๋ผ์ด๋ธ๋ฌ๋ฆฌ ๊ธฐ๋ณธ 8192์ด๋ฉฐ 0 ์ด์์ ๋๋ค. 0์ ๋น๋๊ธฐ ๊ฒ์ฆ์ ํ์ฉํ์ง ์์ต๋๋ค. |
validateWorkers |
์์์ธ ๊ฒ์ฆ worker ์. ๊ธฐ๋ณธ๊ฐ์ ํ๋ก์ธ์ค์์ ๋ณด์ด๋ CPU ์์ ๋๋ค. |
subscriptionBufferSize |
0 ์ด์์ธ ์ ํ๋ฆฌ์ผ์ด์ ๊ตฌ๋ ๋ฒํผ ํฌ๊ธฐ. Topic๋ณ ์ค์ ์ด ์ฐ์ ํฉ๋๋ค. |
signaturePolicy |
strict-sign(๋ผ์ด๋ธ๋ฌ๋ฆฌ ๊ธฐ๋ณธ), strict-no-sign, lax-sign, lax-no-sign. Strict ์ ์ฑ
์ ์ ํํ ์๋ช
๊ท์น์ ์์ ๋ฉ์์ง์๋ ์ ์ฉํ๋ฉฐ lax ์ ์ฑ
์ ์์ ์๋ช
์๊ฑด์ ์ํํฉ๋๋ค. |
seenMessagesTTL |
PubSub seen-message cache ๋ณด์กด ์๊ฐ. ๋ผ์ด๋ธ๋ฌ๋ฆฌ ๊ธฐ๋ณธ 2m์ด๋ฉฐ score ์ ๋ฌ ๊ธฐ๋ก TTL๊ณผ ๊ตฌ๋ถํฉ๋๋ค. |
seenMessagesStrategy |
first-seen(๋ผ์ด๋ธ๋ฌ๋ฆฌ ๊ธฐ๋ณธ) ๋๋ last-seen cache ๋ง๋ฃ ์ ๋ต. |
messageId |
default๋ authorยทsequence, sha256์ ๋ฉ์์ง ๋ฐ์ดํฐ hash, topic-sha256์ ๊ธธ์ด๋ฅผ ์์ ๋ถ์ธ topic๊ณผ ๋ฐ์ดํฐ์ hash๋ฅผ ์ฌ์ฉํฉ๋๋ค. ๋ด์ฉ์ด ๊ฐ์ raw ๋ฐํ์ ๊ฐ์ PubSub ๋ฉ์์ง๋ก ํฉ์ณ์ง ์ ์์ต๋๋ค. |
scoreInspectInterval |
์ ์ snapshot ์ฃผ๊ธฐ. ์ค์ฝ์ด๋ง์ ๋ช
์์ ์ผ๋ก ์ผฐ์ ๋๋ง ๊ธฐ๋ณธ 1s; 0s๋ ๊ด์ธก์ ๋๋๋ค. ์ด ํ๋๋ง์ผ๋ก ์ค์ฝ์ด๋ง์ ์ผ์ง ์์ต๋๋ค. |
GossipSub mesh parameter, HopWave, mesh freeze, ํ์ฑ scoring, flood ๋ฐํ, peer exchange, direct peer์ PeerGater๋ GossipSub router์ ์ ์ฉ๋ฉ๋๋ค. FloodSub๋ mesh feature ์๋ ์ฌ์ฉ์ ์ง์ protocol ID๋ฅผ ์ฌ์ฉํ ์ ์์ผ๋ฉฐ RandomSub๋ ์ฌ์ฉ์ ์ง์ protocol ๋ชฉ๋ก์ ์ง์ํ์ง ์์ต๋๋ค. ๊ณตํต filter, validator, message ID, publication๊ณผ discovery ์ ์ฑ ์ ๊ณตํต PubSub API๋ฅผ ์ฌ์ฉํฉ๋๋ค.
Profile ๋๋ join phase์ node ๋ธ๋ก์ gossipsub.meshFreeze: true๋ฅผ ์ค์ ํ๋ฉด ํด๋น Peer์ GossipSub ๋ฉ์๋ฅผ ๋์ค์ ๋๊ฒฐํ ์ ์์ต๋๋ค. ๊ธฐ๋ณธ๊ฐ์ ๋นํ์ฑ์
๋๋ค. ๋ฉ์๋ฅผ ํ์ฑํ ๋ค ์๋๋ฆฌ์ค v3์ mesh-freeze action์ ์ฌ์ฉํ์ญ์์ค. ์ต์
๋ง์ผ๋ก ์์ ์์ ์ ๋น ๋ฉ์๋ฅผ ๋๊ฒฐํ์ง ์์ต๋๋ค. ๋ช
๋ น์ ์ ํํ ๊ฐ Peer์ ํ์ฌ ๋ชจ๋ topic ๋ฉ์๋ฅผ ๋๊ฒฐํ๋ฉฐ topic ์ ํ์ด๋ ํด์ ๋ช
๋ น์ ์์ต๋๋ค. ๋ฐ๋ณต ํธ์ถ์ ๊ณ ์ ๋ ๊ตฌ์ฑ์์ ๋ฐ๊พธ์ง ์๊ณ ์ฑ๊ณตํฉ๋๋ค.
Peer adapter๋ vendored WithMeshFreeze() ์ต์
๊ณผ PubSub.FreezeMesh(ctx)๋ฅผ ์ฌ์ฉํฉ๋๋ค. ์ฑ๊ณต ์๋ต์ PubSub ์ด๋ฒคํธ ๋ฃจํ์์ ์ ์ฉ์ ๋ง์ณค๋ค๋ ๋ป์
๋๋ค. ๊ทธ ์ดํ heartbeat์ degree ๋ณต๊ตฌ, score ๊ธฐ๋ฐ prune, opportunistic graft๋ ๋ฉ์ ๊ตฌ์ฑ์์ ๋ฐ๊ฟ ์ ์์ต๋๋ค. ์์ GRAFT/PRUNE, ์๋ ๊ตฌ๋
ํด์ ์ Peer ์ ๊ฑฐ๋ ๊ณ ์ ๊ตฌ์ฑ์์ ์ถ๊ฐํ๊ฑฐ๋ ์ ๊ฑฐํ์ง ๋ชปํฉ๋๋ค. ๋๊ธฐ ์ค์ด๊ฑฐ๋ ์ฌ์๋ํ GRAFT/PRUNE ์ ์ด ๋ฉ์์ง๋ ์ ๊ฑฐํฉ๋๋ค. ์ด๋ฏธ ์ก์ ์ ์ํด ํ์์ ๊บผ๋๊ฑฐ๋ ์ ์ก ์ค์ธ ๊ธฐ์กด ์ ์ด ๋ฉ์์ง๋ ์๋ต ๋ค์ ๋์ฐฉํ ์ ์์ผ๋ฏ๋ก ๋คํธ์ํฌ ์ ์ฒด์ ๊ฐ์ ์๊ฐ์ ์ฐจ๋จ ๊ฒฝ๊ณ๋ฅผ ๋ณด์ฅํ์ง ์์ต๋๋ค.
๊ณ ์ ๋ฉ์์๋ ํด๋น PubSub ์ธ์คํด์ค๊ฐ ๋๋ ๋๊น์ง ํ์ ๋ topic/Peer ID ์งํฉ์ด ๋จ์ต๋๋ค. ์ฐ๊ฒฐ์ด ๋๊ธด ๊ตฌ์ฑ์์ ๋์ฒดํ์ง ์์ผ๋ฉฐ transport ์ ๋ฆฌ์ ์๋์ ์์ยท์์ ์ ์ ๋ณด์กด ๊ท์น์ ์ ์งํฉ๋๋ค. ์ฌ์ ์ ์ ํ์๋ ํ๋กํ ์ฝ์ด ๋ฉ์ ๋ผ์ฐํ ์ ์ง์ํ ๋๋ง ํ์ฑ ๋ฉ์ ์ฐ๊ฒฐ์ ๋ณต์ํฉ๋๋ค. ๋ก์ปฌ ๊ตฌ๋ ์ด๋ relay๋ฅผ ์์ผ๋ฉด ๊ทธ topic์ ์ฐธ์ฌ๋ฅผ ์ค๋จํฉ๋๋ค. ์๋ topic์ ๋ค์ ์ฐธ์ฌํ๋ฉด ๊ณ ์ ๊ตฌ์ฑ์์ ์ฌ์ฉํ๋ฉฐ ๊ธฐ์กด ๊ท์น๋๋ก ๋ฐํ ์ ์ฉ fanout์ ์ ๋ฆฌํฉ๋๋ค. ์๋ก ์ฐธ์ฌํ topic์๋ ๋ฉ์ ๊ตฌ์ฑ์์ ์ถ๊ฐํ์ง ์์ง๋ง IHAVE/IWANT์ heartbeat gossip์ ๊ตํํ ์ ์์ต๋๋ค. Peer ํ๋ก์ธ์ค๋ฅผ ์๋ก ์์ํ๋ฉด ๋๊ฒฐ๋์ง ์์ ์ ๋ฉ์๋ฅผ ๋ง๋ญ๋๋ค.
์ค์ ์ฐ๊ฒฐ๊ณผ ์๋ ๊ตฌ๋ ์ ๊ณ์ ์ฌ๋ผ์ง ์ ์์ผ๋ฏ๋ก ๊ณ ์ ๊ตฌ์ฑ์๋ง์ผ๋ก ์ฌ์ฉ ๊ฐ๋ฅํ ๋งํฌ๋ ๋ฉ์์ง ์ ๋ฌ์ ๋ณด์ฅํ์ง ์์ต๋๋ค. Cache, validation, scoring, lazy gossip, fanout, direct peer, flood ๋ฐํ๊ณผ ์ ํ์ HopWave ์ ๋ฌ์ ๊ฐ์์ ๊ท์น๋๋ก ๊ณ์๋ฉ๋๋ค. ์ด๋ฏธ ๊ฒ์ฆ ์ค์ธ ๋ฉ์์ง๋ ๋ก์ปฌ ๊ตฌ๋ ํด์ ๋ค์๋ ์๋ PubSub ๋์๋๋ก ์บ์ ์ ์ฅ๊ณผ ์ ๋ฌ์ ๋ง์น ์ ์์ต๋๋ค. ๋ฉ์๋ฅผ ๊ณ ์ ํ ๋ชจ๋ ์ฐธ๊ฐ์์์ ์ต์ ์ ์ผ๊ณ ๋ช ๋ น์ ๋ณด๋ด์ญ์์ค. ์ฌ๋ฌ Peer์ ๋ํ ๋ช ๋ น์ ๊ฐ Peer์ ๊ฐ๋ณ ์ ์ฉ๋๋ฏ๋ก ๋คํธ์ํฌ ์ ์ฒด์ ํ ์์ snapshot์ ๋ง๋ค์ง ์์ผ๋ฉฐ, ์๊ฐ ์ด๊ณผ๋ ์คํจ ์ ์ผ๋ถ๋ง ๋๊ฒฐ๋ ์ํ์ผ ์ ์์ต๋๋ค. ControllerยทAgentยทPeer ์ด๋ฏธ์ง๋ฅผ ํจ๊ป ๊ฐฑ์ ํด์ผ ํฉ๋๋ค.
์๋๋ฆฌ์ค topology action๋ meshFreeze: true๋ฅผ ์ฌ์ฉํ์ฌ ๋ช
์์ ๊ทธ๋ํ๋ฅผ ์ค์นํ ๋ค ๋๊ฒฐํฉ๋๋ค. Vendored ValidateMeshPlan๊ณผ SetMeshAndFreeze API๋ ์์ฒญํ ๋ชจ๋ ์ด์์ ๊ฒ์ฌํ๋ฉฐ, ํ์๋ ์ฐธ์ฌ ์ค์ธ ํ ํฝ ํ๋๋ฅผ ๊ต์ฒดํ๊ณ Router ์ด๋ฒคํธ ๋ฃจํ์์ ๋ชจ๋ ๋ก์ปฌ ํ ํฝ ๋ฉ์๋ฅผ ์์์ ์ผ๋ก ๋๊ฒฐํฉ๋๋ค. ๊ฐ์ ๋๊ฒฐ ๋ฉค๋ฒ์ญ์ ๋ฉฑ๋ฑ์ด๋ฉฐ ๋ค๋ฅธ ๋ฉค๋ฒ์ญ์ ์ถฉ๋ํฉ๋๋ค. ๊ธฐ์กด ์ ์ ์ฐ์๊ณผ ์ฐ๊ฒฐ accounting์ ์ ์งํ๊ณ GRAFT/PRUNE ๊ตํ์ ํฉ์ฑํด ๊ธฐ๋กํ์ง ์์ต๋๋ค.
HopWave๋ ๋ฉ์์ง์ hop ์งํ์ ๋ฐ๋ผ ์ ํ์ ์ธ ์ ๋ฌ๊ณผ ์ฃผ๊ธฐ์ ์ธ ์ ํ ๊ฐํ๋ฅผ ๊ฒฐํฉํ๋ ๋ธ๋ก๋์บ์คํธ ํ๋กํ ์ฝ์ ๋๋ค. ํ์ ์ฐธ๊ณ ๋ฌธํ์ Sungwook Lee์ Hongtaek Ju์ HopWave ๋ ผ๋ฌธ, APNOMS 2026์ด๋ฉฐ ์์ง ์ถํ๋์ง ์์์ต๋๋ค. ์๋ ๋์์ KPL์ ํ์ฌ ๊ตฌํ์ ์ค๋ช ํฉ๋๋ค.
KPL์ ๊ธฐ์กด ์ ์ ๊ด์ธก ํจ์น๋ฅผ ์ ์งํ๋ฉด์ ๊ณ ์ ํ GossipSub ์์ค ๋ด์ HopWave๋ฅผ ๊ตฌํํฉ๋๋ค. ๋ฐํ ๋์ ์ ํ์ ๋ฐ๊พธ๋ฉฐ mesh ์ ์ง์ scoring์ ๊ธฐ์กด ๋์์ ์ ์งํฉ๋๋ค. ์ด์์ ์ฌ์ฉํ ์์ค ๋ฆฌ๋น์ ์ ์๋ ํจ์น ์ถ์ฒ ์๋ด์ ๊ธฐ๋กํฉ๋๋ค. PubSub๋ฅผ ์ผ boot ๋ ธ๋๋ฅผ ํฌํจํ์ฌ ์ฐธ์ฌํ๋ ๋ชจ๋ profile์ ์ค์ ํ์ญ์์ค.
gossipsub:
hopwave: true
params:
hopwaveFactor: 0.5
hopwaveInterval: 3Peer adapter๋ ์๋ํํฐ Go API์ WithHopwavePublish(true)๋ก ๊ธฐ๋ฅ์ ์ผ๊ณ ํ๋ผ๋ฏธํฐ๋ฅผ GossipSubParams.HopwaveFactor์ HopwaveInterval์ ์ฐ๊ฒฐํฉ๋๋ค. WithHopwave()๋ ๋ฉํ์ ๋ณด๋ง ํ์ฑํํฉ๋๋ค. Go ์๋ณ์๋ hopwave๋ฅผ ํ ๋จ์ด๋ก ์ฐ๋ฉฐ ๊ณต๊ฐ ์ด๋ฆ์ ํ์ํ ์ฒซ ๊ธ์๋ง ๋๋ฌธ์๋ก ํ๊ธฐํฉ๋๋ค.
์ ์ฒด HopWave ์๋๋ฆฌ์ค๋ Swarm์์ ์คํํฉ๋๋ค. kpl validate --scenario examples/hopwave.yaml๋ก ๊ฒ์ฆํ์ญ์์ค.
gossipsub.params ์๋ ํ๋ |
๊ธฐ๋ณธ๊ฐ | ๊ณ์ฝ |
|---|---|---|
hopwaveFactor |
1 |
[0, 1]์ ์ ํํ ๋น์จ. ์ ์ฒด ์ ์ก ์ฌ์ด์๋ ๋ฌด์์๋ก ์์ ํ๋ณด์์ floor(์ ํจ ๋์ ์ ร ๋น์จ)๊ฐ๋ฅผ ์ ํํฉ๋๋ค. ์์ ๋น์จ์ ํ๋ณด๊ฐ ์์ผ๋ฉด ์ต์ ํ๋๋ฅผ ์ ํํฉ๋๋ค. 0์ ์ ์ฒด ์ ์ก ์ฌ์ด์ eager ์ ๋ฌ์ ๋๋๋ค. |
hopwaveInterval |
1 |
[1, 2147483647]์ ์ ์. ์ ์ฒด ์ ์ก ์ฌ์ด์ hop ๋จ๊ณ ์์ด๋ฉฐ ์ค์ ์๊ฐ์ด๋ heartbeat ์ฃผ๊ธฐ์ ๋
๋ฆฝ์ ์
๋๋ค. |
์ ๋ฐํ์ ์นด์ดํฐ 0์ผ๋ก ์์ํฉ๋๋ค. ๊ฐ ์ก์ ์ ์บ์์ ๋ณด์กดํ ์์ ์นด์ดํฐ์์ ํ ๋จ๊ณ ์งํํ๊ณ ์ค์ ํ ์ฃผ๊ธฐ์ ๋๋ฌํ๋ฉด 0์ผ๋ก ๋๋๋ฆฝ๋๋ค. ์ก์ ์นด์ดํฐ๊ฐ 0์ด๋ฉด ์ ํจํ ๋ฐํ ๋์ ์ ์ฒด์ ๋ณด๋ด๋ฉฐ ๋๋จธ์ง ๊ฐ์์๋ ๋น์จ์ ์ ์ฉํฉ๋๋ค. ๊ธฐ์กด ๋ฐ์ ์ยท์์ ์ ์ ์ธ์ protocolยทscoreยทIDONTWANT ๊ท์น์ ์ ์ฉํ ๋ค direct peer์ flood-publish ๋์์๋ ์ ํ์ ์ ์ฉํฉ๋๋ค. IWANT ์๋ต์ ๋น์จ ์ ํ์ ๊ฑฐ์น์ง ์์ผ๋ฉฐ ๊ธฐ์กด ์์ฒญ ์๊ฒฉ๊ณผ ์ฌ์ ์ก ํ๋๋ฅผ ์ ์งํฉ๋๋ค. ํ์ฑํ๋ง ํ๊ณ ์กฐ์ ํ์ง ์์ผ๋ฉด ๊ธฐ๋ณธ 1/1์ด ์ ์ฒด ์ ์ก์ ์ ์งํฉ๋๋ค.
์ผ๋ฐ ๋ฐํ ์ ๋ฌ์ eager-push, IWANT ์๋ต์ lazy-pull์ ๋ณด๊ณ ํฉ๋๋ค. ์ก์ ์ฉ ๋ณต์ฌ๋ณธ์ ์ฌ์ฉํ๋ฏ๋ก ๊ตฌ๋
์ยท์บ์์ ์์ ๊ฐยท๋๊ธฐ ์ค์ธ push๋ ์ ์ง๋๋ฉฐ ๋ฐ๋ณต pull ์๋ต๋ ์นด์ดํฐ๋ฅผ ๋์ ํ์ง ์์ต๋๋ค. ๋๋ฝยท์์ยทoverflow ์นด์ดํฐ๋ unknown์ ์ ์งํ๊ณ ์ ์ฒด ๋ฐํ ์ ๋ฌ์ ์ฌ์ฉํฉ๋๋ค.
HopWave๊ฐ ํ์ฑํ๋๋ฉด ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ ๊ธฐ๋ณธยทtopic๋ณ ๋ฉ์์ง ID callback ์
๋ ฅ์์ ์ด ๊ฐ๋ณ ํ๋๋ฅผ ์ ์ธํฉ๋๋ค. ์ ๋ฌยท์ค๋ณต ์ ๊ฑฐยทIWANT ์กฐํ์์ ๊ฐ์ ID๋ฅผ ์ ์งํ๊ธฐ ์ํ ์ฒ๋ฆฌ์
๋๋ค. ์ ์ธํ default, sha256, topic-sha256 ์ ์ฑ
์ ์ด๋ฏธ ๋ณํ์ง ์๋ ํ๋๋ฅผ ์ฌ์ฉํฉ๋๋ค. HopWave ๋นํ์ฑ ์ callback ์
๋ ฅ์ ๊ธฐ์กด๊ณผ ๊ฐ์ผ๋ฏ๋ก ์ค์ ์ ํผํฉํ ๋๋ ์ฌ์ฉ์ ์ง์ callback๋ ๋ณํ์ง ์๋ ํ๋๋ฅผ ์ฌ์ฉํด์ผ ํฉ๋๋ค.
Wire์ hopCount๋ ์ํํ๋ wave ์นด์ดํฐ์ด๋ฏ๋ก ์ฐ๊ตฌ ์งํ์ ์ ๋ ๊ฒฝ๋ก ๊ธธ์ด๋ฅผ ๋์ ํ ์ ์์ต๋๋ค. ์ ํ ํ์
์ ๋ณด๊ณ ๋ ๋ง์ง๋ง ์ก์ ๋ฐฉ์์ด๋ฉฐ ๋ฐํ์๋ถํฐ ์์ ์๊น์ง์ ์ ์ฒด ๊ฒฝ๋ก ๋ถ๋ฅ๊ฐ ์๋๋๋ค. ๋ ํ๋๋ ์๋ช
ํ์ง ์๋ ๊ฐ๋ณ ๋ณด๊ณ ๊ฐ์ด๋ฉฐ payloadยทtopicยทauthorยทsequence๋ ๊ณ์ ์๋ช
ํฉ๋๋ค. KPL์ ์์ธ Peer ๋ก๊ทธ์ ๋ณ๋๋ก ๋ณด์กดํ๋ฉฐ ๊ธฐ์กด ๋ณต์ ๊ฒฝ๋ก์ eager/lazy ์ถ์ ์ ์ ์๋ฅผ ์ ์งํฉ๋๋ค. ํด๋น ํ๋๊ฐ ์๋ ๊ณผ๊ฑฐ ๋ก๊ทธ์๋ ๊ด์ธก๊ฐ์ ๋ง๋ค์ง ์์ต๋๋ค.
์ฐธ์กฐ fork์ฒ๋ผ GossipSub protocol ID๋ฅผ ์ ์งํฉ๋๋ค. ํจ์น๊ฐ ์๋ ์๋ช ๊ฒ์ฆ๊ธฐ๋ ์ด wire ํ๋๋ฅผ ์ง์ํ์ง ์์ต๋๋ค. ๊ฒฝ๋ก ์ ์ฒด์ ํธํ๋๋ ๋น๋์ ๊ฐ์ HopWave ์ค์ ์ ์ฌ์ฉํ์ญ์์ค. ๊ธฐ์กด protocol ์ค์ ์ ์ฌ์ฉ์ ์ง์ ID๋ก ๊ด์ธก ์คํ์ ๊ฒฉ๋ฆฌํ ์ ์์ต๋๋ค. ControllerยทAgentยทPeer ์ด๋ฏธ์ง๋ฅผ ๋ชจ๋ ๊ฐฑ์ ํด์ผ ํฉ๋๋ค. ํจ์น ์ถ์ฒ์ ์ ๊ทธ๋ ์ด๋ ์๋ด์์ ์ ํํ ์ฐธ์กฐ ์์ค์ ์ด์ ๋ฒ์๋ฅผ ํ์ธํ ์ ์์ต๋๋ค.
gossipsub.params ์๋์ ์ค์ ํฉ๋๋ค. ์๋ ๊ธฐ๋ณธ๊ฐ์ ๋
ธ๋ preset ๋๋ profile์ ์ ์ฉํ๊ธฐ ์ ์ KPL ๊ธฐ๋ณธ๊ฐ์
๋๋ค.
์ด๊ธฐ heartbeat์ direct peer ์ฐ๊ฒฐ ํ์ด๋จธ๋ Peer context๊ฐ ์ทจ์๋๋ฉด ์ข ๋ฃ๋ฉ๋๋ค. ์ฃผ๊ธฐ์ ์ธ direct peer ์ฌ์ฐ๊ฒฐ์ ํฌ๊ธฐ๊ฐ ์ ํ๋ connector ํ๋ฅผ ์ฌ์ฉํ๋ฉฐ, ํ๊ฐ ๊ฐ๋ ์ฐจ๋ฉด ๋จ์ Peer๋ ์ดํ ์ฌ์ฐ๊ฒฐ ์ฃผ๊ธฐ์ ๋ค์ ์๋ํฉ๋๋ค.
Router๋ ์ฃผ์๋ก ์ด๋ฒคํธ ๊ตฌ๋ ์ด ์คํจํ๊ฑฐ๋ ๋ซํ๋ ์ทจ์ ์์ ๊น์ง ์ฃผ์๋ก์ ์ ์งํ๊ณ ์ข ๋ฃ ์ ํด์ ํฉ๋๋ค. ๋ซํ ์ด๋ฒคํธ ์คํธ๋ฆผ์ ๋ฐ๋ณต ์กฐํํ์ง ์์ต๋๋ค.
| ํ๋ | ๊ธฐ๋ณธ๊ฐ | ์๋ฏธ |
|---|---|---|
d |
6 | ๋ชฉํ mesh degree. |
dLow |
5 | Mesh ๋ณด์ถฉ ๊ธฐ์ค. |
dHigh |
12 | Mesh pruning ๊ธฐ์ค. |
dScore |
4 | Pruningํ ๋ ์ ์งํ ๊ณ ๋์ Peer ์. |
dOut |
2 | ์ต์ outbound mesh ์ฐ๊ฒฐ ์. |
dLazy |
6 | ์ต์ gossip ๋์ ์. |
historyLength |
5 | ๋ฉ์์ง cache history slot ์. |
historyGossip |
3 | Gossip์ผ๋ก ์๋ฆด ์ต๊ทผ history slot ์. |
gossipFactor |
0.25 | ์ ๊ฒฉ Peer ์ค gossip ๋์์ผ๋ก ์ ํํ ๋น์จ. |
gossipRetransmission |
3 | IWANT ์๋ต์์ ๋ฉ์์ง๋ณ ์ฌ์ ์ก ํ๋. |
heartbeatInitialDelay |
100ms |
์ฒซ heartbeat ์ ์ง์ฐ. |
heartbeatInterval |
1s |
Mesh ์ ์ง๋ณด์ ์ฃผ๊ธฐ. |
slowHeartbeatWarning |
0.1 | ๋๋ฆฐ heartbeat ๊ฒฝ๊ณ ์ ์ฌ์ฉํ๋ heartbeat ์ฃผ๊ธฐ์ ๋น์จ. |
fanoutTTL |
1m |
๋นํ์ฑ fanout ์ํ ๋ณด์กด ์๊ฐ. |
prunePeers |
16 | PRUNE์ ํฌํจํ๋ peer exchange ํญ๋ชฉ ์. |
pruneBackoff |
1m |
Mesh Peer pruning ํ backoff. |
unsubscribeBackoff |
10s |
๊ตฌ๋ ํด์ ๋ค PRUNE backoff. |
connectors |
8 | PX๋ก ์ป์ Peer์ ๋์ ์ฐ๊ฒฐ worker ์. |
maxPendingConnections |
128 | PX ์ฐ๊ฒฐ ๋๊ธฐ ํ ํ๋. |
connectionTimeout |
30s |
ํด๋น ์ฐ๊ฒฐ์ timeout. |
directConnectTicks |
300 | Direct peer ์ฌ์ฐ๊ฒฐ ๊ฒ์ฌ ์ฌ์ด heartbeat ์. |
directConnectInitialDelay |
1s |
์ต์ด direct peer ์ฐ๊ฒฐ ์ง์ฐ. |
opportunisticGraftTicks |
60 | Opportunistic graft ๊ฒ์ฌ ์ฌ์ด heartbeat ์. |
opportunisticGraftPeers |
2 | Opportunistic graft์์ ์ ํํ Peer ์. |
graftFloodThreshold |
10s |
์ด๋ฅธ ๋ฐ๋ณต GRAFT์ penalty๋ฅผ ์ ์ฉํ๋ ๊ธฐ์ค ์๊ฐ. |
maxIHaveLength |
5000 | IHAVE์ ๋ฃ๊ฑฐ๋ heartbeat๋น Peer์์ ์๋ฝยท์์ฒญํ๋ ์ต๋ ID ์. |
maxIHaveMessages |
10 | Peer๋ณ heartbeat๋น IHAVE ์ฒ๋ฆฌ ํ๋. |
maxIDontWantLength |
10 | IDONTWANT์ ํฌํจํ๊ฑฐ๋ ์๋ฝํ๋ ์ต๋ ๋ฉ์์ง ID ์. |
maxIDontWantMessages |
1000 | Peer๋ณ heartbeat๋น IDONTWANT ์ฒ๋ฆฌ ํ๋. |
iWantFollowupTime |
3s |
IWANT ์ฝ์์ ์ดํํ์ง ์์ ํ๋ penalty๋ฅผ ๋ถ์ฌํ๊ธฐ ์ ๋๊ธฐ ์๊ฐ. |
iDontWantMessageThreshold |
1024 | IDONTWANT ์์ฑ ๊ธฐ์ค ๋ฉ์์ง ๋ฐ์ดํธ ์. |
iDontWantMessageTTL |
3 | IDONTWANT ์ํ๋ฅผ ๋ณด์กดํ๋ heartbeat ์. |
Degree์๋ dLow <= d <= dHigh, 0 <= dScore <= d, dOut < dLow, dOut <= d/2 ์ ์ฝ์ด ์์ต๋๋ค. History๋ 0 <= historyGossip <= historyLength์ด๋ฉฐ d, dHigh, historyLength๋ ์์์
๋๋ค. Heartbeat interval๊ณผ ๋ tick counter๋ ์์์ด๊ณ ๋๋จธ์ง count์ duration์ 0 ์ด์์
๋๋ค. Gossip factor๋ ์ ํํ [0,1], slow-heartbeat warning์ ์ ํํ 0 ์ด์ ๊ฐ์
๋๋ค. 0์ ๋์์ ์ต์ ํ ์ ์์ผ๋ฉฐ ์๋์ผ๋ก ๊ธฐ๋ณธ๊ฐ์ผ๋ก ๋ฐ๊พธ์ง ์์ต๋๋ค.
boot์์ PubSub๋ฅผ ์ผ๋ฉด preset์ dScore: 3์ ์ฌ์ฉํฉ๋๋ค. Worker preset์ v2์ dLow: 5, dScore: 3, maxIHaveLength: 5500, heartbeatInitialDelay: 1s๋ฅผ ์์ํฉ๋๋ค. ์ค์ ๊ฐ์ ํ์
schema์ ๊ธฐ๋ณธ๊ฐ ์ฒ๋ฆฌ์์ ํ์ธํ ์ ์์ต๋๋ค.
**gossipsub.score.enabled: true**๋ฅผ ์ค์ ํด์ผ PeerScore๋ฅผ ์ค์นํฉ๋๋ค. score ๋๋ score.enabled๋ฅผ ์๋ตํ๊ฑฐ๋ false๋ก ์ค์ ํ๋ฉด ์ค์ฝ์ด๋ง๊ณผ ์ ์ ๊ด์ธก์ ์คํํ์ง ์์ต๋๋ค. ๋นํ์ฑ ๋ธ๋ก์๋ ๋ฏธ์์ฑ tuning์ ๋ณด์กดํ ์ ์์ง๋ง ์๋ชป๋ duration, ๋น์ ํ ์์น, ์๋ชป๋ CIDRยทPeer ID์ ๋น topic key๋ ๊ฑฐ๋ถํฉ๋๋ค. ํ์ฑ ๊ตฌ์ฑ์์๋ router๊ฐ ์๊ตฌํ๋ ํ๋ ๊ฐ ๊ด๊ณ๊น์ง ๊ฒ์ฆํฉ๋๋ค.
gossipsub.score ํ๋ |
์๋ฏธ์ ํ์ฑ ์ํ ๊ฒ์ฆ |
|---|---|
enabled |
๋ช ์์ ํ์ฑํ. ๊ธฐ๋ณธ false. |
skipAtomicValidation |
์ค์ ํ์ง ์์ score group์ ๋นํ์ฑ์ผ๋ก ๋ ์ ์์ต๋๋ค. ๊ธฐ๋ณธ false๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ์ ์ฒด group ๊ฒ์ฆ์ ์ ์งํฉ๋๋ค. |
topicScoreCap |
์์ topic ๊ธฐ์ฌ ํฉ๊ณ์ ์ ์ฉํ 0 ์ด์ ์ํ. 0์ ์ํ ์์. |
appSpecificWeight |
์ ํํ P5 ๊ฐ์ค์น. ์์ยท์์ ๋ชจ๋ ๊ฐ๋ฅํ๋ฉฐ 0์ด ์๋๋ฉด appSpecificScore๊ฐ ํ์ํฉ๋๋ค. |
appSpecificScore.default |
๊ธฐ๋ณธ P5 ์์ ์. ์๋ตํ๋ฉด 0. |
appSpecificScore.peers |
libp2p Peer ID์์ P5 ์์ ์๋ก์ map. ๋ช ์์ 0๋ ๊ธฐ๋ณธ๊ฐ๋ณด๋ค ์ฐ์ ํ๋ฉฐ ๊ฐ์ Peer ID์ ์ค๋ณต ํ๊ธฐ๋ ๊ฑฐ๋ถํฉ๋๋ค. |
ipColocationFactorWeight |
0 ์ดํ์ธ P6 ๊ฐ์ค์น. 0์ penalty ๋นํ์ฑ. |
ipColocationFactorThreshold |
P6 ๊ฐ์ค์น๊ฐ 0์ด ์๋๋ฉด ์ต์ 1. |
ipColocationFactorWhitelist |
Colocation penalty์์ ์ ์ธํ CIDR ๋ฌธ์์ด. |
behaviourPenaltyWeight |
0 ์ดํ์ธ P7 ๊ฐ์ค์น. 0์ ๋นํ์ฑ. |
behaviourPenaltyThreshold |
0 ์ด์์ธ penalty counter ๊ธฐ์ค. |
behaviourPenaltyDecay |
P7 ํ์ฑ ์ (0,1)์ธ counter decay factor. |
decayInterval |
Counter ์ ์ง๋ณด์ ์ฃผ๊ธฐ. ์ต์ 1s. |
decayToZero |
(0,1)์ธ counter cutoff. |
retainScore |
0 ์ด์์ธ ์ฐ๊ฒฐ ํด์ Peer์ ์ ์ ๋ณด์กด ์๊ฐ. 0์ ๋ณด์กดํ์ง ์์. |
seenMessageTTL |
0 ์ด์์ธ score ์ ๋ฌ ๊ธฐ๋ก ๋ณด์กด ์๊ฐ. 0์ ๋ผ์ด๋ธ๋ฌ๋ฆฌ ๊ธฐ๋ณธ 2m์ ์ฌ์ฉํ๋ฉฐ gossipsub.seenMessagesTTL๊ณผ ๊ตฌ๋ถํฉ๋๋ค. |
thresholds |
์๋ threshold ๋ธ๋ก. |
topics |
์ ํํ ์ฐธ์ฌ topic ์ด๋ฆ์์ ์๋ TopicScore ๋ธ๋ก์ผ๋ก์ map. ํ์ฑ score key๋ ์ฐธ์ฌ topic์ ๊ฐ๋ฆฌ์ผ์ผ ํฉ๋๋ค. |
P5๋ ์ ํํ ์์ ์์ appSpecificWeight๋ฅผ ๊ณฑํฉ๋๋ค. Peer๋ณ map์ด default๋ณด๋ค ์ฐ์ ํ๋ฉฐ ๊ฐ Peer ์ธ์คํด์ค์์ ๊ฐ์ ๊ณ ์ ๋ฉ๋๋ค. Key๋ ์๋๋ฆฌ์ค node IDยทgroupยทprofile ์ด๋ฆ์ด ์๋ libp2p Peer ID์
๋๋ค. ๋ชจ๋ ์์ ์์ ๊ฐ์ค์น ์ ์ฉ ๊ฒฐ๊ณผ๋ ์ ํํด์ผ ํฉ๋๋ค. Callback์ ๋ถ๋ณ ๋ฉ๋ชจ๋ฆฌ map์ ์ฝ์ผ๋ฉฐ ๋คํธ์ํฌ ์์ฒญ์ ํ์ง ์์ต๋๋ค.
ํ์ฑ selective validation์์ decayInterval/decayToZero group ์ ์ฒด๋ฅผ ์๋ตํ๋ฉด 1s/0.01์ ์ ์ฉํฉ๋๋ค. ๋นํ์ฑ time-in-mesh group ์ ์ฒด๋ฅผ ์๋ตํ๋ฉด ์์ ํ timeInMeshQuantum: 1s๋ฅผ ์ ์ฉํฉ๋๋ค. ์ด tickerยท๋๋์
์ค์ ์ ๋ช
์์ 0s๋ ๊ฑฐ๋ถํฉ๋๋ค. ๊ณ ์ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ selective validator๊ฐ ํ์ฉํ๋ panic ์กฐ๊ฑด์ ๋ง๊ธฐ ์ํ ๊ธฐ๋ณธ๊ฐ์ด๋ฉฐ scoring ๊ฐ์ค์น๋ฅผ ์ผ์ง๋ ์์ต๋๋ค.
gossipsub:
topics: [kpl/default]
score:
enabled: true
skipAtomicValidation: true
appSpecificWeight: 1
appSpecificScore:
default: 2
topics:
kpl/default:
skipAtomicValidation: true
topicWeight: 1
timeInMeshWeight: 0.01
timeInMeshQuantum: 1s
timeInMeshCap: 100gossipsub.score.thresholds ์๋์ ์ค์ ํฉ๋๋ค.
| ํ๋ | ์ ์ฝ๊ณผ ๋์ |
|---|---|
skipAtomicValidation |
์ค์ ํ์ง ์์ threshold group ํ์ฉ. ๊ธฐ๋ณธ false. |
gossipThreshold |
Gossip ์ ๋ฌ์ 0 ์ดํ score ๊ธฐ์ค. |
publishThreshold |
gossipThreshold ์ดํ. ์ด๋ณด๋ค ๋ฎ์ผ๋ฉด flood/fanout ๋ฐํ์ ์ต์ ํฉ๋๋ค. |
graylistThreshold |
publishThreshold ์ดํ. ์ด๋ณด๋ค ๋ฎ์ผ๋ฉด ๋ฉ์์ง ์ฒ๋ฆฌ๋ฅผ ์ต์ ํฉ๋๋ค. |
acceptPXThreshold |
Peer exchange๋ฅผ ์๋ฝํ๋ ๋ฐ ํ์ํ 0 ์ด์ score. |
opportunisticGraftThreshold |
Opportunistic graft๋ฅผ ์ํ 0 ์ด์ mesh score ์ค์๊ฐ ๊ธฐ์ค. |
gossipsub.score.topics.<์ฐธ์ฌ-topic> ์๋์ ์ค์ ํฉ๋๋ค.
| ํ๋ | ์๋ฏธ |
|---|---|
skipAtomicValidation |
์ค์ ํ์ง ์์ score group ํ์ฉ. ๊ธฐ๋ณธ false. |
topicWeight |
Topic ์ ์ฒด ๊ธฐ์ฌ์ 0 ์ด์ ๋ฐฐ์. |
timeInMeshWeight |
0 ์ด์ P1 ๊ฐ์ค์น. 0์ ๋นํ์ฑ. |
timeInMeshQuantum |
์์์ธ mesh ์๊ฐ ์ ์. |
timeInMeshCap |
P1 ํ์ฑ ์ ์์์ธ ์ํ. |
firstMessageDeliveriesWeight |
0 ์ด์ P2 ๊ฐ์ค์น. |
firstMessageDeliveriesDecay |
P2 ํ์ฑ ์ (0,1)์ธ factor. |
firstMessageDeliveriesCap |
P2 ํ์ฑ ์ ์์์ธ counter ์ํ. |
meshMessageDeliveriesWeight |
0 ์ดํ P3 ์ ๋ฌ ๋ถ์กฑ ๊ฐ์ค์น. |
meshMessageDeliveriesDecay |
P3 ํ์ฑ ์ (0,1)์ธ factor. |
meshMessageDeliveriesThreshold |
P3 ํ์ฑ ์ ์์์ธ ์ ๋ฌ ๋ชฉํ. |
meshMessageDeliveriesCap |
P3 ํ์ฑ ์ ์์์ธ counter ์ํ. |
meshMessageDeliveriesActivation |
P3 ํ์ฑ ์ ์ต์ 1s. |
meshMessageDeliveriesWindow |
0 ์ด์์ธ near-first ์ ๋ฌ ๊ณ์ธก ๊ธฐ๊ฐ. |
meshFailurePenaltyWeight |
0 ์ดํ P3b sticky mesh-failure ๊ฐ์ค์น. |
meshFailurePenaltyDecay |
P3b ํ์ฑ ์ (0,1)์ธ factor. |
invalidMessageDeliveriesWeight |
0 ์ดํ P4 invalid-delivery ๊ฐ์ค์น. |
invalidMessageDeliveriesDecay |
์ค์ ๋ P4 group์์ (0,1)์ธ factor. Atomic validation์์๋ ๊ฐ์ค์น๊ฐ 0์ด์ด๋ ํ์ํฉ๋๋ค. |
๋นํ์ฑ ๊ฐ์ค์น ํญ๋ชฉ์ ํฌํจํด ๋ชจ๋ score ๋ถ๋์์์ ๊ฐ์ ์ ํํด์ผ ํฉ๋๋ค. Topic score ๋ธ๋ก์ ์๋ตํ๋ฉด ํด๋น topic์ ์ ์๋ฅผ ๊ณ์ฐํ์ง ์์ต๋๋ค. ์ ์ฒด group ๊ฒ์ฆ์์๋ ๊ฐ์ค์น๊ฐ 0์ด์ด๋ ์ ํจํ time-in-mesh quantum๊ณผ invalid-delivery decay๋ฅผ ์ ๊ณตํ์ญ์์ค. ๋นํ์ฑ์ด๋ฉด ํ ํด๋ก์ง UI์ Peer scores: Disabled๋ก ํ์ํฉ๋๋ค. ํ์ฑ ์ ์ snapshot์ node/network/snapshot API์ SSE์ peerScores์ ์์ต๋๋ค. Router ๊ด์ธก๊ฐ์ด๋ฉฐ ์คํ ๊ฒฐ๊ณผ์ ๊ณ ์ ๊ธฐ๋๊ฐ์ ์๋๋๋ค.
Scoring์ ๊ณ์ ๋ช
์์ ์ผ๋ก ํ์ฑํํด์ผ ํฉ๋๋ค(gossipsub.score.enabled: true). ์์ scoreInspectInterval(ํ์ฑ ์ ๊ธฐ๋ณธ 1s)๋ง๋ค ๊ฐ์ค์น๋ฅผ ์ ์ฉํ P1~P7 ๊ธฐ์ฌ๋๋ฅผ ๊ธฐ๋กํ๋ฉฐ 0s๋ inspection์ ๋๋๋ค. ๊ธฐ์กด ์ด์ ๋ ์ ์งํฉ๋๋ค. P3b์ topic ์ํ ์กฐ์ ๊ฐ์ ๋ณ๋๋ก ์ ๊ณตํ์ฌ ์ด์ ๊ณผ ๋น๊ตํ ๋ ํด๋น ํจ๊ณผ๊ฐ ์จ๊ฒจ์ง์ง ์๋๋ก ํฉ๋๋ค.
| ํญ๋ชฉ | ๊ธฐ๋กํ๋ ๊ธฐ์ฌ๋ |
|---|---|
| P1 | ์ํ์ ์ ์ฉํ ์ ์ time-in-mesh quantum ์ ร ์๊ฐ ๊ฐ์ค์น ร topic ๊ฐ์ค์น. mesh ๋ฐ์์๋ 0. |
| P2 | ์ต์ด ๋ฉ์์ง ์ ๋ฌ counter ร ์ ๋ฌ ๊ฐ์ค์น ร topic ๊ฐ์ค์น. |
| P3 | ์ ๋ฌ ๋ถ์กฑ๋ถ์ ์ ๊ณฑ ร ์ ๋ฌ ๊ฐ์ค์น ร topic ๊ฐ์ค์น. router์ ์ ๋ฌ ํ๋ํฐ ํ์ฑ flag๊ฐ ์ฐธ์ผ ๋๋ง ์ ์ฉ. |
| P3b | ๋ณด์กด๋ mesh ์คํจ counter ร ์คํจ ๊ฐ์ค์น ร topic ๊ฐ์ค์น. |
| P4 | ์๋ชป๋ ๋ฉ์์ง counter์ ์ ๊ณฑ ร ํด๋น ๊ฐ์ค์น ร topic ๊ฐ์ค์น. |
| P5 | ์ ํ๋ฆฌ์ผ์ด์ ์ ์ ร ์ ํ๋ฆฌ์ผ์ด์ ๊ฐ์ค์น. |
| P6 | router๊ฐ ์ด๋ฏธ ์๊ณ๊ฐยท์ ๊ณฑ์ ์ ์ฉํ IP colocation factor ร ๊ฐ์ค์น. |
| P7 | ํ๋ ์๊ณ๊ฐ ์ด๊ณผ๋ถ์ ์ ๊ณฑ ร ํ๋ ๊ฐ์ค์น. |
| Topic cap | ๋ชจ๋ topic ๊ธฐ์ฌ๋๋ฅผ ํฉ์ฐํ ๋ค์ ์ํ ์กฐ์ ๊ฐ. ์ํ์ ๊ฑธ๋ฆฌ์ง ์์ผ๋ฉด 0. |
| Total | ๊ฐ์ ์ธก์ ์์ ๋ํ ์ค์ router ์ด์ . |
Topic ํญ๋ชฉ์ ์ ์๋ฅผ ๋งค๊ธฐ๋ topic ์ ์ฒด๋ฅผ ํฉ์ฐํฉ๋๋ค. ๊ฐ์ค์น๊ฐ 0์ด๋ฉด ์ธก์ ๋ 0์ด๋ฉฐ, ์ธก์ ๋๋ฝยทinspection ๋นํ์ฑ์ ๋น ๊ตฌ๊ฐ์ ๋๋ค. Router inspector์ ๋์ผํ๊ฒ ์ฐ๊ฒฐ ํด์ ํ ๋ณด์กด ์ค์ธ ์๋ Peer ์ ์๋ ํฌํจํฉ๋๋ค. P3๋ prune ํ์๋ ํ์ฑ ์ํ์ผ ์ ์์ผ๋ฉฐ, P3b๋ ์ํ์ด ์ ์ฉ๋ ์ด์ ์์ ์ ํํ ์ญ์ฐํ ์ ์์ต๋๋ค. ๊ณ ์ ํ libp2p-pubsub ์์ค์ ์ ์ ๊ด์ธก ํ์ฅ์ ์ ์ฉํ์ฌ ์ค์ ํ์ฑ flagยท๋์ counterยทsnapshot ์๊ฐ์ ์ ๊ณตํฉ๋๋ค. Router์ ์ ์ยท๊ฐ์ ยท๋ผ์ฐํ ์ฐ์์ ์ ์งํ๋ฉฐ, ๋ฆ๊ฒ ์คํ๋ callback์ด ์ต์ ์ธก์ ์ ๋๋๋ฆฌ์ง ๋ชปํ๋๋ก ํ์ต๋๋ค.
Inspection๋ง๋ค ๊ด์ธก Peer๋น peer_score ์ด๋ฒคํธ ํ๋์ ์ ํจํ ์๋ Peer๋ค์ ํญ๋ชฉ๋ณ count/mean/min/max๋ฅผ ๊ธฐ๋กํฉ๋๋ค. ๊ฐ๋ณ ์๋ Peerยทtopic ํ๋ ฌ์ ์ง๋ ฌํํ์ง ์์ ๊ด์ธก์ยท์๋ยทtopic ์กฐํฉ ์๋งํผ ์ด๋ฒคํธ ํฌ๊ธฐ๊ฐ ๋์ด๋์ง ์๋๋ก ํฉ๋๋ค. ๊ธฐ์กด telemetry ๋ฒํผยท์ ์ค ๋ณด๊ณ ์ ๋ก์ปฌ ์ฐ์ ๊ฒฐ๊ณผ ์ ์ฅ์ ๋ฐ๋ฆ
๋๋ค. Node ์ํ์๋ ์ต์ scoreSample๋ ๋ณด๊ณ ํ๋ฉฐ, Controller๋ ๊ธฐ์กด 5์ด ๊ด์ธก ์ฃผ๊ธฐ์ ์ธก์ ์ ์๋ก ๊ฐ์คํ ๊ทธ๋ฃน ํต๊ณ๋ฅผ observations.jsonl์ ๊ธฐ๋กํฉ๋๋ค. max(30์ด, inspection ๊ฐ๊ฒฉ ร 2 + 5์ด)๋ณด๋ค ์ค๋๋ ํ๋ณธ์ ์ ์ธํฉ๋๋ค. ๊ทธ๋ฃน์ ํ๊ฐ๋ฐ๋ ์๋๊ฐ ์๋ ๊ด์ธก์ ๊ธฐ์ค์
๋๋ค.
์ ์ ํ๋ณธ์ ๊ฐ Peer ํ๋ก์ธ์ค ๋ด inspection ์๋ฒ์ ํฌํจํ๋ฏ๋ก ์๊ณ offset์ด ๋ค๋ก ๋ณด์ ๋์ด๋ Agent๊ฐ ๋ ์ต์ ์ธ ํ๋ณธ์ด๋ ๋น snapshot์ ๊ฑฐ๋ถํ์ง ์์ต๋๋ค. observedAt์ ์ ์ ๋ ํ๋จ๊ณผ ๋ถ์์ ์ฌ์ฉํ ์ค์ ๋ณด์ ์๊ฐ์ ์ ์งํ๋ฉฐ, ์์๋ฅผ ๋ง์ถ๋ ค๊ณ ์์ผ๋ก ๋น๊ธฐ์ง ์์ต๋๋ค. ์ ์ API ํ๋๋ฅผ ์ฐธ๊ณ ํ์ญ์์ค.
Saved Results โ Metrics โ GossipSub โ Peer Scores์ ๊ตฌ์ฑ ํญ๋ชฉ๋ณ ๊ทธ๋ํ์ P3bยท์ํ ์กฐ์ ยท๊ฐ์ ํ๋ณธ์ ์ด์ ๊ทธ๋ํ๋ฅผ ์ถ๊ฐํฉ๋๋ค. ๊ธฐ์กด ์ ์ฒด ์ด์ ๊ทธ๋ํ๋ ์ ์งํฉ๋๋ค. ๊ทธ๋ฃน ์ ์ ๊ด์ธก์๋ง๋ค ๋์ผ ๋น์ค์ด ์๋๋ผ ์ค์ ์ธก์ ์ ์๋ก ๊ฐ์คํฉ๋๋ค. ๋ฐ๋ณต ์คํ ๊ทธ๋ํ๋ Run๋ณ ๋์ผ ๋น์ค๊ณผ ๊ธฐ์กด ํ๋ณธ ํ์คํธ์ฐจ ์์์ ์ฌ์ฉํฉ๋๋ค. ๊ธฐ์กด ์ด๋ฏธ์ง ์ ์ฅ ๊ธฐ๋ฅ์ผ๋ก ๊ทธ๋ํ๋ฅผ ๋ด๋ณด๋ผ ์ ์์ผ๋ฉฐ Run ZIP์๋ ์ด๋ฒคํธ์ ๊ด์ธก๊ฐ์ด ๋ณด์กด๋ฉ๋๋ค. ์ด์ ๋ง ์ ์ฅํ ๊ณผ๊ฑฐ ๊ธฐ๋ก์์ ์ด ํญ๋ชฉ๋ค์ ๋ณต์ํ ์๋ ์์ต๋๋ค. ControllerยทAgentยทPeer๋ฅผ ํจ๊ป ์ ๋ฐ์ดํธํด์ผ ํฉ๋๋ค.
gossipsub.peerGater ๋ธ๋ก์ ์ง์ ํ๋ฉด ๊ฒ์ฆ ๋ถํ gate๋ฅผ ์ค์นํฉ๋๋ค. ๋ธ๋ก์ ์๋ตํ๋ฉด ๋นํ์ฑ์ด๋ฉฐ PeerScore์ ๋
๋ฆฝ์ ์
๋๋ค. ๊ธฐ๋ณธ๊ฐ์ ๊ณ ์ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ DefaultPeerGaterParams๋ฅผ ์ฌ์ฉํฉ๋๋ค.
| ํ๋ | ๊ธฐ๋ณธ๊ฐยท์ ์ฝ |
|---|---|
threshold |
0.33. ์ ํํ ์์์ธ throttled/validated ๋ฉ์์ง ๋น์จ ๊ธฐ์ค. |
globalDecay |
ScoreParameterDecay(2m). (0,1)์ธ ์ ํํ factor. |
sourceDecay |
ScoreParameterDecay(1h). IP๋ณ ํต๊ณ์ (0,1)์ธ ์ ํํ factor. |
decayInterval |
1s. ์ต์ 1s. |
decayToZero |
0.01. (0,1)์ธ ์ ํํ factor. |
retainStats |
6h. 0 ์ด์์ด๋ฉฐ 0์ ๋ณด์กดํ์ง ์์. |
quiet |
1m. Throttle ์์ด ์ง๋ธ ๋ค gate๋ฅผ ๋๊ธฐ๊น์ง ์ต์ 1s. |
duplicateWeight |
0.125. ์ ํํ ์์. |
ignoreWeight |
1. ์ ํํ 1 ์ด์ ๊ฐ. |
rejectWeight |
16. ์ ํํ 1 ์ด์ ๊ฐ. |
topicDeliveryWeights |
Topic์์ weight๋ก์ map. ์ ํํ ์์ ๊ฐ. |
gossipsub ์๋ ๊ฒฝ๋ก |
์ค์ ๊ณผ ๋์ |
|---|---|
topicOptions.<topic> |
messageId, subscriptionBufferSize, validator. Key๋ ์ฐธ์ฌ topic์ด์ด์ผ ํฉ๋๋ค. Topic๋ณ IDยทbuffer ์ค์ ์ด ์ ์ญ ์ค์ ๋ณด๋ค ์ฐ์ ํ๋ฉฐ buffer์๋ subscribe ๋ชจ๋๊ฐ ํ์ํฉ๋๋ค. |
peerFilter |
Peer-ID ๋ชฉ๋ก allow, deny, topics.<topic>.allow/deny. ์ ์ญยทtopic allow ์ ํ์ ๋ชจ๋ ์ ์ฉํ๋ฉฐ ์ด๋ ์ชฝ deny๋ ์ฐ์ ํฉ๋๋ค. ๋น allow ๋ชฉ๋ก์ allow ์ ํ์ ๋์ง ์์ต๋๋ค. |
directPeers |
GossipSub direct peer์ /p2p/<Peer ID>๋ก ๋๋๋ transport multiaddress. Peer ์ปจํ
์ด๋์์ ์ ๊ทผํ ์ ์์ด์ผ ํ๋ฉฐ direct-peer ๊ด๊ณ์ ์์ชฝ์ ๋์นญ์ ์ผ๋ก ์ค์ ํด์ผ ํฉ๋๋ค. |
subscriptionFilter |
Topic allowlist ๋๋ ์ ๊ท์ pattern, ์ ํ์ ์ธ ์์ ๊ตฌ๋
RPC๋น ์์ maxSubscriptions. ์ค์ ๋ ์์ ์ topic๋ filter๋ฅผ ํต๊ณผํด์ผ ํฉ๋๋ค. |
blacklist |
์ต์ด Peer-ID ๋ชฉ๋ก peers. ttl ์๋ต์ Peer ์ธ์คํด์ค ๋ด ์๊ตฌ ๋ณด์กด์
๋๋ค. ์์ TTL์ด๋ฉด Add/Contains๊ฐ ๋ค๋ฅธ ID์ ๋ง๋ฃ ํญ๋ชฉ๋ min(ttl, 1m) ๊ฐ๊ฒฉ๋น ์ต๋ ํ ๋ฒ ์ ๋ฆฌํฉ๋๋ค. ๋ณ๋ background ์ ๋ฆฌ worker๋ ํ์ํ์ง ์์ต๋๋ค. |
protocols |
์์๊ฐ ์๋ {id, features} ๋ชฉ๋ก. ID๋ ์ค๋ณต ์๋ / ์์ ๋ฌธ์์ด์
๋๋ค. Feature๋ mesh, px, idontwant ๋๋ ๋จ๋
none์ด๋ฉฐ PX/IDONTWANT์๋ mesh๊ฐ ํ์ํฉ๋๋ค. |
protocolMatch |
exact(๊ธฐ๋ณธ) ๋๋ prefix. Prefix์๋ ๋ช
์์ protocol ๋ชฉ๋ก์ด ํ์ํ๋ฉฐ ๊ฐ์ฅ ๊ธด ์ผ์น prefix์ capability๋ฅผ ์ ์ฉํฉ๋๋ค. |
์๋ ค์ง protocol ID์์ feature ๋ชฉ๋ก์ ์๋ตํ๋ฉด ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ feature ๋์์ ์ฌ์ฉํฉ๋๋ค. Feature๋ฅผ ์ ์ธํ์ง ์์ ์ฌ์ฉ์ ์ง์ ID์๋ mesh feature๊ฐ ์์ต๋๋ค. ๊ฐ์ ์คํ์ Peer๋ ํธํ๋๋ wire protocol๊ณผ message ID ์ ์ฑ ์ ์ฌ์ฉํด์ผ ํฉ๋๋ค.
defaultValidators๋ ๊ณตํต validator ๋ชฉ๋ก์ด๋ฉฐ topicOptions.<topic>.validator๋ ํด๋น topic์ validator๋ฅผ ์ถ๊ฐํฉ๋๋ค. ์ ๊ณตํ validator๋ ๋ชจ๋ ๊ฒ์ฆ์ ์ฐธ์ฌํฉ๋๋ค. ๊ฐ validator๋ ๋ค์ ํ๋๋ฅผ ์ง์ํฉ๋๋ค.
| ํ๋ | ์๋ฏธ |
|---|---|
result |
๊ฒ์ฌ ์ฑ๊ณต ์ accept(๊ธฐ๋ณธ), reject, ignore. |
failureResult |
๊ฒ์ฌ ์คํจ ์ reject(๊ธฐ๋ณธ) ๋๋ ignore. Reject๋ invalid-message ์ ์์ ๋ฐ์๋๋ฉฐ ignore๋ ์ ๋ฌ ์ฑ๊ณต์ ์๋ฏธํ์ง ์์ต๋๋ค. |
minBytes, maxBytes
|
PubSub ๋ฉ์์ง ๋ฐ์ดํฐ์ 0 ์ด์ ๋ฐ์ดํธ ๋ฒ์. ์ต์๋ ์ต๋ ์ดํ์ด๋ฉฐ envelope ๋ฐ์ดํฐ์๋ ์ธ์ฝ๋ฉ overhead๊ฐ ํฌํจ๋ฉ๋๋ค. |
pattern |
๋ฉ์์ง ๋ฐ์ดํฐ์ ์ ์ฉํ๋ Go ์ ๊ท์. |
format |
any(๊ธฐ๋ณธ), json, KPL envelope. Envelope๋ ํ์ IDยทrunยทpublisher์ ์์ timestamp๋ฅผ ๊ฒ์ฌํฉ๋๋ค. |
delay |
0 ์ด์์ธ ์ธ์์ ๊ฒ์ฆ ์ง์ฐ. ์ทจ์๋ ์์ ์ ignore๋ฅผ ๋ฐํํฉ๋๋ค. |
timeout |
0 ์ด์์ธ validator timeout. 0s๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ timeout ์์ ๋์์
๋๋ค. |
concurrency |
์์์ธ validator๋ณ ๋์ ์คํ ํ๋. ๋ผ์ด๋ธ๋ฌ๋ฆฌ ๊ธฐ๋ณธ 1024. |
inline |
๊ฒ์ฆ ๊ฒฝ๋ก์์ ๋๊ธฐ ์คํ. ๊ธฐ๋ณธ false. |
basicSeqno |
๊ธฐ๋ณธ false. True์ด๋ฉด ๋ฉ๋ชจ๋ฆฌ nonce ์ ์ฅ์๋ก ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ๊ธฐ๋ณธ sequence validator๋ฅผ ์ฌ์ฉํฉ๋๋ค. ๊ธฐ๋ณธยทstrict-sign ์ ์ฑ
์ด ํ์ํ๋ฉฐ ์ด์ ยท๋ฐ๋ณต sequence๋ ignore, ์๋ชป๋ sequence๋ failureResult๋ก ์ฒ๋ฆฌํฉ๋๋ค. |
useValidatorData |
๋ด์ฉ ๊ฒ์ฌ ํ ํ๋ก์ธ์ค ๋ด๋ถ ValidatorData.result๋ก accept/reject/ignore๋ฅผ ์ ํํ ์ ์์ต๋๋ค. |
rpcInspector๋ ์์ RPC envelope๋ฅผ ๊ฒ์ฌํฉ๋๋ค. ์ ํ์ ์ธ 0 ์ด์ maxMessages, maxSubscriptions, maxControlEntries, maxMessageIds, maxBytes๋ฅผ ๋์ผ๋ฉด ๊ฑฐ๋ถํ๋ฉฐ 0๋ ์ค์ 0 ์ ํ์
๋๋ค. rejectPeers๋ ์ง์ ํ Peer ID ๋ฐ์ ์๋ฅผ ๊ฑฐ๋ถํฉ๋๋ค. Control entry๋ IHAVEยทIWANTยทGRAFTยทPRUNEยทIDONTWANT protobuf entry ์์ด๋ฉฐ message ID ์๋ IHAVEยทIWANTยทIDONTWANT์ ์ฐธ์กฐ ํฉ๊ณ์
๋๋ค. ๋ฐ์ดํธ ์ ํ์๋ protobuf ์ง๋ ฌํ RPC ํฌ๊ธฐ๋ฅผ ์ฌ์ฉํฉ๋๋ค.
discovery ๋ธ๋ก์ ์๋ตํ๋ฉด ๊ธฐ์กด KPL์ ์ฉ๋์ ๊ณ ๋ คํ๋ Controller discovery loop๋ฅผ ์ ์งํฉ๋๋ค. ๋ช
์์ discovery.mode: controller({}๋ ๋์ผ)๋ Controller ํ๋ณด๋ฅผ libp2p discovery pipeline์ผ๋ก ์ฐ๊ฒฐํ๊ณ , routing์ Kademlia๋ฅผ ์ฌ์ฉํ๋ฉฐ namespace ์์ run ID๋ฅผ ๋ถ์
๋๋ค. none์ topic discovery๋ฅผ ๋๋๋ค. Routing discovery์๋ Kademlia์ provider ๊ธฐ๋ฅยท์ ์ฅ์๊ฐ ํ์ํฉ๋๋ค. ์ด ์ค์ ์ ๋ณ๋ ์ต์ด bootstrap ์ฐ๊ฒฐ ์ ์ฐจ๋ฅผ ์ ๊ฑฐํ์ง ์์ต๋๋ค.
discovery.ttl์ ์์ advertisement TTL์ด๋ฉฐ limit์ ์์ฒญํ ์์ ๊ฒฐ๊ณผ ํ๋์
๋๋ค. Controller discovery์ TTL์ ์ค์ ๊ด๊ณ ๋ฅผ ์๋ก ๋ง๋ค์ง ์๋ callback์ ๊ฐฑ์ ์ฃผ๊ธฐ์ด๋ฉฐ Controller ์์กด ํ๋จ์ ๊ณ์ Agent ๋ณด๊ณ ๋ฅผ ๋ฐ๋ฆ
๋๋ค. ์ ํ์ ์ธ connector๋ ์ง์ connection backoff๋ฅผ ์ค์ ํฉ๋๋ค.
| Connector ํ๋ | Connector ๋ธ๋ก์ด ์์ ๋ ๊ธฐ๋ณธ๊ฐ |
|---|---|
cacheSize |
100. ์์. |
dialTimeout |
2m. ์์. |
minBackoff, maxBackoff
|
10s, 1h. ์์์ด๋ฉฐ ์ต์๋ ์ต๋ ์ดํ. |
timeUnit |
1s. ์์. |
base |
5. ์ ํํ 1 ์ด๊ณผ ๊ฐ. |
offset |
0s. 0 ์ด์. |
jitter |
full ๋๋ none. ๊ธฐ๋ณธ full. |
seed |
1. Backoff jitter์ ์ ์ seed. |
Connector ๋ธ๋ก์ด ์์ผ๋ฉด libp2p ๊ธฐ๋ณธ connector๋ฅผ ์ฌ์ฉํฉ๋๋ค. Routing discovery๋ DHT admissionยทstorageยทproviderยทrefresh ์ค์ ์ ์ํฅ์ ๋ฐ์ต๋๋ค.
author๋ Peer transport identity์ ๋ณ๋๋ก PubSub author๋ฅผ ์ ํํฉ๋๋ค. ํ๋๋ peerId, base64 libp2p-marshaled privateKey, ๋๋ noAuthor์
๋๋ค. Peer ID๋ฅผ ํจ๊ป ์ ๊ณตํ๋ฉด private key์ ์ผ์นํด์ผ ํ๋ฉฐ ID๋ง์ผ๋ก ์๋ช
author๋ฅผ ์ง์ ํ๋ฉด host peerstore์ ํด๋น key๊ฐ ์์ด์ผ ํฉ๋๋ค. noAuthor: true๋ ๋ค๋ฅธ ๋ ํ๋์ ์ถฉ๋ํ๋ฉฐ unsigned ์๋ช
์ ์ฑ
๊ณผ ๋ชจ๋ topic์ content ๊ธฐ๋ฐ message ID๊ฐ ํ์ํฉ๋๋ค. ๋ช
์์ private key๋ ์ ์ฅ๋ ์๋๋ฆฌ์ค์ ๋ค์ด๋ก๋ archive์ ํฌํจ๋๋ฏ๋ก ์คํ์ฉ key๋ฅผ ์ฌ์ฉํ์ญ์์ค.
publish๋ ์ ํ๋ฆฌ์ผ์ด์
์ ๊ฐ ๋ฐํ์ ์ค์ ํฉ๋๋ค.
| ํ๋ | ๋์ |
|---|---|
readinessMinPeers |
Payloadยทtimestamp ์์ฑ ์ ์ ๊ฒ์ฌํ๋ 0 ์ด์ ์ต์ pubsub.ListPeers(topic) ์. ์๋ ค์ง ์๊ฒฉ topic Peer ์์ด๋ฉฐ upstream MinTopicSize์ mesh ์กฐ๊ฑด์ด๋ ์๋ ด ๋ณด์ฅ์ด ์๋๋๋ค. |
readinessTimeout |
์ต๋ 10s์ธ ์ ํ์ ์์ timeout. readinessMinPeers๊ฐ ํ์ํ๋ฉฐ ์ ์ฒด ๋ฐํ ์์ฒญ ์์ฐ ์์์ ์ ์ฉํฉ๋๋ค. |
local |
๊ธฐ๋ณธ false. True๋ local publication์ ์์ฒญํ๊ณ ์๊ฒฉ readiness ๊ฒ์ฌ๋ฅผ ๊ฑด๋๋ฐ๋ฉฐ ํด๋น ๋ฐํ์ ์๊ฒฉ ์ธ์ ์ ๋ฌ ์งํ์์ ์ ์ธํฉ๋๋ค. |
validatorData |
ํ๋ก์ธ์ค ๋ด๋ถ map. ์ง์ํ๋ result๋ accept/reject/ignore์ด๋ฉฐ useValidatorData์ธ validator๊ฐ ํ์ํฉ๋๋ค. P2P wire์ ์ง๋ ฌํํ์ง ์์ต๋๋ค. |
author |
๊ฐ์ identity ํ๋๋ฅผ ์ฌ์ฉํ๋ ๋ฐํ๋ณ author override. Private key์ signing ์ ์ฑ
์ด ํ์์ด๋ฉฐ noAuthor ๋๋ local: true์ ํจ๊ป ์ฌ์ฉํ ์ ์์ต๋๋ค. |
์๋ ํ๋๋ ๋ชจ๋ kademlia ์๋์ ์์ผ๋ฉฐ Kademlia ํ์ฑ ์ ์ ์ฉํฉ๋๋ค. ๋ผ์ด๋ธ๋ฌ๋ฆฌ datastoreยทprovider interface๋ ์๋ ์ด๋ฆ ์๋ ์ ์ฑ
์ผ๋ก ์ ๊ณตํฉ๋๋ค.
| ํ๋ยทgroup | ์๋ฏธ |
|---|---|
enabled, mode
|
๊ธฐ๋ณธ ํ์ฑ. Mode๋ ๊ธฐ๋ณธ server ๋๋ client, auto, auto-server. |
protocolPrefix |
๊ธฐ๋ณธ /k-p2p-lab/v3. DHT protocol prefix. |
protocolId |
์ ํํ V1 protocol override. Prefixยทextension๊ณผ ์ํธ ๋ฐฐํ์ ์ ๋๋ค. |
protocolExtension |
Prefix ๋ค์ ๋ถ์ด๋ extension. |
bucketSize |
์์ bucket ์ฉ๋. KPL ๊ธฐ๋ณธ 20. |
concurrency |
์์ lookup ๋ณ๋ ฌ ์. |
resiliency |
0 ์ด์ lookup resiliency. |
lookupCheckConcurrency |
์์์ธ ๋์ routing-table admission ๊ฒ์ฌ ์. |
routingTableLatencyTolerance |
0 ์ด์ Peer ์ง์ฐ admission ๊ธฐ์ค. ๊ณ ์ ๋ upstream v0.31.0์ ์ด ์ต์
์ ๋ฐ์ง๋ง routing table์ ๊ณ ์ 1m ๊ธฐ์ค์ผ๋ก ์์ฑํ๋ฏ๋ก ์ค์ ํ override๋ ์ ์ฉ๋์ง ์์ต๋๋ค. ์ค์ ํธํ์ฑ์ ์ํด ํ๋๋ ์ ์งํฉ๋๋ค. |
routingTableRefreshPeriod |
์์ ์๋ routing-table refresh ์ฃผ๊ธฐ. |
routingTableRefreshTimeout |
์์ refresh query timeout. |
maxRecordAge |
0 ์ด์ value-record ์ต๋ age. |
disableAutoRefresh, disableProviders, disableValues
|
๊ฐ DHT ๊ธฐ๋ฅ์ ๋ช ์์ ๋นํ์ฑํ switch. |
optimisticProvide, optimisticProvideJobsPoolSize
|
Optimistic provide ํ์ฑํ์ ์์ ๋ฐฑ๊ทธ๋ผ์ด๋ job pool ํฌ๊ธฐ. |
bootstrapTimeout, bootstrapRetryInterval
|
KPL ์ต์ด transport bootstrap ์์ฐยท์ฌ์๋ ์ฃผ๊ธฐ. ๊ธฐ๋ณธ 60sยท1s, ๋ชจ๋ ์์. |
bootstrapSource, bootstrapPeers
|
DHT bootstrap ์์ฒ์ธ none, static, controller. Static์๋ transport /p2p/<Peer ID> multiaddress๊ฐ ํ์ํ๋ฉฐ controller๋ run ๋ฒ์ bootstrap Peer๋ฅผ ์ฝ์ต๋๋ค. KPL ์ต์ด transport bootstrap๊ณผ ๋ณ๋๋ก DHT ๋ณต๊ตฌ bootstrap์ ์ค์ ํฉ๋๋ค. |
queryFilter, routingTableFilter, addressFilter
|
๊ฐ๊ฐ policy, allowCIDRs, denyCIDRs๋ฅผ ํฌํจํฉ๋๋ค. ์๋ ์ค๋ช
์ฐธ๊ณ . |
routingTableDiversity |
enabled, ์์ maxPerCpl, ์์ maxForTable. ๋ธ๋ก์ด ์์ผ๋ฉด ๊ธฐ๋ณธ ํ์ฑ์ด๊ณ ์๋ตํ ํ๋๋ ๊ณ ์ ๋ผ์ด๋ธ๋ฌ๋ฆฌ ๊ธฐ๋ณธ๊ฐ์ ์ฌ์ฉํฉ๋๋ค. |
datastore |
memory(๊ธฐ๋ณธ ๋์) ๋๋ null. Memory๋ Peer๋ณ ์ ์ฅ์๋ก ์ปจํ
์ด๋ ์ข
๋ฃ ์ ์๋ฉธํ๋ฉฐ null์ ๊ธฐ๋ก์ ๋ฒ๋ฆฝ๋๋ค. |
validator |
mode: default๋ ๊ธฐ๋ณธ pkยทipns๋ฅผ ์ ์งํ๊ณ namespace๋ฅผ ์ถ๊ฐํ ์ ์์ต๋๋ค. mode: namespaced๋ ์ ์ฒด namespace map์ ์ง์ ํฉ๋๋ค. namespaces.<์ด๋ฆ>์ public-key, ipns, bytes, reject ์ค ์ ํํฉ๋๋ค. |
providerStore |
mode: manager(๊ธฐ๋ณธ ๋์) ๋๋ null. Manager๋ ์์ cleanupInterval, cacheSize๋ฅผ ๋ฐ์ผ๋ฉฐ null์ provider ๊ธฐ๋ก์ ๋ฒ๋ฆฌ๊ณ ํด๋น tuning์ ๋ฐ์ง ์์ต๋๋ค. |
requestHook |
none(๊ธฐ๋ณธ) ๋๋ ์์ DHT ์์ฒญ INFO log๋ฅผ ๋จ๊ธฐ๋ log. |
Filter policy๋ all(๋น ๊ฐยท๊ธฐ๋ณธ), public, private, non-loopback์
๋๋ค. Query/routing-table์ public/private๋ ํด๋น ๋ผ์ด๋ธ๋ฌ๋ฆฌ filter๋ฅผ ์ฌ์ฉํ๋ฉฐ, ํนํ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ private query๋ ๋น์ด ์์ง ์์ ์ฃผ์ ๋ชฉ๋ก์ ๋ชจ๋ ํ์ฉํฉ๋๋ค. ์ ํํ ์คํ ์ฃผ์ ๋ฒ์์๋ CIDR ์ ํ์ ์ฌ์ฉํ์ญ์์ค. Address filter๋ ์ฃผ์๋ณ๋ก ์ ์ฉํฉ๋๋ค. ์ด๋ ์ฃผ์๋ deny CIDR์ ํฌํจ๋๋ฉด query/routing-table ํ๋ณด ์ ์ฒด๋ฅผ ๊ฑฐ๋ถํ๋ฉฐ allow ๋ชฉ๋ก์ ์ผ์นํ๋ IP๊ฐ ์ต์ ํ๋ ํ์ํฉ๋๋ค. non-loopback์ private unicast๋ฅผ ํฌํจํด loopback์ด ์๋ global-unicast IP๋ฅผ ์๊ตฌํฉ๋๋ค.
DHT bootstrap source๋ฅผ ์๋ตํ๋ฉด ๋ผ์ด๋ธ๋ฌ๋ฆฌ option ๊ธฐ๋ณธ๊ฐ์ ์ ์งํ๋ฉฐ KPL ์ต์ด Controller bootstrap์ ๋์ฒดํ์ง ์์ต๋๋ค. ๋ช
์์ ์ผ๋ก ๋น static ๋ชฉ๋ก ๋๋ none์ ์ค์ ํ๋ฉด DHT ๋ณต๊ตฌ bootstrap Peer๋ฅผ ์ ๊ณตํ์ง ์์ต๋๋ค. public-key ์ ์ฑ
์ pk namespace์์๋ง, ipns๋ ipns namespace์์๋ง ์ฌ์ฉํฉ๋๋ค. bytes record validator๋ ๋ถํฌ๋ช
๊ฐ์ ์๋ฝํ๊ณ ๋ฐ์ดํธ ์ฌ์ ์ ์์์์ ๊ฐ์ฅ ํฐ ํ๋ณด๋ฅผ ์ ํํ๋ฉฐ reject๋ ๋ชจ๋ record๋ฅผ ๊ฑฐ๋ถํฉ๋๋ค. ์ด ์ ์ฑ
์ ํ๋กํ ์ฝ ๋์์ ์ค์ ํ๋ฉฐ DHT Put/Get/Provide ์๋๋ฆฌ์ค action์ ์ถ๊ฐํ์ง๋ ์์ต๋๋ค.
์ ํํ protocolId: /ipfs/kad/1.0.0์ ํฌํจํ ํ์ค /ipfs namespace์๋ upstream ์ ์ฝ์ธ bucket size 20, value/provider ํ์ฑ, ํ์ค pkยทipns validator๋ง ์ ์ฉํฉ๋๋ค. ์ฌ์ฉ์ ์ง์ ์คํ prefix ๋๋ ์ ํํ protocol ID์์๋ ๋ค๋ฅธ ์ ์ฑ
์ ์ฌ์ฉํ ์ ์์ต๋๋ค. ์ฌ์ฉ์ ์ง์ exact ID์์๋ upstream ๊ธฐ๋ณธ namespace ๊ฒ์ฌ๊ฐ tuning์ ๊ฑฐ๋ถํ์ง ์๋๋ก ๋ด๋ถ ๊ฒ์ฆ prefix๋ ์ค์ ํ๋ฉฐ, ์ง์ ํ ์ ํํ wire ID๋ ์ ์งํฉ๋๋ค. Public address filter๋ Swarm์ private overlay ์ฃผ์๋ฅผ ์ ์ธํ ์ ์์ผ๋ฏ๋ก ์คํ ๋คํธ์ํฌ์ ๋ง๋ filter๋ฅผ ์ ํํ์ญ์์ค.
Schema๋ ๊ณตํต ๋
ธ๋ ์ค์ , GossipSub parameter, PubSub ์ ์ฑ
, scoring, Kademlia ์ ์ฑ
์ผ๋ก ๋๋ฉ๋๋ค. Runtime adapter๋ ๋์ํ๋ internal/peer ํ์ผ์ ์์ต๋๋ค.
Scalar struct ํ๋๋ typed schema๋ก ์ ๊ณตํฉ๋๋ค. Go ํจ์๋ interface๋ฅผ ๋ฐ๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์ต์
์๋ ์ด ๋ฌธ์์ ์ด๋ฆ ์๋ ์ ์ฑ
์ ์ฌ์ฉํฉ๋๋ค. ์์ score ํจ์ยทvalidatorยทstoreยทdiscovery providerยทfeature testยทtracerยทrequest hook ๋ฐ Kademlia WithCustomMessageSender ๊ตฌํ์๋ ์ฝ๋ ํ์ฅ์ด ํ์ํ๋ฉฐ YAML์ Go ์ฝ๋๋ฅผ ์คํํ๊ฑฐ๋ ์์ ๊ตฌํ์ ๋ก๋ํ์ง ์์ต๋๋ค. KPL telemetry tracer์ Peer ๋คํธ์ํฌ ๊ฒฉ๋ฆฌ๋ ์ ์งํ์ฌ ์คํ ์์คํ
์์์ protocol ๋์์ ๊ด์ธกํฉ๋๋ค.