-
Notifications
You must be signed in to change notification settings - Fork 697
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sequencer L2 block parallel processing improvements (#3604)
* wip * first implementation of parallel sequencer optmizations and L2 block reorg management * Close sipBatch (if needed) when processing reorg. Halt when 2 consecuties reorgs (same L2 block) * Return error when reserved counters overflow on l2 block process. Log used/reserved counters when closing wip batch * added logs to analyze blocking issue when storing L2 block * Fix unlock mutex in addTxTracker. Set wipTx to nil in RestoreTxsPendingToStore * add high reserved resorces in wipBatch * store high reserved counter on statedb.batch table * Return contextId in ProcessBatchV2 * fix synchornizer test * Set SequentialProcessL2Block to false by default. Update node config documentation * fix non-e2e tests * fix finalizer tests * remove unused code * test * Fix sequencer loadFromPool gofunc. Fix docker compose variables
- Loading branch information
Showing
41 changed files
with
1,208 additions
and
497 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
-- +migrate Up | ||
ALTER TABLE state.batch | ||
ADD COLUMN high_reserved_counters JSONB; | ||
|
||
-- +migrate Down | ||
ALTER TABLE state.batch | ||
DROP COLUMN high_reserved_counters; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package migrations_test | ||
|
||
import ( | ||
"database/sql" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
type migrationTest0021 struct{} | ||
|
||
func (m migrationTest0021) InsertData(db *sql.DB) error { | ||
const insertBatch0 = ` | ||
INSERT INTO state.batch (batch_num, global_exit_root, local_exit_root, acc_input_hash, state_root, timestamp, coinbase, raw_txs_data, forced_batch_num, wip) | ||
VALUES (0,'0x0000', '0x0000', '0x0000', '0x0000', now(), '0x0000', null, null, true)` | ||
|
||
// insert batch | ||
_, err := db.Exec(insertBatch0) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
return nil | ||
} | ||
|
||
func (m migrationTest0021) RunAssertsAfterMigrationUp(t *testing.T, db *sql.DB) { | ||
var result int | ||
|
||
// Check column high_reserved_counters exists in state.batch table | ||
const getColumn = `SELECT count(*) FROM information_schema.columns WHERE table_name='batch' and column_name='high_reserved_counters'` | ||
row := db.QueryRow(getColumn) | ||
assert.NoError(t, row.Scan(&result)) | ||
assert.Equal(t, 1, result) | ||
|
||
const insertBatch0 = ` | ||
INSERT INTO state.batch (batch_num, global_exit_root, local_exit_root, acc_input_hash, state_root, timestamp, coinbase, raw_txs_data, forced_batch_num, wip, high_reserved_counters) | ||
VALUES (1,'0x0001', '0x0001', '0x0001', '0x0001', now(), '0x0001', null, null, true, '{"Steps": 1890125}')` | ||
|
||
// insert batch 1 | ||
_, err := db.Exec(insertBatch0) | ||
assert.NoError(t, err) | ||
|
||
const insertBatch1 = ` | ||
INSERT INTO state.batch (batch_num, global_exit_root, local_exit_root, acc_input_hash, state_root, timestamp, coinbase, raw_txs_data, forced_batch_num, wip, high_reserved_counters) | ||
VALUES (2,'0x0002', '0x0002', '0x0002', '0x0002', now(), '0x0002', null, null, false, '{"Steps": 1890125}')` | ||
|
||
// insert batch 2 | ||
_, err = db.Exec(insertBatch1) | ||
assert.NoError(t, err) | ||
} | ||
|
||
func (m migrationTest0021) RunAssertsAfterMigrationDown(t *testing.T, db *sql.DB) { | ||
var result int | ||
|
||
// Check column high_reserved_counters doesn't exists in state.batch table | ||
const getCheckedColumn = `SELECT count(*) FROM information_schema.columns WHERE table_name='batch' and column_name='high_reserved_counters'` | ||
row := db.QueryRow(getCheckedColumn) | ||
assert.NoError(t, row.Scan(&result)) | ||
assert.Equal(t, 0, result) | ||
} | ||
|
||
func TestMigration0021(t *testing.T) { | ||
runMigrationTest(t, 21, migrationTest0021{}) | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.