Skip to content
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

fix: BondedTokens exceeds int64 range #300

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion database/gov.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ ON CONFLICT ON CONSTRAINT unique_staking_pool_snapshot DO UPDATE SET
WHERE proposal_staking_pool_snapshot.height <= excluded.height`

_, err := db.Sql.Exec(stmt,
snapshot.ProposalID, snapshot.Pool.BondedTokens.Int64(), snapshot.Pool.NotBondedTokens.Int64(), snapshot.Pool.Height)
snapshot.ProposalID, snapshot.Pool.BondedTokens.String(), snapshot.Pool.NotBondedTokens.String(), snapshot.Pool.Height)
if err != nil {
return fmt.Errorf("error while storing proposal staking pool snapshot: %s", err)
}
Expand Down
4 changes: 2 additions & 2 deletions database/schema/03-staking.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ CREATE INDEX staking_params_height_index ON staking_params (height);
CREATE TABLE staking_pool
(
one_row_id BOOLEAN NOT NULL DEFAULT TRUE PRIMARY KEY,
bonded_tokens BIGINT NOT NULL,
not_bonded_tokens BIGINT NOT NULL,
bonded_tokens TEXT NOT NULL,
not_bonded_tokens TEXT NOT NULL,
height BIGINT NOT NULL,
CHECK (one_row_id)
);
Expand Down
4 changes: 2 additions & 2 deletions database/schema/08-gov.sql
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ CREATE INDEX proposal_tally_result_height_index ON proposal_tally_result (height
CREATE TABLE proposal_staking_pool_snapshot
(
proposal_id INTEGER REFERENCES proposal (id) PRIMARY KEY,
bonded_tokens BIGINT NOT NULL,
not_bonded_tokens BIGINT NOT NULL,
bonded_tokens TEXT NOT NULL,
not_bonded_tokens TEXT NOT NULL,
height BIGINT NOT NULL,
CONSTRAINT unique_staking_pool_snapshot UNIQUE (proposal_id)
);
Expand Down