Skip to content

Commit

Permalink
monitor: fix tx hash (#110)
Browse files Browse the repository at this point in the history
  • Loading branch information
yutianwu authored Aug 29, 2022
1 parent 85c9b16 commit cf40f80
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions service/monitor/monitor/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package monitor

import (
"encoding/base64"
"encoding/hex"
"strconv"

"github.com/consensys/gnark-crypto/ecc/bn254/fr/mimc"
Expand All @@ -28,5 +28,5 @@ func ComputeL1TxTxHash(requestId int64, txHash string) string {
hFunc := mimc.NewMiMC()
hFunc.Write([]byte(strconv.FormatInt(requestId, 10)))
hFunc.Write(common.FromHex(txHash))
return base64.StdEncoding.EncodeToString(hFunc.Sum(nil))
return hex.EncodeToString(hFunc.Sum(nil))
}
3 changes: 2 additions & 1 deletion tools/dbinitializer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ package main
import (
"encoding/json"
"flag"

"github.com/zeromicro/go-zero/core/stores/cache"
"github.com/zeromicro/go-zero/core/stores/redis"
"github.com/zeromicro/go-zero/core/stores/sqlx"
Expand Down Expand Up @@ -50,7 +51,7 @@ import (
)

var (
dsn = "host=localhost user=postgres password=ZecreyProtocolDB@123 dbname=zkbas port=5432 sslmode=disable"
dsn = "host=localhost user=postgres password=Zkbas@123 dbname=zkbas port=5432 sslmode=disable"
DB, _ = gorm.Open(postgres.Open(dsn), &gorm.Config{})
DbInfo, _ = DB.DB()
Connection = sqlx.NewSqlConnFromDB(DbInfo)
Expand Down

0 comments on commit cf40f80

Please sign in to comment.