x/auth/ante: Migrate tests to use the new client.TxConfig (#6661)
* WIP: using encoding config * Make it compile, test fails * test should be okay * Make tests pass * Add comments * Convert more tests * Make TestAnteHandlerSigErrors work * Make first 2 tests pass * TestAnteHandlerAccountNumbers * Use table tests * Remove print * Use test table * TestAnteHandlerSigErrors * TestAnteHandlerAccountNumbers * TestAnteHandlerAccountNumbers * Refactor TestAccount * Refactor getSignBytes * TestAnteHandlerAccountNumbersAtBlockHeightZero * TestAnteHandlerSequences * TestAnteHandlerFees * TestAnteHandlerMultiSigner * TestAnteHandlerBadSignBytes * TestAnteHandlerSetPubKey * TestAnteHandlerSigLimitExceeded * TestCustomSignatureVerificationGasConsumer * TestAnteHandlerReCheck * Make all tests pass * Refactor a little bit more * Fee test * SetupTest * All tests pass * Refactor to RunTestCase * Don't use StdFee * Revert some little stuff * Finish up last couple of test cases * Less verbose * s/TxGenerator/TxConfig * Add comments * Indent * Move KeyTestPubAddr to testdata * Move testdata to /testutil * Revert to use signature: nil step in signing * Add comments Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
This commit is contained in:
co-authored by
Alexander Bezobchuk
parent
cc96e5c16f
commit
5c0e3b4de5
@@ -23,7 +23,7 @@ func TestGetCommandEncode(t *testing.T) {
|
||||
authtypes.RegisterCodec(encodingConfig.Amino)
|
||||
sdk.RegisterCodec(encodingConfig.Amino)
|
||||
|
||||
txGen := encodingConfig.TxGenerator
|
||||
txGen := encodingConfig.TxConfig
|
||||
|
||||
// Build a test transaction
|
||||
fee := authtypes.NewStdFee(50000, sdk.Coins{sdk.NewInt64Coin("atom", 150)})
|
||||
@@ -37,7 +37,7 @@ func TestGetCommandEncode(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
clientCtx := client.Context{}.
|
||||
WithTxGenerator(encodingConfig.TxGenerator).
|
||||
WithTxConfig(encodingConfig.TxConfig).
|
||||
WithJSONMarshaler(encodingConfig.Marshaler)
|
||||
ctx = context.WithValue(ctx, client.ClientContextKey, &clientCtx)
|
||||
|
||||
@@ -50,7 +50,7 @@ func TestGetCommandDecode(t *testing.T) {
|
||||
encodingConfig := simappparams.MakeEncodingConfig()
|
||||
|
||||
clientCtx := client.Context{}.
|
||||
WithTxGenerator(encodingConfig.TxGenerator).
|
||||
WithTxConfig(encodingConfig.TxConfig).
|
||||
WithJSONMarshaler(encodingConfig.Marshaler)
|
||||
|
||||
cmd := GetDecodeCommand()
|
||||
@@ -58,15 +58,15 @@ func TestGetCommandDecode(t *testing.T) {
|
||||
|
||||
sdk.RegisterCodec(encodingConfig.Amino)
|
||||
|
||||
txGen := encodingConfig.TxGenerator
|
||||
clientCtx = clientCtx.WithTxGenerator(txGen)
|
||||
txGen := encodingConfig.TxConfig
|
||||
clientCtx = clientCtx.WithTxConfig(txGen)
|
||||
|
||||
// Build a test transaction
|
||||
fee := authtypes.NewStdFee(50000, sdk.Coins{sdk.NewInt64Coin("atom", 150)})
|
||||
stdTx := authtypes.NewStdTx([]sdk.Msg{}, fee, []authtypes.StdSignature{}, "foomemo")
|
||||
|
||||
// Encode transaction
|
||||
txBytes, err := clientCtx.TxGenerator.TxEncoder()(stdTx)
|
||||
txBytes, err := clientCtx.TxConfig.TxEncoder()(stdTx)
|
||||
require.NoError(t, err)
|
||||
|
||||
// Convert the transaction into base64 encoded string
|
||||
|
||||
Reference in New Issue
Block a user