diff --git a/tests/e2e/configurer/chain/commands.go b/tests/e2e/configurer/chain/commands.go
index c1e96bac5..756af93d2 100644
--- a/tests/e2e/configurer/chain/commands.go
+++ b/tests/e2e/configurer/chain/commands.go
@@ -25,18 +25,19 @@ import (
func (n *NodeConfig) StoreWasmCode(wasmFile, from string) {
n.LogActionF("storing wasm code from file %s", wasmFile)
- cmd := []string{"terrad", "tx", "wasm", "store", wasmFile, fmt.Sprintf("--from=%s", from)}
+ cmd := []string{"terrad", "tx", "wasm", "store", wasmFile, fmt.Sprintf("--from=%s", from), "--fees=10uluna", "--gas=2000000"}
_, _, err := n.containerManager.ExecTxCmd(n.t, n.chainID, n.Name, cmd)
require.NoError(n.t, err)
n.LogActionF("successfully stored")
}
-func (n *NodeConfig) InstantiateWasmContract(codeID, initMsg, amount, from string) {
+func (n *NodeConfig) InstantiateWasmContract(codeID, initMsg, amount, from string, gasLimit string, fees sdk.Coins) {
n.LogActionF("instantiating wasm contract %s with %s", codeID, initMsg)
cmd := []string{"terrad", "tx", "wasm", "instantiate", codeID, initMsg, fmt.Sprintf("--from=%s", from), "--no-admin", "--label=ratelimit"}
if amount != "" {
cmd = append(cmd, fmt.Sprintf("--amount=%s", amount))
}
+ cmd = append(cmd, "--gas", gasLimit, "--fees", fees.String())
n.LogActionF(strings.Join(cmd, " "))
_, _, err := n.containerManager.ExecTxCmd(n.t, n.chainID, n.Name, cmd)
@@ -45,7 +46,7 @@ func (n *NodeConfig) InstantiateWasmContract(codeID, initMsg, amount, from strin
n.LogActionF("successfully initialized")
}
-func (n *NodeConfig) Instantiate2WasmContract(codeID, initMsg, salt, amount, fee, gas, from string) {
+func (n *NodeConfig) Instantiate2WasmContract(codeID, initMsg, salt, amount, from string, gasLimit string, fees sdk.Coins) {
n.LogActionF("instantiating wasm contract %s with %s", codeID, initMsg)
encodedSalt := make([]byte, hex.EncodedLen(len([]byte(salt))))
hex.Encode(encodedSalt, []byte(salt))
@@ -53,27 +54,20 @@ func (n *NodeConfig) Instantiate2WasmContract(codeID, initMsg, salt, amount, fee
if amount != "" {
cmd = append(cmd, fmt.Sprintf("--amount=%s", amount))
}
- if fee != "" {
- cmd = append(cmd, fmt.Sprintf("--fees=%s", fee))
- }
- if gas != "" {
- cmd = append(cmd, fmt.Sprintf("--gas=%s", gas))
- }
+ cmd = append(cmd, "--gas", gasLimit, "--fees", fees.String())
n.LogActionF(strings.Join(cmd, " "))
_, _, err := n.containerManager.ExecTxCmd(n.t, n.chainID, n.Name, cmd)
require.NoError(n.t, err)
n.LogActionF("successfully initialized")
}
-func (n *NodeConfig) WasmExecute(contract, execMsg, amount, fee, from string) {
+func (n *NodeConfig) WasmExecute(contract, execMsg, amount, from string, gasLimit string, fees sdk.Coins) {
n.LogActionF("executing %s on wasm contract %s from %s", execMsg, contract, from)
cmd := []string{"terrad", "tx", "wasm", "execute", contract, execMsg, fmt.Sprintf("--from=%s", from)}
if amount != "" {
cmd = append(cmd, fmt.Sprintf("--amount=%s", amount))
}
- if fee != "" {
- cmd = append(cmd, fmt.Sprintf("--fees=%s", fee))
- }
+ cmd = append(cmd, "--gas", gasLimit, "--fees", fees.String())
n.LogActionF(strings.Join(cmd, " "))
_, _, err := n.containerManager.ExecTxCmd(n.t, n.chainID, n.Name, cmd)
require.NoError(n.t, err)
@@ -124,6 +118,7 @@ func (n *NodeConfig) SubmitAddBurnTaxExemptionAddressProposal(addresses []string
"add-burn-tax-exemption-address", strings.Join(addresses, ","),
"--title=\"burn tax exemption address\"",
"--description=\"\"burn tax exemption address",
+ "--gas", "300000", "--gas-prices", "1uluna",
fmt.Sprintf("--from=%s", walletName),
}
@@ -152,7 +147,7 @@ func (n *NodeConfig) FailIBCTransfer(from, recipient, amount string) {
func (n *NodeConfig) SendIBCTransfer(from, recipient, amount, memo string) {
n.LogActionF("IBC sending %s from %s to %s. memo: %s", amount, from, recipient, memo)
- cmd := []string{"terrad", "tx", "ibc-transfer", "transfer", "transfer", "channel-0", recipient, amount, fmt.Sprintf("--from=%s", from), "--memo", memo}
+ cmd := []string{"terrad", "tx", "ibc-transfer", "transfer", "transfer", "channel-0", recipient, amount, fmt.Sprintf("--from=%s", from), "--memo", memo, "--fees=10uluna"}
_, _, err := n.containerManager.ExecTxCmdWithSuccessString(n.t, n.chainID, n.Name, cmd, "\"code\":0")
require.NoError(n.t, err)
@@ -171,7 +166,7 @@ func (n *NodeConfig) SubmitTextProposal(text string, initialDeposit sdk.Coin) {
func (n *NodeConfig) DepositProposal(proposalNumber int) {
n.LogActionF("depositing on proposal: %d", proposalNumber)
deposit := sdk.NewCoin(initialization.TerraDenom, sdk.NewInt(20*assets.MicroUnit)).String()
- cmd := []string{"terrad", "tx", "gov", "deposit", fmt.Sprintf("%d", proposalNumber), deposit, "--from=val"}
+ cmd := []string{"terrad", "tx", "gov", "deposit", fmt.Sprintf("%d", proposalNumber), deposit, "--from=val", "--gas", "300000", "--fees", "10000000uluna"}
_, _, err := n.containerManager.ExecTxCmd(n.t, n.chainID, n.Name, cmd)
require.NoError(n.t, err)
n.LogActionF("successfully deposited on proposal %d", proposalNumber)
@@ -179,7 +174,7 @@ func (n *NodeConfig) DepositProposal(proposalNumber int) {
func (n *NodeConfig) VoteYesProposal(from string, proposalNumber int) {
n.LogActionF("voting yes on proposal: %d", proposalNumber)
- cmd := []string{"terrad", "tx", "gov", "vote", fmt.Sprintf("%d", proposalNumber), "yes", fmt.Sprintf("--from=%s", from)}
+ cmd := []string{"terrad", "tx", "gov", "vote", fmt.Sprintf("%d", proposalNumber), "yes", fmt.Sprintf("--from=%s", from), "--gas", "300000", "--fees", "10000000uluna"}
_, _, err := n.containerManager.ExecTxCmd(n.t, n.chainID, n.Name, cmd)
require.NoError(n.t, err)
n.LogActionF("successfully voted yes on proposal %d", proposalNumber)
@@ -216,36 +211,37 @@ func extractProposalIDFromResponse(response string) (int, error) {
return proposalID, nil
}
-func (n *NodeConfig) BankSend(amount string, sendAddress string, receiveAddress string) {
- n.BankSendWithWallet(amount, sendAddress, receiveAddress, "val")
+func (n *NodeConfig) BankSend(amount string, sendAddress string, receiveAddress string, gasLimit string, fees sdk.Coins) {
+ n.BankSendWithWallet(amount, sendAddress, receiveAddress, "val", gasLimit, fees)
}
-func (n *NodeConfig) BankSendWithWallet(amount string, sendAddress string, receiveAddress string, walletName string) {
+func (n *NodeConfig) BankSendWithWallet(amount string, sendAddress string, receiveAddress string, walletName string, gasLimit string, fees sdk.Coins) {
n.LogActionF("bank sending %s from address %s to %s", amount, sendAddress, receiveAddress)
cmd := []string{"terrad", "tx", "bank", "send", sendAddress, receiveAddress, amount, fmt.Sprintf("--from=%s", walletName)}
+ cmd = append(cmd, "--fees", fees.String(), "--gas", gasLimit)
_, _, err := n.containerManager.ExecTxCmd(n.t, n.chainID, n.Name, cmd)
require.NoError(n.t, err)
n.LogActionF("successfully sent bank sent %s from address %s to %s", amount, sendAddress, receiveAddress)
}
-func (n *NodeConfig) BankSendFeeGrantWithWallet(amount string, sendAddress string, receiveAddress string, feeGranter string, walletName string) {
+func (n *NodeConfig) BankSendFeeGrantWithWallet(amount string, sendAddress string, receiveAddress string, feeGranter string, walletName string, gasLimit string, fees sdk.Coins) {
n.LogActionF("bank sending %s from address %s to %s", amount, sendAddress, receiveAddress)
cmd := []string{"terrad", "tx", "bank", "send", sendAddress, receiveAddress, amount, fmt.Sprintf("--fee-granter=%s", feeGranter), fmt.Sprintf("--from=%s", walletName)}
+ cmd = append(cmd, "--fees", fees.String(), "--gas", gasLimit)
_, _, err := n.containerManager.ExecTxCmd(n.t, n.chainID, n.Name, cmd)
require.NoError(n.t, err)
n.LogActionF("successfully sent bank sent %s from address %s to %s", amount, sendAddress, receiveAddress)
}
-func (n *NodeConfig) BankMultiSend(amount string, split bool, sendAddress string, receiveAddresses ...string) {
+func (n *NodeConfig) BankMultiSend(amount string, split bool, sendAddress string, gasLimit string, fees sdk.Coins, receiveAddresses ...string) {
n.LogActionF("bank multisending from %s to %s", sendAddress, strings.Join(receiveAddresses, ","))
cmd := []string{"terrad", "tx", "bank", "multi-send", sendAddress}
cmd = append(cmd, receiveAddresses...)
- cmd = append(cmd, amount, "--from=val")
+ cmd = append(cmd, amount, "--from=val", "--fees", fees.String(), "--gas", gasLimit)
if split {
cmd = append(cmd, "--split")
}
-
_, _, err := n.containerManager.ExecTxCmd(n.t, n.chainID, n.Name, cmd)
require.NoError(n.t, err)
n.LogActionF("successfully multisent %s to %s", sendAddress, strings.Join(receiveAddresses, ","))
@@ -253,7 +249,7 @@ func (n *NodeConfig) BankMultiSend(amount string, split bool, sendAddress string
func (n *NodeConfig) GrantAddress(granter, gratee string, spendLimit string, walletName string) {
n.LogActionF("granting for address %s", gratee)
- cmd := []string{"terrad", "tx", "feegrant", "grant", granter, gratee, fmt.Sprintf("--from=%s", walletName), fmt.Sprintf("--spend-limit=%s", spendLimit)}
+ cmd := []string{"terrad", "tx", "feegrant", "grant", granter, gratee, fmt.Sprintf("--from=%s", walletName), fmt.Sprintf("--spend-limit=%s", spendLimit), "--fees=10uluna"}
_, _, err := n.containerManager.ExecTxCmd(n.t, n.chainID, n.Name, cmd)
require.NoError(n.t, err)
n.LogActionF("successfully granted for address %s", gratee)
diff --git a/tests/e2e/e2e_test.go b/tests/e2e/e2e_test.go
index 26872dced..5780d74cd 100644
--- a/tests/e2e/e2e_test.go
+++ b/tests/e2e/e2e_test.go
@@ -28,7 +28,7 @@ func (s *IntegrationTestSuite) TestIBCWasmHooks() {
nodeA.InstantiateWasmContract(
strconv.Itoa(chainA.LatestCodeID),
`{"count": "0"}`, "",
- initialization.ValidatorWalletName)
+ initialization.ValidatorWalletName, "200000", sdk.NewCoins(sdk.NewCoin(initialization.TerraDenom, sdk.NewInt(10))))
contracts, err := nodeA.QueryContractsFromID(chainA.LatestCodeID)
s.NoError(err)
@@ -104,6 +104,7 @@ func (s *IntegrationTestSuite) TestAddBurnTaxExemptionAddress() {
s.Require().Contains(whitelistedAddresses, whitelistAddr2)
}
+// Each tx gas will cost 2 uluna (1 is for ante handler, 1 is for post handler)
func (s *IntegrationTestSuite) TestFeeTax() {
chain := s.configurer.GetChainConfig(0)
node, err := chain.GetDefaultNode()
@@ -119,14 +120,16 @@ func (s *IntegrationTestSuite) TestFeeTax() {
s.Require().NoError(err)
test1Addr := node.CreateWallet("test1")
+ test2Addr := node.CreateWallet("test2")
// Test 1: banktypes.MsgSend
// burn tax with bank send
- node.BankSend(transferCoin1.String(), validatorAddr, test1Addr)
-
subAmount := transferAmount1.Add(initialization.TaxRate.MulInt(transferAmount1).TruncateInt())
- decremented := validatorBalance.Sub(sdk.NewCoin(initialization.TerraDenom, subAmount))
+ gasLimit := transferCoin1.Amount.MulRaw(initialization.E10).String()
+ node.BankSend(transferCoin1.String(), validatorAddr, test1Addr, gasLimit, sdk.NewCoins(transferCoin1))
+
+ decremented := validatorBalance.Sub(sdk.NewCoin(initialization.TerraDenom, subAmount.AddRaw(2)))
newValidatorBalance, err := node.QuerySpecificBalance(validatorAddr, initialization.TerraDenom)
s.Require().NoError(err)
@@ -136,46 +139,22 @@ func (s *IntegrationTestSuite) TestFeeTax() {
s.Require().Equal(balanceTest1.Amount, transferAmount1)
s.Require().Equal(newValidatorBalance, decremented)
- // Test 2: try bank send with grant
- test2Addr := node.CreateWallet("test2")
- transferAmount2 := sdkmath.NewInt(10000000)
- transferCoin2 := sdk.NewCoin(initialization.TerraDenom, transferAmount2)
-
- node.BankSend(transferCoin2.String(), validatorAddr, test2Addr)
- node.GrantAddress(test2Addr, test1Addr, transferCoin2.String(), "test2")
-
+ // Test 2: banktypes.MsgMultiSend
validatorBalance, err = node.QuerySpecificBalance(validatorAddr, initialization.TerraDenom)
s.Require().NoError(err)
- node.BankSendFeeGrantWithWallet(transferCoin2.String(), test1Addr, validatorAddr, test2Addr, "test1")
-
- newValidatorBalance, err = node.QuerySpecificBalance(validatorAddr, initialization.TerraDenom)
- s.Require().NoError(err)
-
- balanceTest1, err = node.QuerySpecificBalance(test1Addr, initialization.TerraDenom)
- s.Require().NoError(err)
-
- balanceTest2, err := node.QuerySpecificBalance(test2Addr, initialization.TerraDenom)
- s.Require().NoError(err)
-
- s.Require().Equal(balanceTest1.Amount, transferAmount1.Sub(transferAmount2))
- s.Require().Equal(newValidatorBalance, validatorBalance.Add(transferCoin2))
- s.Require().Equal(balanceTest2.Amount, transferAmount2.Sub(initialization.TaxRate.MulInt(transferAmount2).TruncateInt()))
-
- // Test 3: banktypes.MsgMultiSend
- validatorBalance, err = node.QuerySpecificBalance(validatorAddr, initialization.TerraDenom)
- s.Require().NoError(err)
-
- node.BankMultiSend(transferCoin1.String(), false, validatorAddr, test1Addr, test2Addr)
+ totalTransferAmount := transferAmount1.Mul(sdk.NewInt(2))
+ gasLimit = transferCoin1.Amount.MulRaw(initialization.E10).String()
+ node.BankMultiSend(transferCoin1.String(), false, validatorAddr, gasLimit, sdk.NewCoins(transferCoin1), test1Addr, test2Addr)
newValidatorBalance, err = node.QuerySpecificBalance(validatorAddr, initialization.TerraDenom)
s.Require().NoError(err)
- totalTransferAmount := transferAmount1.Mul(sdk.NewInt(2))
subAmount = totalTransferAmount.Add(initialization.TaxRate.MulInt(totalTransferAmount).TruncateInt())
- s.Require().Equal(newValidatorBalance, validatorBalance.Sub(sdk.NewCoin(initialization.TerraDenom, subAmount)))
+ s.Require().Equal(newValidatorBalance, validatorBalance.Sub(sdk.NewCoin(initialization.TerraDenom, subAmount.AddRaw(2))))
}
+// Each tx gas will cost 2 uluna (1 is for ante handler, 1 is for post handler)
func (s *IntegrationTestSuite) TestFeeTaxWasm() {
chain := s.configurer.GetChainConfig(0)
node, err := chain.GetDefaultNode()
@@ -184,14 +163,16 @@ func (s *IntegrationTestSuite) TestFeeTaxWasm() {
testAddr := node.CreateWallet("test")
transferAmount := sdkmath.NewInt(100000000)
transferCoin := sdk.NewCoin(initialization.TerraDenom, transferAmount)
- node.BankSend(fmt.Sprintf("%suluna", transferAmount.Mul(sdk.NewInt(4))), initialization.ValidatorWalletName, testAddr)
+
+ gasLimit := transferCoin.Amount.MulRaw(initialization.E10).String()
+ node.BankSend(fmt.Sprintf("%suluna", transferAmount.Mul(sdk.NewInt(4))), initialization.ValidatorWalletName, testAddr, gasLimit, sdk.NewCoins(transferCoin))
node.StoreWasmCode("counter.wasm", initialization.ValidatorWalletName)
chain.LatestCodeID = int(node.QueryLatestWasmCodeID())
// instantiate contract and transfer 100000000uluna
node.InstantiateWasmContract(
strconv.Itoa(chain.LatestCodeID),
`{"count": "0"}`, transferCoin.String(),
- "test")
+ "test", gasLimit, sdk.NewCoins(transferCoin))
contracts, err := node.QueryContractsFromID(chain.LatestCodeID)
s.Require().NoError(err)
@@ -199,17 +180,15 @@ func (s *IntegrationTestSuite) TestFeeTaxWasm() {
balance1, err := node.QuerySpecificBalance(testAddr, initialization.TerraDenom)
s.Require().NoError(err)
- // 400000000 - 100000000 - 100000000 * TaxRate = 300000000 - 10000000 * TaxRate
+ // 400000000 - 100000000 - 100000000 * TaxRate - 2 (gas) = 300000000 - 10000000 * TaxRate - 2 (gas)
taxAmount := initialization.TaxRate.MulInt(transferAmount).TruncateInt()
- s.Require().Equal(balance1.Amount, transferAmount.Mul(sdk.NewInt(3)).Sub(taxAmount))
-
- stabilityFee := sdk.NewDecWithPrec(2, 2).MulInt(transferAmount)
+ s.Require().Equal(balance1.Amount, transferAmount.Mul(sdk.NewInt(3)).Sub(taxAmount).SubRaw(2))
node.Instantiate2WasmContract(
strconv.Itoa(chain.LatestCodeID),
`{"count": "0"}`, "salt",
transferCoin.String(),
- fmt.Sprintf("%duluna", stabilityFee), "300000", "test")
+ "test", gasLimit, sdk.NewCoins(transferCoin))
contracts, err = node.QueryContractsFromID(chain.LatestCodeID)
s.Require().NoError(err)
@@ -217,16 +196,59 @@ func (s *IntegrationTestSuite) TestFeeTaxWasm() {
balance2, err := node.QuerySpecificBalance(testAddr, initialization.TerraDenom)
s.Require().NoError(err)
- // balance1 - 100000000 - 100000000 * TaxRate
+ // balance1 - 100000000 - 100000000 * TaxRate - 2 (gas)
taxAmount = initialization.TaxRate.MulInt(transferAmount).TruncateInt()
- s.Require().Equal(balance2.Amount, balance1.Amount.Sub(transferAmount).Sub(taxAmount))
+ s.Require().Equal(balance2.Amount, balance1.Amount.Sub(transferAmount).Sub(taxAmount).SubRaw(2))
contractAddr := contracts[0]
- node.WasmExecute(contractAddr, `{"donate": {}}`, transferCoin.String(), fmt.Sprintf("%duluna", stabilityFee), "test")
+ node.WasmExecute(contractAddr, `{"donate": {}}`, transferCoin.String(), "test", gasLimit, sdk.NewCoins(transferCoin))
balance3, err := node.QuerySpecificBalance(testAddr, initialization.TerraDenom)
s.Require().NoError(err)
- // balance2 - 100000000 - 100000000 * TaxRate
+ // balance2 - 100000000 - 100000000 * TaxRate - 2 (gas)
taxAmount = initialization.TaxRate.MulInt(transferAmount).TruncateInt()
- s.Require().Equal(balance3.Amount, balance2.Amount.Sub(transferAmount).Sub(taxAmount))
+ s.Require().Equal(balance3.Amount, balance2.Amount.Sub(transferAmount).Sub(taxAmount).SubRaw(2))
+}
+
+func (s *IntegrationTestSuite) TestFeeTaxGrant() {
+ chain := s.configurer.GetChainConfig(0)
+ node, err := chain.GetDefaultNode()
+ s.Require().NoError(err)
+
+ transferAmount := sdkmath.NewInt(100000000)
+ transferCoin := sdk.NewCoin(initialization.TerraDenom, transferAmount)
+
+ validatorAddr := node.GetWallet(initialization.ValidatorWalletName)
+ s.Require().NotEqual(validatorAddr, "")
+
+ test1Addr := node.CreateWallet("test1")
+ test2Addr := node.CreateWallet("test2")
+
+ // Test 1: try bank send with grant
+ gasLimit := transferCoin.Amount.MulRaw(initialization.E10).String()
+ node.BankSend(transferCoin.String(), validatorAddr, test1Addr, gasLimit, sdk.NewCoins(transferCoin))
+ node.BankSend(transferCoin.String(), validatorAddr, test1Addr, gasLimit, sdk.NewCoins(transferCoin))
+ node.BankSend(transferCoin.String(), validatorAddr, test2Addr, gasLimit, sdk.NewCoins(transferCoin))
+ node.GrantAddress(test2Addr, test1Addr, transferCoin.String(), "test2")
+
+ validatorBalance, err := node.QuerySpecificBalance(validatorAddr, initialization.TerraDenom)
+ s.Require().NoError(err)
+
+ node.BankSendFeeGrantWithWallet(transferCoin.String(), test1Addr, validatorAddr, test2Addr, "test1", gasLimit, sdk.NewCoins(transferCoin))
+
+ newValidatorBalance, err := node.QuerySpecificBalance(validatorAddr, initialization.TerraDenom)
+ s.Require().NoError(err)
+
+ balanceTest1, err := node.QuerySpecificBalance(test1Addr, initialization.TerraDenom)
+ s.Require().NoError(err)
+
+ balanceTest2, err := node.QuerySpecificBalance(test2Addr, initialization.TerraDenom)
+ s.Require().NoError(err)
+
+ s.Require().Equal(balanceTest1, transferCoin)
+ s.Require().Equal(newValidatorBalance, validatorBalance.Add(transferCoin))
+ // addr2 lost 2uluna to pay for grant msg's gas, 100000000 * TaxRate + 2uluna to pay for bank send msg's tx fees,
+ s.Require().Equal(balanceTest2.Amount, transferAmount.Sub(initialization.TaxRate.MulInt(transferAmount).TruncateInt()).SubRaw(4))
+
+ // Test 2: try bank send with grant but pay by multiple fees denom
}
diff --git a/tests/e2e/initialization/config.go b/tests/e2e/initialization/config.go
index 79a5bac58..ef96fb78c 100644
--- a/tests/e2e/initialization/config.go
+++ b/tests/e2e/initialization/config.go
@@ -22,6 +22,7 @@ import (
govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
"github.com/classic-terra/core/v3/tests/e2e/util"
+ tax2gastypes "github.com/classic-terra/core/v3/x/tax2gas/types"
treasurytypes "github.com/classic-terra/core/v3/x/treasury/types"
)
@@ -44,7 +45,8 @@ const (
TerraDenom = "uluna"
AtomDenom = "uatom"
TerraIBCDenom = "ibc/4627AD2524E3E0523047E35BB76CC90E37D9D57ACF14F0FCBCEB2480705F3CB8"
- MinGasPrice = "0.000"
+ MinGasPrice = "0.00000000001"
+ E10 = 10000000000
IbcSendAmount = 3300000000
ValidatorWalletName = "val"
// chainA
@@ -256,6 +258,11 @@ func initGenesis(chain *internalChain, forkHeight int) error {
return err
}
+ err = updateModuleGenesis(appGenState, tax2gastypes.ModuleName, &tax2gastypes.GenesisState{}, updateTax2GasGenesis)
+ if err != nil {
+ return err
+ }
+
bz, err := json.MarshalIndent(appGenState, "", " ")
if err != nil {
return err
@@ -352,6 +359,15 @@ func updateGenUtilGenesis(c *internalChain) func(*genutiltypes.GenesisState) {
}
}
+func updateTax2GasGenesis(tax2gasGenState *tax2gastypes.GenesisState) {
+ tax2gasGenState.Params.GasPrices = sdk.NewDecCoins(
+ // Gas prices will be very small so that normal tx only care about taxes
+ sdk.NewDecCoinFromDec("uluna", sdk.NewDecWithPrec(5, 11)), // 0.5 * 10^-10
+ sdk.NewDecCoinFromDec("uusd", sdk.NewDecWithPrec(1, 10)), // 1 * 10^-10
+ sdk.NewDecCoinFromDec("ueur", sdk.NewDecWithPrec(2, 10)), // 2 * 10^-10
+ )
+}
+
func setDenomMetadata(genState *banktypes.GenesisState, denom string) {
genState.DenomMetadata = append(genState.DenomMetadata, banktypes.Metadata{
Description: fmt.Sprintf("Registered denom %s for e2e testing", denom),
diff --git a/tests/e2e/scripts/hermes_bootstrap.sh b/tests/e2e/scripts/hermes_bootstrap.sh
index 0402f93ea..29a7c624f 100644
--- a/tests/e2e/scripts/hermes_bootstrap.sh
+++ b/tests/e2e/scripts/hermes_bootstrap.sh
@@ -42,8 +42,8 @@ account_prefix = 'terra'
key_name = 'val01-terra-a'
store_prefix = 'ibc'
max_gas = 6000000
-gas_price = { price = 0.1, denom = 'uluna' }
-gas_multiplier = 1.1
+gas_price = { price = 28.325, denom = 'uluna' }
+gas_multiplier = 3
max_msg_num = 30
max_tx_size = 2097152
clock_drift = '5s' # to accomdate docker containers
@@ -69,8 +69,8 @@ account_prefix = 'terra'
key_name = 'val01-terra-b'
store_prefix = 'ibc'
max_gas = 6000000
-gas_price = { price = 0.1, denom = 'uluna' }
-gas_multiplier = 1.1
+gas_price = { price = 28.325, denom = 'uluna' }
+gas_multiplier = 3
max_msg_num = 30
max_tx_size = 2097152
clock_drift = '5s' # to accomdate docker containers
diff --git a/x/tax2gas/README.md b/x/tax2gas/README.md
index 08e9b6ba6..f9d258a02 100644
--- a/x/tax2gas/README.md
+++ b/x/tax2gas/README.md
@@ -4,22 +4,24 @@
- Normal tx success
- Not supported tx will not be deducted tax amount
+- Special IBC tx will be bypass when gas usage is not exceeded
- Forward tx should minus the amount to tx origin
- Multiple forward works
-- Out of gas should return the tax and not consumed gas
- Error forward tx should return the fund
+- Out of gas should return the tax and not consumed gas
- Multiple msg types should works
- Grant msg should work
- Allow pay with multiple fees should work
| No | Name | Scenario | Expect Result | Covered by |
|----|----------|-------------------|---------------|------------|
-| 1 | Normal transaction should success | User transfer or make some special transactions which send coins to different address | Tax should be deducted with correct amount| |
+| 1 | Normal transaction should success | User transfer or make some special transactions which send coins to different address | Tax should be deducted with correct amount| [TestFeeTax](../../tests/e2e/e2e_test.go#L108)
[TestFeeTaxWasm](../../tests/e2e/e2e_test.go#L157)|
| 2 | Not supported tx will not be deducted tax amount | User transfer or make some special transactions that not in the tax list | Tax shouldn't be deducted with correct amount| |
-| 3 | Forward transaction should deduct the amount to tx origin | User execute contract that will trigger an execute msg to another contract | - User should be the tx origin of the execute msg
- Tax should be deducted with correct amount | |
-| 4 | Multiple forward works | Contracts will trigger another contracts multiple times | - User should be the tx origin of the execute msg
- Tax should be deducted with correct amount | |
-| 5 | Out of gas should return the tax and not consumed gas | User make some transactions with limited gas amount that will lead to cause `out of gas` error | Tax and not consumed gas should be revert to user | |
+| 3 | Special IBC tx will be bypass when gas limit is not exceeded | User make IBC transactions that happen both cases:
- Gas usage does not exceeded `maxTotalBypassMinFeeMsgGasUsage`
-Gas usage exceeded `maxTotalBypassMinFeeMsgGasUsage` | Bypass when gas limit not exceeded and deduct fee when exceed | |
+| 4 | Forward transaction should deduct the amount to tx origin | User execute contract that will trigger an execute msg to another contract | - User should be the tx origin of the execute msg
- Tax should be deducted with correct amount | |
+| 5 | Multiple forward works | Contracts will trigger another contracts multiple times | - User should be the tx origin of the execute msg
- Tax should be deducted with correct amount | |
| 6 | Error forward tx should return the tax and not consumed gas | User execute contract that will trigger an execute msg to another contract. The execute msg to another contract will be failed | Tax and not consumed gas should be revert to user | |
-| 7 | Multiple msg types should works | - Test multiple tx type that's in the tax list or not
- Contract dispatch multiple tx types | Chain will deduct tax with correct amount | |
-| 8 | Grant msg should work | User grant multiple type of permissions to different transactions | Grant permission msg will only can deduct with one denom | |
-| 9 | Allow pay with multiple fees should work | User make transaction with multiple coins as fee | Fee can be paid by multiple denom, if one denom is not enough, then it will deduct other denom | |
+| 7 | Out of gas should return the tax and not consumed gas | User make some transactions with limited gas amount that will lead to cause `out of gas` error | Tax and not consumed gas should be revert to user | 🛑 Not figure out the way to make `out of gas` error occur, should be test in testnet |
+| 8 | Multiple msg types should works | - Test multiple tx type that's in the tax list or not
- Contract dispatch multiple tx types | Chain will deduct tax with correct amount | |
+| 9 | Grant msg should work | User grant multiple type of permissions to different transactions | Grant permission msg will only can deduct with one denom | [TestFeeTaxGrant](../../tests/e2e/e2e_test.go#L212) |
+| 10 | Allow pay with multiple fees should work | User make transaction with multiple coins as fee | Fee can be paid by multiple denom, if one denom is not enough, then it will deduct other denom | |