-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(taiko-client): p2p network for soft block sharing #18528
base: preconf-driver-apis
Are you sure you want to change the base?
Conversation
@@ -90,13 +108,19 @@ func (d *Driver) InitFromConfig(ctx context.Context, cfg *Config) (err error) { | |||
|
|||
d.l1HeadSub = d.state.SubL1HeadsFeed(d.l1HeadCh) | |||
|
|||
d.p2pnetwork, err = p2p.NewNetwork(d.ctx, d.Config.P2PNetworkBootstrapNodeURL, d.Config.P2PNetworkPort) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we need another flag to open or close p2pnetwork
.
If some peers offlined how can we know or do we need to manage it? |
}) | ||
} | ||
|
||
func (n *Network) Close() error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Call this function in driver.Close()
.
} | ||
|
||
func JoinTopic[T any](_ context.Context, n *Network, topicName string, topicHandler topicHandlerFunc[T]) error { | ||
topic, err := n.ps.Join(topicName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Repeated calls will report error
@@ -185,6 +131,16 @@ func (s *SoftBlockAPIServer) BuildSoftBlock(c echo.Context) error { | |||
} | |||
} | |||
|
|||
// publish to network | |||
if err := p2p.Publish[softblocks.TransactionBatch]( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check s.p2pNetwork != nil
at first.
When starting a boot node peer, it is recommended to support a private key for a fixed Peer ID. |
the actual p2p will be in a sidecar not directly in client most likely, this is just a basic POC. |
Ok, from a proof-of-concept perspective, it's enough. |
No description provided.