diff --git a/Makefile b/Makefile index 194d777..a7eb0a3 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ # TODO should be shared? -BSC_IBC_PROTO ?= ../lcp-parlia/proto/definitions +BSC_IBC_PROTO ?= ../parlia-elc/proto/definitions DOCKER := $(shell which docker) diff --git a/README.md b/README.md index 280a1d8..fec4b3a 100644 --- a/README.md +++ b/README.md @@ -35,11 +35,12 @@ go build -tags dev -ldflags="-X github.com/datachainlab/ibc-parlia-relay/module/ ## Development -Generate proto buf with protobuf definition of [lcp-parlia](https://github.com/datachainlab/lcp-parlia). +Generate proto buf with protobuf definition of [parlia-elc](https://github.com/datachainlab/parlia-elc). ``` cd $GOPATH/github.com/datachainlab -git clone https://github.com/datachainlab/lcp-parlia +git clone https://github.com/datachainlab/parlia-elc cd ibc-parlia-relay +make proto-import make proto-gen ``` diff --git a/e2e/config/demo/ibc-0.json b/e2e/config/demo/ibc-0.json index 4fe9173..45c066d 100644 --- a/e2e/config/demo/ibc-0.json +++ b/e2e/config/demo/ibc-0.json @@ -6,11 +6,15 @@ "rpc_addr": "http://localhost:8645", "hdw_mnemonic": "math razor capable expose worth grape metal sunset metal sudden usage scheme", "hdw_path": "m/44'/60'/0'/0/0", - "ibc_address": "0x702E40245797c5a2108A566b3CE2Bf14Bc6aF841" + "ibc_address": "0x702E40245797c5a2108A566b3CE2Bf14Bc6aF841", + "initial_send_checkpoint": 0, + "initial_recv_checkpoint": 0, + "enable_debug_trace": true, + "average_block_time_msec": 3000, + "max_retry_for_inclusion": 5 }, "prover": { "@type": "/relayer.provers.parlia.config.ProverConfig", - "debug": true, "trustingPeriod": "86400s", "maxClockDrift" : "0.001s" } diff --git a/e2e/config/demo/ibc-1.json b/e2e/config/demo/ibc-1.json index 53d9cc1..00e068a 100644 --- a/e2e/config/demo/ibc-1.json +++ b/e2e/config/demo/ibc-1.json @@ -6,7 +6,12 @@ "rpc_addr": "http://localhost:8545", "hdw_mnemonic": "math razor capable expose worth grape metal sunset metal sudden usage scheme", "hdw_path": "m/44'/60'/0'/0/0", - "ibc_address": "0x702E40245797c5a2108A566b3CE2Bf14Bc6aF841" + "ibc_address": "0x702E40245797c5a2108A566b3CE2Bf14Bc6aF841", + "initial_send_checkpoint": 0, + "initial_recv_checkpoint": 0, + "enable_debug_trace": true, + "average_block_time_msec": 3000, + "max_retry_for_inclusion": 5 }, "prover": { "@type": "/relayer.provers.parlia.config.ProverConfig" diff --git a/go.mod b/go.mod index 00f9b3d..ae31641 100644 --- a/go.mod +++ b/go.mod @@ -7,9 +7,9 @@ require ( github.com/cosmos/cosmos-sdk v0.47.3 github.com/cosmos/gogoproto v1.4.10 github.com/cosmos/ibc-go/v7 v7.2.0 - github.com/datachainlab/ethereum-ibc-relay-chain v0.2.3 + github.com/datachainlab/ethereum-ibc-relay-chain v0.2.6 github.com/ethereum/go-ethereum v1.12.0 - github.com/hyperledger-labs/yui-relayer v0.4.5 + github.com/hyperledger-labs/yui-relayer v0.4.14 github.com/spf13/cobra v1.7.0 github.com/stretchr/testify v1.8.4 google.golang.org/protobuf v1.30.0 @@ -81,6 +81,8 @@ require ( github.com/go-kit/kit v0.12.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.2.4 // indirect + github.com/go-logr/stdr v1.2.2 // indirect github.com/go-ole/go-ole v1.2.6 // indirect github.com/go-stack/stack v1.8.1 // indirect github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect @@ -144,13 +146,13 @@ require ( github.com/petermattis/goid v0.0.0-20230317030725-371a4b8eda08 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/prometheus/client_golang v1.14.0 // indirect - github.com/prometheus/client_model v0.3.0 // indirect + github.com/prometheus/client_golang v1.15.1 // indirect + github.com/prometheus/client_model v0.4.0 // indirect github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/procfs v0.9.0 // indirect github.com/rakyll/statik v0.1.7 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect - github.com/rogpeppe/go-internal v1.9.0 // indirect + github.com/rogpeppe/go-internal v1.10.0 // indirect github.com/rs/cors v1.8.3 // indirect github.com/rs/zerolog v1.29.1 // indirect github.com/sasha-s/go-deadlock v0.3.1 // indirect @@ -172,6 +174,12 @@ require ( github.com/zondax/ledger-go v0.14.1 // indirect go.etcd.io/bbolt v1.3.7 // indirect go.opencensus.io v0.24.0 // indirect + go.opentelemetry.io/otel v1.16.0 // indirect + go.opentelemetry.io/otel/exporters/prometheus v0.39.0 // indirect + go.opentelemetry.io/otel/metric v1.16.0 // indirect + go.opentelemetry.io/otel/sdk v1.16.0 // indirect + go.opentelemetry.io/otel/sdk/metric v0.39.0 // indirect + go.opentelemetry.io/otel/trace v1.16.0 // indirect golang.org/x/crypto v0.9.0 // indirect golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc // indirect golang.org/x/net v0.10.0 // indirect diff --git a/go.sum b/go.sum index de571ce..e696f8d 100644 --- a/go.sum +++ b/go.sum @@ -405,8 +405,8 @@ github.com/cucumber/common/gherkin/go/v22 v22.0.0 h1:4K8NqptbvdOrjL9DEea6HFjSpbd github.com/cucumber/common/messages/go/v17 v17.1.1 h1:RNqopvIFyLWnKv0LfATh34SWBhXeoFTJnSrgm9cT/Ts= github.com/danieljoos/wincred v1.1.2 h1:QLdCxFs1/Yl4zduvBdcHB8goaYk9RARS2SgLLRuAyr0= github.com/danieljoos/wincred v1.1.2/go.mod h1:GijpziifJoIBfYh+S7BbkdUTU4LfM+QnGqR5Vl2tAx0= -github.com/datachainlab/ethereum-ibc-relay-chain v0.2.3 h1:cib07hGm41YyssO3oz38BiHTX6K5iquo0INZ9yBS9hU= -github.com/datachainlab/ethereum-ibc-relay-chain v0.2.3/go.mod h1:Rbn+hsaEaYz7154ckk3blm5df9T0mMccWK26id6JcJs= +github.com/datachainlab/ethereum-ibc-relay-chain v0.2.6 h1:sVonmqqP+uIe8UAfIe778icn/el6xwUv3u7eboJDv2Y= +github.com/datachainlab/ethereum-ibc-relay-chain v0.2.6/go.mod h1:pSJ5MCqRsSERugEQtXMoKiznET4HbP81PE1Z0ZUfUv4= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -504,6 +504,11 @@ github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logfmt/logfmt v0.6.0 h1:wGYYu3uicYdqXVgoYbvnkrPVXkuLM1p1ifugDMEdRi4= github.com/go-logfmt/logfmt v0.6.0/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= +github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab/go.mod h1:/P9AEU963A2AYjv4d1V5eVL1CQbEJq6aCNHDDjibzu8= github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= @@ -743,8 +748,8 @@ github.com/huandu/skiplist v1.2.0/go.mod h1:7v3iFjLcSAzO4fN5B8dvebvo/qsfumiLiDXM github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= github.com/huin/goupnp v1.0.3 h1:N8No57ls+MnjlB+JPiCVSOyy/ot7MJTqlo7rn+NYSqQ= github.com/hydrogen18/memlistener v0.0.0-20200120041712-dcc25e7acd91/go.mod h1:qEIFzExnS6016fRpRfxrExeVn2gbClQA99gQhnIcdhE= -github.com/hyperledger-labs/yui-relayer v0.4.5 h1:zHsDr3Bvg67TT6aN5T92BnG0QnjkdY/gam+xOXqVNXI= -github.com/hyperledger-labs/yui-relayer v0.4.5/go.mod h1:SlZX1TxfN6d3OCKv7fdki1tmRQg0h/GArJL+QYDD+DY= +github.com/hyperledger-labs/yui-relayer v0.4.14 h1:cuQwwhGjb52fT/qgKuYLW6FI/phnrUwFkEHoJWm+d/s= +github.com/hyperledger-labs/yui-relayer v0.4.14/go.mod h1:Hdc/ERCPDhbipri45/U6+/3kDH7EttIWGdql+Rd3tZg= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/imkira/go-interpol v1.1.0/go.mod h1:z0h2/2T3XF8kyEPpRgJ3kmNv+C43p+I/CoI+jC3w2iA= @@ -972,16 +977,16 @@ github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5Fsn github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.14.0 h1:nJdhIvne2eSX/XRAFV9PcvFFRbrjbcTUj0VP62TMhnw= -github.com/prometheus/client_golang v1.14.0/go.mod h1:8vpkKitgIVNcqrRBWh1C4TIUQgYNtG/XQE4E/Zae36Y= +github.com/prometheus/client_golang v1.15.1 h1:8tXpTmJbyH5lydzFPoxSIJ0J46jdh3tylbvM1xCv0LI= +github.com/prometheus/client_golang v1.15.1/go.mod h1:e9yaBhRPU2pPNsZwE+JdQl0KEt1N9XgF6zxWmaC0xOk= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4= -github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= +github.com/prometheus/client_model v0.4.0 h1:5lQXD3cAg1OXBf4Wq03gTrXHeaV0TQvGfUooCfx1yqY= +github.com/prometheus/client_model v0.4.0/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU= github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= @@ -1009,8 +1014,9 @@ github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6L github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/rogpeppe/go-internal v1.8.1/go.mod h1:JeRgkft04UBgHMgCIwADu4Pn6Mtm5d4nPKWu0nJ5d+o= -github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= +github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= +github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/rs/cors v1.8.3 h1:O+qNyWn7Z+F9M0ILBHgMVPuB1xTOucVd5gtaYyXBpRo= github.com/rs/cors v1.8.3/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= @@ -1158,6 +1164,18 @@ go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= +go.opentelemetry.io/otel v1.16.0 h1:Z7GVAX/UkAXPKsy94IU+i6thsQS4nb7LviLpnaNeW8s= +go.opentelemetry.io/otel v1.16.0/go.mod h1:vl0h9NUa1D5s1nv3A5vZOYWn8av4K8Ml6JDeHrT/bx4= +go.opentelemetry.io/otel/exporters/prometheus v0.39.0 h1:whAaiHxOatgtKd+w0dOi//1KUxj3KoPINZdtDaDj3IA= +go.opentelemetry.io/otel/exporters/prometheus v0.39.0/go.mod h1:4jo5Q4CROlCpSPsXLhymi+LYrDXd2ObU5wbKayfZs7Y= +go.opentelemetry.io/otel/metric v1.16.0 h1:RbrpwVG1Hfv85LgnZ7+txXioPDoh6EdbZHo26Q3hqOo= +go.opentelemetry.io/otel/metric v1.16.0/go.mod h1:QE47cpOmkwipPiefDwo2wDzwJrlfxxNYodqc4xnGCo4= +go.opentelemetry.io/otel/sdk v1.16.0 h1:Z1Ok1YsijYL0CSJpHt4cS3wDDh7p572grzNrBMiMWgE= +go.opentelemetry.io/otel/sdk v1.16.0/go.mod h1:tMsIuKXuuIWPBAOrH+eHtvhTL+SntFtXF9QD68aP6p4= +go.opentelemetry.io/otel/sdk/metric v0.39.0 h1:Kun8i1eYf48kHH83RucG93ffz0zGV1sh46FAScOTuDI= +go.opentelemetry.io/otel/sdk/metric v0.39.0/go.mod h1:piDIRgjcK7u0HCL5pCA4e74qpK/jk3NiUoAHATVAmiI= +go.opentelemetry.io/otel/trace v1.16.0 h1:8JRpaObFoW0pxuVPapkgH8UhHQj+bJW8jJsCZEu5MQs= +go.opentelemetry.io/otel/trace v1.16.0/go.mod h1:Yt9vYq1SdNz3xdjZZK7wcXv1qv2pwLkqr2QVwea0ef0= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= diff --git a/module/config.go b/module/config.go index 4a291bd..13e87df 100644 --- a/module/config.go +++ b/module/config.go @@ -2,7 +2,6 @@ package module import ( "fmt" - "github.com/datachainlab/ethereum-ibc-relay-chain/pkg/relay/ethereum" "github.com/hyperledger-labs/yui-relayer/core" ) @@ -16,3 +15,7 @@ func (c *ProverConfig) Build(chain core.Chain) (core.Prover, error) { } return NewProver(NewChain(chain_), c), nil } + +func (c *ProverConfig) Validate() error { + return nil +} diff --git a/module/config.pb.go b/module/config.pb.go index 068f650..535fb93 100644 --- a/module/config.pb.go +++ b/module/config.pb.go @@ -30,7 +30,6 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type ProverConfig struct { TrustingPeriod time.Duration `protobuf:"bytes,1,opt,name=trusting_period,json=trustingPeriod,proto3,stdduration" json:"trusting_period"` MaxClockDrift time.Duration `protobuf:"bytes,2,opt,name=max_clock_drift,json=maxClockDrift,proto3,stdduration" json:"max_clock_drift"` - Debug bool `protobuf:"varint,3,opt,name=debug,proto3" json:"debug,omitempty"` } func (m *ProverConfig) Reset() { *m = ProverConfig{} } @@ -80,13 +79,6 @@ func (m *ProverConfig) GetMaxClockDrift() time.Duration { return 0 } -func (m *ProverConfig) GetDebug() bool { - if m != nil { - return m.Debug - } - return false -} - func init() { proto.RegisterType((*ProverConfig)(nil), "relayer.provers.parlia.config.ProverConfig") } @@ -96,26 +88,25 @@ func init() { } var fileDescriptor_4d00ceb9ab8b08a6 = []byte{ - // 297 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x90, 0x3f, 0x4f, 0x02, 0x31, - 0x18, 0xc6, 0xaf, 0x1a, 0x0d, 0x39, 0xff, 0x90, 0x5c, 0x18, 0x90, 0xc4, 0x42, 0x9c, 0x88, 0x09, - 0x6d, 0xa2, 0xdf, 0x00, 0x58, 0x8c, 0x0e, 0x84, 0xd1, 0x85, 0xf4, 0xda, 0x52, 0x1a, 0x7b, 0xf7, - 0x5e, 0x4a, 0x6b, 0xf0, 0x5b, 0x38, 0xfa, 0x6d, 0x5c, 0x19, 0x19, 0x9d, 0xd4, 0xc0, 0x17, 0x31, - 0xb4, 0xc7, 0xee, 0xd4, 0xb7, 0xcd, 0xef, 0xf7, 0x3c, 0xcd, 0x9b, 0xde, 0x5a, 0x69, 0xd8, 0x9b, - 0xb4, 0xb4, 0xb2, 0xf0, 0x2a, 0xed, 0x92, 0x56, 0xcc, 0x1a, 0xcd, 0x28, 0x87, 0x72, 0xae, 0x55, - 0x7d, 0x90, 0xca, 0x82, 0x83, 0xec, 0xba, 0x66, 0x49, 0xcd, 0x92, 0xc8, 0x92, 0x08, 0x75, 0xb0, - 0x02, 0x50, 0x46, 0xd2, 0x00, 0xe7, 0x7e, 0x4e, 0x85, 0xb7, 0xcc, 0x69, 0x28, 0xa3, 0xde, 0x69, - 0x29, 0x50, 0x10, 0x46, 0xba, 0x9f, 0xe2, 0xeb, 0xcd, 0x27, 0x4a, 0xcf, 0x27, 0x21, 0x6f, 0x14, - 0x62, 0xb2, 0xa7, 0xb4, 0xe9, 0xac, 0x5f, 0x3a, 0x5d, 0xaa, 0x59, 0x25, 0xad, 0x06, 0xd1, 0x46, - 0x3d, 0xd4, 0x3f, 0xbb, 0xbb, 0x22, 0xb1, 0x80, 0x1c, 0x0a, 0xc8, 0xb8, 0x2e, 0x18, 0x36, 0xd6, - 0xdf, 0xdd, 0xe4, 0xe3, 0xa7, 0x8b, 0xa6, 0x97, 0x07, 0x77, 0x12, 0xd4, 0xec, 0x31, 0x6d, 0x16, - 0x6c, 0x35, 0xe3, 0x06, 0xf8, 0xcb, 0x4c, 0x58, 0x3d, 0x77, 0xed, 0xa3, 0xff, 0xa7, 0x5d, 0x14, - 0x6c, 0x35, 0xda, 0xab, 0xe3, 0xbd, 0x99, 0xb5, 0xd2, 0x13, 0x21, 0x73, 0xaf, 0xda, 0xc7, 0x3d, - 0xd4, 0x6f, 0x4c, 0xe3, 0x65, 0xf8, 0xb0, 0xde, 0x62, 0xb4, 0xd9, 0x62, 0xf4, 0xbb, 0xc5, 0xe8, - 0x7d, 0x87, 0x93, 0xcd, 0x0e, 0x27, 0x5f, 0x3b, 0x9c, 0x3c, 0x53, 0xa5, 0xdd, 0xc2, 0xe7, 0x84, - 0x43, 0x41, 0x05, 0x73, 0x8c, 0x2f, 0x98, 0x2e, 0x0d, 0xcb, 0xa9, 0xce, 0xf9, 0x20, 0x2e, 0x6f, - 0x10, 0x76, 0x4a, 0x0b, 0x10, 0xde, 0xc8, 0xfc, 0x34, 0x7c, 0xe6, 0xfe, 0x2f, 0x00, 0x00, 0xff, - 0xff, 0xe6, 0x08, 0x92, 0xd7, 0x96, 0x01, 0x00, 0x00, + // 283 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x90, 0x3f, 0x4e, 0xc3, 0x30, + 0x18, 0xc5, 0x63, 0x06, 0x84, 0xc2, 0x9f, 0x4a, 0x11, 0x43, 0xa9, 0x84, 0x8b, 0x98, 0x10, 0x52, + 0x6d, 0x09, 0x6e, 0xd0, 0x76, 0x41, 0x30, 0x54, 0x8c, 0x2c, 0x91, 0xe3, 0x38, 0xae, 0x85, 0x93, + 0x2f, 0x72, 0x6d, 0x54, 0x6e, 0xc1, 0xc8, 0x15, 0xb8, 0x49, 0xc7, 0x8e, 0x4c, 0x80, 0x92, 0x8b, + 0xa0, 0xd8, 0xe9, 0xde, 0xc9, 0x9f, 0xac, 0xdf, 0xef, 0x3d, 0xe9, 0xc5, 0xb7, 0x46, 0x68, 0xf6, + 0x2e, 0x0c, 0xad, 0x0d, 0xbc, 0x09, 0xb3, 0xa2, 0x35, 0x33, 0x5a, 0x31, 0xca, 0xa1, 0x2a, 0x94, + 0xec, 0x1f, 0x52, 0x1b, 0xb0, 0x90, 0x5c, 0xf6, 0x2c, 0xe9, 0x59, 0x12, 0x58, 0x12, 0xa0, 0x11, + 0x96, 0x00, 0x52, 0x0b, 0xea, 0xe1, 0xcc, 0x15, 0x34, 0x77, 0x86, 0x59, 0x05, 0x55, 0xd0, 0x47, + 0xe7, 0x12, 0x24, 0xf8, 0x93, 0x76, 0x57, 0xf8, 0xbd, 0xfe, 0x42, 0xf1, 0xc9, 0xc2, 0xe7, 0xcd, + 0x7c, 0x4c, 0xf2, 0x14, 0x0f, 0xac, 0x71, 0x2b, 0xab, 0x2a, 0x99, 0xd6, 0xc2, 0x28, 0xc8, 0x87, + 0xe8, 0x0a, 0xdd, 0x1c, 0xdf, 0x5d, 0x90, 0x50, 0x40, 0x76, 0x05, 0x64, 0xde, 0x17, 0x4c, 0x8f, + 0x36, 0x3f, 0xe3, 0xe8, 0xf3, 0x77, 0x8c, 0x9e, 0xcf, 0x76, 0xee, 0xc2, 0xab, 0xc9, 0x63, 0x3c, + 0x28, 0xd9, 0x3a, 0xe5, 0x1a, 0xf8, 0x6b, 0x9a, 0x1b, 0x55, 0xd8, 0xe1, 0xc1, 0xfe, 0x69, 0xa7, + 0x25, 0x5b, 0xcf, 0x3a, 0x75, 0xde, 0x99, 0xd3, 0x87, 0x4d, 0x83, 0xd1, 0xb6, 0xc1, 0xe8, 0xaf, + 0xc1, 0xe8, 0xa3, 0xc5, 0xd1, 0xb6, 0xc5, 0xd1, 0x77, 0x8b, 0xa3, 0x17, 0x2a, 0x95, 0x5d, 0xba, + 0x8c, 0x70, 0x28, 0x69, 0xce, 0x2c, 0xe3, 0x4b, 0xa6, 0x2a, 0xcd, 0x32, 0xaa, 0x32, 0x3e, 0x09, + 0x33, 0x4d, 0xfc, 0x7a, 0xb4, 0x84, 0xdc, 0x69, 0x91, 0x1d, 0xfa, 0xda, 0xfb, 0xff, 0x00, 0x00, + 0x00, 0xff, 0xff, 0x5a, 0x4f, 0xa4, 0xee, 0x80, 0x01, 0x00, 0x00, } func (m *ProverConfig) Marshal() (dAtA []byte, err error) { @@ -138,16 +129,6 @@ func (m *ProverConfig) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.Debug { - i-- - if m.Debug { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x18 - } n1, err1 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.MaxClockDrift, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.MaxClockDrift):]) if err1 != nil { return 0, err1 @@ -188,9 +169,6 @@ func (m *ProverConfig) Size() (n int) { n += 1 + l + sovConfig(uint64(l)) l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.MaxClockDrift) n += 1 + l + sovConfig(uint64(l)) - if m.Debug { - n += 2 - } return n } @@ -295,26 +273,6 @@ func (m *ProverConfig) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Debug", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowConfig - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Debug = bool(v != 0) default: iNdEx = preIndex skippy, err := skipConfig(dAtA[iNdEx:]) diff --git a/module/prover.go b/module/prover.go index c9e9e00..87025ed 100644 --- a/module/prover.go +++ b/module/prover.go @@ -3,7 +3,7 @@ package module import ( "context" "fmt" - "log" + "github.com/hyperledger-labs/yui-relayer/log" "time" "github.com/cometbft/cometbft/libs/math" @@ -64,14 +64,13 @@ func (pr *Prover) GetLatestFinalizedHeader() (out core.Header, err error) { if err != nil { return nil, err } - if pr.config.Debug { - log.Printf("GetLatestFinalizedHeader: finalized = %d, latest = %d\n", header.GetHeight(), latestHeight) - } + log.GetLogger().Debug("GetLatestFinalizedHeader", "finalized", header.GetHeight(), "latest", latestHeight) return header, err } // GetLatestFinalizedHeaderByLatestHeight returns the latest finalized header from the chain func (pr *Prover) GetLatestFinalizedHeaderByLatestHeight(latestBlockNumber uint64) (core.Header, error) { + logger := log.GetLogger() for i := latestBlockNumber; i > 0; i-- { header, err := pr.chain.Header(context.Background(), i) if err != nil { @@ -85,9 +84,9 @@ func (pr *Prover) GetLatestFinalizedHeaderByLatestHeight(latestBlockNumber uint6 continue } probablyFinalized := vote.Data.SourceNumber - if pr.config.Debug { - log.Printf("Try to seek verifying headers to finalize %d, latest=%d\n", probablyFinalized, latestBlockNumber) - } + + logger.Debug("Try to seek verifying headers to finalize", "probablyFinalized", probablyFinalized, "latest", latestBlockNumber) + headers, err := pr.QueryVerifyingEthHeaders(probablyFinalized, latestBlockNumber) if err != nil { return nil, err @@ -95,9 +94,7 @@ func (pr *Prover) GetLatestFinalizedHeaderByLatestHeight(latestBlockNumber uint6 if headers != nil { return pr.withProofAndValidators(probablyFinalized, headers) } - if pr.config.Debug { - log.Printf("Failed to seek verifying headers to finalize %d, latest=%d. So seek previous finalized header.\n", probablyFinalized, latestBlockNumber) - } + logger.Debug("Failed to seek verifying headers to finalize. So seek previous finalized header.", "probablyFinalized", probablyFinalized, "latest", latestBlockNumber) } return nil, fmt.Errorf("no finalized header found: %d", latestBlockNumber) } @@ -207,6 +204,7 @@ func (pr *Prover) SetupHeadersForUpdateByLatestHeight(clientStateLatestHeight ex } targetHeaders = append(targetHeaders, latestFinalizedHeader) + logger := log.GetLogger() for i, h := range targetHeaders { var trustedHeight clienttypes.Height if i == 0 { @@ -216,9 +214,7 @@ func (pr *Prover) SetupHeadersForUpdateByLatestHeight(clientStateLatestHeight ex } h.(*Header).TrustedHeight = &trustedHeight - if pr.config.Debug { - log.Printf("SetupHeadersForUpdateByLatestHeight: targetHeight=%v, trustedHeight=%v, headerLength=%d, \n", h.GetHeight(), trustedHeight, len(h.(*Header).Headers)) - } + logger.Debug("SetupHeadersForUpdateByLatestHeight", "target", h.GetHeight(), "trusted", trustedHeight, "headerSize", len(h.(*Header).Headers)) } return targetHeaders, nil } @@ -294,9 +290,7 @@ func (pr *Prover) QueryVerifyingEthHeaders(height uint64, limit uint64) ([]*ETHH } return append(ethHeaders, targetETHHeader, childETHHeader, grandChildETHHeader), nil } - if pr.config.Debug { - log.Printf("Insufficient verifying headers to finalize %d. limit=%d", height, limit) - } + log.GetLogger().Debug("Insufficient verifying headers to finalize", "height", height, "limit", limit) return nil, nil } diff --git a/module/prover_test.go b/module/prover_test.go index 060609f..609f6d0 100644 --- a/module/prover_test.go +++ b/module/prover_test.go @@ -2,6 +2,7 @@ package module import ( "context" + "github.com/hyperledger-labs/yui-relayer/log" "math/big" "testing" "time" @@ -279,7 +280,10 @@ func (ts *ProverTestSuite) SetupTest() { err = chain.Init("", 0, codec, false) ts.Require().NoError(err) - // call SetRelayInfo + + err = log.InitLogger("DEBUG", "text", "stdout") + ts.Require().NoError(err) + err = chain.SetRelayInfo(&core.PathEnd{ ClientID: "mock-client-0", ConnectionID: "connection-0", @@ -292,7 +296,6 @@ func (ts *ProverTestSuite) SetupTest() { config := ProverConfig{ TrustingPeriod: 100 * time.Second, MaxClockDrift: 1 * time.Millisecond, - Debug: true, } ts.chain = &mockChain{ Chain: NewChain(chain), diff --git a/proto/relayer/provers/parlia/config/config.proto b/proto/relayer/provers/parlia/config/config.proto index dc628c6..ba7c348 100644 --- a/proto/relayer/provers/parlia/config/config.proto +++ b/proto/relayer/provers/parlia/config/config.proto @@ -8,5 +8,4 @@ import "gogoproto/gogo.proto"; message ProverConfig { google.protobuf.Duration trusting_period = 1 [(gogoproto.nullable) = false, (gogoproto.stdduration) = true]; google.protobuf.Duration max_clock_drift = 2 [(gogoproto.nullable) = false, (gogoproto.stdduration) = true]; - bool debug = 3; } diff --git a/tool/testdata/internal/misbehavior.go b/tool/testdata/internal/misbehavior.go index 595ed56..51c0410 100644 --- a/tool/testdata/internal/misbehavior.go +++ b/tool/testdata/internal/misbehavior.go @@ -20,7 +20,7 @@ func (m *misbehaviorModule) success() *cobra.Command { return &cobra.Command{ Use: "success", RunE: func(cmd *cobra.Command, args []string) error { - chainID := int64(9999) + chainID := uint64(9999) targetHeight, header1, err := m.getLocalHeader(chainID, 8645, 0) if err != nil { log.Panic(err) @@ -111,7 +111,7 @@ func (m *misbehaviorModule) error() *cobra.Command { } } -func (m *misbehaviorModule) getLocalHeader(chainID int64, port int64, targetHeight uint64) (uint64, *module.Header, error) { +func (m *misbehaviorModule) getLocalHeader(chainID uint64, port int64, targetHeight uint64) (uint64, *module.Header, error) { chain, err := ethereum.NewChain(ethereum.ChainConfig{ EthChainId: chainID, RpcAddr: fmt.Sprintf("http://localhost:%d", port),