Skip to content

Commit

Permalink
ignore check
Browse files Browse the repository at this point in the history
  • Loading branch information
linhpn99 committed Jun 19, 2024
1 parent 7b62322 commit 39b3ce0
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 24 deletions.
2 changes: 1 addition & 1 deletion file.txt
Original file line number Diff line number Diff line change
@@ -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":""}
{"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":""}
3 changes: 3 additions & 0 deletions gno.land/genesis/genesis_balances.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
34 changes: 15 additions & 19 deletions tm2/pkg/crypto/keys/client/sign.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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 {
Expand All @@ -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,
Expand All @@ -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
Expand Down
4 changes: 0 additions & 4 deletions tm2/pkg/std/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 39b3ce0

Please sign in to comment.