Skip to content
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

fix(taiko-client): set p2p node, taiko flag, update optimism lib #18920

Merged
merged 27 commits into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
4b4c4d7
set p2pnode directly, as they are both edpendant on each other during…
cyberhorsey Feb 12, 2025
45447ae
Log
cyberhorsey Feb 12, 2025
f95be39
img
cyberhorsey Feb 12, 2025
abc9960
check
cyberhorsey Feb 12, 2025
5b1ed75
use v3 gas limit
cyberhorsey Feb 12, 2025
27cf645
add signer
cyberhorsey Feb 12, 2025
a71b3d6
test
cyberhorsey Feb 12, 2025
43f3571
taiko flag
cyberhorsey Feb 12, 2025
ad50fdf
revert image building
cyberhorsey Feb 12, 2025
67c4c6e
build image
cyberhorsey Feb 12, 2025
fdd905c
add time to log
cyberhorsey Feb 12, 2025
b9841e2
Merge branch 'main' into set_p2p_node
davidtaikocha Feb 13, 2025
c886a75
Merge branch 'main' into set_p2p_node
cyberhorsey Feb 13, 2025
7830ca5
Merge branch 'main' into set_p2p_node
cyberhorsey Feb 13, 2025
ade0958
Merge branch 'set_p2p_node' of github.com:taikoxyz/taiko-mono into se…
cyberhorsey Feb 13, 2025
08357f4
Revert "Merge branch 'main' into set_p2p_node"
cyberhorsey Feb 13, 2025
166eb9b
docker img
cyberhorsey Feb 13, 2025
7815016
merge main changes
cyberhorsey Feb 13, 2025
f1ac558
.
cyberhorsey Feb 13, 2025
bd9340c
>
cyberhorsey Feb 13, 2025
62ab841
.
cyberhorsey Feb 13, 2025
e314eb9
forge fmt & update contract layout tables
cyberhorsey Feb 13, 2025
7e3aef9
.
cyberhorsey Feb 13, 2025
b391856
>
cyberhorsey Feb 13, 2025
e9c8076
forge fmt & update contract layout tables
cyberhorsey Feb 13, 2025
be8d50e
Merge branch 'main' into set_p2p_node
davidtaikocha Feb 14, 2025
c68a818
Merge branch 'main' into set_p2p_node
davidtaikocha Feb 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,8 @@ func isBlockPreconfirmed(
err = fmt.Errorf("block number mismatch: %d != %d", block.Number(), meta.BlockID)
return nil, err
}
if block.GasLimit() != meta.GasLimit+consensus.AnchorGasLimit {
err = fmt.Errorf("gas limit mismatch: %d != %d", block.GasLimit(), meta.GasLimit+consensus.AnchorGasLimit)
if block.GasLimit() != meta.GasLimit+consensus.AnchorV3GasLimit {
err = fmt.Errorf("gas limit mismatch: %d != %d", block.GasLimit(), meta.GasLimit+consensus.AnchorV3GasLimit)
return nil, err
}
if block.Time() != meta.Timestamp {
Expand Down
9 changes: 6 additions & 3 deletions packages/taiko-client/driver/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,6 @@ func (d *Driver) InitFromConfig(ctx context.Context, cfg *Config) (err error) {
d.l2ChainSyncer.BlobSyncer().BlocksInserterPacaya(),
d.rpc,
d.Config.PreconfBlockServerCheckSig,
d.p2pNode,
d.p2pSigner,
); err != nil {
return err
}
Expand All @@ -132,7 +130,7 @@ func (d *Driver) InitFromConfig(ctx context.Context, cfg *Config) (err error) {

if d.p2pNode, err = p2p.NewNodeP2P(
d.ctx,
&rollup.Config{L1ChainID: d.rpc.L1.ChainID, L2ChainID: d.rpc.L2.ChainID},
&rollup.Config{L1ChainID: d.rpc.L1.ChainID, L2ChainID: d.rpc.L2.ChainID, Taiko: true},
log.Root(),
d.p2pSetup,
d.preconfBlockServer,
Expand All @@ -149,6 +147,11 @@ func (d *Driver) InitFromConfig(ctx context.Context, cfg *Config) (err error) {
if d.p2pSigner, err = d.P2PSignerConfigs.SetupSigner(d.ctx); err != nil {
return err
}

if d.preconfBlockServer != nil {
d.preconfBlockServer.SetP2PNode(d.p2pNode)
d.preconfBlockServer.SetP2PSigner(d.p2pSigner)
}
}

return nil
Expand Down
4 changes: 2 additions & 2 deletions packages/taiko-client/driver/driver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ func (s *DriverTestSuite) TestInsertPreconfBlocks() {
err error
)
s.d.preconfBlockServer, err = preconfblocks.New(
"*", nil, s.d.ChainSyncer().BlobSyncer().BlocksInserterPacaya(), s.RPCClient, true, nil, nil,
"*", nil, s.d.ChainSyncer().BlobSyncer().BlocksInserterPacaya(), s.RPCClient, true,
)
s.Nil(err)
go func() { s.NotNil(s.d.preconfBlockServer.Start(port)) }()
Expand Down Expand Up @@ -479,7 +479,7 @@ func (s *DriverTestSuite) TestInsertPreconfBlocksNotReorg() {
err error
)
s.d.preconfBlockServer, err = preconfblocks.New(
"*", nil, s.d.ChainSyncer().BlobSyncer().BlocksInserterPacaya(), s.RPCClient, true, nil, nil,
"*", nil, s.d.ChainSyncer().BlobSyncer().BlocksInserterPacaya(), s.RPCClient, true,
)
s.Nil(err)
go func() { s.NotNil(s.d.preconfBlockServer.Start(port)) }()
Expand Down
2 changes: 2 additions & 0 deletions packages/taiko-client/driver/preconf_blocks/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ func (s *PreconfBlockAPIServer) BuildPreconfBlock(c echo.Context) error {
// Propagate the preconfirmation block to the P2P network, if the current server
// connects to the P2P network.
if s.p2pNode != nil {
log.Info("Gossiping L2 Payload", "blockID", header.Number.Uint64())

if err := s.p2pNode.GossipOut().PublishL2Payload(
c.Request().Context(),
&eth.ExecutionPayloadEnvelope{
Expand Down
16 changes: 10 additions & 6 deletions packages/taiko-client/driver/preconf_blocks/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ func New(
chainSyncer preconfBlockChainSyncer,
cli *rpc.Client,
checkSig bool,
p2pNode *p2p.NodeP2P,
p2pSigner p2p.Signer,
) (*PreconfBlockAPIServer, error) {
protocolConfigs, err := cli.GetProtocolConfigs(nil)
if err != nil {
Expand All @@ -78,10 +76,8 @@ func New(
uint64(rpc.BlobBytes),
cli.L2.ChainID,
),
rpc: cli,
checkSig: checkSig,
p2pNode: p2pNode,
p2pSigner: p2pSigner,
rpc: cli,
checkSig: checkSig,
}

server.echo.HideBanner = true
Expand All @@ -94,6 +90,14 @@ func New(
return server, nil
}

func (s *PreconfBlockAPIServer) SetP2PNode(p2pNode *p2p.NodeP2P) {
s.p2pNode = p2pNode
}

func (s *PreconfBlockAPIServer) SetP2PSigner(p2pSigner p2p.Signer) {
s.p2pSigner = p2pSigner
}

// LogSkipper implements the `middleware.Skipper` interface.
func LogSkipper(c echo.Context) bool {
switch c.Request().URL.Path {
Expand Down
2 changes: 1 addition & 1 deletion packages/taiko-client/driver/preconf_blocks/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type PreconfBlockAPIServerTestSuite struct {

func (s *PreconfBlockAPIServerTestSuite) SetupTest() {
s.ClientTestSuite.SetupTest()
server, err := New("*", nil, nil, s.RPCClient, true, nil, nil)
server, err := New("*", nil, nil, s.RPCClient, true)
s.Nil(err)
s.s = server
go func() {
Expand Down