Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Villaquiranm committed Dec 9, 2024
1 parent 18a3541 commit 1e19951
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
4 changes: 1 addition & 3 deletions contribs/gnogenesis/internal/txs/txs_add_packages.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ import (
"github.com/gnolang/gno/tm2/pkg/std"
)

var (
errInvalidPackageDir = errors.New("invalid package directory")
)
var errInvalidPackageDir = errors.New("invalid package directory")

// Keep in sync with gno.land/cmd/start.go
var (
Expand Down
19 changes: 19 additions & 0 deletions gno.land/pkg/integration/testing_integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,11 @@ func (pl *pkgsLoader) SetPatch(replace, with string) {
}

func (pl *pkgsLoader) LoadPackages(creator bft.Address, fee std.Fee, deposit std.Coins) ([]gnoland.TxWithMetadata, error) {
kb := keys.NewInMemory()
_, err := kb.CreateAccount("creator", DefaultAccount_Seed, "", "", 0, 0)
if err != nil {
return nil, fmt.Errorf("createAccount: %w", err)
}
pkgslist, err := pl.List().Sort() // sorts packages by their dependencies.
if err != nil {
return nil, fmt.Errorf("unable to sort packages: %w", err)
Expand Down Expand Up @@ -695,6 +700,20 @@ func (pl *pkgsLoader) LoadPackages(creator bft.Address, fee std.Fee, deposit std
}
}
}
signbytes, err := tx.GetSignBytes("tendermint_test", 0, 0)
if err != nil {
return nil, fmt.Errorf("unable to get sign bytes %q: %w", pkg.Name, err)
}
signature, pubKey, err := kb.Sign("creator", "", signbytes)
if err != nil {
return nil, fmt.Errorf("unable to sign transaction %q: %w", pkg.Name, err)
}
tx.Signatures = []std.Signature{
{
PubKey: pubKey,
Signature: signature,
},
}

txs[i] = gnoland.TxWithMetadata{
Tx: tx,
Expand Down
4 changes: 3 additions & 1 deletion tm2/pkg/sdk/auth/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,9 @@ func NewAnteHandler(ak AccountKeeper, bank BankKeeperI, sigGasConsumer Signature

// check signature, return account with incremented nonce
sacc := signerAccs[i]
if isGenesis && !opts.VerifyGenesisSignatures {
// Do not check signatures if the chainID is dev (gnodev) if we decide to verify the genesis signatures for
// gnodev the initialization would take longer
if isGenesis && (!opts.VerifyGenesisSignatures || newCtx.ChainID() == "dev") {
// No signatures are needed for genesis.
} else {
// Check signature
Expand Down

0 comments on commit 1e19951

Please sign in to comment.