Change votingPower field to bigint type
This commit is contained in:
parent
03835af2d4
commit
f7c3ef7c7f
@ -40,9 +40,13 @@ and this project adheres to
|
||||
- all: Upgrade cosmjs-types to 0.5 ([#1131]).
|
||||
- @cosmjs/stargate: Change `packetCommitment` parameter `sequence` type from
|
||||
`Long` to `number` ([#1168]).
|
||||
- @cosmjs/tendermint-rpc: The type of `votingPower` fields was changed from
|
||||
`number` to `bigint` as those values can exceed the safe integer range
|
||||
([#1133]).
|
||||
|
||||
[#1131]: https://github.com/cosmos/cosmjs/pull/1131
|
||||
[#1168]: https://github.com/cosmos/cosmjs/pull/1168
|
||||
[#1133]: https://github.com/cosmos/cosmjs/issues/1133
|
||||
|
||||
## [0.28.9] - 2022-06-21
|
||||
|
||||
|
||||
@ -44,7 +44,7 @@ describe("Adaptor Responses", () => {
|
||||
});
|
||||
expect(validator).toEqual({
|
||||
address: fromHex("A03DC128D38DB0BC5F18AE1872F1CB2E1FD41157"),
|
||||
votingPower: 169980,
|
||||
votingPower: BigInt(169980),
|
||||
pubkey: {
|
||||
algorithm: "ed25519",
|
||||
data: fromBase64("2BX6Zuj8RmdJAkD1BAg6KB0v04liyM7jBdwOGIb9F9Q="),
|
||||
@ -72,7 +72,7 @@ describe("Adaptor Responses", () => {
|
||||
algorithm: "ed25519",
|
||||
data: fromBase64("0kNlxBMpm+5WtfHIG1xsWatOXTKPLtmSqn3EiEIDZeI="),
|
||||
},
|
||||
votingPower: 11418237,
|
||||
votingPower: BigInt(11418237),
|
||||
});
|
||||
});
|
||||
|
||||
@ -93,7 +93,7 @@ describe("Adaptor Responses", () => {
|
||||
algorithm: "ed25519",
|
||||
data: fromBase64("HjSC7VkhKih6xMhudlqfaFE8ZZnP8RKJPv4iqR7RhcE="),
|
||||
},
|
||||
votingPower: 0,
|
||||
votingPower: BigInt(0),
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -116,7 +116,7 @@ describe("Adaptor Responses", () => {
|
||||
algorithm: "ed25519",
|
||||
data: fromBase64("0kNlxBMpm+5WtfHIG1xsWatOXTKPLtmSqn3EiEIDZeI="),
|
||||
},
|
||||
votingPower: 11228980,
|
||||
votingPower: BigInt(11228980),
|
||||
proposerPriority: 62870960,
|
||||
});
|
||||
});
|
||||
|
||||
@ -4,7 +4,7 @@ import { JsonRpcSuccessResponse } from "@cosmjs/json-rpc";
|
||||
import { assert } from "@cosmjs/utils";
|
||||
|
||||
import { DateWithNanoseconds, fromRfc3339WithNanoseconds } from "../../dates";
|
||||
import { apiToSmallInt } from "../../inthelpers";
|
||||
import { apiToBigInt, apiToSmallInt } from "../../inthelpers";
|
||||
import { SubscriptionEvent } from "../../rpcclients";
|
||||
import { BlockIdFlag, CommitSignature, ValidatorPubkey } from "../../types";
|
||||
import {
|
||||
@ -279,7 +279,7 @@ interface RpcValidatorUpdate {
|
||||
export function decodeValidatorUpdate(data: RpcValidatorUpdate): responses.ValidatorUpdate {
|
||||
return {
|
||||
pubkey: decodePubkey(assertObject(data.pub_key)),
|
||||
votingPower: apiToSmallInt(data.power ?? 0),
|
||||
votingPower: apiToBigInt(data.power ?? "0"),
|
||||
};
|
||||
}
|
||||
|
||||
@ -528,7 +528,7 @@ export function decodeValidatorGenesis(data: RpcValidatorGenesis): responses.Val
|
||||
return {
|
||||
address: fromHex(assertNotEmpty(data.address)),
|
||||
pubkey: decodePubkey(assertObject(data.pub_key)),
|
||||
votingPower: apiToSmallInt(assertNotEmpty(data.power)),
|
||||
votingPower: apiToBigInt(assertNotEmpty(data.power)),
|
||||
};
|
||||
}
|
||||
|
||||
@ -571,7 +571,7 @@ interface RpcValidatorInfo {
|
||||
export function decodeValidatorInfo(data: RpcValidatorInfo): responses.Validator {
|
||||
return {
|
||||
pubkey: decodePubkey(assertObject(data.pub_key)),
|
||||
votingPower: apiToSmallInt(assertNotEmpty(data.voting_power)),
|
||||
votingPower: apiToBigInt(assertNotEmpty(data.voting_power)),
|
||||
address: fromHex(assertNotEmpty(data.address)),
|
||||
proposerPriority: data.proposer_priority ? apiToSmallInt(data.proposer_priority) : undefined,
|
||||
};
|
||||
|
||||
@ -352,13 +352,13 @@ export interface SyncInfo {
|
||||
export interface Validator {
|
||||
readonly address: Uint8Array;
|
||||
readonly pubkey?: ValidatorPubkey;
|
||||
readonly votingPower: number;
|
||||
readonly votingPower: bigint;
|
||||
readonly proposerPriority?: number;
|
||||
}
|
||||
|
||||
export interface ValidatorUpdate {
|
||||
readonly pubkey: ValidatorPubkey;
|
||||
readonly votingPower: number;
|
||||
readonly votingPower: bigint;
|
||||
}
|
||||
|
||||
export interface ConsensusParams {
|
||||
|
||||
@ -44,7 +44,7 @@ describe("Adaptor Responses", () => {
|
||||
});
|
||||
expect(validator).toEqual({
|
||||
address: fromHex("A03DC128D38DB0BC5F18AE1872F1CB2E1FD41157"),
|
||||
votingPower: 169980,
|
||||
votingPower: BigInt(169980),
|
||||
pubkey: {
|
||||
algorithm: "ed25519",
|
||||
data: fromBase64("2BX6Zuj8RmdJAkD1BAg6KB0v04liyM7jBdwOGIb9F9Q="),
|
||||
@ -72,7 +72,7 @@ describe("Adaptor Responses", () => {
|
||||
algorithm: "ed25519",
|
||||
data: fromBase64("0kNlxBMpm+5WtfHIG1xsWatOXTKPLtmSqn3EiEIDZeI="),
|
||||
},
|
||||
votingPower: 11418237,
|
||||
votingPower: BigInt(11418237),
|
||||
});
|
||||
});
|
||||
|
||||
@ -93,7 +93,7 @@ describe("Adaptor Responses", () => {
|
||||
algorithm: "ed25519",
|
||||
data: fromBase64("HjSC7VkhKih6xMhudlqfaFE8ZZnP8RKJPv4iqR7RhcE="),
|
||||
},
|
||||
votingPower: 0,
|
||||
votingPower: BigInt(0),
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -116,7 +116,7 @@ describe("Adaptor Responses", () => {
|
||||
algorithm: "ed25519",
|
||||
data: fromBase64("0kNlxBMpm+5WtfHIG1xsWatOXTKPLtmSqn3EiEIDZeI="),
|
||||
},
|
||||
votingPower: 11228980,
|
||||
votingPower: BigInt(11228980),
|
||||
proposerPriority: 62870960,
|
||||
});
|
||||
});
|
||||
|
||||
@ -4,7 +4,7 @@ import { JsonRpcSuccessResponse } from "@cosmjs/json-rpc";
|
||||
import { assert } from "@cosmjs/utils";
|
||||
|
||||
import { DateWithNanoseconds, fromRfc3339WithNanoseconds } from "../../dates";
|
||||
import { apiToSmallInt } from "../../inthelpers";
|
||||
import { apiToBigInt, apiToSmallInt } from "../../inthelpers";
|
||||
import { SubscriptionEvent } from "../../rpcclients";
|
||||
import { BlockIdFlag, CommitSignature, ValidatorPubkey } from "../../types";
|
||||
import {
|
||||
@ -280,7 +280,7 @@ interface RpcValidatorUpdate {
|
||||
export function decodeValidatorUpdate(data: RpcValidatorUpdate): responses.ValidatorUpdate {
|
||||
return {
|
||||
pubkey: decodePubkey(assertObject(data.pub_key)),
|
||||
votingPower: apiToSmallInt(data.power ?? 0),
|
||||
votingPower: apiToBigInt(data.power ?? "0"),
|
||||
};
|
||||
}
|
||||
|
||||
@ -529,7 +529,7 @@ export function decodeValidatorGenesis(data: RpcValidatorGenesis): responses.Val
|
||||
return {
|
||||
address: fromHex(assertNotEmpty(data.address)),
|
||||
pubkey: decodePubkey(assertObject(data.pub_key)),
|
||||
votingPower: apiToSmallInt(assertNotEmpty(data.power)),
|
||||
votingPower: apiToBigInt(assertNotEmpty(data.power)),
|
||||
};
|
||||
}
|
||||
|
||||
@ -572,7 +572,7 @@ interface RpcValidatorInfo {
|
||||
export function decodeValidatorInfo(data: RpcValidatorInfo): responses.Validator {
|
||||
return {
|
||||
pubkey: decodePubkey(assertObject(data.pub_key)),
|
||||
votingPower: apiToSmallInt(assertNotEmpty(data.voting_power)),
|
||||
votingPower: apiToBigInt(assertNotEmpty(data.voting_power)),
|
||||
address: fromHex(assertNotEmpty(data.address)),
|
||||
proposerPriority: data.proposer_priority ? apiToSmallInt(data.proposer_priority) : undefined,
|
||||
};
|
||||
|
||||
@ -357,13 +357,13 @@ export interface SyncInfo {
|
||||
export interface Validator {
|
||||
readonly address: Uint8Array;
|
||||
readonly pubkey?: ValidatorPubkey;
|
||||
readonly votingPower: number;
|
||||
readonly votingPower: bigint;
|
||||
readonly proposerPriority?: number;
|
||||
}
|
||||
|
||||
export interface ValidatorUpdate {
|
||||
readonly pubkey: ValidatorPubkey;
|
||||
readonly votingPower: number;
|
||||
readonly votingPower: bigint;
|
||||
}
|
||||
|
||||
export interface ConsensusParams {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user