mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-24 23:35:19 +00:00
fix unit test
This commit is contained in:
parent
1da9745903
commit
547b0057c7
@ -68,7 +68,7 @@ func TestAppAnteHandler_AuthorizedMempool(t *testing.T) {
|
||||
chainID,
|
||||
app.NewFundedGenStateWithSameCoins(
|
||||
tApp.AppCodec(),
|
||||
sdk.NewCoins(sdk.NewInt64Coin(chaincfg.DisplayDenom, 1e9)),
|
||||
sdk.NewCoins(sdk.NewInt64Coin("ua0gi", 1e9)),
|
||||
testAddresses,
|
||||
),
|
||||
newBep3GenStateMulti(tApp.AppCodec(), deputy),
|
||||
@ -116,7 +116,7 @@ func TestAppAnteHandler_AuthorizedMempool(t *testing.T) {
|
||||
banktypes.NewMsgSend(
|
||||
tc.address,
|
||||
testAddresses[0],
|
||||
sdk.NewCoins(sdk.NewInt64Coin(chaincfg.DisplayDenom, 1_000_000)),
|
||||
sdk.NewCoins(sdk.NewInt64Coin("ua0gi", 1_000_000)),
|
||||
),
|
||||
},
|
||||
sdk.NewCoins(), // no fee
|
||||
|
@ -12,7 +12,6 @@ import (
|
||||
|
||||
"github.com/0glabs/0g-chain/app"
|
||||
"github.com/0glabs/0g-chain/app/ante"
|
||||
"github.com/0glabs/0g-chain/chaincfg"
|
||||
)
|
||||
|
||||
var _ sdk.AnteHandler = (&MockAnteHandler{}).AnteHandle
|
||||
@ -46,7 +45,7 @@ func TestAuthenticatedMempoolDecorator_AnteHandle_NotCheckTx(t *testing.T) {
|
||||
banktypes.NewMsgSend(
|
||||
testAddresses[0],
|
||||
testAddresses[1],
|
||||
sdk.NewCoins(sdk.NewInt64Coin(chaincfg.DisplayDenom, 100_000_000)),
|
||||
sdk.NewCoins(sdk.NewInt64Coin("ua0gi", 100_000_000)),
|
||||
),
|
||||
},
|
||||
sdk.NewCoins(), // no fee
|
||||
@ -81,12 +80,12 @@ func TestAuthenticatedMempoolDecorator_AnteHandle_Pass(t *testing.T) {
|
||||
banktypes.NewMsgSend(
|
||||
testAddresses[0],
|
||||
testAddresses[1],
|
||||
sdk.NewCoins(sdk.NewInt64Coin(chaincfg.DisplayDenom, 100)),
|
||||
sdk.NewCoins(sdk.NewInt64Coin("ua0gi", 100)),
|
||||
),
|
||||
banktypes.NewMsgSend(
|
||||
testAddresses[2],
|
||||
testAddresses[1],
|
||||
sdk.NewCoins(sdk.NewInt64Coin(chaincfg.DisplayDenom, 100)),
|
||||
sdk.NewCoins(sdk.NewInt64Coin("ua0gi", 100)),
|
||||
),
|
||||
},
|
||||
sdk.NewCoins(), // no fee
|
||||
@ -122,7 +121,7 @@ func TestAuthenticatedMempoolDecorator_AnteHandle_Reject(t *testing.T) {
|
||||
banktypes.NewMsgSend(
|
||||
testAddresses[0],
|
||||
testAddresses[1],
|
||||
sdk.NewCoins(sdk.NewInt64Coin(chaincfg.DisplayDenom, 100)),
|
||||
sdk.NewCoins(sdk.NewInt64Coin("ua0gi", 100)),
|
||||
),
|
||||
},
|
||||
sdk.NewCoins(), // no fee
|
||||
|
@ -11,7 +11,6 @@ import (
|
||||
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
|
||||
|
||||
"github.com/0glabs/0g-chain/app"
|
||||
"github.com/0glabs/0g-chain/chaincfg"
|
||||
|
||||
"github.com/0glabs/0g-chain/tests/e2e/contracts/greeter"
|
||||
"github.com/0glabs/0g-chain/tests/util"
|
||||
@ -99,7 +98,7 @@ func (suite *IntegrationTestSuite) TestEip712BasicMessageAuthorization() {
|
||||
// check that the message was processed & the a0gi is transferred.
|
||||
balRes, err := suite.ZgChain.Bank.Balance(context.Background(), &banktypes.QueryBalanceRequest{
|
||||
Address: receiver.String(),
|
||||
Denom: chaincfg.DisplayDenom,
|
||||
Denom: "ua0gi",
|
||||
})
|
||||
suite.NoError(err)
|
||||
suite.Equal(sdk.NewInt(1e3), balRes.Balance.Amount)
|
||||
|
@ -13,7 +13,6 @@ import (
|
||||
ethtypes "github.com/ethereum/go-ethereum/core/types"
|
||||
|
||||
"github.com/0glabs/0g-chain/app"
|
||||
"github.com/0glabs/0g-chain/chaincfg"
|
||||
"github.com/0glabs/0g-chain/tests/util"
|
||||
)
|
||||
|
||||
@ -25,7 +24,7 @@ func (suite *IntegrationTestSuite) TestEthGasPriceReturnsMinFee() {
|
||||
suite.NoError(err)
|
||||
|
||||
// evm uses neuron, get neuron min fee
|
||||
evmMinGas := minGasPrices.AmountOf(chaincfg.BaseDenom).TruncateInt().BigInt()
|
||||
evmMinGas := minGasPrices.AmountOf("neuron").TruncateInt().BigInt()
|
||||
|
||||
// returns eth_gasPrice, units in a0gi
|
||||
gasPrice, err := suite.ZgChain.EvmClient.SuggestGasPrice(context.Background())
|
||||
@ -44,7 +43,7 @@ func (suite *IntegrationTestSuite) TestEvmRespectsMinFee() {
|
||||
// get min gas price for evm (from app.toml)
|
||||
minFees, err := getMinFeeFromAppToml(util.ZgChainHomePath())
|
||||
suite.NoError(err)
|
||||
minGasPrice := minFees.AmountOf(chaincfg.BaseDenom).TruncateInt()
|
||||
minGasPrice := minFees.AmountOf("neuron").TruncateInt()
|
||||
|
||||
// attempt tx with less than min gas price (min fee - 1)
|
||||
tooLowGasPrice := minGasPrice.Sub(sdk.OneInt()).BigInt()
|
||||
|
@ -19,7 +19,6 @@ import (
|
||||
emtypes "github.com/evmos/ethermint/types"
|
||||
|
||||
"github.com/0glabs/0g-chain/app"
|
||||
"github.com/0glabs/0g-chain/chaincfg"
|
||||
"github.com/0glabs/0g-chain/tests/e2e/testutil"
|
||||
"github.com/0glabs/0g-chain/tests/util"
|
||||
)
|
||||
@ -29,7 +28,7 @@ var (
|
||||
)
|
||||
|
||||
func a0gi(amt *big.Int) sdk.Coin {
|
||||
return sdk.NewCoin(chaincfg.DisplayDenom, sdkmath.NewIntFromBigInt(amt))
|
||||
return sdk.NewCoin("ua0gi", sdkmath.NewIntFromBigInt(amt))
|
||||
}
|
||||
|
||||
type IntegrationTestSuite struct {
|
||||
@ -67,7 +66,7 @@ func (suite *IntegrationTestSuite) TestFundedAccount() {
|
||||
|
||||
// check balance via SDK query
|
||||
res, err := suite.ZgChain.Bank.Balance(context.Background(), banktypes.NewQueryBalanceRequest(
|
||||
acc.SdkAddress, chaincfg.DisplayDenom,
|
||||
acc.SdkAddress, "ua0gi",
|
||||
))
|
||||
suite.NoError(err)
|
||||
suite.Equal(funds, *res.Balance)
|
||||
@ -110,7 +109,7 @@ func (suite *IntegrationTestSuite) TestTransferOverEVM() {
|
||||
|
||||
// expect (9 - gas used) A0GI remaining in account.
|
||||
balance := suite.ZgChain.QuerySdkForBalances(acc.SdkAddress)
|
||||
suite.Equal(sdkmath.NewInt(9e5).Sub(a0giUsedForGas), balance.AmountOf(chaincfg.DisplayDenom))
|
||||
suite.Equal(sdkmath.NewInt(9e5).Sub(a0giUsedForGas), balance.AmountOf("ua0gi"))
|
||||
}
|
||||
|
||||
// TestIbcTransfer transfers A0GI from the primary 0g-chain (suite.ZgChain) to the ibc chain (suite.Ibc).
|
||||
@ -158,7 +157,7 @@ func (suite *IntegrationTestSuite) TestIbcTransfer() {
|
||||
// the balance should be deducted from 0g-chain account
|
||||
suite.Eventually(func() bool {
|
||||
balance := suite.ZgChain.QuerySdkForBalances(zgChainAcc.SdkAddress)
|
||||
return balance.AmountOf(chaincfg.DisplayDenom).Equal(expectedSrcBalance.Amount)
|
||||
return balance.AmountOf("ua0gi").Equal(expectedSrcBalance.Amount)
|
||||
}, 10*time.Second, 1*time.Second)
|
||||
|
||||
// expect the balance to be transferred to the ibc chain!
|
||||
|
@ -4,7 +4,6 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/0glabs/0g-chain/chaincfg"
|
||||
rpchttpclient "github.com/cometbft/cometbft/rpc/client/http"
|
||||
"github.com/ethereum/go-ethereum/ethclient"
|
||||
)
|
||||
@ -74,7 +73,7 @@ var (
|
||||
EvmRpcUrl: "http://localhost:8545",
|
||||
|
||||
ChainId: "0gchainlocalnet_8888-1",
|
||||
StakingDenom: chaincfg.DisplayDenom,
|
||||
StakingDenom: "ua0gi",
|
||||
}
|
||||
kvtoolIbcChain = ChainDetails{
|
||||
RpcUrl: "http://localhost:26658",
|
||||
|
@ -12,7 +12,6 @@ import (
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/0glabs/0g-chain/app"
|
||||
"github.com/0glabs/0g-chain/chaincfg"
|
||||
"github.com/0glabs/0g-chain/x/evmutil/keeper"
|
||||
"github.com/0glabs/0g-chain/x/evmutil/testutil"
|
||||
"github.com/0glabs/0g-chain/x/evmutil/types"
|
||||
|
@ -37,7 +37,6 @@ import (
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/0glabs/0g-chain/app"
|
||||
"github.com/0glabs/0g-chain/chaincfg"
|
||||
"github.com/0glabs/0g-chain/x/evmutil/keeper"
|
||||
"github.com/0glabs/0g-chain/x/evmutil/types"
|
||||
)
|
||||
@ -80,7 +79,7 @@ func (suite *Suite) SetupTest() {
|
||||
suite.Addrs = addrs
|
||||
|
||||
evmGenesis := evmtypes.DefaultGenesisState()
|
||||
evmGenesis.Params.EvmDenom = chaincfg.EvmDenom
|
||||
evmGenesis.Params.EvmDenom = keeper.EvmDenom
|
||||
|
||||
feemarketGenesis := feemarkettypes.DefaultGenesisState()
|
||||
feemarketGenesis.Params.EnableHeight = 1
|
||||
|
Loading…
Reference in New Issue
Block a user