QASH@qash_tit·May 2やっとgethが走った。公式通りにやってもPeer探索がうまく行かず https://quicknode.com/guides/infrastructure/how-to-run-a-binance-smart-chain-node… のConfig.tomlを使う必要があった。まずはLightで同期!12
QASH@qash_tit·22hHello worldは表示されたけどHelloworld2は表示されなかったから、gethではstack.wait()でPeerを探したり 新しいブロックを同期したりしていそう。つまり、Stack内を見れば良さげ?1
QASH@qash_tit·21hstack.wait()が走ってからBlock synchronisation started とかが始まるんだけどこれはどこのどの関数が実行されているのかわからない・・・1
QASH@qash_tit·21hhttps://github.com/bnb-chain/bsc/blob/2ce00adb5545e792f7993862f0aeb7fb579bedd6/p2p/dial.go… Looking for peers ってメッセージはここから呼び出されている。 stack.wait()でなんか実行しているんだろうけど・・・1
QASH@qash_tit·21hhttps://github.com/bnb-chain/bsc/blob/2ce00adb5545e792f7993862f0aeb7fb579bedd6/p2p/dial.go… logstatsが呼び出されているのはfunc (d *dialScheduler) loop(it enode.Iterator) って所。これがstack.wait()の時にバックエンドで動いていそう。でもこれはp2pノードを探索するところだから余り関係なさそう・・・。1
QASH@qash_tit·20hhttps://scrapbox.io/kii-cafe/devp2p 見る限りRLPエンコーディングされたデータを受信できる機能があるし、Gethよりはいきなりdevp2p見たほうが良いのか・・・? start nodeの部分だけパクってscrapbox.iodevp2p - Kiichi SugiharaP2P networkベースのProtocol プロトコル トランスポート層 Transport layerに該当 ノード探索やデータ伝送暗号化などのネットワーク層 Network layerやプレゼンテーション層 Presentation layerの機能も提供する フォーマット:RLP(Recursive Linear Prefix) このフォーマットでエンコード encode アプリケーシ11
QASH@qash_tit·18hdevp2pを見始めた。 https://github.com/ethereum/devp2p/blob/master/caps/eth.md#newpooledtransactionhashes-0x08… NewPooledTransactionHashesを要求すればTXPOOLが見れそう? protocol.go内にhttps://github.com/bnb-chain/bsc/blob/4edd2b105d07e3f256266bc6df547efff07d5c1f/eth/protocols/eth/protocol.go… NewPooledTransactionHashesMsgを定義している部分があるから、これが使われているはず。github.combsc/protocol.go at 4edd2b105d07e3f256266bc6df547efff07d5c1f · bnb-chain/bscA Binance Smart Chain client based on the go-ethereum fork - bsc/protocol.go at 4edd2b105d07e3f256266bc6df547efff07d5c1f · bnb-chain/bsc1
QASH@qash_tit·18henodeを指定してピアに接続->NewPooledTransactionHashesを打ってpendingpoolに関する情報を得ている・・・? この周りを直接実行できればノードを完全に建てずにpendingが見れる・・・?1
QASH@qash_tit·18hhttps://github.com/bnb-chain/bsc/blob/4edd2b105d07e3f256266bc6df547efff07d5c1f/eth/protocols/eth/peer.go… これをたどるか・・・。1
QASH@qash_tit·18hhttps://github.com/bnb-chain/bsc/blob/4edd2b105d07e3f256266bc6df547efff07d5c1f/eth/protocols/eth/broadcast.go… 構造的にはbroadcast.goのannounceTransactions関数内に、sendPooledTransactionHashes(pending);がある。 sendPooledTransactionHashesが呼び出されると他のピアのenodeに0x08が送られてpendingpoolの中身をダウンロードできる? 更にこれをたどるか11
QASH@qash_tit·18hhttps://github.com/bnb-chain/bsc/blob/4edd2b105d07e3f256266bc6df547efff07d5c1f/eth/protocols/eth/peer.go… NewPeer関数でgo peer.announceTransactions()が実行されている。これは色々なところで使われている関数だな・・・。11
QASH@qash_tit·18heth.NewPeerで検索するとhttps://github.com/bnb-chain/bsc/blob/859186f299fa94fada3e92608db1392be1a45599/eth/handler_eth_test.go… https://github.com/bnb-chain/bsc/blob/032970b2deeffe3b7f87703753d7be9a09906758/eth/sync_test.go… の2つgithub.combsc/sync_test.go at 032970b2deeffe3b7f87703753d7be9a09906758 · bnb-chain/bscA Binance Smart Chain client based on the go-ethereum fork - bsc/sync_test.go at 032970b2deeffe3b7f87703753d7be9a09906758 · bnb-chain/bsc11
QASH@qash_tit·18hNewPooledTransactionHashesPacket の方を追っていくと、https://github.com/bnb-chain/bsc/blob/032970b2deeffe3b7f87703753d7be9a09906758/eth/protocols/eth/handlers.go… でみつけた1
QASH@qash_tit·17h集中力切れ! Gethがどうやってtxpoolを取得しているかわからず。 stack.Wait()でなんか処理しているんだけど、そことdevp2pにつながる所がどこか特定できなかった。なんか見落としている12
QASH@qash_tithttps://geth.ethereum.org/docs/developers/devguide… を参考にスタックトレースを起動した。Heapが便利 main->geth->makefullnode->までの関数実行は合っていたが、utils.RegisterEthServiceで色々と動いていそう。次に見るべきはここや。5:50 AM · May 3, 2022·Twitter Web App1 Like
QASH@qash_tit·2hReplying to @qash_titbackend, err := http://les.New(stack, cfg) backend, err := http://eth.New(stack, cfg) の違いがLight SyncとFull syncではあるのね。 https://github.com/bnb-chain/bsc/blob/74ecbf271dc0d32cbc459f83a271408b8485b2c4/les/client.go… のNew関数にLightでは飛んで、 https://github.com/bnb-chain/bsc/blob/74ecbf271dc0d32cbc459f83a271408b8485b2c4/eth/backend.go… のNew関数にFullとかでは飛ぶ。この比較をすればいいはずgithub.combsc/backend.go at 74ecbf271dc0d32cbc459f83a271408b8485b2c4 · bnb-chain/bscA Binance Smart Chain client based on the go-ethereum fork - bsc/backend.go at 74ecbf271dc0d32cbc459f83a271408b8485b2c4 · bnb-chain/bsc1