Skip to content

Commit

Permalink
Fixed failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Shailu-s committed Nov 13, 2024
1 parent ca92869 commit a74a4b5
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 26 deletions.
2 changes: 0 additions & 2 deletions sequencer/database/migrations/0001.sql
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ CREATE TABLE batch (
batch_num BIGINT UNIQUE NOT NULL,
eth_block_num BIGINT NOT NULL REFERENCES block (eth_block_num) ON DELETE CASCADE,
forger_addr BYTEA NOT NULL, -- fake foreign key for coordinator
fees_collected BYTEA NOT NULL,
fee_idxs_coordinator BYTEA NOT NULL,
state_root DECIMAL(78,0) NOT NULL,
num_accounts BIGINT NOT NULL,
last_idx BIGINT NOT NULL,
Expand Down
4 changes: 0 additions & 4 deletions sequencer/database/migrations/0002_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ func (m migrationTest0002) InsertData(db *sqlx.DB) error {
batch_num,
eth_block_num,
forger_addr,
fees_collected,
fee_idxs_coordinator,
state_root,
num_accounts,
last_idx,
Expand All @@ -42,8 +40,6 @@ func (m migrationTest0002) InsertData(db *sqlx.DB) error {
6758,
4417296,
decode('459264CC7D2BF350AFDDA828C273E81367729C1F', 'hex'),
decode('7B2230223A34383337383531313632323134343030307D0A', 'hex'),
decode('5B3236335D0A', 'hex'),
12898140512818699175738765060248919016800434587665040485377676113605873428098,
256,
1044,
Expand Down
8 changes: 0 additions & 8 deletions sequencer/database/migrations/0003_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ func (m migrationTest0003) InsertData(db *sqlx.DB) error {
batch_num,
eth_block_num,
forger_addr,
fees_collected,
fee_idxs_coordinator,
state_root,
num_accounts,
last_idx,
Expand All @@ -36,8 +34,6 @@ func (m migrationTest0003) InsertData(db *sqlx.DB) error {
6758,
4417296,
decode('459264CC7D2BF350AFDDA828C273E81367729C1F', 'hex'),
decode('7B2230223A34383337383531313632323134343030307D0A', 'hex'),
decode('5B3236335D0A', 'hex'),
12898140512818699175738765060248919016800434587665040485377676113605873428098,
256,
1044,
Expand All @@ -56,8 +52,6 @@ func (m migrationTest0003) RunAssertsAfterMigrationUp(t *testing.T, db *sqlx.DB)
batch_num = 6758 AND
eth_block_num = 4417296 AND
forger_addr = decode('459264CC7D2BF350AFDDA828C273E81367729C1F', 'hex') AND
fees_collected = decode('7B2230223A34383337383531313632323134343030307D0A', 'hex') AND
fee_idxs_coordinator = decode('5B3236335D0A', 'hex') AND
state_root = 12898140512818699175738765060248919016800434587665040485377676113605873428098 AND
num_accounts = 256 AND
last_idx = 1044 AND
Expand All @@ -79,8 +73,6 @@ func (m migrationTest0003) RunAssertsAfterMigrationDown(t *testing.T, db *sqlx.D
batch_num = 6758 AND
eth_block_num = 4417296 AND
forger_addr = decode('459264CC7D2BF350AFDDA828C273E81367729C1F', 'hex') AND
fees_collected = decode('7B2230223A34383337383531313632323134343030307D0A', 'hex') AND
fee_idxs_coordinator = decode('5B3236335D0A', 'hex') AND
state_root = 12898140512818699175738765060248919016800434587665040485377676113605873428098 AND
num_accounts = 256 AND
last_idx = 1044 AND
Expand Down
4 changes: 0 additions & 4 deletions sequencer/database/migrations/0006_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ func (m migrationTest0006) InsertData(db *sqlx.DB) error {
batch_num,
eth_block_num,
forger_addr,
fees_collected,
fee_idxs_coordinator,
state_root,
num_accounts,
last_idx,
Expand All @@ -42,8 +40,6 @@ func (m migrationTest0006) InsertData(db *sqlx.DB) error {
6758,
4417296,
decode('459264CC7D2BF350AFDDA828C273E81367729C1F', 'hex'),
decode('7B2230223A34383337383531313632323134343030307D0A', 'hex'),
decode('5B3236335D0A', 'hex'),
12898140512818699175738765060248919016800434587665040485377676113605873428098,
256,
1044,
Expand Down
4 changes: 0 additions & 4 deletions sequencer/database/migrations/0007_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ func (m migrationTest0007) InsertData(db *sqlx.DB) error {
batch_num,
eth_block_num,
forger_addr,
fees_collected,
fee_idxs_coordinator,
state_root,
num_accounts,
last_idx,
Expand All @@ -42,8 +40,6 @@ func (m migrationTest0007) InsertData(db *sqlx.DB) error {
6758,
4417296,
decode('459264CC7D2BF350AFDDA828C273E81367729C1F', 'hex'),
decode('7B2230223A34383337383531313632323134343030307D0A', 'hex'),
decode('5B3236335D0A', 'hex'),
12898140512818699175738765060248919016800434587665040485377676113605873428098,
256,
1044,
Expand Down
6 changes: 3 additions & 3 deletions sequencer/database/migrations/0011_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ func (m migrationTest0011) InsertData(db *sqlx.DB) error {
VALUES(48278, '2021-09-13 08:28:39.000', decode('2AB24E7021318D6CF0686E8F8FBFB0A63CB79A9FB5CDECE7C09FD4438E67242E','hex'));
INSERT INTO batch
(item_id, batch_num, eth_block_num, forger_addr, fees_collected, fee_idxs_coordinator, state_root, num_accounts, last_idx, exit_root, forge_l1_txs_num, slot_num, total_fees_usd, eth_tx_hash)
(item_id, batch_num, eth_block_num, forger_addr, state_root, num_accounts, last_idx, exit_root, forge_l1_txs_num, slot_num, total_fees_usd, eth_tx_hash)
VALUES(1420, 1420, 48295, decode('DCC5DD922FB1D0FD0C450A0636A8CE827521F0ED','hex'), decode('7B7D0A','hex'), decode('5B5D0A','hex'), 0, 0, 255, 0, 1419, 1205, 0, decode('AE80AB27E97213DEC805C78ED9C637E0414A541D489377F766B3372170F4AD66','hex'));
INSERT INTO batch
(item_id, batch_num, eth_block_num, forger_addr, fees_collected, fee_idxs_coordinator, state_root, num_accounts, last_idx, exit_root, forge_l1_txs_num, slot_num, total_fees_usd, eth_tx_hash)
(item_id, batch_num, eth_block_num, forger_addr, state_root, num_accounts, last_idx, exit_root, forge_l1_txs_num, slot_num, total_fees_usd, eth_tx_hash)
VALUES(1419, 1419, 48286, decode('DCC5DD922FB1D0FD0C450A0636A8CE827521F0ED','hex'), decode('7B7D0A','hex'), decode('5B5D0A','hex'), 0, 0, 255, 0, 1418, 1205, 0, decode('4BC9C94E8CF93AD475F8C8394BC934AF5EB0802FE4009D13F58AE25F6047DA95','hex'));
`
_, err := db.Exec(queryInsert)
Expand All @@ -44,7 +44,7 @@ func (m migrationTest0011) RunAssertsAfterMigrationUp(t *testing.T, db *sqlx.DB)
assert.Equal(t, 1, result)

insert := `INSERT INTO batch
(item_id, batch_num, eth_block_num, forger_addr, fees_collected, fee_idxs_coordinator, state_root, num_accounts, last_idx, exit_root, forge_l1_txs_num, slot_num, total_fees_usd, eth_tx_hash, gas_price, gas_used, ether_price_usd)
(item_id, batch_num, eth_block_num, forger_addr, state_root, num_accounts, last_idx, exit_root, forge_l1_txs_num, slot_num, total_fees_usd, eth_tx_hash, gas_price, gas_used, ether_price_usd)
VALUES(1418, 1418, 48278, decode('DCC5DD922FB1D0FD0C450A0636A8CE827521F0ED','hex'), decode('7B7D0A','hex'), decode('5B5D0A','hex'), 0, 0, 255, 0, 1417, 1204, 0, decode('285CE6A154901AF5197382DC8A5CCE02588BDA1B078768C5077B6996FA2EA0A7','hex'), 500000000000, 15000000, 3492.21);
`
_, err := db.Exec(insert)
Expand Down
2 changes: 1 addition & 1 deletion sequencer/database/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func InitSQLDB(port int, host, user, password, name string) (*sqlx.DB, error) {

// InitTestSQLDB opens test PostgreSQL database
func InitTestSQLDB() (*sqlx.DB, error) {
err := godotenv.Load("../.env")
err := godotenv.Load("../../.env")
if err != nil {
log.Info("Error loading .env file")
}
Expand Down

0 comments on commit a74a4b5

Please sign in to comment.