From 27d32f1bd32364c1cc29532a9ae4929a90e90f6f Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Tue, 11 Jun 2024 16:51:35 -0400 Subject: [PATCH] add example --- .../adr-074-implicit-msg-signers.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/docs/architecture/adr-074-implicit-msg-signers.md b/docs/architecture/adr-074-implicit-msg-signers.md index 8b4a457c85fb..b6ca4f72fd88 100644 --- a/docs/architecture/adr-074-implicit-msg-signers.md +++ b/docs/architecture/adr-074-implicit-msg-signers.md @@ -71,6 +71,24 @@ message MsgV2 { Because the `cosmos.msg.v1.signer` annotation is required currently, `MsgV2` types should set the message option `cosmos.msg.v2.is_msg` to `true` instead. +Here is an example comparing a v1 an v2 message: +```protobuf +// v1 +message MsgSendV1 { + string from_address = 1 [(cosmos.msg.v1.signer) = true]; + string to_address = 2; + repeated Coin amount = 3; +} + +// v2 +message MsgSendV2 { + option (cosmos.msg.v2.is_msg) = true; + // from address is implied by the signer + string to_address = 1; + repeated Coin amount = 2; +} +``` + Modules defining handlers for `MsgV2` instances will need to extract the sender from the `context.Context` that is passed in. An interface in `core` which will be present on the `appmodule.Environment` will be defined for this purpose: ```go