From b967398bc30b2f0973dc6fd0a83f8265dc6b0a64 Mon Sep 17 00:00:00 2001 From: Trajan0x Date: Tue, 2 Jul 2024 12:39:49 -0400 Subject: [PATCH 1/5] add contracts api endpoint [goreleaser] --- .../rfq/API/get-contract-addresses.api.mdx | 179 ++++++++++++++++ docs/bridge/docs/rfq/API/relay-ack.api.mdx | 202 ++++++++++++++++++ services/rfq/api/client/client.go | 42 +++- services/rfq/api/docs/docs.go | 38 ++++ services/rfq/api/docs/swagger.json | 38 ++++ services/rfq/api/docs/swagger.yaml | 25 +++ services/rfq/api/model/response.go | 6 + services/rfq/api/rest/handler.go | 28 ++- services/rfq/api/rest/server.go | 11 +- services/rfq/api/rest/server_test.go | 14 ++ 10 files changed, 567 insertions(+), 16 deletions(-) create mode 100644 docs/bridge/docs/rfq/API/get-contract-addresses.api.mdx create mode 100644 docs/bridge/docs/rfq/API/relay-ack.api.mdx diff --git a/docs/bridge/docs/rfq/API/get-contract-addresses.api.mdx b/docs/bridge/docs/rfq/API/get-contract-addresses.api.mdx new file mode 100644 index 0000000000..9bc7fb21b3 --- /dev/null +++ b/docs/bridge/docs/rfq/API/get-contract-addresses.api.mdx @@ -0,0 +1,179 @@ +--- +id: get-contract-addresses +title: "Get contract addresses" +description: "get quotes from all relayers." +sidebar_label: "Get contract addresses" +hide_title: true +hide_table_of_contents: true +api: eJyFUrtuwzAM/BWBs9EEHbMVRZGhQzu0U5CBkZlYqWwpEh3UMPzvJe2keXToZD5OR97RPZSUbXKRXWhgATtic2gDUzbbFGqD3ptEHjtK+QEKSJRjaDJlWPTwOJ/r55bh7VVgNjRMDWsXY/TOonZn+6yQHrKtqEaNHFM9csUUIiV2E7O+T2h5TLAsnT5H/34D4i6SDMycXLODobhb5PnMYVw2aGqMJmyNrdA1xpWGgzlPMTJBhGVZ/MQZNnuyDMPwp/JbwJSwE8QwgnAnK61gsg7WBdTEVSgnR4U3IleSzC7CCnDNNpzFSklCZXLslV76R/F8kqJjY8hc42hfg7VClnKrewmkxDc+9Jdj/HvdkzSmb55FL0bp4Db58UCjgtXVaURlJUtpse83mOkz+WHQ8qGl1EldwiMmhxuVtFoLWUVYUpKkhy8SCDxZS1EdOqJvR1/v/5fh2s3ly4d4/gO22+/e +sidebar_class_name: "get api-method" +custom_edit_url: null +--- + +import ApiTabs from "@theme/ApiTabs"; +import DiscriminatorTabs from "@theme/DiscriminatorTabs"; +import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint"; +import SecuritySchemes from "@theme/ApiExplorer/SecuritySchemes"; +import MimeTabs from "@theme/MimeTabs"; +import ParamsItem from "@theme/ParamsItem"; +import ResponseSamples from "@theme/ResponseSamples"; +import SchemaItem from "@theme/SchemaItem"; +import SchemaTabs from "@theme/SchemaTabs"; +import Markdown from "@theme/Markdown"; +import Heading from "@theme/Heading"; +import OperationTabs from "@theme/OperationTabs"; +import TabItem from "@theme/TabItem"; + + + + + + + + + + +get quotes from all relayers. + +
+
+ + +
+ + + OK + + +
+ + + + +
+ + + Schema + +
+ +
    +
  • +
    + Array [ +
    +
  • +
    + + + + contracts + + object + + +
    +
    + + + Contracts is a map of chain id to contract address + + +
    + + +
    +
    +
  • +
    + ] +
    +
  • +
+
+
+ + + + +
+
+
+
+
+
+
+
+ \ No newline at end of file diff --git a/docs/bridge/docs/rfq/API/relay-ack.api.mdx b/docs/bridge/docs/rfq/API/relay-ack.api.mdx new file mode 100644 index 0000000000..5888fc61f1 --- /dev/null +++ b/docs/bridge/docs/rfq/API/relay-ack.api.mdx @@ -0,0 +1,202 @@ +--- +id: relay-ack +title: "Relay ack" +description: "cache an ack request to synchronize relayer actions." +sidebar_label: "Relay ack" +hide_title: true +hide_table_of_contents: true +api: eJydVMGOm0AM/RU057SJesyxVU89tFrtntIVcsCB2cDM1GO2oYh/rw3shpYsqgoSmvE822/8bDqTY8zIBrbemb3JICsxAZdAdk4IfzQYOWGfxNZlJXlnf6GYK2iRBKJO8b3ZmAn50eet2Xcm847RsS4hhMpmoMjtU9QcnYmSowZdBfIBiS1G3QkVTqH2zejKbUChFJmsK0y/Gc+zEqxLbT5DWMlWIL1CTiCfI9m8wBTynDDGt+OxP6MbYDcxJ3vBPD0h3jyt4ZJ6soUwWuE9IdaZT6B/5T7BV9kLbLL44xNmLJbx1jPBRTdqkwAEdZyEtITCkanBXg0xiMijQB92u0mnWYSvX8ZMUAjmYKRxzKNUBrn0EsaEhiVuAC5ls9XTjdFGuLu2zOcL1KHCRQu8XGSh/G5N6L+85hW6Hs1kvRpvqHk9XIi4W9ds4XmLiNTNupN/mRmZKFlqMS1rPYx4PyPFsdCKDj5yDcMUOagVcqfTmIx1/UOY2Rj+71hP3cN44W2o5OJKoaFqGN1B0Ve9SyGm2647QsQHqvpezUN7iV2Wz0AWjnqtw6OEKRFy6fz9oTNnFIj5NLJ9d69JFV41mnzxA+nn3fXt4V6wx+m/U/tcXQh+aivLd2++y6saDEUZmniwd6YCVzRQKH4Mq89v8jPG1Q== +sidebar_class_name: "put api-method" +custom_edit_url: null +--- + +import ApiTabs from "@theme/ApiTabs"; +import DiscriminatorTabs from "@theme/DiscriminatorTabs"; +import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint"; +import SecuritySchemes from "@theme/ApiExplorer/SecuritySchemes"; +import MimeTabs from "@theme/MimeTabs"; +import ParamsItem from "@theme/ParamsItem"; +import ResponseSamples from "@theme/ResponseSamples"; +import SchemaItem from "@theme/SchemaItem"; +import SchemaTabs from "@theme/SchemaTabs"; +import Markdown from "@theme/Markdown"; +import Heading from "@theme/Heading"; +import OperationTabs from "@theme/OperationTabs"; +import TabItem from "@theme/TabItem"; + + + + + + + + + + +cache an ack request to synchronize relayer actions. + + + + + + +
+ +

+ Body +

+ required + +
+
+ + + query params + + +
+
    + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+ + +
+ + + OK + + +
+ +
+
+
+
+
+ \ No newline at end of file diff --git a/services/rfq/api/client/client.go b/services/rfq/api/client/client.go index 2e878afaf2..0c80c47958 100644 --- a/services/rfq/api/client/client.go +++ b/services/rfq/api/client/client.go @@ -35,6 +35,7 @@ type UnauthenticatedClient interface { GetAllQuotes(ctx context.Context) ([]*model.GetQuoteResponse, error) GetSpecificQuote(ctx context.Context, q *model.GetQuoteSpecificRequest) ([]*model.GetQuoteResponse, error) GetQuoteByRelayerAddress(ctx context.Context, relayerAddr string) ([]*model.GetQuoteResponse, error) + GetRFQContracts(ctx context.Context) (*model.GetContractsResponse, error) resty() *resty.Client } @@ -134,11 +135,11 @@ func (c *clientImpl) PutRelayAck(ctx context.Context, req *model.PutAckRequest) Put(rest.AckRoute) if err != nil { - return nil, fmt.Errorf("error from server: %s %w", resp.Status(), err) + return nil, fmt.Errorf("error from server: %s %w", getStatus(resp), err) } if resp.IsError() { - return nil, fmt.Errorf("error from server: %s", resp.Status()) + return nil, fmt.Errorf("error from server: %s", getStatus(resp)) } return ack, nil @@ -153,11 +154,11 @@ func (c *unauthenticatedClient) GetAllQuotes(ctx context.Context) ([]*model.GetQ Get(rest.QuoteRoute) if err != nil { - return nil, fmt.Errorf("error from server: %s: %w", resp.Status(), err) + return nil, fmt.Errorf("error from server: %s: %w", getStatus(resp), err) } if resp.IsError() { - return nil, fmt.Errorf("error from server: %s", resp.Status()) + return nil, fmt.Errorf("error from server: %s", getStatus(resp)) } return quotes, nil @@ -178,11 +179,11 @@ func (c *unauthenticatedClient) GetSpecificQuote(ctx context.Context, q *model.G Get(rest.QuoteRoute) if err != nil { - return nil, fmt.Errorf("error from server: %s: %w", resp.Status(), err) + return nil, fmt.Errorf("error from server: %s: %w", getStatus(resp), err) } if resp.IsError() { - return nil, fmt.Errorf("error from server: %s", resp.Status()) + return nil, fmt.Errorf("error from server: %s", getStatus(resp)) } return quotes, nil @@ -199,12 +200,37 @@ func (c *unauthenticatedClient) GetQuoteByRelayerAddress(ctx context.Context, re Get(rest.QuoteRoute) if err != nil { - return nil, fmt.Errorf("error from server: %s %w", resp.Status(), err) + return nil, fmt.Errorf("error from server: %s %w", getStatus(resp), err) } if resp.IsError() { - return nil, fmt.Errorf("error from server: %s", resp.Status()) + return nil, fmt.Errorf("error from server: %s", getStatus(resp)) } return quotes, nil } + +func (c unauthenticatedClient) GetRFQContracts(ctx context.Context) (*model.GetContractsResponse, error) { + var contracts *model.GetContractsResponse + resp, err := c.rClient.R(). + SetContext(ctx). + SetResult(&contracts). + Get(rest.ContractsRoute) + + if err != nil { + return nil, fmt.Errorf("error from server: %s %w", getStatus(resp), err) + } + + if resp.IsError() { + return nil, fmt.Errorf("error from server: %s", getStatus(resp)) + } + + return contracts, nil +} + +func getStatus(resp *resty.Response) string { + if resp == nil { + return "http status unavailable" + } + return getStatus(resp) +} diff --git a/services/rfq/api/docs/docs.go b/services/rfq/api/docs/docs.go index fdd79b976b..afb682a084 100644 --- a/services/rfq/api/docs/docs.go +++ b/services/rfq/api/docs/docs.go @@ -46,6 +46,32 @@ const docTemplate = `{ } } }, + "/contracts": { + "get": { + "description": "get quotes from all relayers.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "quotes" + ], + "summary": "Get contract addresses", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/model.GetContractsResponse" + } + } + } + } + } + }, "/quotes": { "get": { "description": "get quotes from all relayers.", @@ -135,6 +161,18 @@ const docTemplate = `{ } }, "definitions": { + "model.GetContractsResponse": { + "type": "object", + "properties": { + "contracts": { + "description": "Contracts is a map of chain id to contract address", + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + }, "model.GetQuoteResponse": { "type": "object", "properties": { diff --git a/services/rfq/api/docs/swagger.json b/services/rfq/api/docs/swagger.json index 0f4707ab3f..bc2eb2d8a3 100644 --- a/services/rfq/api/docs/swagger.json +++ b/services/rfq/api/docs/swagger.json @@ -35,6 +35,32 @@ } } }, + "/contracts": { + "get": { + "description": "get quotes from all relayers.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "quotes" + ], + "summary": "Get contract addresses", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/model.GetContractsResponse" + } + } + } + } + } + }, "/quotes": { "get": { "description": "get quotes from all relayers.", @@ -124,6 +150,18 @@ } }, "definitions": { + "model.GetContractsResponse": { + "type": "object", + "properties": { + "contracts": { + "description": "Contracts is a map of chain id to contract address", + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + }, "model.GetQuoteResponse": { "type": "object", "properties": { diff --git a/services/rfq/api/docs/swagger.yaml b/services/rfq/api/docs/swagger.yaml index a95f1dcddc..4ad07f997a 100644 --- a/services/rfq/api/docs/swagger.yaml +++ b/services/rfq/api/docs/swagger.yaml @@ -1,4 +1,12 @@ definitions: + model.GetContractsResponse: + properties: + contracts: + additionalProperties: + type: string + description: Contracts is a map of chain id to contract address + type: object + type: object model.GetQuoteResponse: properties: dest_amount: @@ -87,6 +95,23 @@ paths: summary: Relay ack tags: - ack + /contracts: + get: + consumes: + - application/json + description: get quotes from all relayers. + produces: + - application/json + responses: + "200": + description: OK + schema: + items: + $ref: '#/definitions/model.GetContractsResponse' + type: array + summary: Get contract addresses + tags: + - quotes /quotes: get: consumes: diff --git a/services/rfq/api/model/response.go b/services/rfq/api/model/response.go index 8e664f9e0e..6cfd2a1599 100644 --- a/services/rfq/api/model/response.go +++ b/services/rfq/api/model/response.go @@ -35,3 +35,9 @@ type PutRelayAckResponse struct { // RelayerAddress is the address of the relayer that is currently acked RelayerAddress string `json:"relayer_address"` } + +// GetContractsResponse contains the schema for a GET /contract response. +type GetContractsResponse struct { + // Contracts is a map of chain id to contract address + Contracts map[uint32]string `json:"contracts"` +} diff --git a/services/rfq/api/rest/handler.go b/services/rfq/api/rest/handler.go index 7722294b6b..b80e3d1278 100644 --- a/services/rfq/api/rest/handler.go +++ b/services/rfq/api/rest/handler.go @@ -1,6 +1,7 @@ package rest import ( + "github.com/synapsecns/sanguine/services/rfq/api/config" "net/http" "strconv" @@ -12,13 +13,15 @@ import ( // Handler is the REST API handler. type Handler struct { - db db.APIDB + db db.APIDB + cfg config.Config } // NewHandler creates a new REST API handler. -func NewHandler(db db.APIDB) *Handler { +func NewHandler(db db.APIDB, cfg config.Config) *Handler { return &Handler{ - db: db, // Store the database connection in the handler + db: db, // Store the database connection in the handler + cfg: cfg, } } @@ -158,3 +161,22 @@ func (h *Handler) GetQuotes(c *gin.Context) { } c.JSON(http.StatusOK, quotes) } + +// GetContracts retrieves all contracts api is currently enabled on. +// GET /contracts. +// PingExample godoc +// @Summary Get contract addresses +// @Description get quotes from all relayers. +// @Tags quotes +// @Accept json +// @Produce json +// @Success 200 {array} model.GetContractsResponse +// @Router /contracts [get]. +func (h *Handler) GetContracts(c *gin.Context) { + // Convert quotes from db model to api model + contracts := make(map[uint32]string) + for chainID, address := range h.cfg.Bridges { + contracts[chainID] = address + } + c.JSON(http.StatusOK, model.GetContractsResponse{Contracts: contracts}) +} diff --git a/services/rfq/api/rest/server.go b/services/rfq/api/rest/server.go index 886c7d075c..1cffbd7bf5 100644 --- a/services/rfq/api/rest/server.go +++ b/services/rfq/api/rest/server.go @@ -143,8 +143,10 @@ const ( // QuoteRoute is the API endpoint for handling quote related requests. QuoteRoute = "/quotes" // AckRoute is the API endpoint for handling relay ack related requests. - AckRoute = "/ack" - cacheInterval = time.Minute + AckRoute = "/ack" + // ContractsRoute is the API endpoint for returning a list fo contracts + ContractsRoute = "/contracts" + cacheInterval = time.Minute ) var logger = log.Logger("rfq-api") @@ -153,7 +155,7 @@ var logger = log.Logger("rfq-api") func (r *QuoterAPIServer) Run(ctx context.Context) error { // TODO: Use Gin Helper engine := ginhelper.New(logger) - h := NewHandler(r.db) + h := NewHandler(r.db, r.cfg) engine.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerfiles.Handler)) // Apply AuthMiddleware only to the PUT routes @@ -168,8 +170,7 @@ func (r *QuoterAPIServer) Run(ctx context.Context) error { // engine.PUT("/quotes", h.ModifyQuote) engine.GET(QuoteRoute, h.GetQuotes) - // Expose Prometheus metrics - engine.GET(metrics.MetricsPathDefault, gin.WrapH(r.handler.Handler())) + engine.GET(ContractsRoute, h.GetContracts) r.engine = engine diff --git a/services/rfq/api/rest/server_test.go b/services/rfq/api/rest/server_test.go index c8c0e727ea..dac06ae00e 100644 --- a/services/rfq/api/rest/server_test.go +++ b/services/rfq/api/rest/server_test.go @@ -4,6 +4,7 @@ import ( "bytes" "encoding/json" "fmt" + apiClient "github.com/synapsecns/sanguine/services/rfq/api/client" "io" "net/http" "strconv" @@ -338,3 +339,16 @@ func (c *ServerSuite) sendPutAckRequest(header string, txID string) (*http.Respo } return resp, nil } + +func (c *ServerSuite) TestContracts() { + // Start the API server in a separate goroutine and wait for it to initialize. + c.startQuoterAPIServer() + + client, err := apiClient.NewUnauthenticatedClient(c.handler, fmt.Sprintf("http://localhost:%d", c.port)) + c.Require().NoError(err) + + contracts, err := client.GetRFQContracts(c.GetTestContext()) + c.Require().NoError(err) + + c.Require().Len(contracts.Contracts, 2) +} From 544967f25c2162f53f6607a208456e28a3333dbb Mon Sep 17 00:00:00 2001 From: Trajan0x Date: Tue, 2 Jul 2024 12:48:12 -0400 Subject: [PATCH 2/5] address slack-io/slacker#16 --- contrib/opbot/botmd/middleware.go | 5 +++-- contrib/opbot/go.mod | 9 ++++----- contrib/opbot/go.sum | 18 ++++++++---------- go.work.sum | 9 ++++++++- 4 files changed, 23 insertions(+), 18 deletions(-) diff --git a/contrib/opbot/botmd/middleware.go b/contrib/opbot/botmd/middleware.go index f4112cac7d..48af04c303 100644 --- a/contrib/opbot/botmd/middleware.go +++ b/contrib/opbot/botmd/middleware.go @@ -21,12 +21,13 @@ const ( func (b *Bot) tracingMiddleware() slacker.CommandMiddlewareHandler { return func(next slacker.CommandHandler) slacker.CommandHandler { return func(cmdCtx *slacker.CommandContext) { - // TODO: context is not inherited here. - _, span := b.handler.Tracer().Start(cmdCtx.Context(), fmt.Sprintf("command.%s", cmdCtx.Definition().Command), trace.WithAttributes( + ctx, span := b.handler.Tracer().Start(cmdCtx.Context(), fmt.Sprintf("command.%s", cmdCtx.Definition().Command), trace.WithAttributes( attribute.String("user_id", cmdCtx.Event().UserID), attribute.String("channel_id", cmdCtx.Event().Channel.ID), )) + cmdCtx.WithContext(ctx) + defer func() { metrics.EndSpan(span) }() diff --git a/contrib/opbot/go.mod b/contrib/opbot/go.mod index 6cc6e6bc8e..a118d88166 100644 --- a/contrib/opbot/go.mod +++ b/contrib/opbot/go.mod @@ -139,7 +139,7 @@ require ( github.com/google/s2a-go v0.1.7 // indirect github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect github.com/googleapis/gax-go/v2 v2.12.4 // indirect - github.com/gorilla/websocket v1.5.1 // indirect + github.com/gorilla/websocket v1.5.3 // indirect github.com/grafana/otel-profiling-go v0.5.1 // indirect github.com/grafana/pyroscope-go v1.1.1 // indirect github.com/grafana/pyroscope-go/godeltaprof v0.1.7 // indirect @@ -202,9 +202,9 @@ require ( github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect github.com/shibukawa/configdir v0.0.0-20170330084843-e180dbdc8da0 // indirect github.com/shirou/gopsutil v3.21.11+incompatible // indirect - github.com/shomali11/commander v0.0.0-20230730023802-0b64f620037d // indirect - github.com/shomali11/proper v0.0.0-20190608032528-6e70a05688e7 // indirect github.com/skeema/knownhosts v1.2.2 // indirect + github.com/slack-io/commander v0.0.0-20231120025847-9fd78b4b2d54 // indirect + github.com/slack-io/proper v0.0.0-20231119200853-f78ba4fc878f // indirect github.com/stretchr/testify v1.9.0 // indirect github.com/supranational/blst v0.3.11 // indirect github.com/synapsecns/sanguine/services/cctp-relayer v0.0.0-00010101000000-000000000000 // indirect @@ -272,8 +272,7 @@ replace ( github.com/brianvoe/gofakeit/v6 => github.com/brianvoe/gofakeit/v6 v6.9.0 github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 github.com/slack-go/slack => github.com/slack-go/slack v0.12.2 - // TODO: replace after https://github.com/slack-io/slacker/pull/14 is merged - github.com/slack-io/slacker => github.com/kathiouchka/slacker v0.0.0-20240629123301-04d4e71c3a96 + github.com/slack-io/slacker => github.com/slack-io/slacker v0.1.1-0.20240701203341-bd3ee211e9d2 github.com/synapsecns/sanguine/core => ./../../core github.com/synapsecns/sanguine/ethergo => ./../../ethergo github.com/synapsecns/sanguine/services/cctp-relayer => ./../../services/cctp-relayer diff --git a/contrib/opbot/go.sum b/contrib/opbot/go.sum index 3e2fe7e384..c89db77f7f 100644 --- a/contrib/opbot/go.sum +++ b/contrib/opbot/go.sum @@ -569,8 +569,8 @@ github.com/googleapis/gax-go/v2 v2.12.4/go.mod h1:KYEYLorsnIGDi/rPC8b5TdlB9kbKoF github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= -github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= +github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= +github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/grafana/otel-profiling-go v0.5.1 h1:stVPKAFZSa7eGiqbYuG25VcqYksR6iWvF3YH66t4qL8= github.com/grafana/otel-profiling-go v0.5.1/go.mod h1:ftN/t5A/4gQI19/8MoWurBEtC6gFw8Dns1sJZ9W4Tls= github.com/grafana/pyroscope-go v1.1.1 h1:PQoUU9oWtO3ve/fgIiklYuGilvsm8qaGhlY4Vw6MAcQ= @@ -696,8 +696,6 @@ github.com/kataras/iris/v12 v12.1.8/go.mod h1:LMYy4VlP67TQ3Zgriz8RE2h2kMZV2SgMYb github.com/kataras/neffos v0.0.14/go.mod h1:8lqADm8PnbeFfL7CLXh1WHw53dG27MC3pgi2R1rmoTE= github.com/kataras/pio v0.0.2/go.mod h1:hAoW0t9UmXi4R5Oyq5Z4irTbaTsOemSrDGUtaTl7Dro= github.com/kataras/sitemap v0.0.5/go.mod h1:KY2eugMKiPwsJgx7+U103YZehfvNGOXURubcGyk0Bz8= -github.com/kathiouchka/slacker v0.0.0-20240629123301-04d4e71c3a96 h1:/RfYfEL6WutfEvEGx7JM3lG7dKdeKT/tnhXpaiaBILw= -github.com/kathiouchka/slacker v0.0.0-20240629123301-04d4e71c3a96/go.mod h1:VPW+xhTrmB4lUoxA5tiB180fmWFt6UFW+96ZWYtj0Qg= github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4= github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= github.com/keybase/go-keychain v0.0.0-20231219164618-57a3676c3af6 h1:IsMZxCuZqKuao2vNdfD82fjjgPLfyHLpR41Z88viRWs= @@ -983,11 +981,6 @@ github.com/shibukawa/configdir v0.0.0-20170330084843-e180dbdc8da0/go.mod h1:7Awj github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI= github.com/shirou/gopsutil v3.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= -github.com/shomali11/commander v0.0.0-20230730023802-0b64f620037d h1:IImd1gV+EdlKWWi8RoHSaccjLQtSi4tJiFOjq6mM+ZQ= -github.com/shomali11/commander v0.0.0-20230730023802-0b64f620037d/go.mod h1:bYyJw/Aj9fK+qoFmRbPJeWsDgq7WGO8f/Qof95qPug4= -github.com/shomali11/proper v0.0.0-20180607004733-233a9a872c30/go.mod h1:O723XwIZBX3FR45rBic/Eyp/DKo/YtchYFURzpUWY2c= -github.com/shomali11/proper v0.0.0-20190608032528-6e70a05688e7 h1:wAyBXFZOcLkbaoDlDbMpTCw9xy3yP2YJDMRrbTVuVKU= -github.com/shomali11/proper v0.0.0-20190608032528-6e70a05688e7/go.mod h1:cg2VM85Y+0BcVSICzB+OafOlTcJ9QPbtF4qtuhuR/GA= github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k= github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= @@ -999,6 +992,12 @@ github.com/skeema/knownhosts v1.2.2 h1:Iug2P4fLmDw9f41PB6thxUkNUkJzB5i+1/exaj40L github.com/skeema/knownhosts v1.2.2/go.mod h1:xYbVRSPxqBZFrdmDyMmsOs+uX1UZC3nTN3ThzgDxUwo= github.com/slack-go/slack v0.12.2 h1:x3OppyMyGIbbiyFhsBmpf9pwkUzMhthJMRNmNlA4LaQ= github.com/slack-go/slack v0.12.2/go.mod h1:hlGi5oXA+Gt+yWTPP0plCdRKmjsDxecdHxYQdlMQKOw= +github.com/slack-io/commander v0.0.0-20231120025847-9fd78b4b2d54 h1:aRc+G2mUb697z6bR09Roq6kP08suJulgNo00SGhAsfM= +github.com/slack-io/commander v0.0.0-20231120025847-9fd78b4b2d54/go.mod h1:aHmXZnL/ELKlfMybblXnnCl+IeHQ+gMb++DT7ujIGlA= +github.com/slack-io/proper v0.0.0-20231119200853-f78ba4fc878f h1:wiEJBKJKvMOeE9KtLV7iwtHOsNXDBZloL+FPlkZ6vnA= +github.com/slack-io/proper v0.0.0-20231119200853-f78ba4fc878f/go.mod h1:q+erLGESzGsEP/cJeGoDxfdLKDstT4caj/JvAShLEt4= +github.com/slack-io/slacker v0.1.1-0.20240701203341-bd3ee211e9d2 h1:+ZbW5lFQj1CyetlFrrd4KmNCxfSxzTX873PrZSkRoDc= +github.com/slack-io/slacker v0.1.1-0.20240701203341-bd3ee211e9d2/go.mod h1:0dIY7rxW5j4aSRq+rg79dpg3My012uZdGrzFmewSKUA= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= @@ -1023,7 +1022,6 @@ github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpE github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.2.0/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.2.1/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= diff --git a/go.work.sum b/go.work.sum index 4c420938cb..932e84c975 100644 --- a/go.work.sum +++ b/go.work.sum @@ -2402,6 +2402,8 @@ github.com/gorilla/handlers v1.5.1/go.mod h1:t8XrUpc4KVXb7HGyJ4/cEnwQiaxrX/hz1Zv github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/securecookie v1.1.1 h1:miw7JPhV+b/lAHSXz4qd/nN9jRiAFV5FwjeKyCS8BvQ= github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= +github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= +github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gostaticanalysis/analysisutil v0.4.1 h1:/7clKqrVfiVwiBQLM0Uke4KvXnO6JcCTS7HwF2D6wG8= github.com/gostaticanalysis/comment v1.4.1 h1:xHopR5L2lRz6OsjH4R2HG5wRhW9ySl3FsHIvi5pcXwc= github.com/gostaticanalysis/forcetypeassert v0.0.0-20200621232751-01d4955beaa5 h1:rx8127mFPqXXsfPSo8BwnIU97MKFZc89WHAHt8PwDVY= @@ -2668,7 +2670,6 @@ github.com/kataras/sitemap v0.0.6 h1:w71CRMMKYMJh6LR2wTgnk5hSgjVNB9KL60n5e2KHvLY github.com/kataras/sitemap v0.0.6/go.mod h1:dW4dOCNs896OR1HmG+dMLdT7JjDk7mYBzoIRwuj5jA4= github.com/kataras/tunnel v0.0.4 h1:sCAqWuJV7nPzGrlb0os3j49lk2JhILT0rID38NHNLpA= github.com/kataras/tunnel v0.0.4/go.mod h1:9FkU4LaeifdMWqZu7o20ojmW4B7hdhv2CMLwfnHGpYw= -github.com/kathiouchka/slacker v0.0.0-20240629123301-04d4e71c3a96/go.mod h1:VPW+xhTrmB4lUoxA5tiB180fmWFt6UFW+96ZWYtj0Qg= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= github.com/keep-network/keep-common v1.7.1-0.20211012131917-7102d7b9c6a0 h1:pQ6IV5wK1v5GESbLUQlQASCBorc13FJHFYoO1O7ftNU= @@ -3335,6 +3336,12 @@ github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546 h1:pXY9qYc/MP5zdvq github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw= github.com/shurcooL/webdavfs v0.0.0-20170829043945-18c3829fa133 h1:JtcyT0rk/9PKOdnKQzuDR+FSjh7SGtJwpgVpfZBRKlQ= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= +github.com/slack-io/commander v0.0.0-20231120025847-9fd78b4b2d54 h1:aRc+G2mUb697z6bR09Roq6kP08suJulgNo00SGhAsfM= +github.com/slack-io/commander v0.0.0-20231120025847-9fd78b4b2d54/go.mod h1:aHmXZnL/ELKlfMybblXnnCl+IeHQ+gMb++DT7ujIGlA= +github.com/slack-io/proper v0.0.0-20231119200853-f78ba4fc878f h1:wiEJBKJKvMOeE9KtLV7iwtHOsNXDBZloL+FPlkZ6vnA= +github.com/slack-io/proper v0.0.0-20231119200853-f78ba4fc878f/go.mod h1:q+erLGESzGsEP/cJeGoDxfdLKDstT4caj/JvAShLEt4= +github.com/slack-io/slacker v0.1.1-0.20240701203341-bd3ee211e9d2 h1:+ZbW5lFQj1CyetlFrrd4KmNCxfSxzTX873PrZSkRoDc= +github.com/slack-io/slacker v0.1.1-0.20240701203341-bd3ee211e9d2/go.mod h1:0dIY7rxW5j4aSRq+rg79dpg3My012uZdGrzFmewSKUA= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= github.com/sonatard/noctx v0.0.1 h1:VC1Qhl6Oxx9vvWo3UDgrGXYCeKCe3Wbw7qAWL6FrmTY= From a65c2bc17364abd2f5f1e39bcfaa8deb2a6612c1 Mon Sep 17 00:00:00 2001 From: Trajan0x Date: Tue, 2 Jul 2024 13:57:34 -0400 Subject: [PATCH 3/5] opbot refunder first pass --- contrib/opbot/botmd/botmd.go | 46 ++++++++++++- contrib/opbot/botmd/commands.go | 80 ++++++++++++++++++++++ contrib/opbot/config/config.go | 21 ++++++ contrib/opbot/go.mod | 1 - contrib/opbot/go.sum | 4 +- contrib/opbot/sql/base/base.go | 38 ++++++++++ contrib/opbot/sql/base/doc.go | 2 + contrib/opbot/sql/doc.go | 2 + contrib/opbot/sql/mysql/doc.go | 2 + contrib/opbot/sql/mysql/store.go | 66 ++++++++++++++++++ contrib/opbot/sql/sqlite/doc.go | 2 + contrib/opbot/sql/sqlite/sqlite.go | 62 +++++++++++++++++ contrib/opbot/sql/store.go | 36 ++++++++++ ethergo/submitter/db/service.go | 5 ++ go.work.sum | 4 +- services/cctp-relayer/db/relayer_db.go | 5 +- services/rfq/relayer/relapi/client.go | 18 +++++ services/rfq/relayer/relapi/client_test.go | 12 ++++ services/rfq/relayer/relapi/handler.go | 28 ++++++++ services/rfq/relayer/relapi/model.go | 5 ++ services/rfq/relayer/relapi/server.go | 2 + 21 files changed, 431 insertions(+), 10 deletions(-) create mode 100644 contrib/opbot/sql/base/base.go create mode 100644 contrib/opbot/sql/base/doc.go create mode 100644 contrib/opbot/sql/doc.go create mode 100644 contrib/opbot/sql/mysql/doc.go create mode 100644 contrib/opbot/sql/mysql/store.go create mode 100644 contrib/opbot/sql/sqlite/doc.go create mode 100644 contrib/opbot/sql/sqlite/sqlite.go create mode 100644 contrib/opbot/sql/store.go diff --git a/contrib/opbot/botmd/botmd.go b/contrib/opbot/botmd/botmd.go index 24b9236e77..0b6d6e4c03 100644 --- a/contrib/opbot/botmd/botmd.go +++ b/contrib/opbot/botmd/botmd.go @@ -2,10 +2,19 @@ package botmd import ( "context" + "fmt" "github.com/slack-io/slacker" "github.com/synapsecns/sanguine/contrib/opbot/config" "github.com/synapsecns/sanguine/contrib/opbot/signoz" + "github.com/synapsecns/sanguine/core/dbcommon" "github.com/synapsecns/sanguine/core/metrics" + signerConfig "github.com/synapsecns/sanguine/ethergo/signer/config" + "github.com/synapsecns/sanguine/ethergo/signer/signer" + "github.com/synapsecns/sanguine/ethergo/submitter" + submitterdb "github.com/synapsecns/sanguine/ethergo/submitter/db" + cctpSql "github.com/synapsecns/sanguine/services/cctp-relayer/db/sql" + omnirpcClient "github.com/synapsecns/sanguine/services/omnirpc/client" + "golang.org/x/sync/errgroup" ) // Bot represents the bot server. @@ -15,6 +24,10 @@ type Bot struct { cfg config.Config signozClient *signoz.Client signozEnabled bool + rpcClient omnirpcClient.RPCClient + signer signer.Signer + submitter submitter.TransactionSubmitter + db submitterdb.SubmitterDBFactory } // NewBot creates a new bot server. @@ -32,8 +45,10 @@ func NewBot(handler metrics.Handler, cfg config.Config) Bot { bot.signozEnabled = true } + bot.rpcClient = omnirpcClient.NewOmnirpcClient(cfg.OmniRPCURL, handler, omnirpcClient.WithCaptureReqRes()) + bot.addMiddleware(bot.tracingMiddleware(), bot.metricsMiddleware()) - bot.addCommands(bot.traceCommand(), bot.rfqLookupCommand()) + bot.addCommands(bot.traceCommand(), bot.rfqLookupCommand(), bot.rfqRefund()) return bot } @@ -53,6 +68,33 @@ func (b *Bot) addCommands(commands ...*slacker.CommandDefinition) { // Start starts the bot server. // nolint: wrapcheck func (b *Bot) Start(ctx context.Context) error { + var err error + b.signer, err = signerConfig.SignerFromConfig(ctx, b.cfg.Signer) + if err != nil { + return fmt.Errorf("failed to create signer: %w", err) + } + + dbType, err := dbcommon.DBTypeFromString(b.cfg.Database.Type) + if err != nil { + return fmt.Errorf("could not get db type: %w", err) + } + + store, err := cctpSql.Connect(ctx, dbType, b.cfg.Database.DSN, b.handler) + if err != nil { + return fmt.Errorf("could not connect to database: %w", err) + } + + b.submitter = submitter.NewTransactionSubmitter(b.handler, b.signer, b.rpcClient, store.SubmitterDB(), &b.cfg.SubmitterConfig) + + g, ctx := errgroup.WithContext(ctx) + g.Go(func() error { + return b.submitter.Start(ctx) + }) + + g.Go(func() error { + return b.server.Listen(ctx) + }) + // nolint: wrapcheck - return b.server.Listen(ctx) + return g.Wait() } diff --git a/contrib/opbot/botmd/commands.go b/contrib/opbot/botmd/commands.go index d2e19039a6..e9a489303b 100644 --- a/contrib/opbot/botmd/commands.go +++ b/contrib/opbot/botmd/commands.go @@ -4,15 +4,21 @@ package botmd import ( "fmt" + "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" "github.com/hako/durafmt" "github.com/slack-go/slack" "github.com/slack-io/slacker" "github.com/synapsecns/sanguine/contrib/opbot/signoz" "github.com/synapsecns/sanguine/ethergo/chaindata" + rfqClient "github.com/synapsecns/sanguine/services/rfq/api/client" + "github.com/synapsecns/sanguine/services/rfq/contracts/fastbridge" "github.com/synapsecns/sanguine/services/rfq/relayer/relapi" "log" + "math/big" "regexp" + "strconv" "strings" "sync" "time" @@ -239,6 +245,80 @@ func (b *Bot) rfqLookupCommand() *slacker.CommandDefinition { }} } +func (b *Bot) rfqRefund() *slacker.CommandDefinition { + return &slacker.CommandDefinition{ + Command: "refund ", + Description: "refund a quote request", + Examples: []string{"refund 0x1234"}, + Handler: func(ctx *slacker.CommandContext) { + client, err := rfqClient.NewUnauthenticatedClient(b.handler, b.cfg.RFQApiURL) + if err != nil { + log.Printf("error creating rfq client: %v\n", err) + return + } + + contracts, err := client.GetRFQContracts(ctx.Context()) + if err != nil { + log.Printf("error fetching rfq contracts: %v\n", err) + return + } + + tx := stripLinks(ctx.Request().Param("tx")) + originChainIDStr := ctx.Request().Param("origin_chainid") + + originChainID, err := strconv.Atoi(originChainIDStr) + if err != nil { + _, err := ctx.Response().Reply("origin_chainid must be a number") + if err != nil { + log.Println(err) + } + return + } + + chainClient, err := b.rpcClient.GetChainClient(ctx.Context(), originChainID) + if err != nil { + log.Printf("error getting chain client: %v\n", err) + return + } + + contractAddress, ok := contracts.Contracts[uint32(originChainID)] + if !ok { + _, err := ctx.Response().Reply("contract address not found") + if err != nil { + log.Println(err) + } + return + } + + fastBridgeHandle, err := fastbridge.NewFastBridge(common.HexToAddress(contractAddress), chainClient) + if err != nil { + log.Printf("error creating fast bridge: %v\n", err) + return + } + + for _, relayer := range b.cfg.RelayerURLS { + relClient := relapi.NewRelayerClient(b.handler, relayer) + qr, err := relClient.GetQuoteRequestByTXID(ctx.Context(), tx) + if err != nil { + log.Printf("error fetching quote request: %v\n", err) + continue + } + + nonce, err := b.submitter.SubmitTransaction(ctx.Context(), big.NewInt(int64(originChainID)), func(transactor *bind.TransactOpts) (tx *types.Transaction, err error) { + return fastBridgeHandle.Refund(transactor, common.Hex2Bytes(qr.QuoteRequestRaw)) + }) + if err != nil { + log.Printf("error submitting refund: %v\n", err) + continue + } + + _, err = ctx.Response().Reply(fmt.Sprintf("refund submitted with nonce %d", nonce)) + return + } + }, + } +} + func toExplorerSlackLink(ogHash string) string { rfqHash := strings.ToUpper(ogHash) // cut off 0x diff --git a/contrib/opbot/config/config.go b/contrib/opbot/config/config.go index 5701c876ef..d071dc3fba 100644 --- a/contrib/opbot/config/config.go +++ b/contrib/opbot/config/config.go @@ -1,6 +1,11 @@ // Package config provides a simple way to read and write configuration files. package config +import ( + "github.com/synapsecns/sanguine/ethergo/signer/config" + submitterConfig "github.com/synapsecns/sanguine/ethergo/submitter/config" +) + // Config represents the configuration of the application. type Config struct { // SlackBotToken is the token of the slack bot. @@ -18,4 +23,20 @@ type Config struct { SignozBaseURL string `yaml:"signoz_base_url"` // RelayerURLS is the list of RFQ relayer URLs. RelayerURLS []string `yaml:"rfq_relayer_urls"` + // RFQApiURL is the URL of the RFQ API. + RFQApiURL string `yaml:"rfq_api_url"` + // OmniRPCURL is the URL of the Omni RPC. + OmniRPCURL string `yaml:"omni_rpc_url"` + // Signer is the signer config. + Signer config.SignerConfig `yaml:"signer"` + // SubmitterConfig is the submitter config. + SubmitterConfig submitterConfig.Config `yaml:"submitter_config"` + // Database is the database config. + Database DatabaseConfig `yaml:"database"` +} + +// DatabaseConfig represents the configuration for the database. +type DatabaseConfig struct { + Type string `yaml:"type"` + DSN string `yaml:"dsn"` // Data Source Name } diff --git a/contrib/opbot/go.mod b/contrib/opbot/go.mod index a118d88166..c240fe4fee 100644 --- a/contrib/opbot/go.mod +++ b/contrib/opbot/go.mod @@ -271,7 +271,6 @@ replace ( // later versions give errors on uint64 being too high. github.com/brianvoe/gofakeit/v6 => github.com/brianvoe/gofakeit/v6 v6.9.0 github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 - github.com/slack-go/slack => github.com/slack-go/slack v0.12.2 github.com/slack-io/slacker => github.com/slack-io/slacker v0.1.1-0.20240701203341-bd3ee211e9d2 github.com/synapsecns/sanguine/core => ./../../core github.com/synapsecns/sanguine/ethergo => ./../../ethergo diff --git a/contrib/opbot/go.sum b/contrib/opbot/go.sum index c89db77f7f..8722dbd416 100644 --- a/contrib/opbot/go.sum +++ b/contrib/opbot/go.sum @@ -990,8 +990,8 @@ github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/skeema/knownhosts v1.2.2 h1:Iug2P4fLmDw9f41PB6thxUkNUkJzB5i+1/exaj40L3A= github.com/skeema/knownhosts v1.2.2/go.mod h1:xYbVRSPxqBZFrdmDyMmsOs+uX1UZC3nTN3ThzgDxUwo= -github.com/slack-go/slack v0.12.2 h1:x3OppyMyGIbbiyFhsBmpf9pwkUzMhthJMRNmNlA4LaQ= -github.com/slack-go/slack v0.12.2/go.mod h1:hlGi5oXA+Gt+yWTPP0plCdRKmjsDxecdHxYQdlMQKOw= +github.com/slack-go/slack v0.13.0 h1:7my/pR2ubZJ9912p9FtvALYpbt0cQPAqkRy2jaSI1PQ= +github.com/slack-go/slack v0.13.0/go.mod h1:hlGi5oXA+Gt+yWTPP0plCdRKmjsDxecdHxYQdlMQKOw= github.com/slack-io/commander v0.0.0-20231120025847-9fd78b4b2d54 h1:aRc+G2mUb697z6bR09Roq6kP08suJulgNo00SGhAsfM= github.com/slack-io/commander v0.0.0-20231120025847-9fd78b4b2d54/go.mod h1:aHmXZnL/ELKlfMybblXnnCl+IeHQ+gMb++DT7ujIGlA= github.com/slack-io/proper v0.0.0-20231119200853-f78ba4fc878f h1:wiEJBKJKvMOeE9KtLV7iwtHOsNXDBZloL+FPlkZ6vnA= diff --git a/contrib/opbot/sql/base/base.go b/contrib/opbot/sql/base/base.go new file mode 100644 index 0000000000..e73ca70a4e --- /dev/null +++ b/contrib/opbot/sql/base/base.go @@ -0,0 +1,38 @@ +package base + +import ( + "github.com/synapsecns/sanguine/core/metrics" + submitterDB "github.com/synapsecns/sanguine/ethergo/submitter/db" + "github.com/synapsecns/sanguine/ethergo/submitter/db/txdb" + "gorm.io/gorm" +) + +// Store is a store that implements an underlying gorm db. +type Store struct { + db *gorm.DB + metrics metrics.Handler + submitterStore submitterDB.Service +} + +// NewStore creates a new store. +func NewStore(db *gorm.DB, metrics metrics.Handler) *Store { + txDB := txdb.NewTXStore(db, metrics) + return &Store{db: db, metrics: metrics, submitterStore: txDB} +} + +// DB gets the database object for mutation outside of the lib. +func (s Store) DB() *gorm.DB { + return s.db +} + +// SubmitterDB gets the submitter database object for mutation outside of the lib. +func (s Store) SubmitterDB() submitterDB.Service { + return s.submitterStore +} + +// GetAllModels gets all models to migrate. +// see: https://medium.com/@SaifAbid/slice-interfaces-8c78f8b6345d for an explanation of why we can't do this at initialization time +func GetAllModels() (allModels []interface{}) { + allModels = append(allModels, txdb.GetAllModels()...) + return allModels +} diff --git a/contrib/opbot/sql/base/doc.go b/contrib/opbot/sql/base/doc.go new file mode 100644 index 0000000000..9b758883a1 --- /dev/null +++ b/contrib/opbot/sql/base/doc.go @@ -0,0 +1,2 @@ +// Package base contains the base sql implementation +package base diff --git a/contrib/opbot/sql/doc.go b/contrib/opbot/sql/doc.go new file mode 100644 index 0000000000..9c3daf2957 --- /dev/null +++ b/contrib/opbot/sql/doc.go @@ -0,0 +1,2 @@ +// Package sql provides a common interface for starting sql-lite databases +package sql diff --git a/contrib/opbot/sql/mysql/doc.go b/contrib/opbot/sql/mysql/doc.go new file mode 100644 index 0000000000..a6b8106850 --- /dev/null +++ b/contrib/opbot/sql/mysql/doc.go @@ -0,0 +1,2 @@ +// Package mysql contains a mysql db +package mysql diff --git a/contrib/opbot/sql/mysql/store.go b/contrib/opbot/sql/mysql/store.go new file mode 100644 index 0000000000..5ee8625a81 --- /dev/null +++ b/contrib/opbot/sql/mysql/store.go @@ -0,0 +1,66 @@ +package mysql + +import ( + "context" + "fmt" + "github.com/synapsecns/sanguine/contrib/opbot/sql/base" + submitterDB "github.com/synapsecns/sanguine/ethergo/submitter/db" + "time" + + "github.com/ipfs/go-log" + common_base "github.com/synapsecns/sanguine/core/dbcommon" + "github.com/synapsecns/sanguine/core/metrics" + "gorm.io/driver/mysql" + "gorm.io/gorm" + "gorm.io/gorm/schema" +) + +// Logger is the mysql logger. +var logger = log.Logger("synapse-mysql") + +// NewMysqlStore creates a new mysql store for a given data store. +func NewMysqlStore(ctx context.Context, dbURL string, handler metrics.Handler) (*Store, error) { + logger.Debug("create mysql store") + + gdb, err := gorm.Open(mysql.Open(dbURL), &gorm.Config{ + Logger: common_base.GetGormLogger(logger), + FullSaveAssociations: true, + NamingStrategy: NamingStrategy, + NowFunc: time.Now, + }) + + if err != nil { + return nil, fmt.Errorf("could not create mysql connection: %w", err) + } + + sqlDB, err := gdb.DB() + if err != nil { + return nil, fmt.Errorf("could not get sql db: %w", err) + } + + // fixes a timeout issue https://stackoverflow.com/a/42146536 + sqlDB.SetMaxIdleConns(MaxIdleConns) + sqlDB.SetConnMaxLifetime(time.Hour) + + handler.AddGormCallbacks(gdb) + + err = gdb.WithContext(ctx).AutoMigrate(base.GetAllModels()...) + if err != nil { + return nil, fmt.Errorf("could not migrate on mysql: %w", err) + } + + return &Store{base.NewStore(gdb, handler)}, nil +} + +// Store is the mysql store. It extends the bsae store for mysql queries. +type Store struct { + *base.Store +} + +// MaxIdleConns is exported here for testing. Tests execute too slowly with a reconnect each time. +var MaxIdleConns = 10 + +// NamingStrategy is for table prefixes. +var NamingStrategy = schema.NamingStrategy{} + +var _ submitterDB.SubmitterDBFactory = &Store{} diff --git a/contrib/opbot/sql/sqlite/doc.go b/contrib/opbot/sql/sqlite/doc.go new file mode 100644 index 0000000000..d30fb340b9 --- /dev/null +++ b/contrib/opbot/sql/sqlite/doc.go @@ -0,0 +1,2 @@ +// Package sqlite implements the sqlite package +package sqlite diff --git a/contrib/opbot/sql/sqlite/sqlite.go b/contrib/opbot/sql/sqlite/sqlite.go new file mode 100644 index 0000000000..e3ebada5ef --- /dev/null +++ b/contrib/opbot/sql/sqlite/sqlite.go @@ -0,0 +1,62 @@ +package sqlite + +import ( + "context" + "fmt" + "github.com/synapsecns/sanguine/contrib/opbot/sql/base" + submitterDB "github.com/synapsecns/sanguine/ethergo/submitter/db" + "os" + + "github.com/ipfs/go-log" + common_base "github.com/synapsecns/sanguine/core/dbcommon" + "github.com/synapsecns/sanguine/core/metrics" + "gorm.io/driver/sqlite" + "gorm.io/gorm" +) + +// Store is the sqlite store. It extends the base store for sqlite specific queries. +type Store struct { + *base.Store +} + +var logger = log.Logger("scribe-sqlite") + +// NewSqliteStore creates a new sqlite data store. +func NewSqliteStore(parentCtx context.Context, dbPath string, handler metrics.Handler, skipMigrations bool) (_ *Store, err error) { + logger.Debugf("creating sqlite store at %s", dbPath) + + ctx, span := handler.Tracer().Start(parentCtx, "start-sqlite") + defer func() { + metrics.EndSpanWithErr(span, err) + }() + + // create the directory to the store if it doesn't exist + err = os.MkdirAll(dbPath, os.ModePerm) + if err != nil { + return nil, fmt.Errorf("could not create sqlite store") + } + + logger.Warnf("database is at %s/synapse.db", dbPath) + + gdb, err := gorm.Open(sqlite.Open(fmt.Sprintf("%s/%s", dbPath, "synapse.db")), &gorm.Config{ + DisableForeignKeyConstraintWhenMigrating: true, + Logger: common_base.GetGormLogger(logger), + FullSaveAssociations: true, + SkipDefaultTransaction: true, + }) + if err != nil { + return nil, fmt.Errorf("could not connect to db %s: %w", dbPath, err) + } + + handler.AddGormCallbacks(gdb) + + if !skipMigrations { + err = gdb.WithContext(ctx).AutoMigrate(base.GetAllModels()...) + if err != nil { + return nil, fmt.Errorf("could not migrate models: %w", err) + } + } + return &Store{base.NewStore(gdb, handler)}, nil +} + +var _ submitterDB.SubmitterDBFactory = &Store{} diff --git a/contrib/opbot/sql/store.go b/contrib/opbot/sql/store.go new file mode 100644 index 0000000000..a2d524b332 --- /dev/null +++ b/contrib/opbot/sql/store.go @@ -0,0 +1,36 @@ +package sql + +import ( + "context" + "errors" + "fmt" + "github.com/synapsecns/sanguine/contrib/opbot/sql/mysql" + "github.com/synapsecns/sanguine/contrib/opbot/sql/sqlite" + "github.com/synapsecns/sanguine/core/dbcommon" + "github.com/synapsecns/sanguine/core/metrics" + submitterDB "github.com/synapsecns/sanguine/ethergo/submitter/db" +) + +// Connect connects to the database. +func Connect(ctx context.Context, dbType dbcommon.DBType, path string, metrics metrics.Handler) (submitterDB.SubmitterDBFactory, error) { + switch dbType { + case dbcommon.Mysql: + store, err := mysql.NewMysqlStore(ctx, path, metrics) + if err != nil { + return nil, fmt.Errorf("could not create mysql store: %w", err) + } + + return store, nil + case dbcommon.Sqlite: + store, err := sqlite.NewSqliteStore(ctx, path, metrics, false) + if err != nil { + return nil, fmt.Errorf("could not create sqlite store: %w", err) + } + + return store, nil + case dbcommon.Clickhouse: + return nil, errors.New("driver not supported") + default: + return nil, fmt.Errorf("unsupported driver: %s", dbType) + } +} diff --git a/ethergo/submitter/db/service.go b/ethergo/submitter/db/service.go index b0d27960f4..ad2bbd78d2 100644 --- a/ethergo/submitter/db/service.go +++ b/ethergo/submitter/db/service.go @@ -47,6 +47,11 @@ type Service interface { // TransactionFunc is a function that can be passed to DBTransaction. type TransactionFunc func(ctx context.Context, svc Service) error +// SubmitterDBFactory is the interface for the tx queue database factory. +type SubmitterDBFactory interface { + SubmitterDB() Service +} + // Status is the status of a tx. // //go:generate go run golang.org/x/tools/cmd/stringer -type=Status -linecomment diff --git a/go.work.sum b/go.work.sum index 932e84c975..f5612891b6 100644 --- a/go.work.sum +++ b/go.work.sum @@ -2402,8 +2402,6 @@ github.com/gorilla/handlers v1.5.1/go.mod h1:t8XrUpc4KVXb7HGyJ4/cEnwQiaxrX/hz1Zv github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/securecookie v1.1.1 h1:miw7JPhV+b/lAHSXz4qd/nN9jRiAFV5FwjeKyCS8BvQ= github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= -github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= -github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gostaticanalysis/analysisutil v0.4.1 h1:/7clKqrVfiVwiBQLM0Uke4KvXnO6JcCTS7HwF2D6wG8= github.com/gostaticanalysis/comment v1.4.1 h1:xHopR5L2lRz6OsjH4R2HG5wRhW9ySl3FsHIvi5pcXwc= github.com/gostaticanalysis/forcetypeassert v0.0.0-20200621232751-01d4955beaa5 h1:rx8127mFPqXXsfPSo8BwnIU97MKFZc89WHAHt8PwDVY= @@ -3336,6 +3334,8 @@ github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546 h1:pXY9qYc/MP5zdvq github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw= github.com/shurcooL/webdavfs v0.0.0-20170829043945-18c3829fa133 h1:JtcyT0rk/9PKOdnKQzuDR+FSjh7SGtJwpgVpfZBRKlQ= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= +github.com/slack-go/slack v0.13.0 h1:7my/pR2ubZJ9912p9FtvALYpbt0cQPAqkRy2jaSI1PQ= +github.com/slack-go/slack v0.13.0/go.mod h1:hlGi5oXA+Gt+yWTPP0plCdRKmjsDxecdHxYQdlMQKOw= github.com/slack-io/commander v0.0.0-20231120025847-9fd78b4b2d54 h1:aRc+G2mUb697z6bR09Roq6kP08suJulgNo00SGhAsfM= github.com/slack-io/commander v0.0.0-20231120025847-9fd78b4b2d54/go.mod h1:aHmXZnL/ELKlfMybblXnnCl+IeHQ+gMb++DT7ujIGlA= github.com/slack-io/proper v0.0.0-20231119200853-f78ba4fc878f h1:wiEJBKJKvMOeE9KtLV7iwtHOsNXDBZloL+FPlkZ6vnA= diff --git a/services/cctp-relayer/db/relayer_db.go b/services/cctp-relayer/db/relayer_db.go index 0da5209f03..556568149d 100644 --- a/services/cctp-relayer/db/relayer_db.go +++ b/services/cctp-relayer/db/relayer_db.go @@ -2,11 +2,10 @@ package db import ( "context" + "github.com/synapsecns/sanguine/ethergo/submitter/db" "github.com/ethereum/go-ethereum/common" listenerDB "github.com/synapsecns/sanguine/ethergo/listener/db" - submitterDB "github.com/synapsecns/sanguine/ethergo/submitter/db" - "github.com/synapsecns/sanguine/services/cctp-relayer/types" ) @@ -34,6 +33,6 @@ type CCTPRelayerDBWriter interface { type CCTPRelayerDB interface { CCTPRelayerDBReader CCTPRelayerDBWriter - SubmitterDB() submitterDB.Service + db.SubmitterDBFactory listenerDB.ChainListenerDB } diff --git a/services/rfq/relayer/relapi/client.go b/services/rfq/relayer/relapi/client.go index cd643cec4c..f00ecbe707 100644 --- a/services/rfq/relayer/relapi/client.go +++ b/services/rfq/relayer/relapi/client.go @@ -18,6 +18,7 @@ type RelayerClient interface { GetQuoteRequestStatusByTxID(ctx context.Context, hash string) (*GetQuoteRequestStatusResponse, error) RetryTransaction(ctx context.Context, txhash string) (*GetTxRetryResponse, error) Withdraw(ctx context.Context, req *WithdrawRequest) (*WithdrawResponse, error) + GetQuoteRequestByTXID(ctx context.Context, txid string) (*GetQuoteRequestResponse, error) } type relayerClient struct { @@ -122,3 +123,20 @@ func (r *relayerClient) Withdraw(ctx context.Context, req *WithdrawRequest) (*Wi return &res, nil } + +func (r *relayerClient) GetQuoteRequestByTXID(ctx context.Context, txid string) (*GetQuoteRequestResponse, error) { + var res GetQuoteRequestResponse + resp, err := r.client.R().SetContext(ctx). + SetQueryParam("id", txid). + SetResult(&res). + Get(getRequestByTxID) + if err != nil { + return nil, fmt.Errorf("failed to get quote request by tx id: %w", err) + } + + if resp.StatusCode() != http.StatusOK { + return nil, fmt.Errorf("unexpected status code: %d", resp.StatusCode()) + } + + return &res, nil +} diff --git a/services/rfq/relayer/relapi/client_test.go b/services/rfq/relayer/relapi/client_test.go index 875eb71c04..d93e0a5def 100644 --- a/services/rfq/relayer/relapi/client_test.go +++ b/services/rfq/relayer/relapi/client_test.go @@ -1,6 +1,7 @@ package relapi_test import ( + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/synapsecns/sanguine/services/rfq/relayer/reldb" ) @@ -49,3 +50,14 @@ func (c *RelayerClientSuite) TestRetryTransaction() { c.Equal(resp.TxID, hexutil.Encode(testReq.TransactionID[:])) } + +func (c *RelayerClientSuite) TestGetQuoteByTX() { + testReq := c.underlying.getTestQuoteRequest(reldb.Seen) + err := c.underlying.database.StoreQuoteRequest(c.GetTestContext(), testReq) + c.Require().NoError(err) + + resp, err := c.Client.GetQuoteRequestByTXID(c.GetTestContext(), hexutil.Encode(testReq.TransactionID[:])) + c.Require().NoError(err) + + c.Equal(len(common.Hex2Bytes(resp.QuoteRequestRaw)), len(testReq.RawRequest)) +} diff --git a/services/rfq/relayer/relapi/handler.go b/services/rfq/relayer/relapi/handler.go index 9b5d741cbd..929be8aa40 100644 --- a/services/rfq/relayer/relapi/handler.go +++ b/services/rfq/relayer/relapi/handler.go @@ -142,6 +142,34 @@ func (h *Handler) GetTxRetry(c *gin.Context) { c.JSON(http.StatusOK, resp) } +func (h *Handler) GetQuoteRequestByTxID(c *gin.Context) { + txIDStr := c.Query("id") + if txIDStr == "" { + c.JSON(http.StatusBadRequest, gin.H{"error": "Must specify 'id'"}) + return + } + + txIDBytes, err := hexutil.Decode(txIDStr) + if err != nil { + c.JSON(http.StatusBadRequest, gin.H{"error": "Invalid txID"}) + return + } + var txID [32]byte + copy(txID[:], txIDBytes) + + quoteRequest, err := h.db.GetQuoteRequestByID(c, txID) + if err != nil { + c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) + return + } + + resp := GetQuoteRequestResponse{ + QuoteRequestRaw: common.Bytes2Hex(quoteRequest.RawRequest), + } + c.JSON(http.StatusOK, resp) + +} + // Withdraw withdraws tokens from the relayer. // //nolint:cyclop diff --git a/services/rfq/relayer/relapi/model.go b/services/rfq/relayer/relapi/model.go index dbae73fd14..dffab9ce5c 100644 --- a/services/rfq/relayer/relapi/model.go +++ b/services/rfq/relayer/relapi/model.go @@ -24,3 +24,8 @@ type PutRelayAckResponse struct { ShouldRelay bool `json:"should_relay"` RelayerAddress string `json:"relayer_address"` } + +// GetQuoteRequestResponse is the response to a get quote request. +type GetQuoteRequestResponse struct { + QuoteRequestRaw string `json:"quote_request"` +} diff --git a/services/rfq/relayer/relapi/server.go b/services/rfq/relayer/relapi/server.go index 709a6c3b12..f57c01e59c 100644 --- a/services/rfq/relayer/relapi/server.go +++ b/services/rfq/relayer/relapi/server.go @@ -101,6 +101,7 @@ const ( getQuoteStatusByTxIDRoute = "/status/by_tx_id" getRetryRoute = "/retry" postWithdrawRoute = "/withdraw" + getRequestByTxID = "/request/by_tx_id" ) var logger = log.Logger("relayer-api") @@ -117,6 +118,7 @@ func (r *RelayerAPIServer) Run(ctx context.Context) error { engine.GET(getQuoteStatusByTxHashRoute, h.GetQuoteRequestStatusByTxHash) engine.GET(getQuoteStatusByTxIDRoute, h.GetQuoteRequestStatusByTxID) engine.GET(getRetryRoute, h.GetTxRetry) + engine.GET(getRequestByTxID, h.GetQuoteRequestByTxID) engine.GET(metrics.MetricsPathDefault, gin.WrapH(r.handler.Handler())) if r.cfg.EnableAPIWithdrawals { From d14682e108f8e7e50fb475bfd7168a599734672b Mon Sep 17 00:00:00 2001 From: Trajan0x Date: Tue, 2 Jul 2024 16:06:46 -0400 Subject: [PATCH 4/5] [goreleaser] bump --- agents/go.mod | 2 +- agents/go.sum | 3 +-- contrib/opbot/botmd/botmd.go | 2 -- contrib/opbot/botmd/commands.go | 3 +++ contrib/opbot/go.mod | 25 ++++++++++++++++++++----- contrib/opbot/go.sum | 22 ++++++++++++++++++++++ contrib/promexporter/go.mod | 2 +- contrib/promexporter/go.sum | 3 +-- contrib/screener-api/go.mod | 2 +- contrib/screener-api/go.sum | 3 +-- core/go.mod | 2 +- core/go.sum | 3 +-- ethergo/go.mod | 2 +- ethergo/go.sum | 3 +-- services/cctp-relayer/go.mod | 2 +- services/cctp-relayer/go.sum | 3 +-- services/explorer/go.mod | 2 +- services/explorer/go.sum | 3 +-- services/omnirpc/go.mod | 2 +- services/omnirpc/go.sum | 3 +-- services/rfq/go.mod | 2 +- services/rfq/go.sum | 3 +-- services/scribe/go.mod | 2 +- services/scribe/go.sum | 3 +-- tools/go.mod | 2 +- tools/go.sum | 3 +-- 26 files changed, 67 insertions(+), 40 deletions(-) diff --git a/agents/go.mod b/agents/go.mod index 55acbdbc79..e3f558924c 100644 --- a/agents/go.mod +++ b/agents/go.mod @@ -203,7 +203,7 @@ require ( github.com/google/uuid v1.6.0 // indirect github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect github.com/googleapis/gax-go/v2 v2.12.4 // indirect - github.com/gorilla/websocket v1.5.1 // indirect + github.com/gorilla/websocket v1.5.3 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect github.com/hashicorp/consul/sdk v0.14.0 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect diff --git a/agents/go.sum b/agents/go.sum index 7a0231de40..be94fd6335 100644 --- a/agents/go.sum +++ b/agents/go.sum @@ -622,8 +622,7 @@ github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORR github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= -github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= +github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= github.com/grafana/otel-profiling-go v0.5.1 h1:stVPKAFZSa7eGiqbYuG25VcqYksR6iWvF3YH66t4qL8= github.com/grafana/otel-profiling-go v0.5.1/go.mod h1:ftN/t5A/4gQI19/8MoWurBEtC6gFw8Dns1sJZ9W4Tls= github.com/grafana/pyroscope-go v1.1.1 h1:PQoUU9oWtO3ve/fgIiklYuGilvsm8qaGhlY4Vw6MAcQ= diff --git a/contrib/opbot/botmd/botmd.go b/contrib/opbot/botmd/botmd.go index 0b6d6e4c03..c7a1c09cc6 100644 --- a/contrib/opbot/botmd/botmd.go +++ b/contrib/opbot/botmd/botmd.go @@ -11,7 +11,6 @@ import ( signerConfig "github.com/synapsecns/sanguine/ethergo/signer/config" "github.com/synapsecns/sanguine/ethergo/signer/signer" "github.com/synapsecns/sanguine/ethergo/submitter" - submitterdb "github.com/synapsecns/sanguine/ethergo/submitter/db" cctpSql "github.com/synapsecns/sanguine/services/cctp-relayer/db/sql" omnirpcClient "github.com/synapsecns/sanguine/services/omnirpc/client" "golang.org/x/sync/errgroup" @@ -27,7 +26,6 @@ type Bot struct { rpcClient omnirpcClient.RPCClient signer signer.Signer submitter submitter.TransactionSubmitter - db submitterdb.SubmitterDBFactory } // NewBot creates a new bot server. diff --git a/contrib/opbot/botmd/commands.go b/contrib/opbot/botmd/commands.go index e9a489303b..baa88e13ce 100644 --- a/contrib/opbot/botmd/commands.go +++ b/contrib/opbot/botmd/commands.go @@ -313,6 +313,9 @@ func (b *Bot) rfqRefund() *slacker.CommandDefinition { } _, err = ctx.Response().Reply(fmt.Sprintf("refund submitted with nonce %d", nonce)) + if err != nil { + log.Println(err) + } return } }, diff --git a/contrib/opbot/go.mod b/contrib/opbot/go.mod index c240fe4fee..7bc37bfdca 100644 --- a/contrib/opbot/go.mod +++ b/contrib/opbot/go.mod @@ -14,6 +14,7 @@ require ( github.com/google/uuid v1.6.0 github.com/hako/durafmt v0.0.0-20210608085754-5c1018a4e16b github.com/hedzr/log v1.6.3 + github.com/ipfs/go-log v1.0.5 github.com/joho/godotenv v1.5.1 github.com/keybase/go-keychain v0.0.0-20231219164618-57a3676c3af6 github.com/mailru/easyjson v0.7.7 @@ -23,13 +24,19 @@ require ( github.com/slack-io/slacker v0.1.0 github.com/synapsecns/sanguine/core v0.0.0-00010101000000-000000000000 github.com/synapsecns/sanguine/ethergo v0.1.0 + github.com/synapsecns/sanguine/services/cctp-relayer v0.0.0-00010101000000-000000000000 + github.com/synapsecns/sanguine/services/omnirpc v0.0.0-00010101000000-000000000000 github.com/synapsecns/sanguine/services/rfq v0.0.0-00010101000000-000000000000 github.com/urfave/cli/v2 v2.27.2 go.opentelemetry.io/otel v1.27.0 go.opentelemetry.io/otel/metric v1.27.0 go.opentelemetry.io/otel/trace v1.27.0 + golang.org/x/sync v0.7.0 gopkg.in/yaml.v2 v2.4.0 gopkg.in/yaml.v3 v3.0.1 + gorm.io/driver/mysql v1.5.6 + gorm.io/driver/sqlite v1.5.6 + gorm.io/gorm v1.25.10 k8s.io/apimachinery v0.29.3 ) @@ -44,6 +51,7 @@ require ( dario.cat/mergo v1.0.0 // indirect github.com/DataDog/zstd v1.5.2 // indirect github.com/ImVexed/fasturl v0.0.0-20230304231329-4e41488060f3 // indirect + github.com/KyleBanks/depth v1.2.1 // indirect github.com/Microsoft/go-winio v0.6.1 // indirect github.com/ProtonMail/go-crypto v1.0.0 // indirect github.com/VictoriaMetrics/fastcache v1.12.1 // indirect @@ -127,9 +135,14 @@ require ( github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-ole/go-ole v1.3.0 // indirect + github.com/go-openapi/jsonpointer v0.20.2 // indirect + github.com/go-openapi/jsonreference v0.20.4 // indirect + github.com/go-openapi/spec v0.20.14 // indirect + github.com/go-openapi/swag v0.22.9 // indirect github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect github.com/go-playground/validator/v10 v10.20.0 // indirect + github.com/go-sql-driver/mysql v1.7.0 // indirect github.com/goccy/go-json v0.10.2 // indirect github.com/gofrs/flock v0.8.1 // indirect github.com/gogo/protobuf v1.3.3 // indirect @@ -149,11 +162,12 @@ require ( github.com/holiman/bloomfilter/v2 v2.0.3 // indirect github.com/holiman/uint256 v1.2.4 // indirect github.com/huin/goupnp v1.3.0 // indirect + github.com/imkira/go-interpol v1.1.0 // indirect github.com/integralist/go-findroot v0.0.0-20160518114804-ac90681525dc // indirect - github.com/ipfs/go-log v1.0.5 // indirect github.com/ipfs/go-log/v2 v2.5.1 // indirect github.com/jackpal/go-nat-pmp v1.0.2 // indirect github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect + github.com/jellydator/ttlcache/v3 v3.1.1 // indirect github.com/jftuga/ellipsis v1.0.0 // indirect github.com/jinzhu/inflection v1.0.0 // indirect github.com/jinzhu/now v1.1.5 // indirect @@ -173,6 +187,7 @@ require ( github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-localereader v0.0.1 // indirect github.com/mattn/go-runewidth v0.0.15 // indirect + github.com/mattn/go-sqlite3 v2.0.3+incompatible // indirect github.com/mattn/go-tty v0.0.3 // indirect github.com/miguelmota/go-ethereum-hdwallet v0.1.1 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect @@ -202,13 +217,15 @@ require ( github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect github.com/shibukawa/configdir v0.0.0-20170330084843-e180dbdc8da0 // indirect github.com/shirou/gopsutil v3.21.11+incompatible // indirect + github.com/shopspring/decimal v1.4.0 // indirect github.com/skeema/knownhosts v1.2.2 // indirect github.com/slack-io/commander v0.0.0-20231120025847-9fd78b4b2d54 // indirect github.com/slack-io/proper v0.0.0-20231119200853-f78ba4fc878f // indirect github.com/stretchr/testify v1.9.0 // indirect github.com/supranational/blst v0.3.11 // indirect - github.com/synapsecns/sanguine/services/cctp-relayer v0.0.0-00010101000000-000000000000 // indirect - github.com/synapsecns/sanguine/services/omnirpc v0.0.0-00010101000000-000000000000 // indirect + github.com/swaggo/files v1.0.1 // indirect + github.com/swaggo/gin-swagger v1.6.0 // indirect + github.com/swaggo/swag v1.16.3 // indirect github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect github.com/teivah/onecontext v1.3.0 // indirect github.com/tklauser/go-sysconf v0.3.12 // indirect @@ -248,7 +265,6 @@ require ( golang.org/x/mod v0.18.0 // indirect golang.org/x/net v0.26.0 // indirect golang.org/x/oauth2 v0.21.0 // indirect - golang.org/x/sync v0.7.0 // indirect golang.org/x/sys v0.21.0 // indirect golang.org/x/text v0.16.0 // indirect golang.org/x/time v0.5.0 // indirect @@ -260,7 +276,6 @@ require ( google.golang.org/grpc v1.64.0 // indirect google.golang.org/protobuf v1.34.1 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect - gorm.io/gorm v1.25.10 // indirect k8s.io/klog/v2 v2.120.1 // indirect k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect rsc.io/tmplfunc v0.0.3 // indirect diff --git a/contrib/opbot/go.sum b/contrib/opbot/go.sum index 8722dbd416..bbb49d58b8 100644 --- a/contrib/opbot/go.sum +++ b/contrib/opbot/go.sum @@ -72,6 +72,8 @@ github.com/Flaque/filet v0.0.0-20201012163910-45f684403088/go.mod h1:TK+jB3mBs+8 github.com/ImVexed/fasturl v0.0.0-20230304231329-4e41488060f3 h1:ClzzXMDDuUbWfNNZqGeYq4PnYOlwlOVIvSyNaIy0ykg= github.com/ImVexed/fasturl v0.0.0-20230304231329-4e41488060f3/go.mod h1:we0YA5CsBbH5+/NUzC/AlMmxaDtWlXeNsqrwXjTzmzA= github.com/Joker/hpp v1.0.0/go.mod h1:8x5n+M1Hp5hC0g8okX3sR3vFQwynaX/UgSOM9MeBKzY= +github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc= +github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE= github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= @@ -399,6 +401,8 @@ github.com/getsentry/sentry-go v0.18.0 h1:MtBW5H9QgdcJabtZcuJG80BMOwaBpkRDZkxRkN github.com/getsentry/sentry-go v0.18.0/go.mod h1:Kgon4Mby+FJ7ZWHFUAZgVaIa8sxHtnRJRLTXZr51aKQ= github.com/gin-contrib/cors v1.7.2 h1:oLDHxdg8W/XDoN/8zamqk/Drgt4oVZDvaV0YmvVICQw= github.com/gin-contrib/cors v1.7.2/go.mod h1:SUJVARKgQ40dmrzgXEVxj2m7Ig1v1qIboQkPDTQ9t2E= +github.com/gin-contrib/gzip v0.0.6 h1:NjcunTcGAj5CO1gn4N8jHOSIeRFHIbn51z6K+xaN4d4= +github.com/gin-contrib/gzip v0.0.6/go.mod h1:QOJlmV2xmayAjkNS2Y8NQsMneuRShOU/kjovCXNuzzk= github.com/gin-contrib/requestid v0.0.6 h1:mGcxTnHQ45F6QU5HQRgQUDsAfHprD3P7g2uZ4cSZo9o= github.com/gin-contrib/requestid v0.0.6/go.mod h1:9i4vKATX/CdggbkY252dPVasgVucy/ggBeELXuQztm4= github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s= @@ -448,6 +452,14 @@ github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dT github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE= github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78= +github.com/go-openapi/jsonpointer v0.20.2 h1:mQc3nmndL8ZBzStEo3JYF8wzmeWffDH4VbXz58sAx6Q= +github.com/go-openapi/jsonpointer v0.20.2/go.mod h1:bHen+N0u1KEO3YlmqOjTT9Adn1RfD91Ar825/PuiRVs= +github.com/go-openapi/jsonreference v0.20.4 h1:bKlDxQxQJgwpUSgOENiMPzCTBVuc7vTdXSSgNeAhojU= +github.com/go-openapi/jsonreference v0.20.4/go.mod h1:5pZJyJP2MnYCpoeoMAql78cCHauHj0V9Lhc506VOpw4= +github.com/go-openapi/spec v0.20.14 h1:7CBlRnw+mtjFGlPDRZmAMnq35cRzI91xj03HVyUi/Do= +github.com/go-openapi/spec v0.20.14/go.mod h1:8EOhTpBoFiask8rrgwbLC3zmJfz4zsCUueRuPM6GNkw= +github.com/go-openapi/swag v0.22.9 h1:XX2DssF+mQKM2DHsbgZK74y/zj4mo9I99+89xUmuZCE= +github.com/go-openapi/swag v0.22.9/go.mod h1:3/OXnFfnMAwBD099SwYRk7GD3xOrr1iL7d/XNLXVVwE= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= @@ -660,6 +672,8 @@ github.com/jarcoal/httpmock v1.2.0/go.mod h1:oCoTsnAz4+UoOUIf5lJOWV2QQIW5UoeUI6a github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= github.com/jedisct1/go-minisign v0.0.0-20190909160543-45766022959e/go.mod h1:G1CVv03EnqU1wYL2dFwXxW2An0az9JTl/ZsqXQeBlkU= +github.com/jellydator/ttlcache/v3 v3.1.1 h1:RCgYJqo3jgvhl+fEWvjNW8thxGWsgxi+TPhRir1Y9y8= +github.com/jellydator/ttlcache/v3 v3.1.1/go.mod h1:hi7MGFdMAwZna5n2tuvh63DvFLzVKySzCVW6+0gA2n4= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jftuga/ellipsis v1.0.0 h1:ERi1XBFERM2YpadkvM1P9bxQKgOC40Hr6TCKkvLBDtY= @@ -1036,6 +1050,12 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/supranational/blst v0.3.11 h1:LyU6FolezeWAhvQk0k6O/d49jqgO52MSDDfYgbeoEm4= github.com/supranational/blst v0.3.11/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= +github.com/swaggo/files v1.0.1 h1:J1bVJ4XHZNq0I46UU90611i9/YzdrF7x92oX1ig5IdE= +github.com/swaggo/files v1.0.1/go.mod h1:0qXmMNH6sXNf+73t65aKeB+ApmgxdnkQzVTAj2uaMUg= +github.com/swaggo/gin-swagger v1.6.0 h1:y8sxvQ3E20/RCyrXeFfg60r6H0Z+SwpTjMYsMm+zy8M= +github.com/swaggo/gin-swagger v1.6.0/go.mod h1:BG00cCEy294xtVpyIAHG6+e2Qzj/xKlRdOqDkvq0uzo= +github.com/swaggo/swag v1.16.3 h1:PnCYjPCah8FK4I26l2F/KQ4yz3sILcVUN3cTlBFA9Pg= +github.com/swaggo/swag v1.16.3/go.mod h1:DImHIuOFXKpMFAQjcC7FG4m3Dg4+QuUgUzJmKjI/gRk= github.com/synapsecns/fasthttp-http2 v1.0.0 h1:G1/8AKgAzVImHpGbCGZo8w4c0kUBXb4eRKkMlWUW4eA= github.com/synapsecns/fasthttp-http2 v1.0.0/go.mod h1:QM9mQS/FygGB3PdvmW8a0/70FirWmEZVvj6Dlo1pisw= github.com/syndtr/goleveldb v1.0.1-0.20210305035536-64b5b1c73954/go.mod h1:u2MKkTVTVJWe5D1rCvame8WqhBd88EuIwODJZ1VHCPM= @@ -1275,6 +1295,7 @@ golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= @@ -1554,6 +1575,7 @@ gorm.io/driver/mysql v1.5.6 h1:Ld4mkIickM+EliaQZQx3uOJDJHtrd70MxAUqWqlx3Y8= gorm.io/driver/mysql v1.5.6/go.mod h1:sEtPWMiqiN1N1cMXoXmBbd8C6/l+TESwriotuRRpkDM= gorm.io/driver/sqlite v1.5.6 h1:fO/X46qn5NUEEOZtnjJRWRzZMe8nqJiQ9E+0hi+hKQE= gorm.io/driver/sqlite v1.5.6/go.mod h1:U+J8craQU6Fzkcvu8oLeAQmi50TkwPEhHDEjQZXDah4= +gorm.io/gorm v1.25.7/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8= gorm.io/gorm v1.25.10 h1:dQpO+33KalOA+aFYGlK+EfxcI5MbO7EP2yYygwh9h+s= gorm.io/gorm v1.25.10/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8= gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= diff --git a/contrib/promexporter/go.mod b/contrib/promexporter/go.mod index 8c2fe5c0b3..1283126502 100644 --- a/contrib/promexporter/go.mod +++ b/contrib/promexporter/go.mod @@ -122,7 +122,7 @@ require ( github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect github.com/google/uuid v1.6.0 // indirect - github.com/gorilla/websocket v1.5.1 // indirect + github.com/gorilla/websocket v1.5.3 // indirect github.com/grafana/otel-profiling-go v0.5.1 // indirect github.com/grafana/pyroscope-go v1.1.1 // indirect github.com/grafana/pyroscope-go/godeltaprof v0.1.7 // indirect diff --git a/contrib/promexporter/go.sum b/contrib/promexporter/go.sum index 3170bf3e09..da48c4f7fa 100644 --- a/contrib/promexporter/go.sum +++ b/contrib/promexporter/go.sum @@ -562,8 +562,7 @@ github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8 github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= -github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= +github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= github.com/grafana/otel-profiling-go v0.5.1 h1:stVPKAFZSa7eGiqbYuG25VcqYksR6iWvF3YH66t4qL8= github.com/grafana/otel-profiling-go v0.5.1/go.mod h1:ftN/t5A/4gQI19/8MoWurBEtC6gFw8Dns1sJZ9W4Tls= github.com/grafana/pyroscope-go v1.1.1 h1:PQoUU9oWtO3ve/fgIiklYuGilvsm8qaGhlY4Vw6MAcQ= diff --git a/contrib/screener-api/go.mod b/contrib/screener-api/go.mod index 5e66914364..e416d3f024 100644 --- a/contrib/screener-api/go.mod +++ b/contrib/screener-api/go.mod @@ -91,7 +91,7 @@ require ( github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect - github.com/gorilla/websocket v1.5.1 // indirect + github.com/gorilla/websocket v1.5.3 // indirect github.com/grafana/otel-profiling-go v0.5.1 // indirect github.com/grafana/pyroscope-go v1.1.1 // indirect github.com/grafana/pyroscope-go/godeltaprof v0.1.7 // indirect diff --git a/contrib/screener-api/go.sum b/contrib/screener-api/go.sum index 1d7c0eea54..529a3f74f8 100644 --- a/contrib/screener-api/go.sum +++ b/contrib/screener-api/go.sum @@ -292,8 +292,7 @@ github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= -github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= -github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= +github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= github.com/grafana/otel-profiling-go v0.5.1 h1:stVPKAFZSa7eGiqbYuG25VcqYksR6iWvF3YH66t4qL8= github.com/grafana/otel-profiling-go v0.5.1/go.mod h1:ftN/t5A/4gQI19/8MoWurBEtC6gFw8Dns1sJZ9W4Tls= github.com/grafana/pyroscope-go v1.1.1 h1:PQoUU9oWtO3ve/fgIiklYuGilvsm8qaGhlY4Vw6MAcQ= diff --git a/core/go.mod b/core/go.mod index 3938b25872..f6dc83fac2 100644 --- a/core/go.mod +++ b/core/go.mod @@ -106,7 +106,7 @@ require ( github.com/gogo/protobuf v1.3.3 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect - github.com/gorilla/websocket v1.5.1 // indirect + github.com/gorilla/websocket v1.5.3 // indirect github.com/grafana/pyroscope-go/godeltaprof v0.1.7 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect github.com/holiman/uint256 v1.2.4 // indirect diff --git a/core/go.sum b/core/go.sum index 9f04a80f95..0375c7df6f 100644 --- a/core/go.sum +++ b/core/go.sum @@ -282,8 +282,7 @@ github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= -github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= -github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= +github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= github.com/grafana/otel-profiling-go v0.5.1 h1:stVPKAFZSa7eGiqbYuG25VcqYksR6iWvF3YH66t4qL8= github.com/grafana/otel-profiling-go v0.5.1/go.mod h1:ftN/t5A/4gQI19/8MoWurBEtC6gFw8Dns1sJZ9W4Tls= github.com/grafana/pyroscope-go v1.1.1 h1:PQoUU9oWtO3ve/fgIiklYuGilvsm8qaGhlY4Vw6MAcQ= diff --git a/ethergo/go.mod b/ethergo/go.mod index 1424de73b8..ffb85421c7 100644 --- a/ethergo/go.mod +++ b/ethergo/go.mod @@ -173,7 +173,7 @@ require ( github.com/google/s2a-go v0.1.7 // indirect github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect - github.com/gorilla/websocket v1.5.1 // indirect + github.com/gorilla/websocket v1.5.3 // indirect github.com/grafana/otel-profiling-go v0.5.1 // indirect github.com/grafana/pyroscope-go v1.1.1 // indirect github.com/grafana/pyroscope-go/godeltaprof v0.1.7 // indirect diff --git a/ethergo/go.sum b/ethergo/go.sum index 1e7d9fcda0..a633eaeacf 100644 --- a/ethergo/go.sum +++ b/ethergo/go.sum @@ -561,8 +561,7 @@ github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORR github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= -github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= +github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= github.com/grafana/otel-profiling-go v0.5.1 h1:stVPKAFZSa7eGiqbYuG25VcqYksR6iWvF3YH66t4qL8= github.com/grafana/otel-profiling-go v0.5.1/go.mod h1:ftN/t5A/4gQI19/8MoWurBEtC6gFw8Dns1sJZ9W4Tls= github.com/grafana/pyroscope-go v1.1.1 h1:PQoUU9oWtO3ve/fgIiklYuGilvsm8qaGhlY4Vw6MAcQ= diff --git a/services/cctp-relayer/go.mod b/services/cctp-relayer/go.mod index cee5c5e8ef..2d37656afe 100644 --- a/services/cctp-relayer/go.mod +++ b/services/cctp-relayer/go.mod @@ -148,7 +148,7 @@ require ( github.com/google/uuid v1.6.0 // indirect github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect github.com/googleapis/gax-go/v2 v2.12.4 // indirect - github.com/gorilla/websocket v1.5.1 // indirect + github.com/gorilla/websocket v1.5.3 // indirect github.com/grafana/otel-profiling-go v0.5.1 // indirect github.com/grafana/pyroscope-go v1.1.1 // indirect github.com/grafana/pyroscope-go/godeltaprof v0.1.7 // indirect diff --git a/services/cctp-relayer/go.sum b/services/cctp-relayer/go.sum index 30c684088c..806af7f54e 100644 --- a/services/cctp-relayer/go.sum +++ b/services/cctp-relayer/go.sum @@ -573,8 +573,7 @@ github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORR github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= -github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= +github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= github.com/grafana/otel-profiling-go v0.5.1 h1:stVPKAFZSa7eGiqbYuG25VcqYksR6iWvF3YH66t4qL8= github.com/grafana/otel-profiling-go v0.5.1/go.mod h1:ftN/t5A/4gQI19/8MoWurBEtC6gFw8Dns1sJZ9W4Tls= github.com/grafana/pyroscope-go v1.1.1 h1:PQoUU9oWtO3ve/fgIiklYuGilvsm8qaGhlY4Vw6MAcQ= diff --git a/services/explorer/go.mod b/services/explorer/go.mod index 4d99dfb961..f447f71b6f 100644 --- a/services/explorer/go.mod +++ b/services/explorer/go.mod @@ -153,7 +153,7 @@ require ( github.com/google/go-cmp v0.6.0 // indirect github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect github.com/google/uuid v1.6.0 // indirect - github.com/gorilla/websocket v1.5.1 // indirect + github.com/gorilla/websocket v1.5.3 // indirect github.com/grafana/otel-profiling-go v0.5.1 // indirect github.com/grafana/pyroscope-go v1.1.1 // indirect github.com/grafana/pyroscope-go/godeltaprof v0.1.7 // indirect diff --git a/services/explorer/go.sum b/services/explorer/go.sum index 4699e24207..53295ebf82 100644 --- a/services/explorer/go.sum +++ b/services/explorer/go.sum @@ -557,8 +557,7 @@ github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORR github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= -github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= +github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= github.com/grafana/otel-profiling-go v0.5.1 h1:stVPKAFZSa7eGiqbYuG25VcqYksR6iWvF3YH66t4qL8= github.com/grafana/otel-profiling-go v0.5.1/go.mod h1:ftN/t5A/4gQI19/8MoWurBEtC6gFw8Dns1sJZ9W4Tls= github.com/grafana/pyroscope-go v1.1.1 h1:PQoUU9oWtO3ve/fgIiklYuGilvsm8qaGhlY4Vw6MAcQ= diff --git a/services/omnirpc/go.mod b/services/omnirpc/go.mod index 45aaccec49..2f1c9be9ac 100644 --- a/services/omnirpc/go.mod +++ b/services/omnirpc/go.mod @@ -135,7 +135,7 @@ require ( github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect - github.com/gorilla/websocket v1.5.1 // indirect + github.com/gorilla/websocket v1.5.3 // indirect github.com/grafana/otel-profiling-go v0.5.1 // indirect github.com/grafana/pyroscope-go v1.1.1 // indirect github.com/grafana/pyroscope-go/godeltaprof v0.1.7 // indirect diff --git a/services/omnirpc/go.sum b/services/omnirpc/go.sum index 2bc342f5b9..db37ced0a6 100644 --- a/services/omnirpc/go.sum +++ b/services/omnirpc/go.sum @@ -565,8 +565,7 @@ github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORR github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= -github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= +github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= github.com/grafana/otel-profiling-go v0.5.1 h1:stVPKAFZSa7eGiqbYuG25VcqYksR6iWvF3YH66t4qL8= github.com/grafana/otel-profiling-go v0.5.1/go.mod h1:ftN/t5A/4gQI19/8MoWurBEtC6gFw8Dns1sJZ9W4Tls= github.com/grafana/pyroscope-go v1.1.1 h1:PQoUU9oWtO3ve/fgIiklYuGilvsm8qaGhlY4Vw6MAcQ= diff --git a/services/rfq/go.mod b/services/rfq/go.mod index 138846a0c5..c1d9077051 100644 --- a/services/rfq/go.mod +++ b/services/rfq/go.mod @@ -163,7 +163,7 @@ require ( github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect github.com/googleapis/gax-go/v2 v2.12.4 // indirect - github.com/gorilla/websocket v1.5.1 // indirect + github.com/gorilla/websocket v1.5.3 // indirect github.com/grafana/otel-profiling-go v0.5.1 // indirect github.com/grafana/pyroscope-go v1.1.1 // indirect github.com/grafana/pyroscope-go/godeltaprof v0.1.7 // indirect diff --git a/services/rfq/go.sum b/services/rfq/go.sum index cf76314f9e..54495a710e 100644 --- a/services/rfq/go.sum +++ b/services/rfq/go.sum @@ -585,8 +585,7 @@ github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORR github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= -github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= +github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= github.com/grafana/otel-profiling-go v0.5.1 h1:stVPKAFZSa7eGiqbYuG25VcqYksR6iWvF3YH66t4qL8= github.com/grafana/otel-profiling-go v0.5.1/go.mod h1:ftN/t5A/4gQI19/8MoWurBEtC6gFw8Dns1sJZ9W4Tls= github.com/grafana/pyroscope-go v1.1.1 h1:PQoUU9oWtO3ve/fgIiklYuGilvsm8qaGhlY4Vw6MAcQ= diff --git a/services/scribe/go.mod b/services/scribe/go.mod index 5df6e12305..2260cebd61 100644 --- a/services/scribe/go.mod +++ b/services/scribe/go.mod @@ -168,7 +168,7 @@ require ( github.com/google/go-cmp v0.6.0 // indirect github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect github.com/google/uuid v1.6.0 // indirect - github.com/gorilla/websocket v1.5.1 // indirect + github.com/gorilla/websocket v1.5.3 // indirect github.com/grafana/otel-profiling-go v0.5.1 // indirect github.com/grafana/pyroscope-go v1.1.1 // indirect github.com/grafana/pyroscope-go/godeltaprof v0.1.7 // indirect diff --git a/services/scribe/go.sum b/services/scribe/go.sum index 08a4564088..e9cd963d6e 100644 --- a/services/scribe/go.sum +++ b/services/scribe/go.sum @@ -603,8 +603,7 @@ github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORR github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= -github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= +github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= github.com/grafana/otel-profiling-go v0.5.1 h1:stVPKAFZSa7eGiqbYuG25VcqYksR6iWvF3YH66t4qL8= github.com/grafana/otel-profiling-go v0.5.1/go.mod h1:ftN/t5A/4gQI19/8MoWurBEtC6gFw8Dns1sJZ9W4Tls= github.com/grafana/pyroscope-go v1.1.1 h1:PQoUU9oWtO3ve/fgIiklYuGilvsm8qaGhlY4Vw6MAcQ= diff --git a/tools/go.mod b/tools/go.mod index 27c24c923b..6b259f7cc6 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -60,7 +60,7 @@ require ( github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/google/uuid v1.6.0 // indirect - github.com/gorilla/websocket v1.5.1 // indirect + github.com/gorilla/websocket v1.5.3 // indirect github.com/holiman/uint256 v1.2.4 // indirect github.com/integralist/go-findroot v0.0.0-20160518114804-ac90681525dc // indirect github.com/ipfs/go-log/v2 v2.5.1 // indirect diff --git a/tools/go.sum b/tools/go.sum index bcae9b9df7..0a0a86f1cb 100644 --- a/tools/go.sum +++ b/tools/go.sum @@ -279,8 +279,7 @@ github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5m github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= -github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= +github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= From b62cb029a2dad267cf88cf5d2fc217fa4c53fa8d Mon Sep 17 00:00:00 2001 From: Trajan0x Date: Fri, 5 Jul 2024 16:47:56 -0400 Subject: [PATCH 5/5] cleanup --- contrib/opbot/botmd/commands.go | 62 ++++++++++++++++++++++++++++--- contrib/opbot/cmd/commands.go | 3 +- contrib/opbot/config/config.go | 2 +- ethergo/chaindata/chaindata.go | 11 ++++++ ethergo/signer/wallet/import.go | 5 +++ services/omnirpc/client/client.go | 9 ++++- services/rfq/api/client/client.go | 2 +- 7 files changed, 85 insertions(+), 9 deletions(-) diff --git a/contrib/opbot/botmd/commands.go b/contrib/opbot/botmd/commands.go index baa88e13ce..91bb2a070d 100644 --- a/contrib/opbot/botmd/commands.go +++ b/contrib/opbot/botmd/commands.go @@ -3,6 +3,7 @@ package botmd import ( + "context" "fmt" "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" @@ -260,13 +261,33 @@ func (b *Bot) rfqRefund() *slacker.CommandDefinition { contracts, err := client.GetRFQContracts(ctx.Context()) if err != nil { log.Printf("error fetching rfq contracts: %v\n", err) + _, err = ctx.Response().Reply("error fetching rfq contracts") + if err != nil { + return + } return } tx := stripLinks(ctx.Request().Param("tx")) + + if len(tx) == 0 { + _, err := ctx.Response().Reply("please provide a tx hash") + if err != nil { + log.Println(err) + } + return + } + originChainIDStr := ctx.Request().Param("origin_chainid") + if len(originChainIDStr) == 0 { + _, err := ctx.Response().Reply("please provide an origin chain id") + if err != nil { + log.Println(err) + } + return + } - originChainID, err := strconv.Atoi(originChainIDStr) + originChainID, err := strconv.Atoi(convertChainName(originChainIDStr)) if err != nil { _, err := ctx.Response().Reply("origin_chainid must be a number") if err != nil { @@ -298,14 +319,18 @@ func (b *Bot) rfqRefund() *slacker.CommandDefinition { for _, relayer := range b.cfg.RelayerURLS { relClient := relapi.NewRelayerClient(b.handler, relayer) - qr, err := relClient.GetQuoteRequestByTXID(ctx.Context(), tx) + + rawRequest, err := getQuoteRequest(ctx.Context(), relClient, tx) if err != nil { - log.Printf("error fetching quote request: %v\n", err) - continue + _, err := ctx.Response().Reply("error fetching quote request") + if err != nil { + log.Println(err) + } + return } nonce, err := b.submitter.SubmitTransaction(ctx.Context(), big.NewInt(int64(originChainID)), func(transactor *bind.TransactOpts) (tx *types.Transaction, err error) { - return fastBridgeHandle.Refund(transactor, common.Hex2Bytes(qr.QuoteRequestRaw)) + return fastBridgeHandle.Refund(transactor, rawRequest) }) if err != nil { log.Printf("error submitting refund: %v\n", err) @@ -347,3 +372,30 @@ func stripLinks(input string) string { linkRegex := regexp.MustCompile(`]+\|([^>]+)>`) return linkRegex.ReplaceAllString(input, "$1") } + +// convertChainName detects if the string contains letters and if it does, tries to convert it to a chain id. +// otherwise return the original string +func convertChainName(input string) string { + res := chaindata.ChainNameToChainID(input) + if res != 0 { + return strconv.Itoa(int(res)) + } + return input +} + +func getQuoteRequest(ctx context.Context, client relapi.RelayerClient, tx string) ([]byte, error) { + // at this point tx can be a txid or a has, we try both + txRequest, err := client.GetQuoteRequestStatusByTxHash(ctx, tx) + if err == nil { + // override tx with txid + tx = txRequest.TxID + } + + // look up quote request + qr, err := client.GetQuoteRequestByTXID(ctx, tx) + if err != nil { + return nil, fmt.Errorf("error fetching quote request: %w", err) + } + + return common.Hex2Bytes(qr.QuoteRequestRaw), nil +} diff --git a/contrib/opbot/cmd/commands.go b/contrib/opbot/cmd/commands.go index 7d09a59924..3b7001f0ad 100644 --- a/contrib/opbot/cmd/commands.go +++ b/contrib/opbot/cmd/commands.go @@ -3,6 +3,7 @@ package cmd import ( "fmt" "github.com/synapsecns/sanguine/contrib/opbot/botmd" + "github.com/synapsecns/sanguine/core" "github.com/synapsecns/sanguine/core/metrics" // used for testing. @@ -23,7 +24,7 @@ var slackBotCommand = &cli.Command{ Usage: "start the slack bot", Flags: []cli.Flag{fileFlag}, Action: func(c *cli.Context) error { - configFile, err := os.ReadFile(c.String(fileFlag.Name)) + configFile, err := os.ReadFile(core.ExpandOrReturnPath(c.String(fileFlag.Name))) if err != nil { return fmt.Errorf("failed to open config file: %w", err) } diff --git a/contrib/opbot/config/config.go b/contrib/opbot/config/config.go index d071dc3fba..606e413c09 100644 --- a/contrib/opbot/config/config.go +++ b/contrib/opbot/config/config.go @@ -26,7 +26,7 @@ type Config struct { // RFQApiURL is the URL of the RFQ API. RFQApiURL string `yaml:"rfq_api_url"` // OmniRPCURL is the URL of the Omni RPC. - OmniRPCURL string `yaml:"omni_rpc_url"` + OmniRPCURL string `yaml:"omnirpc_url"` // Signer is the signer config. Signer config.SignerConfig `yaml:"signer"` // SubmitterConfig is the submitter config. diff --git a/ethergo/chaindata/chaindata.go b/ethergo/chaindata/chaindata.go index 5b9a2f791a..0fab04a166 100644 --- a/ethergo/chaindata/chaindata.go +++ b/ethergo/chaindata/chaindata.go @@ -164,6 +164,17 @@ var ChainMetadataList = []ChainMetadata{ }, } +// ChainNameToChainID converts the chain name to the chain id. +// It returns 0 if the chain name is not found. +func ChainNameToChainID(chainName string) uint64 { + for _, chainMetadata := range ChainMetadataList { + if strings.EqualFold(chainMetadata.ChainName, chainName) { + return uint64(chainMetadata.ChainID) + } + } + return 0 +} + // ChainIDToChainName converts the chain id to the chain name. func ChainIDToChainName(chainID int64, isUpper bool) string { for _, chainMetadata := range ChainMetadataList { diff --git a/ethergo/signer/wallet/import.go b/ethergo/signer/wallet/import.go index d872adad13..3488506ada 100644 --- a/ethergo/signer/wallet/import.go +++ b/ethergo/signer/wallet/import.go @@ -58,6 +58,11 @@ func FromKeyFile(keyFile string) (Wallet, error) { // FromHex gets the wallet from the private key. func FromHex(privateKey string) (Wallet, error) { + // Check for '0x' prefix and remove it if it exists + if len(privateKey) >= 2 && strings.EqualFold(privateKey[:2], "0x") { + privateKey = privateKey[2:] + } + privKey, err := crypto.HexToECDSA(privateKey) if err != nil { return nil, fmt.Errorf("could not decode key: %w", err) diff --git a/services/omnirpc/client/client.go b/services/omnirpc/client/client.go index 74cf1f5199..ea21fec74c 100644 --- a/services/omnirpc/client/client.go +++ b/services/omnirpc/client/client.go @@ -11,6 +11,7 @@ import ( "io" "math/big" "net/http" + "strings" ) // RPCClient is an interface for the omnirpc service. @@ -55,7 +56,13 @@ func (c *rpcClient) GetClient(ctx context.Context, chainID *big.Int) (client.EVM return c.GetChainClient(ctx, int(chainID.Uint64())) } -func (c *rpcClient) GetEndpoint(chainID, confirmations int) string { +func (c *rpcClient) GetEndpoint(chainID, confirmations int) (res string) { + defer func() { + res = strings.ReplaceAll(c.endpoint, "://", "TEMP_PROTOCOL") + res = strings.ReplaceAll(c.endpoint, "//", "/") + res = strings.ReplaceAll(c.endpoint, "TEMP_PROTOCOL", "://") + }() + if confirmations == 0 { return fmt.Sprintf("%s/rpc/%d", c.endpoint, chainID) } diff --git a/services/rfq/api/client/client.go b/services/rfq/api/client/client.go index 0c80c47958..0f64f753a4 100644 --- a/services/rfq/api/client/client.go +++ b/services/rfq/api/client/client.go @@ -232,5 +232,5 @@ func getStatus(resp *resty.Response) string { if resp == nil { return "http status unavailable" } - return getStatus(resp) + return resp.Status() }