-
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.
* reserved zk counters (#3343) * reserved zk counters * new prover image * udpate counters names * udpate counters names * add gas used to reserved zkCounters * add ReservedZKCounters to pool trasactions * Add reserved zk counters to pool transactions (#3346) * add reserved zk counters to pool transaction * add reserved zk counters to pool transaction * correct migration test
- Loading branch information
1 parent
0204aff
commit 49e837a
Showing
27 changed files
with
1,272 additions
and
928 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
-- +migrate Up | ||
ALTER TABLE pool.transaction | ||
ADD COLUMN reserved_zkcounters jsonb; | ||
|
||
-- +migrate Down | ||
ALTER TABLE pool.transaction | ||
DROP COLUMN reserved_zkcounters; |
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,50 @@ | ||
package pool_migrations_test | ||
|
||
import ( | ||
"database/sql" | ||
"testing" | ||
|
||
"github.com/0xPolygonHermez/zkevm-node/state" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
// this migration adds reserved_zkcounters to the transaction | ||
type migrationTest0013 struct{} | ||
|
||
func (m migrationTest0013) InsertData(db *sql.DB) error { | ||
return nil | ||
} | ||
|
||
func (m migrationTest0013) RunAssertsAfterMigrationUp(t *testing.T, db *sql.DB) { | ||
var reserved_zkcounters = state.ZKCounters{ | ||
GasUsed: 0, | ||
KeccakHashes: 1, | ||
PoseidonHashes: 2, | ||
} | ||
|
||
const insertTx = ` | ||
INSERT INTO pool.transaction (hash, ip, received_at, from_address, reserved_zkcounters) | ||
VALUES ('0x0001', '127.0.0.1', '2023-12-07', '0x0011', $1)` | ||
|
||
_, err := db.Exec(insertTx, reserved_zkcounters) | ||
require.NoError(t, err) | ||
} | ||
|
||
func (m migrationTest0013) RunAssertsAfterMigrationDown(t *testing.T, db *sql.DB) { | ||
var reserved_zkcounters = state.ZKCounters{ | ||
GasUsed: 0, | ||
KeccakHashes: 1, | ||
PoseidonHashes: 2, | ||
} | ||
|
||
const insertTx = ` | ||
INSERT INTO pool.transaction (hash, ip, received_at, from_address, reserved_zkcounters) | ||
VALUES ('0x0001', '127.0.0.1', '2023-12-07', '0x0011', $1)` | ||
|
||
_, err := db.Exec(insertTx, reserved_zkcounters) | ||
require.Error(t, err) | ||
} | ||
|
||
func TestMigration0013(t *testing.T) { | ||
runMigrationTest(t, 13, migrationTest0013{}) | ||
} |
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.