Skip to content

Commit

Permalink
fixes using time.Since
Browse files Browse the repository at this point in the history
  • Loading branch information
fbac committed Sep 12, 2024
1 parent 89668b5 commit db2eb45
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 8 deletions.
6 changes: 6 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ import (
"github.com/zeta-chain/node/docs/openapi"
zetamempool "github.com/zeta-chain/node/pkg/mempool"
"github.com/zeta-chain/node/precompiles"
bankprecompile "github.com/zeta-chain/node/precompiles/bank"
srvflags "github.com/zeta-chain/node/server/flags"
authoritymodule "github.com/zeta-chain/node/x/authority"
authoritykeeper "github.com/zeta-chain/node/x/authority/keeper"
Expand Down Expand Up @@ -1065,6 +1066,11 @@ func (app *App) BlockedAddrs() map[string]bool {
// Each enabled precompiled stateful contract should be added as a BlockedAddrs.
// That way it's marked as non payable by the bank keeper.
for addr, enabled := range precompiles.EnabledStatefulContracts {
// bank precompile has to be able to receive funds.
if addr == bankprecompile.ContractAddress {
continue
}

if enabled {
blockList[addr.String()] = enabled
}
Expand Down
4 changes: 2 additions & 2 deletions e2e/e2etests/test_rate_limiter.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func createAndWaitWithdraws(r *runner.E2ERunner, withdrawType withdrawType, with
return err
}

duration := time.Now().Sub(startTime).Seconds()
duration := time.Since(startTime).Seconds()
block, err := r.ZEVMClient.BlockNumber(r.Ctx)
if err != nil {
return fmt.Errorf("error getting block number: %w", err)
Expand Down Expand Up @@ -155,7 +155,7 @@ func waitForWithdrawMined(
}

// record the time for completion
duration := time.Now().Sub(startTime).Seconds()
duration := time.Since(startTime).Seconds()
block, err := r.ZEVMClient.BlockNumber(ctx)
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion e2e/e2etests/test_stress_btc_deposit.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func monitorBTCDeposit(r *runner.E2ERunner, hash *chainhash.Hash, index int, sta
cctx.Index,
)
}
timeToComplete := time.Now().Sub(startTime)
timeToComplete := time.Since(startTime)
r.Logger.Print("index %d: deposit cctx success in %s", index, timeToComplete.String())

return nil
Expand Down
2 changes: 1 addition & 1 deletion e2e/e2etests/test_stress_btc_withdraw.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func monitorBTCWithdraw(r *runner.E2ERunner, tx *ethtypes.Transaction, index int
cctx.Index,
)
}
timeToComplete := time.Now().Sub(startTime)
timeToComplete := time.Since(startTime)
r.Logger.Print("index %d: withdraw cctx success in %s", index, timeToComplete.String())

return nil
Expand Down
2 changes: 1 addition & 1 deletion e2e/e2etests/test_stress_eth_deposit.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func monitorEtherDeposit(r *runner.E2ERunner, hash ethcommon.Hash, index int, st
cctx.Index,
)
}
timeToComplete := time.Now().Sub(startTime)
timeToComplete := time.Since(startTime)
r.Logger.Print("index %d: deposit cctx success in %s", index, timeToComplete.String())

return nil
Expand Down
2 changes: 1 addition & 1 deletion e2e/e2etests/test_stress_eth_withdraw.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func monitorEtherWithdraw(r *runner.E2ERunner, tx *ethtypes.Transaction, index i
cctx.Index,
)
}
timeToComplete := time.Now().Sub(startTime)
timeToComplete := time.Since(startTime)
r.Logger.Print("index %d: withdraw cctx success in %s", index, timeToComplete.String())

return nil
Expand Down
4 changes: 2 additions & 2 deletions precompiles/types/errors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import "testing"

func Test_ErrInvalidAddr(t *testing.T) {
e := ErrInvalidAddr{
Got: "foo",
Got: "foo",
Reason: "bar",
}
got := e.Error()
Expand Down Expand Up @@ -82,4 +82,4 @@ func Test_ErrUnexpected(t *testing.T) {
if got != expect {
t.Errorf("Expected %v, got %v", expect, got)
}
}
}

0 comments on commit db2eb45

Please sign in to comment.