diff --git a/integrationTests/relayers/slowTests/edgeCases_test.go b/integrationTests/relayers/slowTests/edgeCases_test.go index 4364bcfe..5deae397 100644 --- a/integrationTests/relayers/slowTests/edgeCases_test.go +++ b/integrationTests/relayers/slowTests/edgeCases_test.go @@ -300,7 +300,7 @@ func TestRelayersShouldExecuteTransfersForEdgeCases(t *testing.T) { NumOfDecimalsUniversal: 6, NumOfDecimalsChainSpecific: 6, MvxUniversalTokenTicker: "TEST", - MvxChainSpecificTokenTicker: "ONETEST", + MvxChainSpecificTokenTicker: "ETHTEST", MvxUniversalTokenDisplayName: "WrappedTEST", MvxChainSpecificTokenDisplayName: "EthereumWrappedTEST", ValueToMintOnMvx: "10000000000", @@ -414,7 +414,6 @@ func TestRelayersShouldExecuteTransfersForEdgeCases(t *testing.T) { testToken, ) }) - t.Run("decreasing max bridge amount on Safe before wrong SC call should stop refund", func(t *testing.T) { handler := func(setup *framework.TestSetup, tokens []framework.TestTokenParams) { setup.ProxyWrapperInstance.RegisterBeforeTransactionSendHandler(func(tx *transaction.FrontendTransaction) { @@ -431,6 +430,117 @@ func TestRelayersShouldExecuteTransfersForEdgeCases(t *testing.T) { testToken, ) }) + t.Run("making a failing deposit on eth with MVX_MAX_BRIDGE_AMOUNT + 1 should still refund", func(t *testing.T) { + testToken = framework.TestTokenParams{ + IssueTokenParams: framework.IssueTokenParams{ + AbstractTokenIdentifier: "TEST", + NumOfDecimalsUniversal: 6, + NumOfDecimalsChainSpecific: 6, + MvxUniversalTokenTicker: "TEST", + MvxChainSpecificTokenTicker: "ETHTEST", + MvxUniversalTokenDisplayName: "WrappedTEST", + MvxChainSpecificTokenDisplayName: "EthereumWrappedTEST", + ValueToMintOnMvx: "10000000000", + IsMintBurnOnMvX: true, + IsNativeOnMvX: false, + HasChainSpecificToken: true, + EthTokenName: "EthTEST", + EthTokenSymbol: "TEST", + ValueToMintOnEth: "10000000000", + IsMintBurnOnEth: false, + IsNativeOnEth: true, + }, + TestOperations: []framework.TokenOperations{ + { + ValueToTransferToMvx: big.NewInt(500101), + ValueToSendFromMvX: nil, + MvxSCCallData: badCallData, + MvxFaultySCCall: true, + }, + }, + DeltaBalances: map[framework.HalfBridgeIdentifier]framework.DeltaBalancesOnKeys{ + framework.FirstHalfBridge: map[string]*framework.DeltaBalanceHolder{ + framework.Alice: { + OnEth: big.NewInt(-500101), + OnMvx: big.NewInt(0), + MvxToken: framework.UniversalToken, + }, + framework.Bob: { + OnEth: big.NewInt(0), + OnMvx: big.NewInt(0), + MvxToken: framework.UniversalToken, + }, + framework.SafeSC: { + OnEth: big.NewInt(500101), + OnMvx: big.NewInt(0), + MvxToken: framework.ChainSpecificToken, + }, + framework.CalledTestSC: { + OnEth: big.NewInt(0), + OnMvx: big.NewInt(0), + MvxToken: framework.UniversalToken, + }, + framework.WrapperSC: { + OnEth: big.NewInt(0), + OnMvx: big.NewInt(0), + MvxToken: framework.ChainSpecificToken, + }, + }, + framework.SecondHalfBridge: map[string]*framework.DeltaBalanceHolder{ + framework.Alice: { + OnEth: big.NewInt(-500101 + 500051), + OnMvx: big.NewInt(0), + MvxToken: framework.UniversalToken, + }, + framework.Bob: { + OnEth: big.NewInt(0), + OnMvx: big.NewInt(0), + MvxToken: framework.UniversalToken, + }, + framework.Charlie: { + OnEth: big.NewInt(0), + OnMvx: big.NewInt(0), + MvxToken: framework.UniversalToken, + }, + framework.SafeSC: { + OnEth: big.NewInt(500101 - 500051), + OnMvx: big.NewInt(50), + MvxToken: framework.ChainSpecificToken, + }, + framework.CalledTestSC: { + OnEth: big.NewInt(0), + OnMvx: big.NewInt(0), + MvxToken: framework.UniversalToken, + }, + framework.WrapperSC: { + OnEth: big.NewInt(0), + OnMvx: big.NewInt(500101 - 500101), + MvxToken: framework.ChainSpecificToken, + }, + }, + }, + MintBurnChecks: &framework.MintBurnBalances{ + MvxTotalUniversalMint: big.NewInt(0), + MvxTotalChainSpecificMint: big.NewInt(500101), + MvxTotalUniversalBurn: big.NewInt(0), + MvxTotalChainSpecificBurn: big.NewInt(500101 - 50), + MvxSafeMintValue: big.NewInt(500101), + MvxSafeBurnValue: big.NewInt(500101 - 50), + + EthSafeMintValue: big.NewInt(0), + EthSafeBurnValue: big.NewInt(0), + }, + SpecialChecks: &framework.SpecialBalanceChecks{ + WrapperDeltaLiquidityCheck: big.NewInt(500101 - 500101), + }, + } + + testRelayersWithChainSimulatorAndTokensAndRefund( + t, + make(chan error), + testToken, + ) + }) } func testRelayersWithChainSimulatorAndTokensForDynamicPriceChange( diff --git a/integrationTests/relayers/slowTests/framework/ethereumHandler.go b/integrationTests/relayers/slowTests/framework/ethereumHandler.go index b0f8b0ad..e8439ca8 100644 --- a/integrationTests/relayers/slowTests/framework/ethereumHandler.go +++ b/integrationTests/relayers/slowTests/framework/ethereumHandler.go @@ -27,7 +27,7 @@ const ( ethStatusSuccess = uint64(1) minterRoleString = "MINTER_ROLE" ethMinAmountAllowedToTransfer = 25 - ethMaxAmountAllowedToTransfer = 500000 + ethMaxAmountAllowedToTransfer = 1000000 erc20SafeABI = "testdata/contracts/eth/ERC20Safe.abi.json" erc20SafeBytecode = "testdata/contracts/eth/ERC20Safe.hex"