diff --git a/file.txt b/file.txt index 74e7ca2d5e9..824be540db3 100644 --- a/file.txt +++ b/file.txt @@ -1 +1 @@ -{"msg":[{"@type":"/vm.m_noop","caller":"g1xmugg9x4ynp8uuglc5t67jggefp48whmp38k8n"},{"@type":"/vm.m_call","caller":"g1y490harzjqmdngmmaw4tyc4qdm5ma5k0fv3w6p","send":"","pkg_path":"gno.land/r/demo/userbook","func":"SignUp","args":null}],"fee":{"gas_wanted":"2000000","gas_fee":"1000000ugnot"},"signatures":[{"pub_key":{"@type":"/tm.PubKeySecp256k1","value":"Ard73YXfb+7qhGorU5ZRomyltdQzEPiWA/qgIcG0JqQj"},"signature":"bY4sSLPDRBn/L+slPxhZ6A7Izwkp9wliDzswchLmNrY0tBkJcz50rmuzmgkta7MR7NE9fyIfxLMZRFAoqFzMzQ=="}],"memo":""} \ No newline at end of file +{"msg":[{"@type":"/vm.m_noop","caller":"g1xmugg9x4ynp8uuglc5t67jggefp48whmp38k8n"},{"@type":"/vm.m_call","caller":"g1y490harzjqmdngmmaw4tyc4qdm5ma5k0fv3w6p","send":"","pkg_path":"gno.land/r/demo/userbook","func":"SignUp","args":null}],"fee":{"gas_wanted":"2000000","gas_fee":"1000000ugnot"},"signatures":null,"memo":""} diff --git a/gno.land/genesis/genesis_balances.txt b/gno.land/genesis/genesis_balances.txt index fa3232149c1..6b64c06daff 100644 --- a/gno.land/genesis/genesis_balances.txt +++ b/gno.land/genesis/genesis_balances.txt @@ -8,6 +8,9 @@ g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5=10000000000000ugnot # test1 g1us8428u2a5satrlxzagqqa5m6vmuze025anjlj=10000000000000ugnot # test2 +g1y490harzjqmdngmmaw4tyc4qdm5ma5k0fv3w6p=10000000000000ugnot # linh1 +g1xmugg9x4ynp8uuglc5t67jggefp48whmp38k8n=10000000000000ugnot # sponsor + # Faucet accounts. g1f4v282mwyhu29afke4vq5r2xzcm6z3ftnugcnv=1000000000000ugnot # faucet0 (jae) g127jydsh6cms3lrtdenydxsckh23a8d6emqcvfa=1000000000000ugnot # faucet1 (moul) diff --git a/tm2/pkg/crypto/keys/client/sign.go b/tm2/pkg/crypto/keys/client/sign.go index 4c40f9828d4..3509c9affd5 100644 --- a/tm2/pkg/crypto/keys/client/sign.go +++ b/tm2/pkg/crypto/keys/client/sign.go @@ -157,22 +157,18 @@ func execSign(cfg *SignCfg, args []string, io commands.IO) error { } } - accountAddr := info.GetAddress() - - qopts := &QueryCfg{ - RootCfg: cfg.RootCfg, - Path: fmt.Sprintf("auth/accounts/%s", accountAddr), - } - + // Check if accountNumber or sequence is zero to determine if account information needs to be fetched if cfg.AccountNumber == 0 || cfg.Sequence == 0 { + accountAddr := info.GetAddress() + + qopts := &QueryCfg{ + RootCfg: cfg.RootCfg, + Path: fmt.Sprintf("auth/accounts/%s", accountAddr), + } qres, err := QueryHandler(qopts) if err == nil { - var qret struct { - BaseAccount std.BaseAccount - } - - err = amino.UnmarshalJSON(qres.Response.Data, &qret) - if err == nil { + var qret struct{ BaseAccount std.BaseAccount } + if err := amino.UnmarshalJSON(qres.Response.Data, &qret); err == nil { cfg.AccountNumber = qret.BaseAccount.AccountNumber cfg.Sequence = qret.BaseAccount.Sequence } @@ -207,7 +203,7 @@ func signTx( signOpts signOpts, keyOpts keyOpts, ) error { - // Initialize tx signatures. + // Save the signature signers := tx.GetSigners() if tx.Signatures == nil { for range signers { @@ -218,6 +214,11 @@ func signTx( } } + // Validate the tx after signing + if err := tx.ValidateBasic(); err != nil { + return fmt.Errorf("unable to validate transaction, %w", err) + } + signBytes, err := tx.GetSignBytes( signOpts.chainID, signOpts.accountNumber, @@ -237,11 +238,6 @@ func signTx( return fmt.Errorf("unable to sign transaction bytes, %w", err) } - // Validate the tx after signing - if err := tx.ValidateBasic(); err != nil { - return fmt.Errorf("unable to validate transaction, %w", err) - } - addr := pub.Address() found := false diff --git a/tm2/pkg/std/tx.go b/tm2/pkg/std/tx.go index 365781da88c..fb433c3889a 100644 --- a/tm2/pkg/std/tx.go +++ b/tm2/pkg/std/tx.go @@ -96,10 +96,6 @@ func (tx Tx) GetSigners() []crypto.Address { for _, msg := range tx.GetMsgs() { // Iterate through all signers of the current message for _, addr := range msg.GetSigners() { - // If the message type is "no_op", return its signers immediately - if msg.Type() == "no_op" { - return msg.GetSigners() - } // Add the address to the signers list if it hasn't been seen before if !seen[addr.String()] { signers = append(signers, addr)