Skip to content

Add checksum JSON validation tests#736

Open
modernzju wants to merge 1 commit into
CosmWasm:mainfrom
modernzju:main
Open

Add checksum JSON validation tests#736
modernzju wants to merge 1 commit into
CosmWasm:mainfrom
modernzju:main

Conversation

@modernzju

Copy link
Copy Markdown

Summary

This PR adds focused tests for the types.Checksum JSON behavior and constructor validation.

The new coverage verifies that:

  • valid checksums round-trip through JSON as hex strings
  • invalid checksum JSON is rejected for malformed hex, wrong length, and non-string input
  • ForceNewChecksum panics for invalid input as documented

Motivation

Checksum is used as the Go representation of Wasm code hashes and has custom JSON marshal/unmarshal logic with a strict 32-byte length requirement. These tests make that public behavior explicit and help prevent regressions around checksum serialization at the Go/Rust boundary.

Testing

go test ./types -count=1
CGO_ENABLED=0 go test ./types -count=1
go test ./... -count=1
git diff --check

Signed-off-by: modernzju <modernzju@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant