-
Notifications
You must be signed in to change notification settings - Fork 38
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
Adding geths mempool #1639
Adding geths mempool #1639
Conversation
WalkthroughThe changes involve a significant refactor of the transaction pool ( Changes
TipsChat with CodeRabbit Bot (
|
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.
Review Status
Actionable comments generated: 12
Configuration used: CodeRabbit UI
Files selected for processing (10)
- go/common/gethencoding/geth_encoding.go (3 hunks)
- go/enclave/enclave.go (7 hunks)
- go/enclave/ethblockchain/eth_blockchain.go (1 hunks)
- go/enclave/ethblockchain/eth_chainparams.go (1 hunks)
- go/enclave/nodetype/sequencer.go (11 hunks)
- go/enclave/txpool/txpool.go (1 hunks)
- integration/common/utils.go (1 hunks)
- integration/obscuroscan/obscuroscan_test.go (1 hunks)
- integration/simulation/network/network_utils.go (1 hunks)
- integration/simulation/simulation.go (2 hunks)
Files skipped from review due to trivial changes (2)
- integration/common/utils.go
- integration/simulation/simulation.go
Additional comments: 20
go/enclave/ethblockchain/eth_chainparams.go (1)
- 1-36: The
ChainParams
function is well implemented. It correctly initializes theparams.ChainConfig
structure with the providedobscuroChainID
and sets all fork blocks togethcommon.Big0
. This implies that all Ethereum protocol upgrades are immediately available from the genesis block. The timestamp fields are also correctly set to zero. Ensure that this configuration aligns with the intended behavior of the Obscuro network.integration/simulation/network/network_utils.go (1)
- 94-98: The
GasLimit
value has been significantly increased. Ensure that this change is compatible with the rest of the system and won't cause any issues such as out-of-memory errors or transaction failures due to exceeding gas limits.go/common/gethencoding/geth_encoding.go (3)
7-15: New import statements have been added. Ensure that these packages are included in your dependencies.
245-251: The
CreateEthHeaderForBatch
function has been updated to use theGasUsed
value from the input parameter. Ensure that theGasUsed
value is being correctly calculated and passed in all calls to this function.257-263: A new function
CreateEthBlockFromBatch
has been added. This function creates an Ethereum block from a batch. Ensure that this function is being correctly used and the batch passed to it is properly formed.func CreateEthBlockFromBatch(b *core.Batch) (*types.Block, error) { blockHeader, err := CreateEthHeaderForBatch(b.Header, nil) if err != nil { return nil, fmt.Errorf("unable to create eth block from batch - %w", err) } return types.NewBlock(blockHeader, b.Transactions, nil, nil, trie.NewStackTrie(nil)), nil }go/enclave/nodetype/sequencer.go (8)
12-18: The new packages
ethblockchain
andtxpool
are imported. Ensure that these packages are correctly implemented and tested.53-62: The
sequencer
struct has been updated to includemempool
andblockchain
. Ensure that these fields are correctly used throughout the struct methods.68-83: > Note: This review was outside of the patch, so it was mapped to the patch with the greatest overlap. Original lines [64-81]
The
NewSequencer
function has been updated to acceptmempool
andblockchain
as arguments. Ensure that all calls to this function throughout the codebase have been updated to match the new signature.
138-140: The
initGenesis
function now includes logic for signing the batch. Ensure that the signing process is secure and correctly implemented.146-163: The
initGenesis
function now includes logic for ingesting the blockchain and starting the mempool. Ensure that these operations are correctly implemented and that error handling is robust.186-204: The
createNewHeadBatch
function has been updated to use pending transactions from the mempool. Ensure that the transactions are correctly retrieved and processed.252-262: The
produceBatch
function now includes logic for ingesting the blockchain. Ensure that this operation is correctly implemented and that error handling is robust.363-365: The
SubmitTransaction
function has been modified to use thetxpool.TxPool
for adding transactions. Ensure that the transaction is correctly added to the pool.go/enclave/ethblockchain/eth_blockchain.go (1)
- 1-153: The new
EthBlockchain
type and its methods are well-structured and seem to follow good practices. However, there are a few areas that could be improved.go/enclave/enclave.go (6)
14-17: The new import statements for
ethblockchain
andtxpool
are correct and necessary for the changes in this PR.131-132: The initialization of
chainConfig
andstorage
usingethblockchain.ChainParams
andstorage.NewStorageFromConfig
respectively is correct. Ensure that theNewStorageFromConfig
function is updated to acceptchainConfig
as an argument.220-222: The usage of
mempool
in theNewSequencer
function is correct.233-234: The usage of
blockchain
in theNewSequencer
function is correct.239-241: The usage of
chainConfig
in theNewChain
function is correct.254-254: The usage of
chainConfig
in theNew
function ofdebugger
is correct.
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.
Review Status
Actionable comments generated: 2
Configuration used: CodeRabbit UI
Files selected for processing (4)
- go/enclave/enclave.go (7 hunks)
- go/enclave/ethblockchain/eth_blockchain.go (1 hunks)
- go/enclave/nodetype/sequencer.go (11 hunks)
- go/enclave/txpool/txpool.go (1 hunks)
Additional comments: 24
go/enclave/enclave.go (5)
14-17: The new import statements are correctly added for the new packages.
130-132: The initialization of
chainConfig
andstorage
is correct. Ensure thatethblockchain.ChainParams
function is correctly implemented and that it returns the expected value.217-219: The initialization of
service
is correct. Ensure that thenodetype.NewSequencer
function has been updated to accept the newmempool
parameter.230-238: The initialization of
service
andchain
is correct. Ensure that thenodetype.NewValidator
andl2chain.NewChain
functions have been updated to accept the new parameters.251-251: The initialization of
debug
is correct. Ensure that thedebugger.New
function has been updated to accept the newchainConfig
parameter.go/enclave/txpool/txpool.go (5)
1-14: The import statements are well organized and separated by functionality. Good job.
16-22: The
TxPool
struct is well defined with clear field names. Good job.24-34: The
NewTxPool
function is well implemented. It initializes a newTxPool
instance with the necessary fields.36-50: The
Start
function is well implemented. It checks if the pool is already started before initializing a new one. This prevents overwriting an existing pool.52-55: The
PendingTransactions
function is well implemented. It retrieves all pending transactions from the pool.go/enclave/ethblockchain/eth_blockchain.go (6)
24-30: The previous comment about using an interface for the logger is still valid. This would make the code more testable and flexible.
33-41: The previous comment about validating function parameters before using them is still valid. This would prevent potential nil pointer dereferences.
50-65: The previous comment about returning an error from the
CurrentBlock
function instead ofnil
is still valid. This would make error handling more explicit.67-82: The previous comment about refactoring the anonymous function in
SubscribeChainHeadEvent
into a separate function is still valid. This would make the code easier to test and reason about.120-131: The previous comment about adding a way to stop the goroutine in
IngestNewBlock
and handling potential panics is still valid. This would make the code more robust and prevent potential issues.149-153: The previous comment about handling the error returned by
storage.FetchSecret()
is still valid. Ignoring errors can lead to unexpected behavior and hard-to-debug issues.go/enclave/nodetype/sequencer.go (8)
53-62: The
sequencer
struct has been updated to replacemempool.Manager
with*txpool.TxPool
and addblockchain *ethblockchain.EthBlockchain
. Ensure that all instances ofsequencer
are updated accordingly.68-83: > Note: This review was outside of the patch, so it was mapped to the patch with the greatest overlap. Original lines [64-81]
The
NewSequencer
function signature has been updated to includeblockchain *ethblockchain.EthBlockchain
. Ensure that all calls to this function throughout the codebase have been updated to match the new signature.
138-140: The
signBatch
function is called here. Ensure that the function is implemented correctly and that the private key used for signing is securely stored and managed.147-156: The
blockchain.IngestNewBlock
andmempool.Start
functions are called here. Ensure that these functions are implemented correctly and handle errors properly.161-163: The
mempool.Add
function is called here. Ensure that this function is implemented correctly and handles errors properly.188-204: The
mempool.PendingTransactions
function is called here and the transactions are processed. Ensure that this function is implemented correctly and handles errors properly.252-262: The
blockchain.IngestNewBlock
function is called here. Ensure that this function is implemented correctly and handles errors properly.364-365: The
mempool.Add
function is called here. Ensure that this function is implemented correctly and handles errors properly.
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.
Review Status
Actionable comments generated: 6
Configuration used: CodeRabbit UI
Files selected for processing (5)
- go/enclave/enclave.go (7 hunks)
- go/enclave/nodetype/sequencer.go (11 hunks)
- go/enclave/txpool/txpool.go (1 hunks)
- go/enclave/txpool/txpool_mock_test.go (1 hunks)
- go/enclave/txpool/txpool_test.go (1 hunks)
Additional comments: 15
go/enclave/txpool/txpool_test.go (1)
- 91-91: The TODO comment indicates that there is an incomplete test case. It's important to either implement the test case for minting a block and checking the transaction pool or create a task to track this work for future implementation.
go/enclave/txpool/txpool_mock_test.go (1)
- 3-20: The import list is extensive, which is common in Go files, especially for testing. Ensure that all imported packages are used within the file to avoid unnecessary dependencies.
go/enclave/enclave.go (5)
13-17: The addition of the
txpool
import statement is correct and aligns with the changes described in the summary. This import is necessary for initializing the new transaction pool.130-131: The replacement of the previous
chainConfig
initialization withethblockchain.ChainParams
is a significant change. It is important to ensure that theChainParams
function correctly sets up the chain configuration and that all references tochainConfig
throughout the codebase are updated to work with the new configuration structure.200-201: The initialization of
mempool
usingtxpool.NewTxPool
replaces the previous mempool manager. It is crucial to verify that the new transaction pool is initialized with the correct parameters and that it integrates seamlessly with the rest of the system, especially with theEthBlockchain
type.217-219: The usage of
chainConfig
without the address-of operator (&
) suggests that the function signatures fornodetype.NewSequencer
and potentially other functions have been updated to accept a value instead of a pointer. This change should be verified across the codebase to ensure consistency and to prevent potential runtime errors due to type mismatches.251-251: The creation of a new
debugger
instance is tied to thechain
andchainConfig
, which indicates that debugging capabilities may have been enhanced or modified to work with the new chain structure. It is important to ensure that the debugger functions as expected and that any new debugging features are documented and tested.go/enclave/nodetype/sequencer.go (8)
9-18: Reorganization of import statements is a common practice to keep the code clean and maintainable. Ensure that all new imports are used and that there are no conflicts with existing code.
28-33: The constant
RollupDelay
is introduced. Verify that this constant is being used consistently throughout the codebase and that its value is appropriate for the intended behavior.53-61: The
sequencer
struct has been updated to include ablockchain
field of type*ethblockchain.EthBlockchain
and amempool
field of type*txpool.TxPool
. Ensure that these new fields are properly initialized and used wherever necessary.68-83: > Note: This review was outside of the patch, so it was mapped to the patch with the greatest overlap. Original lines [64-81]
The
NewSequencer
function signature has been updated to include the newblockchain
andmempool
parameters. Ensure that all invocations of this function are updated accordingly.
- 143-166: > Note: This review was outside of the patch, so it was mapped to the patch with the greatest overlap. Original lines [138-164]
The
initGenesis
function has been refactored to include blockchain ingestion and mempool start. Ensure that the error messages are clear and that the blockchain and mempool are correctly initialized and started.
183-207: The
createNewHeadBatch
function now uses pending transactions from the mempool. Ensure that the transaction selection logic is correct and that the limiter is functioning as expected. Also, verify that the error handling is appropriate and that the transactions are being processed correctly.253-262: The
produceBatch
function has been modified to include blockchain ingestion. Ensure that the batch is correctly added to the blockchain and that the pending transactions are removed from the mempool as expected.364-366: The
SubmitTransaction
function has been simplified to directly add the transaction to the mempool. Ensure that the mempool'sAdd
method is robust and handles all necessary validation and error checking.Overall, the changes to
sequencer.go
seem to be focused on integrating the newEthBlockchain
andTxPool
types into the sequencer logic. It is important to ensure that these changes are thoroughly tested, especially since they involve critical components like transaction handling and blockchain ingestion. Additionally, ensure that all error messages provide enough context to be useful for debugging and that the new code follows the existing coding standards and practices of the Obscuro network's codebase.
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.
Review Status
Actionable comments generated: 1
Configuration used: CodeRabbit UI
Files selected for processing (1)
- go/enclave/txpool/txpool_test.go (1 hunks)
Additional comments: 1
go/enclave/txpool/txpool_test.go (1)
- 91-91: This TODO comment indicates that there is additional test coverage needed to ensure that transactions are cleared from the pool after a block is minted. It's important to implement this to verify the full lifecycle of a transaction in the pool.
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- integration/obscuroscan/obscuroscan_test.go (2 hunks)
Additional comments: 2
integration/obscuroscan/obscuroscan_test.go (2)
86-89: The test assertion for the transaction count has been updated to expect 5 transactions. Ensure that this change aligns with the intended number of transactions to be issued in the test setup. If the number of transactions issued is dynamic or can vary, consider parameterizing this assertion to avoid brittle tests.
238-251: The nonce is being set outside the loop, which is good for performance. However, the
issuerWallet.GetNonceAndIncrement()
method is still being used inside the loop. This could lead to incorrect nonce values if theissuerWallet
does not internally track the nonce correctly. It's important to ensure that the nonce is being managed correctly to avoid transaction failures due to nonce mismatch.
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.
Looks good. Had a quick pass through it, and left a few comments
transactions, err := s.mempool.CurrentTxs(stateDB, limiter) | ||
if err != nil { | ||
return err | ||
pendingTransactions := s.mempool.PendingTransactions() |
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.
Does this logic belong in the txpool as well?
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 thought the same thing, but I didn't want to pass the limiter to the tx pool. Do you think the limiter should be in the txpool ? So that we can lazily build the batch ?
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.
how do they do it in geth?
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.
Very similar..! Cycle through each lazy tx, resolve it, and then add it to the block until there's it hits the block gas.
for {
// Check interruption signal and abort building if it's fired.
if interrupt != nil {
if signal := interrupt.Load(); signal != commitInterruptNone {
return signalToErr(signal)
}
}
// If we don't have enough gas for any further transactions then we're done.
if env.gasPool.Gas() < params.TxGas {
log.Trace("Not enough gas for further transactions", "have", env.gasPool, "want", params.TxGas)
break
}
// Retrieve the next transaction and abort if all done.
ltx := txs.Peek()
if ltx == nil {
break
}
tx := ltx.Resolve()
if tx == nil {
log.Warn("Ignoring evicted transaction")
txs.Pop()
continue
}
...
case errors.Is(err, nil):
// Everything ok, collect the logs and shift in the next transaction from the same account
coalescedLogs = append(coalescedLogs, logs...)
env.tcount++
txs.Shift()
```
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.
Review Status
Actionable comments generated: 13
Configuration used: CodeRabbit UI
Files selected for processing (7)
- go/enclave/enclave.go (7 hunks)
- go/enclave/evm/ethchainadapter/eth_chainadapter.go (1 hunks)
- go/enclave/evm/ethchainadapter/eth_chainparams.go (1 hunks)
- go/enclave/nodetype/sequencer.go (13 hunks)
- go/enclave/txpool/txpool.go (1 hunks)
- go/enclave/txpool/txpool_test.go (1 hunks)
- integration/simulation/simulation.go (3 hunks)
Additional comments: 31
go/enclave/txpool/txpool.go (3)
3-13: The import statements are well-organized and follow the convention of grouping standard library imports separately from third-party packages. This is a good practice for readability and maintainability.
15-22: The
TxPool
struct is well-defined with clear field names indicating their purpose. However, ensure that therunning
field is accessed in a thread-safe manner ifTxPool
methods are called concurrently.75-77: The
Running
method provides a simple way to check the running status of the pool. Ensure that this method is thread-safe ifTxPool
can be accessed concurrently.go/enclave/txpool/txpool_test.go (3)
91-91: This TODO comment indicates that there is an intention to extend the test to include block minting and checking the transaction pool's state afterward. It's important to ensure that this test is completed to verify the full lifecycle of a transaction within the pool.
20-92: The test function
TestTxPool_AddTransaction_Pending
is well-structured and covers the initialization of the transaction pool, adding a transaction, and checking its pending status. However, it relies on a sleep function to wait for the transaction to be processed, which is not ideal for test reliability and performance. It would be beneficial to replace this with a more deterministic synchronization mechanism.94-110: The
applyGenesisState
function is a new addition that sets up the initial state for the test blockchain. It's important to ensure that this function is called appropriately and that the genesis state is correctly applied to the mock storage. The error handling within this function is done well, with errors being wrapped to provide more context.integration/simulation/simulation.go (1)
- 230-234: The gas limit set here is extremely high (
1025_000_000
). This seems like an error, as Ethereum gas limits are typically much lower. Verify that this value is correct and adjust it if necessary. If this is a simulation-specific parameter, consider documenting why such a high value is used.- Gas: 1025_000_000, + Gas: 10_000_000, // Adjusted to a more typical gas limitgo/enclave/enclave.go (6)
10-23: The addition of new imports for
ethchainadapter
andtxpool
is appropriate given the context of integrating Ethereum's mempool into the Obscuro network. These imports are necessary for the new functionality being introduced.51-56: The addition of new imports for
debugger
andevents
is consistent with the changes described in the summary, such as the introduction of a newdebug
component and the update to thesubscriptionManager
.198-202: The creation of
blockchain
usingethchainadapter.NewEthChainAdapter
and the initialization ofmempool
withtxpool.NewTxPool
are key changes that align with the pull request's goal of integrating Ethereum's mempool. It is important to ensure that error handling is robust here, as the initialization of these components is critical to the system's operation.212-220: > Note: This review was outside of the patch, so it was mapped to the patch with the greatest overlap. Original lines [204-231]
The conditional initialization of
service
as either aSequencer
or aValidator
based on theconfig.NodeType
is a logical change that reflects the system's need to differentiate node behavior. It is important to ensure that all necessary dependencies are correctly passed to the constructors ofSequencer
andValidator
.
234-239: The initialization of
chain
with theNewChain
function, passing in thestorage
,chainConfig
,genesis
, andlogger
, is a straightforward instantiation that seems to follow the established patterns in the codebase.248-252: The creation of a new
debugger
instance and its inclusion in theenclaveImpl
struct is consistent with the summary's mention of a newdebug
component. It is important to ensure that thedebug
component is properly configured and that its use is gated by appropriate configuration flags or permissions to prevent unauthorized access.go/enclave/evm/ethchainadapter/eth_chainadapter.go (10)
3-21: The import section is well-organized and follows the convention of grouping standard library imports separately from third-party packages. However, it's important to ensure that all imported packages are used within the file to avoid unnecessary dependencies.
23-30: The
EthChainAdapter
struct is well-defined and encapsulates the necessary components for the adapter's functionality. It's important to ensure that all fields are used effectively within the adapter's methods.32-41: The constructor function
NewEthChainAdapter
is correctly returning a pointer to a newEthChainAdapter
instance. It's good practice to ensure that all parameters passed to the constructor are validated before use.43-46: The
Config
method correctly delegates to theChainParams
function to retrieve the chain configuration. It's important to ensure thatChainParams
is robust and handles all possible chain IDs correctly.48-64: The
CurrentBlock
method retrieves the current head of the chain from the batch registry and storage. Error handling is present, but it logs a warning and returnsnil
in case of an error. Consider if this is the desired behavior or if the error should be propagated to the caller.67-81: The
SubscribeChainHeadEvent
method sets up a subscription to chain head events. It's important to ensure that thequit
channel is appropriately handled in all calling contexts to avoid potential goroutine leaks.84-98: The
GetBlock
method retrieves a specific block by height. Error handling is consistent with theCurrentBlock
method, logging the error and returningnil
. Again, consider if this is the desired behavior or if the error should be propagated.101-118: The
StateAt
method returns a state database for a given root hash. The method checks for an empty root hash and returnsnil
without an error. Ensure that this behavior is consistent with the expectations of the callers. Also, thenilnil
lint exception is used; verify that this is intentional and justified.120-130: The
IngestNewBlock
method ingests a new block into the adapter. It converts the batch to an Ethereum block and sends a chain head event. The use of a goroutine for sending the event is appropriate, but ensure that thenewHeadChan
channel has sufficient buffer or that the receiver is always ready to prevent blocking the goroutine.133-146: The
NewLegacyPoolConfig
function creates a default legacy pool configuration. Ensure that the hardcoded values are appropriate for the application's requirements and that they are documented if they deviate from standardgeth
configurations.go/enclave/nodetype/sequencer.go (8)
5-21: Reordering of import statements is generally fine as long as it follows the convention of grouping standard library imports separately from third-party packages. However, it's important to ensure that no imports were removed that are still needed by the code.
28-31: The addition of new imports suggests that new dependencies have been introduced. Verify that these new dependencies are properly managed (e.g., vendored if necessary) and that their licenses are compatible with the project's license.
53-61: The
sequencer
struct has been updated to include new fields such asblockchain
andmempool
. Ensure that all usages of thesequencer
struct throughout the codebase have been updated to handle these new fields appropriately.95-100: The initialization of the
sequencer
struct within theNewSequencer
function is correct and follows the Go convention of listing fields explicitly. This is good for readability and maintainability.153-176: > Note: This review was outside of the patch, so it was mapped to the patch with the greatest overlap. Original lines [132-175]
The
createGenesisBatch
function has been refactored and now includes logic to start the mempool and ingest a new block into the blockchain. Ensure that this logic is correct and that the mempool is indeed supposed to be started at this point in the code. Also, verify that the sleep on line 169 is necessary and that there isn't a more deterministic way to ensure the mempool queuing system is initialized.
193-217: The transaction selection logic in
createNewHeadBatch
has been updated to use a limiter. Ensure that the limiter's behavior is well-tested, especially in edge cases where the batch size is close to the limit. Also, verify that the error handling is correct and that the batch creation process is aborted if an unexpected error occurs.263-273: The logging in
produceBatch
is good for monitoring and debugging purposes. Ensure that the log levels are appropriate and that sensitive information is not being logged.372-377: The
SubmitTransaction
function has been updated to use the newmempool
field of thesequencer
struct. Ensure that this change is reflected everywhere in the codebase where transactions are submitted to the sequencer.
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.
Review Status
Actionable comments generated: 1
Configuration used: CodeRabbit UI
Files selected for processing (1)
- go/enclave/nodetype/sequencer.go (13 hunks)
Additional comments: 7
go/enclave/nodetype/sequencer.go (7)
9-20: The import order has been changed to group Obscuro imports separately from Ethereum imports, which is a common practice for readability and organization. This change is purely stylistic and has no impact on functionality.
52-60: The
sequencer
struct has been updated to include a new fieldblockchain
of type*ethchainadapter.EthChainAdapter
. This change aligns with the pull request's goal to integrate Geth's mempool functionality. Ensure that all instances and usages of thesequencer
struct are updated to handle this new field.67-80: The
NewSequencer
function signature has been updated to include new parameters such asrollupProducer
,rollupConsumer
,rollupCompression
, andblockchain
. This is a breaking change and all calls to this function must be updated accordingly. Additionally, ensure that the new parameters are properly documented in the function's comments to explain their purpose and usage.110-127: The error handling in
CreateBatch
has been updated to provide more context, which is good for debugging. However, ensure that the error messages are consistent and follow a similar format throughout the codebase.192-216: > Note: This review was outside of the patch, so it was mapped to the patch with the greatest overlap. Original lines [192-233]
The
createNewHeadBatch
function now includes logic to limit the size of the batch using aBatchSizeLimiter
. Ensure that the limiter is correctly configured and that the error handling is robust. The error message on line 209 should be more descriptive to aid in debugging. Consider including additional context such as the transaction details or the current batch size.
262-271: The
produceBatch
function now adds the batch to the chain after it is produced. Ensure that theIngestNewBlock
method of theblockchain
correctly handles the new batch and that any transactions in the batch are properly removed from the mempool. The error message on line 268 should be more descriptive to aid in debugging. Consider including additional context such as the batch number or the transaction details.371-377: The
SubmitTransaction
function has been modified to usemempool.Add
instead ofAddMempoolTx
. Ensure that themempool.Add
method is compatible with the expected behavior ofSubmitTransaction
and that any necessary error handling is in place.
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.
lgtm
Why this change is needed
Adding geths mempool.
What changes were made as part of this PR
PR checks pre-merging
Please indicate below by ticking the checkbox that you have read and performed the required
PR checks