From aa1efb41750548e5a859ee5fe9eefe9dd6eae076 Mon Sep 17 00:00:00 2001 From: Trung Nguyen Thanh <59964019+trungnt1811@users.noreply.github.com> Date: Wed, 26 Jun 2024 23:32:01 +0700 Subject: [PATCH] feat: refactor logger (#1670) * fix: conflicting replacements for github.com/tendermint/tendermint * refactor: use one zerolog library * refactor: using zerelog * chore: using zerolog instead of stdlog * fix: logging no formatting directives --- go.mod | 2 +- go.work | 2 + go.work.sum | 41 ++++++-- icq-relayer/cmd/run.go | 8 +- icq-relayer/go.mod | 8 +- icq-relayer/pkg/runner/run.go | 167 +++++++++++++++++++------------- icq-relayer/pkg/types/client.go | 44 ++++----- 7 files changed, 162 insertions(+), 110 deletions(-) diff --git a/go.mod b/go.mod index 3484ae218..668bdcef3 100644 --- a/go.mod +++ b/go.mod @@ -347,6 +347,6 @@ replace ( // replace broken goleveldb github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // use cometbft - github.com/tendermint/tendermint => github.com/cometbft/cometbft v0.34.32 + github.com/tendermint/tendermint => github.com/cometbft/cometbft v0.34.33 github.com/tendermint/tm-db => github.com/notional-labs/tm-db v0.11.0 ) diff --git a/go.work b/go.work index 9a7c63ca0..db46b365b 100644 --- a/go.work +++ b/go.work @@ -5,3 +5,5 @@ use ( ./icq-relayer ./test/interchaintest ) + +replace github.com/tendermint/tendermint => github.com/cometbft/cometbft v0.34.33 diff --git a/go.work.sum b/go.work.sum index 9f9051979..ed20ba52b 100644 --- a/go.work.sum +++ b/go.work.sum @@ -342,6 +342,7 @@ github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398/go.mod h1:a1uqR github.com/Shopify/goreferrer v0.0.0-20220729165902-8cddb4f5de06/go.mod h1:7erjKLwalezA0k99cWs5L11HWOAPNjdUZ6RxH1BXbbM= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= +github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= github.com/Workiva/go-datastructures v1.0.53/go.mod h1:1yZL+zfsztete+ePzZz/Zb1/t5BnDuE2Ya2MMGhzP6A= github.com/Zilliqa/gozilliqa-sdk v1.2.1-0.20201201074141-dd0ecada1be6/go.mod h1:eSYp2T6f0apnuW8TzhV3f6Aff2SE8Dwio++U4ha4yEM= github.com/aclements/go-gg v0.0.0-20170118225347-6dbb4e4fefb0/go.mod h1:55qNq4vcpkIuHowELi5C8e+1yUHtoLoOUR9QU5j7Tes= @@ -412,6 +413,7 @@ github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go github.com/bandprotocol/bandchain-packet v0.0.2/go.mod h1:pk/wJxznWERdDVU2WWpzt8Tr0WvDSkT66JDYVdIECAo= github.com/bitly/go-simplejson v0.5.0/go.mod h1:cXHtHw4XUPsvGaxgjIAn8PhEWG9NfngEKAMDJEczWVA= github.com/bits-and-blooms/bitset v1.7.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA= +github.com/bits-and-blooms/bitset v1.10.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= github.com/bkielbasa/cyclop v1.2.0/go.mod h1:qOI0yy6A7dYC4Zgsa72Ppm9kONl0RoIlPbzot9mhmeI= github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ= @@ -427,6 +429,7 @@ github.com/btcsuite/btcd v0.0.0-20190315201642-aa6e0f35703c/go.mod h1:DrZx5ec/dm github.com/btcsuite/btcd v0.21.0-beta.0.20201114000516-e9c7a5ac6401/go.mod h1:Sv4JPQ3/M+teHz9Bo5jBpkNcP0x6r7rdihlNL/7tTAs= github.com/btcsuite/btcd v0.22.1/go.mod h1:wqgTSL29+50LRkmOVknEdmt8ZojIzhuWvgu/iptuN7Y= github.com/btcsuite/btcd v0.23.0/go.mod h1:0QJIIN1wwIXF/3G/m87gIwGniDMDQqjVn4SZgnFpsYY= +github.com/btcsuite/btcd v0.23.5-0.20231215221805-96c9fd8078fd h1:js1gPwhcFflTZ7Nzl7WHaOTlTr5hIrR4n1NM4v9n4Kw= github.com/btcsuite/btcd/btcec/v2 v2.1.2/go.mod h1:ctjw4H1kknNJmRN4iP1R7bTQ+v3GJkZBd6mui8ZsAZE= github.com/btcsuite/btcd/btcec/v2 v2.2.0/go.mod h1:U7MHm051Al6XmscBQ0BoNydpOTsFAn707034b5nY8zU= github.com/btcsuite/btcd/btcec/v2 v2.2.1/go.mod h1:9/CSmJxmuvqzX9Wh2fXMWToLOHhPd11lSPuIupwTkI8= @@ -489,11 +492,14 @@ github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0/go.mod h1:4Zcju github.com/coinbase/kryptology v1.8.0/go.mod h1:RYXOAPdzOGUe3qlSFkMGn58i3xUA8hmxYHksuq+8ciI= github.com/coinbase/rosetta-sdk-go v0.7.9/go.mod h1:0/knutI7XGVqXmmH4OQD8OckFrbQ8yMsUZTG7FXCR2M= github.com/cometbft/cometbft-db v0.7.0/go.mod h1:yiKJIm2WKrt6x8Cyxtq9YTEcIMPcEe4XPxhgX59Fzf0= +github.com/cometbft/cometbft-db v0.9.1/go.mod h1:iliyWaoV0mRwBJoizElCwwRA9Tf7jZJOURcRZF9m60U= github.com/confio/ics23/go v0.9.0/go.mod h1:4LPZ2NYqnYIVRklaozjNR1FScgDJ2s5Xrp+e/mYVRak= github.com/consensys/bavard v0.1.8-0.20210406032232-f3452dc9b572/go.mod h1:Bpd0/3mZuaj6Sj+PqrmIquiOKy397AKGThQPaGzNXAQ= github.com/consensys/bavard v0.1.8-0.20210915155054-088da2f7f54a/go.mod h1:9ItSMtA/dXMAiL7BG6bqW2m3NdSEObYWoH223nGHukI= +github.com/consensys/bavard v0.1.13/go.mod h1:9ItSMtA/dXMAiL7BG6bqW2m3NdSEObYWoH223nGHukI= github.com/consensys/gnark-crypto v0.4.1-0.20210426202927-39ac3d4b3f1f/go.mod h1:815PAHg3wvysy0SyIqanF8gZ0Y1wjk/hrDHD/iT88+Q= github.com/consensys/gnark-crypto v0.5.3/go.mod h1:hOdPlWQV1gDLp7faZVeg8Y0iEPFaOUnCc4XeCCk96p0= +github.com/consensys/gnark-crypto v0.12.1/go.mod h1:v2Gy7L/4ZRosZ7Ivs+9SfUDr0f5UlG+EM5t7MPHiLuY= github.com/containerd/aufs v1.0.0/go.mod h1:kL5kd6KM5TzQjR79jljyi4olc1Vrx6XBlcyj3gNv2PU= github.com/containerd/btrfs v1.0.0/go.mod h1:zMcX3qkXTAi9GI50+0HOeuV8LU2ryCE/V2vG/ZBiTss= github.com/containerd/cgroups v1.1.0/go.mod h1:6ppBcbh/NOOUU+dMKrykgaBnK9lCIBxHqJDGwsa1mIw= @@ -530,10 +536,13 @@ github.com/cosmos/ledger-go v0.9.2/go.mod h1:oZJ2hHAZROdlHiwTg4t7kP+GKIIkBT+o6c9 github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/crate-crypto/go-ipa v0.0.0-20230601170251-1830d0757c80/go.mod h1:gzbVz57IDJgQ9rLQwfSk696JGWof8ftznEL9GoAv3NI= +github.com/crate-crypto/go-ipa v0.0.0-20231025140028-3c0104f4b233/go.mod h1:geZJZH3SzKCqnz5VT0q/DyIG/tvu/dZk+VIfXicupJs= +github.com/crate-crypto/go-kzg-4844 v0.7.0/go.mod h1:1kMhvPgI0Ky3yIa+9lFySEBUBXkYxeOi8ZF1sYioxhc= github.com/creachadair/taskgroup v0.3.2/go.mod h1:wieWwecHVzsidg2CsUnFinW1faVN4+kq+TDlRJQ0Wbk= github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/cristalhq/acmd v0.8.1/go.mod h1:LG5oa43pE/BbxtfMoImHCQN++0Su7dzipdgBjMCBVDQ= github.com/cristalhq/acmd v0.11.2/go.mod h1:LG5oa43pE/BbxtfMoImHCQN++0Su7dzipdgBjMCBVDQ= +github.com/cristalhq/acmd v0.12.0/go.mod h1:LG5oa43pE/BbxtfMoImHCQN++0Su7dzipdgBjMCBVDQ= github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4= github.com/cyphar/filepath-securejoin v0.2.3/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= @@ -561,6 +570,7 @@ github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8 github.com/dimchansky/utfbom v1.1.1/go.mod h1:SxdoEBH5qIqFocHMyGOXVAybYJdr71b1Q/j0mACtrfE= github.com/djherbis/atime v1.1.0/go.mod h1:28OF6Y8s3NQWwacXc5eZTsEsiMzp7LF8MbXE+XJPdBE= github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= +github.com/dlclark/regexp2 v1.7.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= github.com/docker/cli v20.10.17+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= @@ -575,6 +585,7 @@ github.com/docker/go-metrics v0.0.1/go.mod h1:cG1hvH2utMXtqgqqYE9plW6lDxS3/5ayHz github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/dop251/goja v0.0.0-20211011172007-d99e4b8cbf48/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk= github.com/dop251/goja v0.0.0-20211022113120-dc8c55024d06/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk= +github.com/dop251/goja v0.0.0-20230806174421-c933cf95e127/go.mod h1:QMWlm50DNe14hD7t24KEqZuUdC9sOTy8W6XbCU1mlw4= github.com/dop251/goja_nodejs v0.0.0-20210225215109-d91c329300e7/go.mod h1:hn7BA7c8pLvoGndExHudxTDKZ84Pyvv+90pbBjbTz0Y= github.com/dop251/goja_nodejs v0.0.0-20211022123610-8dd9abb0616d/go.mod h1:DngW8aVqWbuLRMHItjPUyqdj+HWPvnQe8V8y1nDpIbM= github.com/dvsekhvalnov/jose2go v1.5.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB/mPZadG+mhXU= @@ -590,6 +601,7 @@ github.com/envoyproxy/protoc-gen-validate v1.0.2/go.mod h1:GpiZQP3dDbg4JouG/NNS7 github.com/envoyproxy/protoc-gen-validate v1.0.4/go.mod h1:qys6tmnRsYrQqIhm2bvKZH4Blx/1gTIZ2UKVY1M+Yew= github.com/esimonov/ifshort v1.0.4/go.mod h1:Pe8zjlRrJ80+q2CxHLfEOfTwxCZ4O+MuhcHcfgNWTk0= github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw= +github.com/ethereum/c-kzg-4844 v0.4.0/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0= github.com/ethereum/go-ethereum v1.10.17/go.mod h1:Lt5WzjM07XlXc95YzrhosmR4J9Ahd6X2wyEV2SvGhk0= github.com/ethereum/go-ethereum v1.10.21/go.mod h1:EYFyF19u3ezGLD4RqOkLq+ZCXzYbLoNDdZlMt7kyKFg= github.com/ethereum/go-ethereum v1.10.22/go.mod h1:EYFyF19u3ezGLD4RqOkLq+ZCXzYbLoNDdZlMt7kyKFg= @@ -599,6 +611,7 @@ github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/fatih/color v1.14.1/go.mod h1:2oHN61fhTpgcxD3TSWCgKDiH1+x4OiDVVGH8WlgGZGg= +github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/felixge/httpsnoop v1.0.2/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= @@ -623,6 +636,7 @@ github.com/garslo/gogen v0.0.0-20170306192744-1d203ffc1f61/go.mod h1:Q0X6pkwTILD github.com/gavv/httpexpect v2.0.0+incompatible/go.mod h1:x+9tiU1YnrOvnB725RkpoLv1M62hOWzwo5OXotisrKc= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= github.com/gballet/go-verkle v0.0.0-20230607174250-df487255f46b/go.mod h1:CDncRYVRSDqwakm282WEkjfaAj1hxU/v5RXxk5nXOiI= +github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46/go.mod h1:QNpY22eby74jVhqH4WhDLDwxc/vqsern6pW+u2kbkpc= github.com/gdamore/encoding v1.0.0/go.mod h1:alR0ol34c49FCSBLjhosxzcPHQbf2trDkoo5dl+VrEg= github.com/gdamore/tcell/v2 v2.6.0/go.mod h1:be9omFATkdr0D9qewWW3d+MEvl5dha+Etb5y65J2H8Y= github.com/getkin/kin-openapi v0.53.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4= @@ -632,7 +646,6 @@ github.com/ghemawat/stream v0.0.0-20171120220530-696b145b53b9/go.mod h1:106OIgoo github.com/ghostiam/protogetter v0.3.5/go.mod h1:7lpeDnEJ1ZjL/YtyoN99ljO4z0pd3H0d18/t2dPBxHw= github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s= github.com/gin-gonic/gin v1.4.0/go.mod h1:OW2EZn3DO8Ln9oIKOvM++LBO+5UPHJJDH72/q/3rZdM= -github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M= github.com/gin-gonic/gin v1.7.0/go.mod h1:jD2toBW3GZUr5UMcdrwQA10I7RuaFOl/SGeDjXkfUtY= github.com/gliderlabs/ssh v0.3.5/go.mod h1:8XB4KraRrX39qHhT6yxPsHedjA08I/uBVwj4xC+/+z4= github.com/glycerine/go-unsnap-stream v0.0.0-20180323001048-9f0cb55181dd/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE= @@ -672,12 +685,10 @@ github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiU github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/go-pdf/fpdf v0.5.0/go.mod h1:HzcnA+A23uwogo0tp9yU+l3V+KXhiESpt1PMayhOh5M= -github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= -github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= -github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI= github.com/go-playground/validator/v10 v10.11.1/go.mod h1:i+3WkQ1FvaUjjxh1kSvIA4dMGDBiPU55YFDl0WbKdWU= github.com/go-redis/redis v6.15.8+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq8Jd4h5lpwo= +github.com/go-sourcemap/sourcemap v2.1.3+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg= github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= @@ -842,11 +853,13 @@ github.com/hashicorp/serf v0.10.1/go.mod h1:yL2t6BqATOLGc5HF7qbFkTfXoPIY0WZdWHfE github.com/hdevalence/ed25519consensus v0.0.0-20220222234857-c00d1f31bab3/go.mod h1:5PC6ZNPde8bBqU/ewGZig35+UIZtw9Ytxez8/q5ZyFE= github.com/holiman/billy v0.0.0-20230718173358-1c7e68d277a7/go.mod h1:5GuXa7vkL8u9FkFuWdVvfR5ix8hRB7DbOAaYULamFpc= github.com/holiman/billy v0.0.0-20240216141850-2abb0c79d3c4/go.mod h1:5GuXa7vkL8u9FkFuWdVvfR5ix8hRB7DbOAaYULamFpc= +github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= github.com/holiman/uint256 v1.2.0/go.mod h1:y4ga/t+u+Xwd7CpDgZESaRcWy0I7XMlTMA25ApIH5Jw= github.com/huandu/xstrings v1.0.0/go.mod h1:4qWG/gcEcfX4z/mBDHJ++3ReCw9ibxbsNJbcucJdbSo= github.com/huandu/xstrings v1.2.0/go.mod h1:DvyZB1rfVYsBIigL8HwpZgxHwXozlTgGqn63UyNX5k4= github.com/hudl/fargo v1.4.0/go.mod h1:9Ai6uvFy5fQNq6VPKtg+Ceq1+eTY4nKUlR2JElEOcDo= github.com/huin/goupnp v1.0.3-0.20220313090229-ca81a64b4204/go.mod h1:ZxNlw5WqJj6wSsRK5+YfflQGXYfccj5VgQsMNixHM7Y= +github.com/huin/goupnp v1.3.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8= github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= github.com/hydrogen18/memlistener v0.0.0-20141126152155-54553eb933fb/go.mod h1:qEIFzExnS6016fRpRfxrExeVn2gbClQA99gQhnIcdhE= github.com/hydrogen18/memlistener v1.0.0/go.mod h1:qEIFzExnS6016fRpRfxrExeVn2gbClQA99gQhnIcdhE= @@ -889,6 +902,7 @@ github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5ey github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= github.com/jackc/pgx/v5 v5.4.3/go.mod h1:Ig06C2Vu0t5qXC60W8sqIthScaEnFvojjj9dSljmHRA= github.com/jackc/puddle/v2 v2.2.1/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4= +github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= github.com/jbenet/go-temp-err-catcher v0.1.0/go.mod h1:0kJRvmDZXNMIiJirNPEYfhpPwbGVtZVWC34vc5WLsDk= github.com/jbenet/goprocess v0.1.4/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4= @@ -965,6 +979,7 @@ github.com/koron/go-ssdp v0.0.4/go.mod h1:oDXq+E5IL5q0U8uSBcoAXzTzInwy5lEgC91HoK github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kunwardeep/paralleltest v1.0.6/go.mod h1:Y0Y0XISdZM5IKm3TREQMZ6iteqn1YuwCsJO/0kL9Zes= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/kyoh86/exportloopref v0.1.8/go.mod h1:1tUcJeiioIs7VWe5gcOObrux3lb66+sBqGZrRkMwPgg= github.com/labstack/echo/v4 v4.1.11/go.mod h1:i541M3Fj6f76NZtHSj7TXnyM8n2gaodfvfxNnFqi74g= github.com/labstack/echo/v4 v4.2.1/go.mod h1:AA49e0DZ8kk5jTOOCKNuPR6oTnBS0dYiM4FW1e6jwpg= @@ -976,7 +991,6 @@ github.com/labstack/gommon v0.4.0/go.mod h1:uW6kP17uPlLJsD3ijUYn3/M5bAxtlZhMI6m3 github.com/ldez/gomoddirectives v0.2.3/go.mod h1:cpgBogWITnCfRq2qGoDkKMEVSaarhdBr6g8G04uz6d0= github.com/ldez/tagliatelle v0.3.1/go.mod h1:8s6WJQwEYHbKZDsp/LjArytKOG8qaMrKQQ3mFukHs88= github.com/ledongthuc/pdf v0.0.0-20220302134840-0c2507a12d80/go.mod h1:imJHygn/1yfhB7XSJJKlFZKl/J+dCPAknuiaGOshXAs= -github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= github.com/leonklingele/grouper v1.1.0/go.mod h1:uk3I3uDfi9B6PeUjsCKi6ndcf63Uy7snXgR4yDYQVDY= github.com/leonklingele/grouper v1.1.1 h1:suWXRU57D4/Enn6pXR0QVqqWWrnJ9Osrz+5rjt8ivzU= github.com/leonklingele/grouper v1.1.1/go.mod h1:uk3I3uDfi9B6PeUjsCKi6ndcf63Uy7snXgR4yDYQVDY= @@ -999,6 +1013,7 @@ github.com/libp2p/go-openssl v0.1.0/go.mod h1:OiOxwPpL3n4xlenjx2h7AwSGaFSC/KZvf6 github.com/libp2p/go-reuseport v0.2.0/go.mod h1:bvVho6eLMm6Bz5hmU0LYN3ixd3nPPvtIlaURZZgOY4k= github.com/libp2p/go-yamux/v4 v4.0.0/go.mod h1:NWjl8ZTLOGlozrXSOZ/HlfG++39iKNnM5wwmtQP1YB4= github.com/libp2p/zeroconf/v2 v2.2.0/go.mod h1:fuJqLnUwZTshS3U/bMRJ3+ow/v9oid1n0DmyYyNO1Xs= +github.com/linxGnu/grocksdb v1.8.6/go.mod h1:xZCIb5Muw+nhbDK4Y5UJuOrin5MceOuiXkVUR7vp4WY= github.com/linxGnu/grocksdb v1.8.12/go.mod h1:xZCIb5Muw+nhbDK4Y5UJuOrin5MceOuiXkVUR7vp4WY= github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= github.com/lucasjones/reggen v0.0.0-20180717132126-cdb49ff09d77/go.mod h1:5ELEyG+X8f+meRWHuqUOewBOhvHkl7M76pdGEansxW4= @@ -1031,7 +1046,6 @@ github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hd github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= -github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.18/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-pointer v0.0.1/go.mod h1:2zXcozF6qYGgmsG+SeTZz3oAbFLdD3OWqnUbNvJZAlc= @@ -1079,6 +1093,7 @@ github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RR github.com/mitchellh/pointerstructure v1.2.0/go.mod h1:BRAsLI5zgXmw97Lf6s25bs8ohIXc3tViBH44KcwB2g4= github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/mitchellh/reflectwalk v1.0.1/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= +github.com/mmcloughlin/addchain v0.4.0/go.mod h1:A86O+tHqZLMNO4w6ZZ4FlVQEadcoqkyU72HC5wJ4RlU= github.com/mmcloughlin/avo v0.5.0/go.mod h1:ChHFdoV7ql95Wi7vuq2YT1bwCJqiWdZrQ1im3VujLYM= github.com/moby/buildkit v0.10.4/go.mod h1:Yajz9vt1Zw5q9Pp4pdb3TCSUXJBIroIQGQ3TTs/sLug= github.com/moby/locker v1.0.1/go.mod h1:S7SDdo5zpBK84bzzVlKr2V0hz+7x9hWbYC/kq7oQppc= @@ -1129,10 +1144,12 @@ github.com/onsi/ginkgo v1.13.0/go.mod h1:+REjRxOmWfHCjfv9TTWB1jD1Frx4XydAD3zm1ls github.com/onsi/ginkgo v1.16.2/go.mod h1:CObGmKUOKaSC0RjmoAK7tKyn4Azo5P2IWuoMnvwxz1E= github.com/onsi/ginkgo/v2 v2.9.2/go.mod h1:WHcJJG2dIlcCqVfBAwUCrJxSPFb6v4azBwgxeMeDuts= github.com/onsi/ginkgo/v2 v2.11.0/go.mod h1:ZhrRA5XmEE3x3rhlzamx/JJvujdZoJ2uvgI7kR0iZvM= +github.com/onsi/ginkgo/v2 v2.17.2/go.mod h1:nP2DPOQoNsQmsVyv5rDA8JkXQoCs6goXIvr/PRJ1eCc= github.com/onsi/gomega v1.13.0/go.mod h1:lRk9szgn8TxENtWd0Tp4c3wjlRfMTMH27I+3Je41yGY= github.com/onsi/gomega v1.20.0/go.mod h1:DtrZpjmvpn2mPm4YWQa0/ALMDj9v4YxLgojwPeREyVo= github.com/onsi/gomega v1.27.4/go.mod h1:riYq/GJKh8hhoM01HN6Vmuy93AarCXCBGpvFDK3q3fQ= github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M= +github.com/onsi/gomega v1.33.0/go.mod h1:+925n5YtiFsLzzafLUHzVMBpvvRAzrydIBiSIxjX3wY= github.com/opencontainers/runtime-spec v1.0.2/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/opencontainers/selinux v1.10.0/go.mod h1:2i0OySw99QjzBBQByd1Gr9gSjvuho1lHsJxIJ3gGbJI= @@ -1290,6 +1307,7 @@ github.com/spf13/viper v1.13.0/go.mod h1:Icm2xNL3/8uyh/wFuB1jI7TiTNKp8632Nwegu+z github.com/spf13/viper v1.15.0/go.mod h1:fFcTBJxvhhzSJiZy8n+PeW6t8l+KeT/uTARa0jHOQLA= github.com/spf13/viper v1.18.1/go.mod h1:EKmWIqdnk5lOcmR72yw6hS+8OPYcwD0jteitLMVB+yk= github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q= +github.com/status-im/keycard-go v0.2.0/go.mod h1:wlp8ZLbsmrF6g6WjugPAx+IzoLrkdf9+mHxBEeo3Hbg= github.com/steakknife/bloomfilter v0.0.0-20180922174646-6819c0d2a570/go.mod h1:8OR4w3TdeIHIh1g6EMY5p0gVNOovcWC+1vpc7naMuAw= github.com/steakknife/hamming v0.0.0-20180906055917-c99c65617cd3/go.mod h1:hpGUWaI9xL8pRQCTXQgocU38Qw1g0Us7n5PxxTwTCYU= github.com/stefanberger/go-pkcs11uri v0.0.0-20201008174630-78d3cae3a980/go.mod h1:AO3tvPzVZ/ayst6UlUKUv6rcPQInYe3IknH3jYhAKu8= @@ -1307,6 +1325,7 @@ github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXl github.com/subosito/gotenv v1.4.0/go.mod h1:mZd6rFysKEcUhUHXJk0C/08wAgyDBFuwEYL7vWWGaGo= github.com/subosito/gotenv v1.4.1/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= +github.com/supranational/blst v0.3.11/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca/go.mod h1:u2MKkTVTVJWe5D1rCvame8WqhBd88EuIwODJZ1VHCPM= github.com/tchap/go-patricia v2.2.6+incompatible/go.mod h1:bmLyhP68RS6kStMGxByiQ23RP/odRBOTVjwp2cDyi6I= @@ -1323,6 +1342,8 @@ github.com/tidwall/btree v1.5.0/go.mod h1:LGm8L/DZjPLmeWGjv5kFrY8dL4uVhMmzmmLYms github.com/tidwall/gjson v1.12.1/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/gjson v1.14.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/gjson v1.14.1/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= +github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= +github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= github.com/tidwall/sjson v1.2.4/go.mod h1:098SZ494YoMWPmMO6ct4dcFnqxwj9r/gF0Etp19pSNM= github.com/timakin/bodyclose v0.0.0-20210704033933-f49887972144/go.mod h1:Qimiffbc6q9tBWlVV6x0P9sat/ao1xEkREYPPj9hphk= github.com/timakin/bodyclose v0.0.0-20230421092635-574207250966 h1:quvGphlmUVU+nhpFa4gg4yJyTRJ13reZMDHrKwYw53M= @@ -1344,9 +1365,8 @@ github.com/tonistiigi/units v0.0.0-20180711220420-6950e57a87ea/go.mod h1:WPnis/6 github.com/tonistiigi/vt100 v0.0.0-20210615222946-8066bb97264f/go.mod h1:ulncasL3N9uLrVann0m+CDlJKWsIAP34MPcOJF6VRvc= github.com/tyler-smith/go-bip39 v1.0.1-0.20181017060643-dbb3b84ba2ef/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs= github.com/tyler-smith/go-bip39 v1.0.2/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs= +github.com/tyler-smith/go-bip39 v1.1.0/go.mod h1:gUYDtqQw1JS3ZJ8UWVcGTGqqr6YIN3CWg+kkNaLt55U= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= -github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= -github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= github.com/ulikunitz/xz v0.5.8/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/ulikunitz/xz v0.5.11/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/ultraware/funlen v0.0.3/go.mod h1:Dp4UiAus7Wdb9KUZsYWZEWiRzGuM2kXM1lPbfaF6xhA= @@ -1577,6 +1597,7 @@ golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= +golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= golang.org/x/oauth2 v0.0.0-20170207211851-4464e7848382/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.5.0/go.mod h1:9/XBHVqLaWO3/BRHs5jbpYCnOZVjj5V0ndyaAM7KB4I= @@ -1602,7 +1623,6 @@ golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191115151921-52ab43148777/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200107162124-548cf772de50/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200826173525-f9321e4c35a6/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200923182605-d9f96fdee20d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201101102859-da207088b7d1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1651,6 +1671,7 @@ golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY= golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= +golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= @@ -1818,6 +1839,7 @@ google.golang.org/grpc v1.61.0/go.mod h1:VUbo7IFqmF1QtCAstipjG0GIoq49KvMe9+h1jFL google.golang.org/grpc v1.61.1/go.mod h1:VUbo7IFqmF1QtCAstipjG0GIoq49KvMe9+h1jFLBNJs= google.golang.org/grpc v1.62.0/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= +google.golang.org/grpc v1.63.2/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA= google.golang.org/protobuf v1.28.2-0.20220831092852-f930b1dc76e8/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.28.2-0.20230222093303-bc1253ad3743/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.29.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= @@ -1869,6 +1891,7 @@ mvdan.cc/unparam v0.0.0-20240104100049-c549a3470d14 h1:zCr3iRRgdk5eIikZNDphGcM6K mvdan.cc/unparam v0.0.0-20240104100049-c549a3470d14/go.mod h1:ZzZjEpJDOmx8TdVU6umamY3Xy0UAQUI2DHbf05USVbI= pgregory.net/rapid v0.4.7/go.mod h1:UYpPVyjFHzYBGHIxLFoupi8vwk6rXNzRY9OMvVxFIOU= rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= +rsc.io/tmplfunc v0.0.3/go.mod h1:AG3sTPzElb1Io3Yg4voV9AGZJuleGAwaVRxL9M49PhA= sigs.k8s.io/structured-merge-diff/v4 v4.1.2/go.mod h1:j/nl6xW8vLS49O8YvXW1ocPhZawJtm+Yrr7PPRQ0Vg4= sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8= diff --git a/icq-relayer/cmd/run.go b/icq-relayer/cmd/run.go index 365f7e564..35852212a 100644 --- a/icq-relayer/cmd/run.go +++ b/icq-relayer/cmd/run.go @@ -60,7 +60,7 @@ func InitConfigCommand() *cobra.Command { if err := encoder.Encode(config); err != nil { return fmt.Errorf("failed to encode config to TOML: %w", err) } - fmt.Printf("Config file created at %s\n", configFilePath) + log.Info().Msgf("Config file created at %s\n", configFilePath) return nil }, } @@ -73,7 +73,7 @@ func VersionCommand() *cobra.Command { Short: "Print the version number of icq-relayer", Long: `Print the version number of icq-relayer`, Run: func(cmd *cobra.Command, args []string) { - fmt.Println(runner.VERSION) + log.Info().Msg(runner.VERSION) }, } return versionCommand @@ -114,7 +114,7 @@ func StartCommand() *cobra.Command { config.ClientContext = &clientContext config.ProtoCodec = codec.NewProtoCodec(clientContext.InterfaceRegistry) ctx := context.Background() - log.Print("starting the server and listening for epochs") + log.Info().Msg("starting the server and listening for epochs") c := make(chan os.Signal, 1) signal.Notify(c, os.Interrupt, syscall.SIGTERM, syscall.SIGABRT) @@ -122,7 +122,7 @@ func StartCommand() *cobra.Command { go runner.Run(ctx, &config, CreateErrHandler(c)) for sig := range c { - log.Printf("Signal Received (%s) - gracefully shutting down", sig.String()) + log.Info().Msgf("Signal Received (%s) - gracefully shutting down", sig.String()) break } return nil diff --git a/icq-relayer/go.mod b/icq-relayer/go.mod index 9a27feeb9..9f8d1d3d7 100644 --- a/icq-relayer/go.mod +++ b/icq-relayer/go.mod @@ -9,7 +9,6 @@ require ( github.com/cosmos/cosmos-sdk v0.46.16 github.com/cosmos/ibc-go/v6 v6.3.1 github.com/dgraph-io/ristretto v0.1.1 - github.com/go-kit/log v0.2.1 github.com/mitchellh/go-homedir v1.1.0 github.com/prometheus/client_golang v1.18.0 github.com/quicksilver-zone/quicksilver v1.6.1-rc2 @@ -17,9 +16,6 @@ require ( github.com/spf13/cobra v1.8.0 github.com/spf13/viper v1.18.2 github.com/tendermint/tendermint v0.34.33 - golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 - golang.org/x/term v0.20.0 - gopkg.in/yaml.v2 v2.4.0 ) require ( @@ -77,6 +73,7 @@ require ( github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/getsentry/sentry-go v0.27.0 // indirect github.com/go-kit/kit v0.13.0 // indirect + github.com/go-kit/log v0.2.1 // indirect github.com/go-logfmt/logfmt v0.6.0 // indirect github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect @@ -171,10 +168,12 @@ require ( go.opentelemetry.io/otel/trace v1.26.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.23.0 // indirect + golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect golang.org/x/net v0.25.0 // indirect golang.org/x/oauth2 v0.20.0 // indirect golang.org/x/sync v0.7.0 // indirect golang.org/x/sys v0.20.0 // indirect + golang.org/x/term v0.20.0 // indirect golang.org/x/text v0.15.0 // indirect golang.org/x/time v0.5.0 // indirect google.golang.org/api v0.177.0 // indirect @@ -184,6 +183,7 @@ require ( google.golang.org/grpc v1.64.0 // indirect google.golang.org/protobuf v1.34.1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect nhooyr.io/websocket v1.8.11 // indirect sigs.k8s.io/yaml v1.4.0 // indirect diff --git a/icq-relayer/pkg/runner/run.go b/icq-relayer/pkg/runner/run.go index db98edf9e..61918675e 100644 --- a/icq-relayer/pkg/runner/run.go +++ b/icq-relayer/pkg/runner/run.go @@ -4,7 +4,6 @@ import ( "context" "encoding/hex" "fmt" - stdlog "log" "math" "math/rand" "net/http" @@ -23,12 +22,13 @@ import ( clienttypes "github.com/cosmos/ibc-go/v6/modules/core/02-client/types" tmclient "github.com/cosmos/ibc-go/v6/modules/light-clients/07-tendermint/types" "github.com/dgraph-io/ristretto" - "github.com/go-kit/log" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promhttp" "github.com/quicksilver-zone/quicksilver/icq-relayer/pkg/types" "github.com/quicksilver-zone/quicksilver/icq-relayer/prommetrics" qstypes "github.com/quicksilver-zone/quicksilver/x/interchainquery/types" + "github.com/rs/zerolog" + "github.com/rs/zerolog/log" abcitypes "github.com/tendermint/tendermint/abci/types" tmquery "github.com/tendermint/tendermint/libs/pubsub/query" "github.com/tendermint/tendermint/proto/tendermint/crypto" @@ -76,11 +76,25 @@ func Run(ctx context.Context, cfg *types.Config, errHandler func(error)) error { } TxMsgs = MaxTxMsgs - logger := log.NewLogfmtLogger(log.NewSyncWriter(os.Stderr)) - logger = log.With(logger, "ts", log.DefaultTimestampUTC, "caller", log.DefaultCaller) - - _ = logger.Log("worker", "init", "msg", "starting icq relayer", "version", VERSION) - _ = logger.Log("worker", "init", "msg", "permitted queries", "queries", strings.Join(cfg.AllowedQueries, ",")) + // Configure zerolog to log to os.Stderr + zerolog.TimeFieldFormat = zerolog.TimeFormatUnix + logger := log.Output(zerolog.ConsoleWriter{Out: os.Stderr, TimeFormat: time.RFC3339}) + + // Add global context fields + logger = logger.With().Timestamp().Caller().Logger() + + // Log messages + logger.Info(). + Str("worker", "init"). + Str("msg", "starting icq relayer"). + Str("version", VERSION). + Msg("") + + logger.Info(). + Str("worker", "init"). + Str("msg", "permitted queries"). + Str("queries", strings.Join(cfg.AllowedQueries, ",")). + Msg("") reg := prometheus.NewRegistry() metrics := *prommetrics.NewMetrics(reg) @@ -98,18 +112,19 @@ func Run(ctx context.Context, cfg *types.Config, errHandler func(error)) error { http.Handle("/metrics", promHandler) go func() { - stdlog.Fatal(http.ListenAndServe(fmt.Sprintf(":%d", cfg.BindPort), nil)) + err := http.ListenAndServe(fmt.Sprintf(":%d", cfg.BindPort), nil) + logger.Fatal().Err(err).Msg("HTTP metrics failed to start") }() defer func() { err := Close(cfg) if err != nil { - logger.Log("worker", "init", "msg", "error in closing the routine") + logger.Error().Str("worker", "init").Str("msg", "error in closing the routine").Msg("") } }() if err := cfg.DefaultChain.Init(cfg.ProtoCodec, cache); err != nil { - fmt.Println(err) + logger.Error().Err(err).Msg("Failed to initialize default chain") return err } @@ -118,7 +133,11 @@ func Run(ctx context.Context, cfg *types.Config, errHandler func(error)) error { return err } - _ = logger.Log("worker", "init", "msg", "configured chain", "chain", c.ChainID) + logger.Info(). + Str("worker", "init"). + Str("msg", "configured chain"). + Str("chain", c.ChainID). + Msg("") } query := tmquery.MustParse(fmt.Sprintf("message.module='%s'", "interchainquery")) @@ -126,11 +145,15 @@ func Run(ctx context.Context, cfg *types.Config, errHandler func(error)) error { wg := &sync.WaitGroup{} defer wg.Wait() - _ = logger.Log("worker", "init", "msg", "configuring subscription on default chainClient", "chain", cfg.DefaultChain.ChainID) + logger.Info(). + Str("worker", "init"). + Str("msg", "configuring subscription on default chainClient"). + Str("chain", cfg.DefaultChain.ChainID). + Msg("") ch, err := cfg.DefaultChain.GetClient().Subscribe(ctx, cfg.DefaultChain.ChainID+"-icq", query.String()) if err != nil { - _ = logger.Log("error", err.Error()) + logger.Error().Err(err).Msg("Failed to subscribe to default chain client") return err } wg.Add(1) @@ -140,23 +163,23 @@ func Run(ctx context.Context, cfg *types.Config, errHandler func(error)) error { v.Events["source"] = []string{chainId} // why does this always trigger twice? messages are deduped later, but this causes 2x queries to trigger. time.Sleep(75 * time.Millisecond) // try to avoid thundering herd. - go handleEvent(cfg, v, log.With(logger, "worker", "chainClient", "chain", cfg.DefaultChain.ChainID), metrics) + go handleEvent(cfg, v, logger.With().Str("worker", "chainClient").Str("chain", cfg.DefaultChain.ChainID).Logger(), metrics) } }(cfg.DefaultChain.ChainID, ch) wg.Add(1) go func() { defer wg.Done() - err := FlushSendQueue(cfg, log.With(logger, "worker", "flusher", "chain", cfg.DefaultChain.ChainID), metrics) + err := FlushSendQueue(cfg, logger.With().Str("worker", "flusher").Str("chain", cfg.DefaultChain.ChainID).Logger(), metrics) if err != nil { - _ = logger.Log("Flush Go-routine Bailing") + logger.Error().Msg("Flush Go-routine Bailing") panic(err) } }() for _, chainCfg := range cfg.Chains { wg.Add(1) - go func(defaultClient *types.ChainConfig, srcClient *types.ReadOnlyChainConfig, logger log.Logger) { + go func(defaultClient *types.ChainConfig, srcClient *types.ReadOnlyChainConfig, logger zerolog.Logger) { defer wg.Done() CNT: for { @@ -178,19 +201,23 @@ func Run(ctx context.Context, cfg *types.Config, errHandler func(error)) error { out := qstypes.QueryRequestsResponse{} err = cfg.ProtoCodec.Unmarshal(res.Response.Value, &out) if err != nil { - err := logger.Log("msg", "Error: Unable to unmarshal: ", "error", err) + logger.Error().Err(err).Str("msg", "Error: Unable to unmarshal").Msg("") if err != nil { return } continue CNT } - _ = logger.Log("worker", "chainClient", "msg", "fetched historic queries for chain", "count", len(out.Queries)) + logger.Info(). + Str("worker", "chainClient"). + Str("msg", "fetched historic queries for chain"). + Int("count", len(out.Queries)). + Msg("") if len(out.Queries) > 0 { - go handleHistoricRequests(cfg, srcClient, out.Queries, cfg.DefaultChain.ChainID, log.With(logger, "worker", "historic"), metrics) + go handleHistoricRequests(cfg, srcClient, out.Queries, cfg.DefaultChain.ChainID, logger.With().Str("worker", "historic").Logger(), metrics) } } - }(cfg.DefaultChain, chainCfg, log.With(logger, "chain", cfg.DefaultChain.ChainID, "src_chain", chainCfg.ChainID)) + }(cfg.DefaultChain, chainCfg, logger.With().Str("chain", cfg.DefaultChain.ChainID).Str("src_chain", chainCfg.ChainID).Logger()) } return nil @@ -206,7 +233,7 @@ type Query struct { Request []byte } -func handleHistoricRequests(cfg *types.Config, queryClient *types.ReadOnlyChainConfig, queries []qstypes.Query, sourceChainId string, logger log.Logger, metrics prommetrics.Metrics) { +func handleHistoricRequests(cfg *types.Config, queryClient *types.ReadOnlyChainConfig, queries []qstypes.Query, sourceChainId string, logger zerolog.Logger, metrics prommetrics.Metrics) { metrics.HistoricQueries.WithLabelValues("historic-queries").Set(float64(len(queries))) if len(queries) == 0 { @@ -229,19 +256,19 @@ func handleHistoricRequests(cfg *types.Config, queryClient *types.ReadOnlyChainC q.Type = query.QueryType if _, found := cache.Get("query/" + q.QueryId); found { - logger.Log("msg", "Query already in cache", "id", q.QueryId) + logger.Info().Str("msg", "Query already in cache").Str("id", q.QueryId).Msg("") continue } if _, found := cache.Get("ignore/" + q.QueryId); found { - logger.Log("msg", "Query already in ignore cache", "id", q.QueryId) + logger.Info().Str("msg", "Query already in ignore cache").Str("id", q.QueryId).Msg("") continue } var err error - q.Height, err = queryClient.GetCurrentHeight(ctx, cache, log.With(logger, "chain", queryClient.ChainID)) + q.Height, err = queryClient.GetCurrentHeight(ctx, cache, logger.With().Str("chain", queryClient.ChainID).Logger()) if err != nil { - _ = logger.Log("msg", "Error getting current height", "error", err) + logger.Error().Str("msg", "Error getting current height").Err(err).Msg("") continue } @@ -258,7 +285,7 @@ func handleHistoricRequests(cfg *types.Config, queryClient *types.ReadOnlyChainC } if !handle { - _ = logger.Log("msg", "Ignoring existing query; not a permitted type", "id", query.Id, "type", q.Type) + logger.Info().Str("msg", "Ignoring existing query; not a permitted type").Str("id", query.Id).Str("type", q.Type).Msg("") continue } //_ = logger.Log("msg", "Handling existing query", "id", query.Id) @@ -271,7 +298,7 @@ func handleHistoricRequests(cfg *types.Config, queryClient *types.ReadOnlyChainC } } -func handleEvent(cfg *types.Config, event coretypes.ResultEvent, logger log.Logger, metrics prommetrics.Metrics) { +func handleEvent(cfg *types.Config, event coretypes.ResultEvent, logger zerolog.Logger, metrics prommetrics.Metrics) { queries := []Query{} source := event.Events["source"] connections := event.Events["message.connection_id"] @@ -290,12 +317,12 @@ func handleEvent(cfg *types.Config, event coretypes.ResultEvent, logger log.Logg } req, err := hex.DecodeString(request[i]) if err != nil { - _ = logger.Log("worker", "handler", "msg", err.Error()) + logger.Error().Str("worker", "handler").Str("msg", err.Error()).Msg("") continue } h, err := strconv.ParseInt(height[i], 10, 64) if err != nil { - _ = logger.Log("worker", "handler", "msg", err.Error()) + logger.Error().Str("worker", "handler").Str("msg", err.Error()).Msg("") continue } @@ -312,7 +339,7 @@ func handleEvent(cfg *types.Config, event coretypes.ResultEvent, logger log.Logg } if !handle { - _ = logger.Log("worker", "handler", "msg", "Ignoring current query; not a permitted type", "id", queryIds[i], "type", types[i]) + logger.Info().Str("worker", "handler").Str("msg", "Ignoring current query; not a permitted type").Str("id", queryIds[i]).Str("type", types[i]).Msg("") continue } if _, found := cache.Get("query/" + queryIds[i]); found { @@ -321,15 +348,15 @@ func handleEvent(cfg *types.Config, event coretypes.ResultEvent, logger log.Logg } if _, found := cache.Get("ignore/" + queryIds[i]); found { - logger.Log("msg", "Query already in ignore cache", "id", queryIds[i]) + logger.Info().Str("msg", "Query already in ignore cache").Str("id", queryIds[i]).Msg("") // break if this is in the cache continue } if h == 0 { - currentheight, err := client.GetCurrentHeight(ctx, cache, log.With(logger, "chain", chains[i])) + currentheight, err := client.GetCurrentHeight(ctx, cache, logger.With().Str("chain", chains[i]).Logger()) if err != nil { - logger.Log("worker", "handler", "msg", "error getting current block", "height", currentheight) + logger.Error().Str("worker", "handler").Str("msg", "error getting current block").Int64("height", currentheight).Msg("") continue } } @@ -338,7 +365,7 @@ func handleEvent(cfg *types.Config, event coretypes.ResultEvent, logger log.Logg } for _, q := range queries { - go doRequestWithMetrics(cfg, q, log.With(logger, "src_chain", q.ChainId), metrics) + go doRequestWithMetrics(cfg, q, logger.With().Str("src_chain", q.ChainId).Logger(), metrics) time.Sleep(75 * time.Millisecond) // try to avoid thundering herd. } } @@ -377,7 +404,7 @@ func retryLightblock(ctx context.Context, chain *types.ReadOnlyChainConfig, heig return lightBlock.(*tmtypes.LightBlock), err } -func doRequestWithMetrics(cfg *types.Config, query Query, logger log.Logger, metrics prommetrics.Metrics) { +func doRequestWithMetrics(cfg *types.Config, query Query, logger zerolog.Logger, metrics prommetrics.Metrics) { startTime := time.Now() metrics.Requests.WithLabelValues("requests", query.Type).Inc() doRequest(cfg, query, logger, metrics) @@ -385,7 +412,7 @@ func doRequestWithMetrics(cfg *types.Config, query Query, logger log.Logger, met metrics.RequestsLatency.WithLabelValues("request-latency", query.Type).Observe(endTime.Sub(startTime).Seconds()) } -func doRequest(cfg *types.Config, query Query, logger log.Logger, metrics prommetrics.Metrics) { +func doRequest(cfg *types.Config, query Query, logger zerolog.Logger, metrics prommetrics.Metrics) { var err error client, ok := cfg.Chains[query.ChainId] if !ok { @@ -405,7 +432,7 @@ func doRequest(cfg *types.Config, query Query, logger log.Logger, metrics promme request := qstypes.GetTxsEventRequest{} err = cfg.ProtoCodec.Unmarshal(query.Request, &request) if err != nil { - _ = logger.Log("msg", "Error: Failed in Unmarshalling Request", "type", query.Type, "id", query.QueryId, "height", query.Height) + logger.Error().Str("msg", "Error: Failed in Unmarshalling Request").Str("type", query.Type).Str("id", query.QueryId).Int64("height", query.Height).Msg("") return } request.OrderBy = txtypes.OrderBy_ORDER_BY_DESC @@ -415,14 +442,14 @@ func doRequest(cfg *types.Config, query Query, logger log.Logger, metrics promme query.Request, err = cfg.ProtoCodec.Marshal(&request) if err != nil { - _ = logger.Log("msg", "Error: Failed in Marshalling Request", "type", query.Type, "id", query.QueryId, "height", query.Height) + logger.Error().Str("msg", "Error: Failed in Marshalling Request").Str("type", query.Type).Str("id", query.QueryId).Int64("height", query.Height).Msg("") return } - _ = logger.Log("msg", "Handling GetTxsEvents", "id", query.QueryId, "height", query.Height) + logger.Info().Str("msg", "Handling GetTxsEvents").Str("id", query.QueryId).Int64("height", query.Height).Msg("") res, err = client.RunABCIQuery(ctx, "/"+query.Type, query.Request, query.Height, prove, metrics) if err != nil { - _ = logger.Log("msg", "Error: Failed in RunGRPCQuery", "type", query.Type, "id", query.QueryId, "height", query.Height) + logger.Error().Str("msg", "Error: Failed in RunGRPCQuery").Str("type", query.Type).Str("id", query.QueryId).Int64("height", query.Height).Msg("") return } @@ -432,12 +459,12 @@ func doRequest(cfg *types.Config, query Query, logger log.Logger, metrics promme cfg.ProtoCodec.MustUnmarshal(query.Request, &req) hashBytes, err := hex.DecodeString(req.GetHash()) if err != nil { - _ = logger.Log("msg", fmt.Sprintf("Error: Could not get decode hash %s", err)) + logger.Error().Str("msg", fmt.Sprintf("Error: Could not decode hash %s", err)).Msg("") return } txRes, height, err := client.Tx(hashBytes) if err != nil { - _ = logger.Log("msg", fmt.Sprintf("Error: Could not fetch proof %s", err)) + logger.Error().Str("msg", fmt.Sprintf("Error: Could not fetch proof %s", err)).Msg("") return } @@ -445,13 +472,13 @@ func doRequest(cfg *types.Config, query Query, logger log.Logger, metrics promme clientId, err := cfg.DefaultChain.GetClientId(ctx, query.ConnectionId, logger, metrics) if err != nil { - _ = logger.Log("msg", fmt.Sprintf("Error: Could not get client id %s", err)) + logger.Error().Str("msg", fmt.Sprintf("Error: Could not get client id %s", err)).Msg("") return } header, err := getHeader(ctx, cfg, client, clientId, height-1, logger, true, metrics) if err != nil { - _ = logger.Log("msg", fmt.Sprintf("Error: Could not get header %s", err)) + logger.Error().Str("msg", fmt.Sprintf("Error: Could not get header %s", err)).Msg("") return } @@ -466,7 +493,7 @@ func doRequest(cfg *types.Config, query Query, logger log.Logger, metrics promme default: res, err = client.RunABCIQuery(ctx, "/"+query.Type, query.Request, query.Height, prove, metrics) if err != nil { - _ = logger.Log("msg", "Error: Failed in RunGRPCQuery", "type", query.Type, "id", query.QueryId, "height", query.Height) + logger.Error().Str("msg", "Error: Failed in RunGRPCQuery").Str("type", query.Type).Str("id", query.QueryId).Int64("height", query.Height).Msg("") return } } @@ -481,13 +508,13 @@ func doRequest(cfg *types.Config, query Query, logger log.Logger, metrics promme sendQueue <- Message{Msg: msg, ClientUpdate: clientUpdate} } -func asyncCacheClientUpdate(ctx context.Context, cfg *types.Config, client *types.ReadOnlyChainConfig, query Query, height int64, logger log.Logger, metrics prommetrics.Metrics) error { +func asyncCacheClientUpdate(ctx context.Context, cfg *types.Config, client *types.ReadOnlyChainConfig, query Query, height int64, logger zerolog.Logger, metrics prommetrics.Metrics) error { cacheKey := fmt.Sprintf("cu/%s-%d", query.ConnectionId, height) queryKey := fmt.Sprintf("cuquery/%s-%d", query.ConnectionId, height) _, ok := cache.Get("cu/" + cacheKey) if ok { - fmt.Println("cache found for ", cacheKey) + log.Info().Msgf("cache found for %s", cacheKey) return nil } else { _, ok := cache.Get(queryKey) // lock on querying the same block @@ -500,18 +527,18 @@ func asyncCacheClientUpdate(ctx context.Context, cfg *types.Config, client *type clientId, err := cfg.DefaultChain.GetClientId(ctx, query.ConnectionId, logger, metrics) if err != nil { - _ = logger.Log("msg", fmt.Sprintf("Error: Could not get clientId %s", err)) + logger.Error().Str("msg", "Error: Could not get clientId").Err(err).Msg("") return err } header, err := getHeader(ctx, cfg, client, clientId, height, logger, false, metrics) if err != nil { - _ = logger.Log("msg", fmt.Sprintf("Error: Could not get header %s", err)) + logger.Error().Str("msg", "Error: Could not get header").Err(err).Msg("") return err } msg, err := clienttypes.NewMsgUpdateClient(clientId, header, cfg.DefaultChain.GetAddress()) if err != nil { - _ = logger.Log("msg", fmt.Sprintf("Error: Could not create msg update: %s", err)) + logger.Error().Str("msg", "Error: Could not create msg update").Err(err).Msg("") return err } cache.SetWithTTL(cacheKey, msg, 5, 10*time.Minute) @@ -530,7 +557,7 @@ func getCachedClientUpdate(connectionId string, height int64) (sdk.Msg, error) { return nil, fmt.Errorf("client update not found") } -func getHeader(ctx context.Context, cfg *types.Config, client *types.ReadOnlyChainConfig, clientId string, requestHeight int64, logger log.Logger, historicOk bool, metrics prommetrics.Metrics) (*tmclient.Header, error) { +func getHeader(ctx context.Context, cfg *types.Config, client *types.ReadOnlyChainConfig, clientId string, requestHeight int64, logger zerolog.Logger, historicOk bool, metrics prommetrics.Metrics) (*tmclient.Header, error) { state, err := cfg.DefaultChain.GetClientState(ctx, clientId, logger, metrics) if err != nil { return nil, fmt.Errorf("error: Could not get state from chain: %q ", err.Error()) @@ -587,7 +614,7 @@ func getHeader(ctx context.Context, cfg *types.Config, client *types.ReadOnlyCha return header, nil } -func FlushSendQueue(cfg *types.Config, logger log.Logger, metrics prommetrics.Metrics) error { +func FlushSendQueue(cfg *types.Config, logger zerolog.Logger, metrics prommetrics.Metrics) error { time.Sleep(WaitInterval) toSend := []Message{} ch := sendQueue @@ -599,7 +626,7 @@ func FlushSendQueue(cfg *types.Config, logger log.Logger, metrics prommetrics.Me } else { TxMsgs = 2 * TxMsgs } - _ = logger.Log("msg", "increased batchsize", "size", TxMsgs) + logger.Info().Str("msg", "increased batch size").Int("size", TxMsgs).Msg("") LastReduced = time.Now() } @@ -615,7 +642,7 @@ func FlushSendQueue(cfg *types.Config, logger log.Logger, metrics prommetrics.Me go func() { err := asyncCacheClientUpdate(ctx, cfg, cfg.Chains[msg.ClientUpdate.ChainId], Query{ConnectionId: msg.ClientUpdate.ConnectionId, Height: msg.ClientUpdate.Height}, msg.ClientUpdate.Height, logger, metrics) if err != nil { - _ = logger.Log("msg", fmt.Sprintf("Error: Could not submit client update %s", err)) + logger.Error().Str("msg", "Error: Could not submit client update").Err(err).Msg("") } }() } @@ -629,10 +656,10 @@ func FlushSendQueue(cfg *types.Config, logger log.Logger, metrics prommetrics.Me } // TODO: refactor me! -func flush(cfg *types.Config, toSend []Message, logger log.Logger, metrics prommetrics.Metrics) { - fmt.Println("flush messages", len(toSend)) +func flush(cfg *types.Config, toSend []Message, logger zerolog.Logger, metrics prommetrics.Metrics) { + logger.Info().Msgf("Flush messages: %d", len(toSend)) if len(toSend) > 0 { - _ = logger.Log("msg", fmt.Sprintf("Sending batch of %d messages", len(toSend))) + logger.Info().Msgf("Sending batch of %d messages", len(toSend)) msgs := prepareMessages(toSend, logger) if len(msgs) > 0 { ctx, cancel := context.WithTimeout(context.Background(), time.Second*15) @@ -641,26 +668,26 @@ func flush(cfg *types.Config, toSend []Message, logger log.Logger, metrics promm switch { case err == nil: - _ = logger.Log("msg", fmt.Sprintf("Sent batch of %d (deduplicated) messages [hash: %s]", len(msgs), hash)) + logger.Info().Msgf("Sent batch of %d (deduplicated) messages [hash: %s]", len(msgs), hash) case code == 12: - _ = logger.Log("msg", "Not enough gas") + logger.Warn().Msg("Not enough gas") case code == 19: - _ = logger.Log("msg", "Tx already in mempool") + logger.Warn().Msg("Tx already in mempool") case strings.Contains(err.Error(), "request body too large"): TxMsgs = TxMsgs / 4 * 3 LastReduced = time.Now() - _ = logger.Log("msg", "body too large: reduced batchsize", "size", TxMsgs) + logger.Warn().Msgf("Body too large: reduced batch size to %d", TxMsgs) case strings.Contains(err.Error(), "failed to execute message"): regex := regexp.MustCompile(`failed to execute message; message index: (\d+)`) match := regex.FindStringSubmatch(err.Error()) idx, _ := strconv.Atoi(match[1]) badMsg := msgs[idx].(*qstypes.MsgSubmitQueryResponse) cache.SetWithTTL("ignore/"+badMsg.QueryId, true, 1, time.Minute*5) - _ = logger.Log("msg", "Failed to execute message; ignoring for five minutes", "index", match[1], "err", err.Error()) + logger.Error().Msgf("Failed to execute message; ignoring for five minutes (index: %d, error: %s)", idx, err.Error()) case code == 65536: - _ = logger.Log("msg", "error in tx", "err", err.Error()) + logger.Error().Err(err).Msg("Error in tx") default: - _ = logger.Log("msg", "Failed to submit; nevermind, we'll try again!", "err", err) + logger.Error().Err(err).Msg("Failed to submit; we'll try again!") metrics.FailedTxs.WithLabelValues("failed_txs").Inc() } @@ -668,7 +695,7 @@ func flush(cfg *types.Config, toSend []Message, logger log.Logger, metrics promm } } -func prepareMessages(msgSlice []Message, logger log.Logger) []sdk.Msg { +func prepareMessages(msgSlice []Message, logger zerolog.Logger) []sdk.Msg { keys := make(map[string]bool) list := []sdk.Msg{} @@ -688,12 +715,12 @@ func prepareMessages(msgSlice []Message, logger log.Logger) []sdk.Msg { msg, ok := entry.Msg.(*qstypes.MsgSubmitQueryResponse) if !ok { - fmt.Println("unable to cast message to MsgSubmitQueryResponse") + log.Info().Msg("unable to cast message to MsgSubmitQueryResponse") continue // unable to cast message to MsgSubmitQueryResponse } if _, ok := cache.Get("ignore/" + msg.QueryId); ok { - logger.Log("msg", "Query already in ignore cache", "id", msg.QueryId) + logger.Info().Str("msg", "Query already in ignore cache").Str("id", msg.QueryId).Msg("") continue } @@ -709,7 +736,7 @@ func prepareMessages(msgSlice []Message, logger log.Logger) []sdk.Msg { //fmt.Println("client update not ready; requeueing") go func(entry Message) { time.Sleep(time.Second * 2); sendQueue <- entry }(entry) // client update not ready; requeue. } else { - fmt.Println("client update ready; adding update and query response to send list") + log.Info().Msg("client update ready; adding update and query response to send list") list = append(list, cu) list = append(list, entry.Msg) keys[msg.QueryId] = true @@ -717,7 +744,7 @@ func prepareMessages(msgSlice []Message, logger log.Logger) []sdk.Msg { cache.Del("query/" + msg.QueryId) } } else { - fmt.Println("adding query response to send list") + log.Info().Msg("adding query response to send list") list = append(list, entry.Msg) keys[msg.QueryId] = true cache.Del("query/" + msg.QueryId) diff --git a/icq-relayer/pkg/types/client.go b/icq-relayer/pkg/types/client.go index 15ba4b195..870ca7bf2 100644 --- a/icq-relayer/pkg/types/client.go +++ b/icq-relayer/pkg/types/client.go @@ -4,7 +4,6 @@ import ( "context" "errors" "fmt" - "log" "os" "strings" "time" @@ -23,6 +22,8 @@ import ( clienttypes "github.com/cosmos/ibc-go/v6/modules/core/02-client/types" "github.com/dgraph-io/ristretto" "github.com/quicksilver-zone/quicksilver/icq-relayer/prommetrics" + "github.com/rs/zerolog" + "github.com/rs/zerolog/log" abcitypes "github.com/tendermint/tendermint/abci/types" cmtjson "github.com/tendermint/tendermint/libs/json" coretypes "github.com/tendermint/tendermint/rpc/core/types" @@ -40,7 +41,6 @@ import ( "github.com/cosmos/cosmos-sdk/types/bech32" xauthsigning "github.com/cosmos/cosmos-sdk/x/auth/signing" connectiontypes "github.com/cosmos/ibc-go/v6/modules/core/03-connection/types" - log2 "github.com/go-kit/log" home "github.com/mitchellh/go-homedir" prov "github.com/tendermint/tendermint/light/provider" lighthttp "github.com/tendermint/tendermint/light/provider/http" @@ -127,31 +127,31 @@ func (r *ReadOnlyChainConfig) LightBlock(ctx context.Context, height int64) (*tm defer cancel() lightBlock, err := r.LightProvider.LightBlock(ctx, height) if err != nil { - fmt.Println("error getting light block", err) + log.Error().Err(err).Msg("Error getting light block") return nil, err } return lightBlock, nil } -func (r *ReadOnlyChainConfig) GetClientState(ctx context.Context, clientId string, logger log2.Logger, metrics prommetrics.Metrics) (*clienttypes.QueryClientStateResponse, error) { +func (r *ReadOnlyChainConfig) GetClientState(ctx context.Context, clientId string, logger zerolog.Logger, metrics prommetrics.Metrics) (*clienttypes.QueryClientStateResponse, error) { clientStateQuery := clienttypes.QueryClientStateRequest{ClientId: clientId} bz := r.Codec.MustMarshal(&clientStateQuery) res, err := r.Client.ABCIQuery(ctx, "/ibc.core.client.v1.Query/ClientState", bz) if err != nil { - _ = logger.Log("msg", fmt.Sprintf("Error: Could not get client state from client %s", err)) + logger.Error().Err(err).Str("clientId", clientId).Msg("Could not get client state from client") return nil, err } clientStateResponse := clienttypes.QueryClientStateResponse{} err = r.Codec.Unmarshal(res.Response.Value, &clientStateResponse) if err != nil { - _ = logger.Log("msg", fmt.Sprintf("Error: Could not unmarshal connection %s", err)) + logger.Error().Err(err).Str("clientId", clientId).Msg("Could not unmarshal connection") return nil, err } return &clientStateResponse, nil } -func (r *ReadOnlyChainConfig) GetClientStateHeights(ctx context.Context, clientId string, chainId string, height uint64, logger log2.Logger, metrics prommetrics.Metrics, depth int) ([]clienttypes.Height, error) { +func (r *ReadOnlyChainConfig) GetClientStateHeights(ctx context.Context, clientId string, chainId string, height uint64, logger zerolog.Logger, metrics prommetrics.Metrics, depth int) ([]clienttypes.Height, error) { if depth > 10 { return nil, fmt.Errorf("reached max depth") @@ -163,8 +163,8 @@ func (r *ReadOnlyChainConfig) GetClientStateHeights(ctx context.Context, clientI bz := r.Codec.MustMarshal(&req) res, err := r.Client.ABCIQuery(ctx, "/ibc.core.client.v1.Query/ConsensusStateHeights", bz) if err != nil { - _ = logger.Log("msg", fmt.Sprintf("Error: Could not get consensus state heights from client %s", err)) - return nil, err + logger.Error().Err(err).Msg("Could not get consensus state heights from client") + return nil, err } resp := clienttypes.QueryConsensusStateHeightsResponse{} err = r.Codec.Unmarshal(res.Response.Value, &resp) @@ -179,20 +179,20 @@ func (r *ReadOnlyChainConfig) GetClientStateHeights(ctx context.Context, clientI return resp.ConsensusStateHeights, nil } -func (r *ReadOnlyChainConfig) GetClientId(ctx context.Context, connectionId string, logger log2.Logger, metrics prommetrics.Metrics) (string, error) { +func (r *ReadOnlyChainConfig) GetClientId(ctx context.Context, connectionId string, logger zerolog.Logger, metrics prommetrics.Metrics) (string, error) { clientId, found := r.Cache.Get("clientId/" + connectionId) if !found { connectionQuery := connectiontypes.QueryConnectionRequest{ConnectionId: connectionId} bz := r.Codec.MustMarshal(&connectionQuery) res, err := r.Client.ABCIQuery(ctx, "/ibc.core.connection.v1.Query/Connection", bz) if err != nil { - _ = logger.Log("msg", fmt.Sprintf("Error: Could not get connection from chain %s", err)) - return "", err + logger.Error().Err(err).Msg("Could not get connection from chain") + return "", err } connectionResponse := connectiontypes.QueryConnectionResponse{} err = r.Codec.Unmarshal(res.Response.Value, &connectionResponse) if err != nil { - _ = logger.Log("msg", fmt.Sprintf("Error: Could not unmarshal connection %s", err)) + logger.Error().Err(err).Msg("Could not unmarshal connection") return "", err } @@ -282,9 +282,9 @@ type TxResultMinimal struct { type QueryClient interface { Init(codec *codec.ProtoCodec, cache *ristretto.Cache) error - GetClientState(ctx context.Context, clientId string, logger log2.Logger, metrics prommetrics.Metrics) (*clienttypes.QueryClientStateResponse, error) - GetClientStateHeights(ctx context.Context, clientId string, chainId string, height uint64, logger log2.Logger, metrics prommetrics.Metrics, depth int) ([]clienttypes.Height, error) - GetClientId(ctx context.Context, connectionId string, logger log2.Logger, metrics prommetrics.Metrics) (string, error) + GetClientState(ctx context.Context, clientId string, logger zerolog.Logger, metrics prommetrics.Metrics) (*clienttypes.QueryClientStateResponse, error) + GetClientStateHeights(ctx context.Context, clientId string, chainId string, height uint64, logger zerolog.Logger, metrics prommetrics.Metrics, depth int) ([]clienttypes.Height, error) + GetClientId(ctx context.Context, connectionId string, logger zerolog.Logger, metrics prommetrics.Metrics) (string, error) } type TxClient interface { @@ -321,16 +321,16 @@ func (c *ChainConfig) GetAddressBytes() sdktypes.AccAddress { func (c *ChainConfig) GetPrivKeyAddress() (sdkcryptotypes.PrivKey, sdktypes.AccAddress) { kb, err := keyring.New("icq-relayer", keyring.BackendMemory, "", nil, c.Codec) if err != nil { - log.Fatal(err) + log.Fatal().Err(err).Msg("Failed to create keyring") } path, err := home.Expand(c.MnemonicPath) if err != nil { - log.Fatal(err) + log.Fatal().Err(err).Msg("Failed to expand mnemonic path") } mnemonicBytes, err := os.ReadFile(path) if err != nil { - log.Fatal(err) + log.Fatal().Err(err).Msg("Failed to read mnemonic file") } mnemonic := strings.Trim(string(mnemonicBytes), "\n") @@ -338,14 +338,14 @@ func (c *ChainConfig) GetPrivKeyAddress() (sdkcryptotypes.PrivKey, sdktypes.AccA algo, err := keyring.NewSigningAlgoFromString(string(hd.Secp256k1Type), keyringAlgos) if err != nil { - log.Fatal(err) + log.Fatal().Err(err).Msg("Failed to create signing algorithm") } hdPath := hd.CreateHDPath(118, 0, 0) derivedPriv, err := algo.Derive()(mnemonic, "", hdPath.String()) if err != nil { - log.Fatal(err) + log.Fatal().Err(err).Msg("Failed to derive private key") } privKey := algo.Generate()(derivedPriv) @@ -391,7 +391,7 @@ func (r *ReadOnlyChainConfig) RunABCIQuery(ctx context.Context, method string, r return abciRes, nil } -func (r *ReadOnlyChainConfig) GetCurrentHeight(ctx context.Context, cache *ristretto.Cache, logger log2.Logger) (int64, error) { +func (r *ReadOnlyChainConfig) GetCurrentHeight(ctx context.Context, cache *ristretto.Cache, logger zerolog.Logger) (int64, error) { currentheight, found := cache.Get("currentblock/" + r.ChainID) if !found { var err error