mirror of
https://github.com/cosmos/cosmjs.git
synced 2025-03-10 21:49:15 +00:00
Upgrade Tendermint version in tests to 0.34.10 and adapt code
This commit is contained in:
parent
e1b2048cc6
commit
4f4d1537bd
@ -28,23 +28,15 @@ export const adaptor33 = v0_33;
|
||||
*/
|
||||
export const adaptor34 = v0_33; // With this alias we can swap out the implementation without affecting caller code.
|
||||
|
||||
const hashes = {
|
||||
v0_34: [
|
||||
"ca2c9df", // v0.34.0-rc6
|
||||
"182fa32", // v0.34.0
|
||||
],
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns an Adaptor implementation for a given tendermint version.
|
||||
* Throws when version is not supported.
|
||||
*
|
||||
* @param version full Tendermint version string, e.g. "0.20.1"
|
||||
*/
|
||||
export function adaptorForVersion(version: string): Adaptor {
|
||||
if (version.startsWith("0.33.") || version.startsWith("0.34.") || hashes.v0_34.includes(version)) {
|
||||
return v0_33;
|
||||
} else {
|
||||
throw new Error(`Unsupported tendermint version: ${version}`);
|
||||
}
|
||||
export function adaptorForVersion(_version: string): Adaptor {
|
||||
// Note: In some cases, Tendermint 0.34 returns an empty version value.
|
||||
// This supports 0.33 and 0.34 now, no matter which version you provide.
|
||||
// Very soon this function becomes obsolete (https://github.com/cosmos/cosmjs/issues/789).
|
||||
return v0_33;
|
||||
}
|
||||
|
@ -167,7 +167,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, adaptor: Adaptor, expecte
|
||||
const status = await client.status();
|
||||
|
||||
// node info
|
||||
expect(status.nodeInfo.version).toEqual(expected.version);
|
||||
expect(status.nodeInfo.version).toMatch(expected.version);
|
||||
expect(status.nodeInfo.protocolVersion).toEqual({
|
||||
p2p: expected.p2pVersion,
|
||||
block: expected.blockVersion,
|
||||
|
@ -166,7 +166,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, expected: ExpectedValues)
|
||||
const status = await client.status();
|
||||
|
||||
// node info
|
||||
expect(status.nodeInfo.version).toEqual(expected.version);
|
||||
expect(status.nodeInfo.version).toMatch(expected.version);
|
||||
expect(status.nodeInfo.protocolVersion).toEqual({
|
||||
p2p: expected.p2pVersion,
|
||||
block: expected.blockVersion,
|
||||
|
@ -1,9 +1,12 @@
|
||||
import { toAscii } from "@cosmjs/encoding";
|
||||
import { sleep } from "@cosmjs/utils";
|
||||
|
||||
export const chainIdMatcher = /^[-a-zA-Z0-9]{3,30}$/;
|
||||
export const anyMatcher = /^.*$/; // Any string, including empty. Does not do more than a type check.
|
||||
|
||||
export interface ExpectedValues {
|
||||
/** The Tendermint version as reported by Tendermint itself */
|
||||
readonly version: string;
|
||||
readonly version: string | RegExp;
|
||||
readonly appCreator: string;
|
||||
readonly p2pVersion: number;
|
||||
readonly blockVersion: number;
|
||||
@ -49,7 +52,7 @@ export const tendermintInstances: readonly TendermintInstance[] = [
|
||||
version: "0.34.x",
|
||||
blockTime: 500,
|
||||
expected: {
|
||||
version: "182fa32", // srsly?
|
||||
version: anyMatcher,
|
||||
appCreator: "Cosmoshi Netowoko",
|
||||
p2pVersion: 8,
|
||||
blockVersion: 11,
|
||||
@ -60,8 +63,6 @@ export const tendermintInstances: readonly TendermintInstance[] = [
|
||||
|
||||
export const defaultInstance: TendermintInstance = tendermintInstances[0];
|
||||
|
||||
export const chainIdMatcher = /^[-a-zA-Z0-9]{3,30}$/;
|
||||
|
||||
export function tendermintEnabled(): boolean {
|
||||
return !!process.env.TENDERMINT_ENABLED;
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ command -v shellcheck >/dev/null && shellcheck "$0"
|
||||
# Find latest patch releases at https://hub.docker.com/r/tendermint/tendermint/tags/
|
||||
declare -a TM_VERSIONS
|
||||
TM_VERSIONS[33]=v0.33.8
|
||||
TM_VERSIONS[34]=v0.34.0
|
||||
TM_VERSIONS[34]=v0.34.10
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
|
@ -4,7 +4,7 @@ command -v shellcheck >/dev/null && shellcheck "$0"
|
||||
|
||||
declare -a TM_VERSIONS
|
||||
TM_VERSIONS[33]=v0.33.8
|
||||
TM_VERSIONS[34]=v0.34.0
|
||||
TM_VERSIONS[34]=v0.34.10
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user