@@ -239,13 +239,6 @@ func TestNotEnoughISCGas(t *testing.T) {
239239 _ , err := storage .store (43 )
240240 require .NoError (t , err )
241241
242- // only the owner can call the setEVMGasRatio endpoint
243- // set the ISC gas ratio VERY HIGH
244- newGasRatio := util.Ratio32 {A : gas .DefaultEVMGasRatio .A * 500 , B : gas .DefaultEVMGasRatio .B }
245- err = env .setEVMGasRatio (newGasRatio , iscCallOptions {wallet : env .Chain .ChainAdmin })
246- require .NoError (t , err )
247- require .Equal (t , newGasRatio , env .getEVMGasRatio ())
248-
249242 senderAddress := crypto .PubkeyToAddress (storage .defaultSender .PublicKey )
250243 nonce := env .getNonce (senderAddress )
251244
@@ -281,7 +274,8 @@ func TestLoop(t *testing.T) {
281274 gasRatio := env .getEVMGasRatio ()
282275
283276 for _ , gasLimit := range []uint64 {200000 , 400000 } {
284- baseTokensSent := coin .Value (gas .EVMGasToISC (gasLimit , & gasRatio ))
277+ iscGasUnits := gas .EVMGasToISC (gasLimit , & gasRatio )
278+ baseTokensSent := gas .FeeFromGasWithGasPerToken (iscGasUnits , gas .DefaultGasPerToken )
285279 ethKey2 , ethAddr2 := env .Chain .NewEthereumAccountWithL2Funds (baseTokensSent )
286280 require .EqualValues (t ,
287281 env .Chain .L2BaseTokens (isc .NewEthereumAddressAgentID (ethAddr2 )),
@@ -307,7 +301,8 @@ func TestLoopWithGasLeft(t *testing.T) {
307301 gasRatio := env .getEVMGasRatio ()
308302 var usedGas []uint64
309303 for _ , gasLimit := range []uint64 {50000 , 200000 } {
310- baseTokensSent := coin .Value (gas .EVMGasToISC (gasLimit , & gasRatio ))
304+ iscGasUnits := gas .EVMGasToISC (gasLimit , & gasRatio )
305+ baseTokensSent := gas .FeeFromGasWithGasPerToken (iscGasUnits , gas .DefaultGasPerToken )
311306 ethKey2 , _ := env .Chain .NewEthereumAccountWithL2Funds (baseTokensSent )
312307 res , err := iscTest .CallFn ([]ethCallOptions {{
313308 sender : ethKey2 ,
@@ -354,7 +349,8 @@ func TestLoopWithGasLeftEstimateGas(t *testing.T) {
354349 t .Log (estimatedGas )
355350
356351 gasRatio := env .getEVMGasRatio ()
357- baseTokensSent := coin .Value (gas .EVMGasToISC (estimatedGas , & gasRatio ))
352+ iscGasUnits := gas .EVMGasToISC (estimatedGas , & gasRatio )
353+ baseTokensSent := gas .FeeFromGasWithGasPerToken (iscGasUnits , gas .DefaultGasPerToken )
358354 ethKey2 , _ := env .Chain .NewEthereumAccountWithL2Funds (baseTokensSent )
359355 res , err := iscTest .CallFn ([]ethCallOptions {{
360356 sender : ethKey2 ,
@@ -692,8 +688,8 @@ func TestCannotDepleteAccount(t *testing.T) {
692688 require .Zero (t , env .solo .L1BaseTokens (receiver ))
693689 senderInitialBalance := env .Chain .L2BaseTokens (isc .NewEthereumAddressAgentID (ethAddress ))
694690
695- // we eill attempt to transfer so much that we are left with no funds for gas
696- transfer := senderInitialBalance - 300
691+ // we will attempt to transfer so much that we are left with no funds for gas
692+ transfer := senderInitialBalance - gas . FeeFromGasWithGasPerToken ( 30_000 , gas . DefaultGasPerToken )
697693
698694 // allow ISCTest to take the tokens
699695 _ , err := env .ISCMagicSandbox (ethKey ).CallFn (
@@ -1335,11 +1331,10 @@ func TestSelfDestruct(t *testing.T) {
13351331
13361332 // send some tokens to the ISCTest contract
13371333 {
1338- const baseTokensDepositFee = 500
13391334 k , _ := env .solo .NewKeyPairWithFunds (env .solo .NewSeedFromTestNameAndTimestamp (t .Name ()))
1340- err := env .Chain .SendFromL1ToL2AccountBaseTokens (baseTokensDepositFee , 1 * isc . Million , iscTestAgentID , k )
1335+ err := env .Chain .SendFromL1ToL2AccountBaseTokens (solo . BaseTokensForL2Gas , solo . BaseTokensForL2Gas , iscTestAgentID , k )
13411336 require .NoError (t , err )
1342- require .EqualValues (t , 1 * isc . Million , env .Chain .L2BaseTokens (iscTestAgentID ))
1337+ require .EqualValues (t , solo . BaseTokensForL2Gas , env .Chain .L2BaseTokens (iscTestAgentID ))
13431338 }
13441339
13451340 _ , beneficiary := solo .EthereumAccountByIndex (1 )
@@ -1353,7 +1348,7 @@ func TestSelfDestruct(t *testing.T) {
13531348 // except when called in the same transaction as creation
13541349 require .NotEmpty (t , env .getCode (iscTest .address ))
13551350 require .Zero (t , env .Chain .L2BaseTokens (iscTestAgentID ))
1356- require .EqualValues (t , 1 * isc . Million , env .Chain .L2BaseTokens (isc .NewEthereumAddressAgentID (beneficiary )))
1351+ require .EqualValues (t , solo . BaseTokensForL2Gas , env .Chain .L2BaseTokens (isc .NewEthereumAddressAgentID (beneficiary )))
13571352
13581353 testdbhash .VerifyContractStateHash (env .solo , evm .Contract , "" , t .Name ())
13591354}
0 commit comments