Commit Graph

11 Commits

Author SHA1 Message Date
Chirantan Ekbote 3c6702b6f7 sdk/rust: Add serde_wormhole::RawMessage
Add a RawMessage type that can be used to defer parsing parts of a
payload, similar to the `json.RawMessage` from Go.  The implementation
is inspired by `serde_json::RawValue`, which does a similar thing.

When serializing, RawMessage will serialize to a base64-encoded string
if it detects that the data format is human readable (like JSON).
Otherwise it will simply forward the raw bytes to the serializer.

RawMessage has both borrowed and boxed versions.  The borrowed version
is the most efficient as it enables zero-copy handling of the input data
but also requires that the input data already contains raw bytes and is
not suitable when dealing with human-readable formats like JSON.

The boxed version is more flexible as it supports byte slices, base64-
encoded strings, and byte sequences but is slightly less efficient as it
requires copying or decoding the input data.
2023-01-18 09:29:05 +09:00
Chirantan Ekbote ab172b4da5 sdk/rust: Ensure chain conversions are isomorphic
Ensure that converting `Chain` to/from a u16 or to/from a string is
always isomorphic.  This requires changing the `FromStr` impl so that in
can handle strings like "Unknown(27)".
2023-01-04 16:17:14 +09:00
Chirantan Ekbote 16b22a8cfc cosmwasm: wormhole-bindings: Use the Signature type from the SDK
Use the `Signature` type from the core SDK to avoid unnecessary
type conversions.  Cosmwasm requires its message types to implement
`JsonSchema` so also derive that impl for the `Signature` type behind a
feature flag.

This change uncovered a separate issue where the fake `WormholeKeeper`
was using regular ecdsa signatures rather than recoverable signatures
so fix the signing and verification methods to use the recoverable
signatures.
2022-12-15 12:22:37 +09:00
Chirantan Ekbote d157c7bf67 sdk/rust: Add serde-based struct defintions
Refactor the core crate to add serde-based struct definitions for the
various messages used by the different wormhole smart contracts.  This
will also make it easier to use alternate data formats (like json) for
client-side tooling.

Co-authored-by: Reisen <reisen@morphism.org>
2022-12-14 16:33:22 +09:00
Chirantan Ekbote 92cb3d28a3 sdk/rust: Add serde_wormhole crate
The serde_wormhole crate implements the wormhole wire format as a serde
data format.  This will let us replace all the hand-rolled
serialization with auto-generated code, which is less error-prone and
easier to review.
2022-12-14 16:33:22 +09:00
Chirantan Ekbote 676d729e3a sdk/rust: Fix clippy warnings 2022-10-28 14:35:44 -04:00
Chirantan Ekbote e907a05b1e sdk, terra: Fix tests and add them to CI
The terra tests had bit rotted quite terribly. It seems no one has run
them in almost a year because the API changed with the 0.14 release of
cosmwasm_vm in April, 2021.

Completely remove cosmwasm_vm from dev-dependencies.  The tests aren't
doing anything that requires interacting with the wasm code and can just
test the relevant functions directly.

Once this goes in the tests should be running in the CI so hopefully no
one will be able to push any more breaking changes.

commit-id:537d95e6
2022-04-20 09:46:51 +09:00
Hendrik Hofstadt c04d25e704 Fix solana integration tests & add test for account creation
Change-Id: I222744f194f952d03bfbd3ba4469bce59c310fc0
2022-04-11 21:29:39 -04:00
Reisen 03aae4a48a terra: fix messenger builds for sdk
Change-Id: Id30399c6a0521621c60f8382f13bd29714e6c116
2022-01-14 14:55:40 -05:00
Reisen e561d6de02 sdk: fixes to types and builds
Change-Id: I10b753450445cc021dbeb9f28ddb0384070e9635
2022-01-14 13:09:12 +00:00
Reisen ee0fea0436 sdk: add underlying sdk for wormhole programs
Change-Id: I858f3e43e6458af51131de9165a63078e4bb024c
2022-01-14 13:09:12 +00:00