diff --git a/vendor/github.com/0xsequence/ethkit/ethmonitor/ethmonitor.go b/vendor/github.com/0xsequence/ethkit/ethmonitor/ethmonitor.go index 6e639a86..7fc2779a 100644 --- a/vendor/github.com/0xsequence/ethkit/ethmonitor/ethmonitor.go +++ b/vendor/github.com/0xsequence/ethkit/ethmonitor/ethmonitor.go @@ -48,6 +48,11 @@ type Options struct { // Logger used by ethmonitor to log warnings and debug info Logger logger.Logger + // (optional) ChainID is the chainID to use for the monitor. We + // also confirm it with the provider, but in case you're using a monitor + // with a faulty node, this can be used to manually set the chainID. + ChainID *big.Int + // PollingInterval to query the chain for new blocks PollingInterval time.Duration @@ -203,8 +208,21 @@ func (m *Monitor) lazyInit(ctx context.Context) error { var err error m.chainID, err = getChainID(ctx, m.provider) if err != nil { - return err + // Allow monitor to use a manually set chainID if provided, in case + // the provider is faulty. + if m.options.ChainID != nil { + m.chainID = m.options.ChainID + m.log.Errorf("ethmonitor: using manually set chainID: %s due to error: %v", m.chainID.String(), err) + return nil + } + return fmt.Errorf("ethmonitor: lazyInit failed to get chainID from provider: %w", err) } + + // Confirm the chainID passed to options matches the provider chainID + if m.options.ChainID != nil && m.chainID.Cmp(m.options.ChainID) != 0 { + return fmt.Errorf("ethmonitor: chainID passed to options %s does not match provider chainID %s", m.options.ChainID.String(), m.chainID.String()) + } + return nil } diff --git a/vendor/github.com/go-chi/traceid/middleware.go b/vendor/github.com/go-chi/traceid/middleware.go index 844e02ff..6d9bb05b 100644 --- a/vendor/github.com/go-chi/traceid/middleware.go +++ b/vendor/github.com/go-chi/traceid/middleware.go @@ -18,6 +18,7 @@ func Middleware(next http.Handler) http.Handler { ctx = context.WithValue(ctx, ctxKey{}, traceID) w.Header().Set(Header, traceID) + next.ServeHTTP(w, r.WithContext(ctx)) }) } diff --git a/vendor/modules.txt b/vendor/modules.txt index 560e6ab2..e3ea6b34 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1,7 +1,7 @@ # dario.cat/mergo v1.0.0 ## explicit; go 1.13 dario.cat/mergo -# github.com/0xsequence/ethkit v1.29.4 +# github.com/0xsequence/ethkit v1.29.5 ## explicit; go 1.21 github.com/0xsequence/ethkit github.com/0xsequence/ethkit/ethartifact @@ -41,7 +41,7 @@ github.com/0xsequence/ethkit/util # github.com/0xsequence/go-ethauth v0.13.0 ## explicit; go 1.17 github.com/0xsequence/go-ethauth -# github.com/0xsequence/go-sequence v0.43.4 +# github.com/0xsequence/go-sequence v0.43.6 ## explicit; go 1.22.0 github.com/0xsequence/go-sequence github.com/0xsequence/go-sequence/contracts