Reconstruct a CosmWasm contract’s migration timeline
An instance keeps its address across a code migration. A trace tied only to that address can therefore refer to different implementations at different heights.
Read history for the instance
Set CONTRACT to the instance address and GRPC to a wasmd TLS gRPC endpoint with reflection. Inspect operation, codeId and updated position for each entry. Continue pagination if the response supplies a next key.
grpcurl -d "{\"address\":\"$CONTRACT\",\"pagination\":{\"limit\":\"50\"}}" "$GRPC" cosmwasm.wasm.v1.Query/ContractHistory
Suppose an instantiate entry selects code 8 and a later migrate entry selects code 12. Use the recorded position to determine which code served an incident. If both changes and the call share a block, inspect the transaction order.
Separate historical code from historical state
The timeline resolves implementation changes. Replaying a query from months ago also requires the application state at the relevant height. Old code availability alone cannot reconstruct balances, configuration or other mutable contract data. github.com wasmd Query API