-
Notifications
You must be signed in to change notification settings - Fork 0
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: initial implementation #3
base: main
Are you sure you want to change the base?
Conversation
WalkthroughThe changes introduce a new Go module for the Astria Sequencer, including a copyright notice, a Changes
Assessment against linked issues
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
7baba0a
to
3ce0759
Compare
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.
Actionable comments posted: 2
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (1)
go.sum
is excluded by!**/*.sum
Files selected for processing (3)
- NOTICE (1 hunks)
- go.mod (1 hunks)
- sequencer.go (1 hunks)
Files skipped from review due to trivial changes (1)
- NOTICE
Additional comments not posted (3)
sequencer.go (2)
1-12
: Review of package and imports:The package name
astria_sequencer
and the imports are appropriate for the functionality being implemented. The use of specific imports likeastriaproto
andtxproto
indicates a well-structured approach to handling specific protocol buffer models, which is crucial for the sequencer's functionality.The structure and imports are approved.
22-38
: Review ofNew
constructor:The constructor function
New
is well-implemented with proper error handling and initialization of theSequencer
type. The use of Go's error wrapping in lines 26 and 31 enhances the error information, aiding in debugging and maintenance.The constructor implementation is approved.
go.mod (1)
1-64
: Review of Go module and dependencies:The
go.mod
file is well-structured with a clear definition of the module path and required dependencies. The specified Go version, 1.22.5, is appropriate for the current standards. The dependencies are well-documented with specific versions, ensuring reproducible builds and compatibility.The Go module configuration and dependencies are approved.
// GetNextBatch returns the next batch of transactions from sequencer to rollup | ||
// lastBatch is the last batch of transactions received from the sequencer | ||
// returns the next batch of transactions and an error if any from the sequencer | ||
func (s *Sequencer) GetNextBatch(ctx context.Context, lastBatch *sequencing.Batch) (*sequencing.Batch, error) { | ||
//TODO implement me | ||
panic("implement me") | ||
} | ||
|
||
// VerifyBatch verifies a batch of transactions received from the sequencer | ||
func (s *Sequencer) VerifyBatch(ctx context.Context, batch *sequencing.Batch) (bool, error) { | ||
//TODO implement me | ||
panic("implement me") | ||
} |
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.
Implement stub methods:
Both GetNextBatch
and VerifyBatch
methods are currently implemented as stubs with panic("implement me")
. These methods are essential for the sequencer's operation and need to be fully implemented to handle batch transactions effectively.
Would you like me to help with the implementation or open a GitHub issue to track this task?
// SubmitRollupTransaction submits a transaction from rollup to sequencer | ||
func (s *Sequencer) SubmitRollupTransaction(ctx context.Context, rollupId sequencing.RollupId, tx sequencing.Tx) error { | ||
unsignedTx := &txproto.UnsignedTransaction{ | ||
Actions: []*txproto.Action{ | ||
{ | ||
Value: &txproto.Action_SequenceAction{ | ||
SequenceAction: &txproto.SequenceAction{ | ||
RollupId: &astriaproto.RollupId{Inner: rollupId[:]}, | ||
Data: []byte("test-data"), | ||
// TODO(tzdybal): what about `FeeAsset`? | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
|
||
signed, err := s.signer.SignTransaction(unsignedTx) | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
_, err = s.client.BroadcastTxAsync(ctx, signed) | ||
|
||
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.
Address TODO and verify transaction logic:
The SubmitRollupTransaction
method is crucial for the functionality of the sequencer. However, there is a TODO comment on line 49 regarding the handling of FeeAsset
. This needs to be addressed to ensure complete transaction processing. Additionally, the method uses panic
for error handling on line 58, which is not advisable in production code as it can terminate the program unexpectedly.
Consider replacing panic
with more robust error handling. Also, resolve the TODO about FeeAsset
to ensure the transaction logic is complete.
- panic(err)
+ return fmt.Errorf("failed to sign transaction: %w", err)
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
// SubmitRollupTransaction submits a transaction from rollup to sequencer | |
func (s *Sequencer) SubmitRollupTransaction(ctx context.Context, rollupId sequencing.RollupId, tx sequencing.Tx) error { | |
unsignedTx := &txproto.UnsignedTransaction{ | |
Actions: []*txproto.Action{ | |
{ | |
Value: &txproto.Action_SequenceAction{ | |
SequenceAction: &txproto.SequenceAction{ | |
RollupId: &astriaproto.RollupId{Inner: rollupId[:]}, | |
Data: []byte("test-data"), | |
// TODO(tzdybal): what about `FeeAsset`? | |
}, | |
}, | |
}, | |
}, | |
} | |
signed, err := s.signer.SignTransaction(unsignedTx) | |
if err != nil { | |
panic(err) | |
} | |
_, err = s.client.BroadcastTxAsync(ctx, signed) | |
return err | |
} | |
// SubmitRollupTransaction submits a transaction from rollup to sequencer | |
func (s *Sequencer) SubmitRollupTransaction(ctx context.Context, rollupId sequencing.RollupId, tx sequencing.Tx) error { | |
unsignedTx := &txproto.UnsignedTransaction{ | |
Actions: []*txproto.Action{ | |
{ | |
Value: &txproto.Action_SequenceAction{ | |
SequenceAction: &txproto.SequenceAction{ | |
RollupId: &astriaproto.RollupId{Inner: rollupId[:]}, | |
Data: []byte("test-data"), | |
// TODO(tzdybal): what about `FeeAsset`? | |
}, | |
}, | |
}, | |
}, | |
} | |
signed, err := s.signer.SignTransaction(unsignedTx) | |
if err != nil { | |
return fmt.Errorf("failed to sign transaction: %w", err) | |
} | |
_, err = s.client.BroadcastTxAsync(ctx, signed) | |
return err | |
} |
Overview
Resolves #4
Resolves #5
Summary by CodeRabbit
New Features
Sequencer
interface for the Astria sequencing network, enabling transaction submissions and preparing for future batch processing.Bug Fixes