Add support for protobuf TxGenerator and SIGN_MODE_DIRECT (#6385)
* Add TxWrapper, encoder, decoder and DirectModeHandler * fix pkg name * Update API and leave test TODO's * Update TxWrapper API * tests for tx wrapper (#6410) * WIP: added test for direct mode handler * updated code * Add msg * Update TxWrapper API * Fix pubkey declaration * Add pubkey for tests * Fix SetFee * Remove logs * Avoid global var declaration for tests * Add test for GetPubKeys * Fix direct signing tests * Add more test cases for GetSignBytes * Revert SetFee API * Remove logs * Refactor tests Co-authored-by: anilCSE <anil@vitwit.com> Co-authored-by: sahith-narahari <sahithnarahari@gmail.com> * Refactoring * Refactoring * Integrate SignatureV2 API * Fix wrapper tests * Fix tests * Linting and API tweaks * Update API * WIP on updating API * Fix tests * Update to new SigVerifiableTx * Rename * Update docs to reflect ADR 020 * proto-gen * proto docs * cleanup * cleanup * cleanup * cleanup * cleanup * cleanup * cleanup * Add tests * Refactor and improving test coverage * WIP on test coverage * WIP on test coverage * proto-gen * Fix CompactBitArray.Size() bug * Rename * Remove Builder interface * Address review comments * Update x/auth/tx/sigs.go Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com> * Update x/auth/tx/encoder.go Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com> * Update x/auth/tx/encoder.go Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com> * Address review feedback * Fix build issues * Resolve conflicts * Fix ValidateBasic test coverage * Add test for malicious multisig Co-authored-by: atheeshp <59333759+atheeshp@users.noreply.github.com> Co-authored-by: anilCSE <anil@vitwit.com> Co-authored-by: sahith-narahari <sahithnarahari@gmail.com> Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com> Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
This commit is contained in:
co-authored by
anilCSE
sahith-narahari
Federico Kunze
atheeshp
Alexander Bezobchuk
parent
feb69770ef
commit
2f44fbf2ab
@@ -42,7 +42,6 @@ message MultiSignature {
|
||||
// space after proto encoding.
|
||||
// This is not thread safe, and is not intended for concurrent usage.
|
||||
message CompactBitArray {
|
||||
option (gogoproto.sizer) = false;
|
||||
option (gogoproto.goproto_stringer) = false;
|
||||
|
||||
uint32 extra_bits_stored = 1;
|
||||
|
||||
+39
-14
@@ -18,17 +18,34 @@ message Tx {
|
||||
// signers, signer modes and fee
|
||||
AuthInfo auth_info = 2;
|
||||
|
||||
// signatures are the raw binary signatures of signers specified by body and auth_info
|
||||
// signatures is a list of signatures that matches the length and order of AuthInfo's signer_infos to
|
||||
// allow connecting signature meta information like public key and signing mode by position.
|
||||
repeated bytes signatures = 3;
|
||||
}
|
||||
|
||||
// SignDoc is the standard type used for signing transaction in SIGN_MODE_DIRECT
|
||||
message SignDoc {
|
||||
// body is the TxBody from Tx
|
||||
TxBody body = 1;
|
||||
// TxRaw is a variant of Tx that pins the signer's exact binary representation of body and
|
||||
// auth_info. This is used for signing, broadcasting and verification. The binary
|
||||
// `serialize(tx: TxRaw)` is stored in Tendermint and the hash `sha256(serialize(tx: TxRaw))`
|
||||
// becomes the "txhash", commonly used as the transaction ID.
|
||||
message TxRaw {
|
||||
// body_bytes is a protobuf serialization of a TxBody that matches the representation in SignDoc.
|
||||
bytes body_bytes = 1;
|
||||
|
||||
// auth_info is the AuthInfo from Tx
|
||||
AuthInfo auth_info = 2;
|
||||
// auth_info_bytes is a protobuf serialization of an AuthInfo that matches the representation in SignDoc.
|
||||
bytes auth_info_bytes = 2;
|
||||
|
||||
// signatures is a list of signatures that matches the length and order of AuthInfo's signer_infos to
|
||||
// allow connecting signature meta information like public key and signing mode by position.
|
||||
repeated bytes signatures = 3;
|
||||
}
|
||||
|
||||
// SignDoc is the type used for generating sign bytes for SIGN_MODE_DIRECT
|
||||
message SignDoc {
|
||||
// body_bytes is protobuf serialization of a TxBody that matches the representation in TxRaw.
|
||||
bytes body_bytes = 1;
|
||||
|
||||
// auth_info_bytes is a protobuf serialization of an AuthInfo that matches the representation in TxRaw.
|
||||
bytes auth_info_bytes = 2;
|
||||
|
||||
// chain_id is the unique identifier of the chain this transaction targets.
|
||||
// It prevents signed transactions from being used on another chain by an
|
||||
@@ -45,7 +62,12 @@ message SignDoc {
|
||||
|
||||
// TxBody is the body of a transaction that all signers sign over
|
||||
message TxBody {
|
||||
// messages are the processable content of the transaction
|
||||
// messages is a list of messages to be executed. The required signers of those messages define
|
||||
// the number and order of elements in AuthInfo's signer_infos and Tx's signatures.
|
||||
// Each required signer address is added to the list only the first time it occurs.
|
||||
//
|
||||
// By convention, the first required signer (usually from the first message) is referred
|
||||
// to as the primary signer and pays the fee for the whole transaction.
|
||||
repeated google.protobuf.Any messages = 1;
|
||||
|
||||
// memo is any arbitrary memo to be added to the transaction
|
||||
@@ -68,21 +90,24 @@ message TxBody {
|
||||
|
||||
// AuthInfo describes the fee and signer modes that are used to sign a transaction
|
||||
message AuthInfo {
|
||||
// signer_infos is the list of signer infos which corresponds with
|
||||
// Tx.signatures and expected signers derived from TxBody.messages. All signers
|
||||
// are expected to occur in the same order in each of these locations
|
||||
// signer_infos defines the signing modes for the required signers. The number
|
||||
// and order of elements must match the required signers from TxBody's messages.
|
||||
// The first element is the primary signer and the one which pays the fee.
|
||||
repeated SignerInfo signer_infos = 1;
|
||||
|
||||
// Fee is the fee and gas limit for the transaction. The first signer is the
|
||||
// primary signer and the one which pays the fee
|
||||
// primary signer and the one which pays the fee. The fee can be calculated
|
||||
// based on the cost of evaluating the body and doing signature verification
|
||||
// of the signers. This can be estimated via simulation.
|
||||
Fee fee = 2;
|
||||
}
|
||||
|
||||
// SignerInfo describes the public key and signing mode of a single top-level signer
|
||||
message SignerInfo {
|
||||
// public_key is the public key of the signer. It is optional for accounts
|
||||
// that already exist in state
|
||||
google.protobuf.Any public_key = 1;
|
||||
// that already exist in state. If unset, the verifier can use the required \
|
||||
// signer address for this position and lookup the public key.
|
||||
cosmos.crypto.PublicKey public_key = 1;
|
||||
|
||||
// mode_info describes the signing mode of the signer and is a nested
|
||||
// structure to support nested multisig pubkey's
|
||||
|
||||
Reference in New Issue
Block a user