Remove compressedChecksum

This commit is contained in:
Simon Warta 2023-05-24 00:49:44 +02:00
parent 94ed39b4e3
commit 7f9425f7d9
3 changed files with 13 additions and 10 deletions

View File

@ -16,12 +16,16 @@ and this project adheres to
query strings and key/value pairs are now supported. ([#1411])
- @cosmjs/cosmwasm-stargate: Let `searchTx` return non-readonly array. The
caller owns this array and can mutate it as they want. ([#1411])
- @cosmjs/cosmwasm-stargate: In `UploadResult` (result from
`SigningCosmWasmClient.upload`), rename `originalChecksum` to `checksum` and
remove `compressedChecksum` ([#1409]).
- @cosmjs/stargate: Implement auto-detection for Tendermint 0.34/37 ([#1411]).
- @cosmjs/stargate: Remove structured `searchTx` queries. Only raw query strings
and key/value pairs are now supported. ([#1411])
- @cosmjs/stargate: Let `searchTx` return non-readonly array. The caller owns
this array and can mutate it as they want. ([#1411])
[#1409]: https://github.com/cosmos/cosmjs/issues/1409
[#1411]: https://github.com/cosmos/cosmjs/pull/1411
## [0.30.1] - 2023-03-22

View File

@ -104,11 +104,13 @@ describe("SigningCosmWasmClient", () => {
const options = { ...defaultSigningClientOptions, prefix: wasmd.prefix };
const client = await SigningCosmWasmClient.connectWithSigner(wasmd.endpoint, wallet, options);
const wasm = getHackatom().data;
const { codeId, originalChecksum, originalSize, compressedChecksum, compressedSize } =
await client.upload(alice.address0, wasm, defaultUploadFee);
expect(originalChecksum).toEqual(toHex(sha256(wasm)));
const { codeId, checksum, originalSize, compressedSize } = await client.upload(
alice.address0,
wasm,
defaultUploadFee,
);
expect(checksum).toEqual(toHex(sha256(wasm)));
expect(originalSize).toEqual(wasm.length);
expect(compressedChecksum).toMatch(/^[0-9a-f]{64}$/);
expect(compressedSize).toBeLessThan(wasm.length * 0.5);
expect(codeId).toBeGreaterThanOrEqual(1);
client.disconnect();

View File

@ -67,14 +67,12 @@ import {
} from "./modules";
export interface UploadResult {
/** A hex encoded sha256 checksum of the original Wasm code (that is stored on chain) */
readonly checksum: string;
/** Size of the original wasm code in bytes */
readonly originalSize: number;
/** A hex encoded sha256 checksum of the original wasm code (that is stored on chain) */
readonly originalChecksum: string;
/** Size of the compressed wasm code in bytes */
readonly compressedSize: number;
/** A hex encoded sha256 checksum of the compressed wasm code (that stored in the transaction) */
readonly compressedChecksum: string;
/** The ID of the code asigned by the chain */
readonly codeId: number;
readonly logs: readonly logs.Log[];
@ -301,10 +299,9 @@ export class SigningCosmWasmClient extends CosmWasmClient {
const parsedLogs = logs.parseRawLog(result.rawLog);
const codeIdAttr = logs.findAttribute(parsedLogs, "store_code", "code_id");
return {
checksum: toHex(sha256(wasmCode)),
originalSize: wasmCode.length,
originalChecksum: toHex(sha256(wasmCode)),
compressedSize: compressed.length,
compressedChecksum: toHex(sha256(compressed)),
codeId: Number.parseInt(codeIdAttr.value, 10),
logs: parsedLogs,
height: result.height,