Skip to content

Commit 5761cfb

Browse files
committed
fix: change BIGINT to Numeric for more bigger number
1 parent 0123f0b commit 5761cfb

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

cmd/dispatcher/aggregate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func AggregateSignatures(validResponses map[string][]byte, req *config.Request,
4848
// Calculate total power
4949
var totalPower uint64 = 0
5050
for _, val := range valSetResp.ValidatorWithBlsKeys {
51-
totalPower += uint64(val.VotingPower)
51+
totalPower += val.VotingPower
5252
}
5353

5454
// Convert to types.ValidatorSet

store/client.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,12 @@ func (c *DBClient) CreateDispatcherTables() error {
112112
CREATE TABLE IF NOT EXISTS aggregated_checkpoints (
113113
id SERIAL PRIMARY KEY,
114114
request_id INTEGER REFERENCES sign_requests(id),
115-
epoch_num BIGINT NOT NULL,
115+
epoch_num NUMERIC NOT NULL,
116116
block_hash TEXT NOT NULL,
117117
bitmap TEXT NOT NULL,
118118
bls_multi_sig TEXT,
119119
bls_aggr_pk TEXT,
120-
power_sum BIGINT NOT NULL,
120+
power_sum NUMERIC NOT NULL,
121121
status VARCHAR(20) NOT NULL,
122122
validator_count INTEGER NOT NULL,
123123
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
@@ -131,7 +131,7 @@ func (c *DBClient) CreateDispatcherTables() error {
131131
_, err = c.db.Exec(`
132132
CREATE TABLE IF NOT EXISTS reward_distributions (
133133
id SERIAL PRIMARY KEY,
134-
epoch_num BIGINT NOT NULL,
134+
epoch_num NUMERIC NOT NULL,
135135
transaction_hash TEXT NOT NULL,
136136
status VARCHAR(20) NOT NULL,
137137
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
@@ -259,12 +259,12 @@ func (c *DBClient) InsertAggregatedCheckpoint(
259259
err := c.db.QueryRowx(
260260
query,
261261
requestID,
262-
epochNum,
262+
fmt.Sprintf("%d", epochNum), // Convert uint64 to string for NUMERIC
263263
blockHash,
264264
bitmap,
265265
blsMultiSig,
266266
blsAggrPk,
267-
powerSum,
267+
fmt.Sprintf("%d", powerSum), // Convert uint64 to string for NUMERIC
268268
status,
269269
validatorCount,
270270
time.Now(),

0 commit comments

Comments
 (0)