Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add refunder to opbot #2838

Merged
merged 16 commits into from
Jul 5, 2024
5 changes: 3 additions & 2 deletions contrib/opbot/botmd/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tip

Codebase Verification

Add tests for new functionality.

The new functionality added to the tracingMiddleware method is not covered by tests. Ensure that tests are added to cover:

  • Context inheritance using ctx.

  • Span creation with appropriate attributes.

  • contrib/opbot/botmd/middleware.go

Analysis chain

Add tests for new functionality.

The new functionality added to the tracingMiddleware method is not covered by tests. Ensure that tests are added to cover:

  • Context inheritance using ctx.
  • Span creation with appropriate attributes.
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify test coverage for new functionality in `tracingMiddleware`.

# Test: Search for test cases covering the `tracingMiddleware` method. Expect: Test cases covering all new functionality.
rg --type go 'tracingMiddleware'

Length of output: 233



Script:

#!/bin/bash
# Description: Verify test coverage for the `tracingMiddleware` method by searching for test files and functions.

# Find all test files in the repository.
fd --type f --name '*_test.go'

# Search for test functions that might cover `tracingMiddleware`.
rg --type go 'func Test' | rg 'tracingMiddleware'

Length of output: 333



Script:

#!/bin/bash
# Description: Verify test coverage for the `tracingMiddleware` method by searching for test files and functions.

# Find all test files in the repository.
fd '_test.go$'

# Search for references to `tracingMiddleware` within test files.
rg 'tracingMiddleware' $(fd '_test.go$')

Length of output: 25161

Tools
GitHub Check: codecov/patch

[warning] 24-24: contrib/opbot/botmd/middleware.go#L24
Added line #L24 was not covered by tests

attribute.String("user_id", cmdCtx.Event().UserID),
attribute.String("channel_id", cmdCtx.Event().Channel.ID),
))

cmdCtx.WithContext(ctx)

Comment on lines +29 to +30
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tip

Codebase Verification

Add tests for new functionality.

The tracingMiddleware method is not covered by any existing test cases. Please add tests to ensure the following functionalities are covered:

  • Context inheritance using ctx.

  • Span creation with appropriate attributes.

  • contrib/opbot/botmd/middleware.go

Analysis chain

Add tests for new functionality.

The new functionality added to the tracingMiddleware method is not covered by tests. Ensure that tests are added to cover:

  • Context inheritance using ctx.
  • Span creation with appropriate attributes.
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify test coverage for new functionality in `tracingMiddleware`.

# Test: Search for test cases covering the `tracingMiddleware` method. Expect: Test cases covering all new functionality.
rg --type go 'tracingMiddleware'

Length of output: 233



Script:

#!/bin/bash
# Description: Verify if there are tests covering the `tracingMiddleware` method.

# Find all Go test files in the repository
test_files=$(fd --type f --extension go --glob '*_test.go')

# Search for test cases covering the `tracingMiddleware` method in the test files
for file in $test_files; do
    echo "Checking $file"
    rg 'tracingMiddleware' "$file"
done

Length of output: 75047

Tools
GitHub Check: codecov/patch

[warning] 29-30: contrib/opbot/botmd/middleware.go#L29-L30
Added lines #L29 - L30 were not covered by tests

defer func() {
metrics.EndSpan(span)
}()
Expand Down
9 changes: 4 additions & 5 deletions contrib/opbot/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
18 changes: 8 additions & 10 deletions contrib/opbot/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down Expand Up @@ -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=
Expand Down Expand Up @@ -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=
Expand All @@ -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=
Expand All @@ -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=
Expand Down
179 changes: 179 additions & 0 deletions docs/bridge/docs/rfq/API/get-contract-addresses.api.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
---
id: get-contract-addresses
title: "Get contract addresses"
description: "get quotes from all relayers."
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📚 spelling: The description 'get quotes from all relayers.' seems incorrect for this endpoint. It should describe getting contract addresses.

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";

<Heading
as={"h1"}
className={"openapi__heading"}
children={"Get contract addresses"}
>
</Heading>

<MethodEndpoint
method={"get"}
path={"/contracts"}
>

</MethodEndpoint>



get quotes from all relayers.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📚 spelling: This line appears to be a leftover from a copy-paste. It should be removed or corrected to describe the 'get contract addresses' functionality.


<div>
<div>
<ApiTabs
label={undefined}
id={undefined}
>
<TabItem
label={"200"}
value={"200"}
>
<div>


OK


</div><div>
<MimeTabs
className={"openapi-tabs__mime"}
schemaType={"response"}
>
<TabItem
label={"application/json"}
value={"application/json"}
>
<SchemaTabs
className={"openapi-tabs__schema"}
>
<TabItem
label={"Schema"}
value={"Schema"}
>
<details
style={{}}
className={"openapi-markdown__details response"}
data-collapsed={false}
open={true}
>
<summary
style={{}}
className={"openapi-markdown__details-summary-response"}
>
<strong>
Schema
</strong>
</summary><div
style={{"textAlign":"left","marginLeft":"1rem"}}
>

</div><ul
style={{"marginLeft":"1rem"}}
>
<li>
<div
style={{"fontSize":"var(--ifm-code-font-size)","opacity":"0.6","marginLeft":"-.5rem","paddingBottom":".5rem"}}
>
Array [
</div>
</li><SchemaItem
collapsible={true}
className={"schemaItem"}
>
<details
style={{}}
className={"openapi-markdown__details"}
>
<summary
style={{}}
>
<span
className={"openapi-schema__container"}
>
<strong
className={"openapi-schema__property"}
>
contracts
</strong><span
className={"openapi-schema__name"}
>
object
</span>
</span>
</summary><div
style={{"marginLeft":"1rem"}}
>
<div
style={{"marginTop":".5rem","marginBottom":".5rem"}}
>


Contracts is a map of chain id to contract address


</div><SchemaItem
name={"property name*"}
required={false}
schemaName={"string"}
qualifierMessage={undefined}
schema={{"type":"string"}}
collapsible={false}
discriminator={false}
>

</SchemaItem>
</div>
</details>
</SchemaItem><li>
<div
style={{"fontSize":"var(--ifm-code-font-size)","opacity":"0.6","marginLeft":"-.5rem"}}
>
]
</div>
</li>
</ul>
</details>
</TabItem><TabItem
label={"Example (from schema)"}
value={"Example (from schema)"}
>
<ResponseSamples
responseExample={"[\n {\n \"contracts\": {}\n }\n]"}
language={"json"}
>

</ResponseSamples>
</TabItem>
</SchemaTabs>
</TabItem>
</MimeTabs>
</div>
</TabItem>
</ApiTabs>
</div>
</div>

Loading
Loading