-
Notifications
You must be signed in to change notification settings - Fork 724
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
Add sequencer data to stream server #2517
Conversation
* Use ZKEVM_NETWORK variable to specify location of config files in docker-compose * fix config path in step 7.1
if err != nil { | ||
return err | ||
} | ||
|
||
// Update batch l2 data | ||
batch, err := d.state.GetBatchByNumber(ctx, tx.batchNumber, dbTx) | ||
if err != nil { | ||
err2 := dbTx.Rollback(ctx) |
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.
This rollback should not be done in line 182? as in the line 182 we are returning with an open db transaction (started in line 175)
if err != nil { | ||
return err | ||
// Send tx data to data stream server | ||
if d.streamServer != nil { |
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.
I think this code does the same:
if d.streamServer != nil {
l2Block := DSL2Block{
BatchNumber: tx.batchNumber,
L2BlockNumber: l2BlochHeader.Number.Uint64(),
Timestamp: tx.timestamp,
GlobalExitRoot: batch.GlobalExitRoot,
Coinbase: tx.coinbase,
}
l2Transaction := DSL2Transaction{
BatchNumber: batch.BatchNumber,
EffectiveGasPricePercentage: uint8(tx.response.EffectivePercentage),
IsValid: 1,
EncodedLength: uint32(len(txData)),
Encoded: txData,
}
err = d.streamServer.StartAtomicOp()
if err != nil {
return err
}
_, err = d.streamServer.AddStreamEntry(EntryTypeL2Block, l2Block.Encode())
if err != nil {
return err
}
_, err = d.streamServer.AddStreamEntry(EntryTypeL2Tx, l2Transaction.Encode())
if err != nil {
return err
}
err = d.streamServer.CommitAtomicOp()
if err != nil {
log.Error("failed to commit atomic op: %v", err)
err2 := dbTx.Rollback(ctx)
if err2 != nil {
log.Errorf("failed to rollback dbTx when committing atomic op that gave err: %v. Rollback err: %v", err2, err)
}
return err
}
}
err = dbTx.Commit(ctx)
if err != nil {
return err
}
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.
If we do the error check this way, we would return without rolling back the stream transaction.
@@ -110,6 +110,10 @@ MaxTxLifetime = "3h" | |||
ByteGasCost = 16 | |||
MarginFactor = 1 | |||
Enabled = false | |||
[Sequencer.StreamServer] |
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.
StreamServer or DataStreamer? As we have used DataStreamerCfg for the config struct
Closes #2515
What does this PR do?
Adds sequencer data to stream server.
New config params:
Reviewers
Main reviewers: