Skip to content

Commit

Permalink
add new test case
Browse files Browse the repository at this point in the history
  • Loading branch information
cosmatudor committed Jan 14, 2025
1 parent 8a39b05 commit c98ebb4
Show file tree
Hide file tree
Showing 2 changed files with 113 additions and 3 deletions.
114 changes: 112 additions & 2 deletions integrationTests/relayers/slowTests/edgeCases_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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) {
Expand All @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit c98ebb4

Please sign in to comment.