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

FE Release 2024-08-27 #3071

Closed
wants to merge 91 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
bb647ce
Publish
aureliusbtc Aug 15, 2024
a123a5f
RFQ API Auth Cache (#3007)
aureliusbtc Aug 15, 2024
fca30be
fix ci matrix
trajan0x Aug 15, 2024
6f99fad
Merge branch 'master' of https://github.com/synapsecns/sanguine
trajan0x Aug 15, 2024
914d2e2
feat(listener): add `ListenerName` db field (#3020)
dwasse Aug 15, 2024
445b4fb
feat(rfq-relayer): add mutex on committable balance consumption (#2994)
dwasse Aug 16, 2024
317c07d
feat(promexporter): relayer balances (#3016)
golangisfun123 Aug 16, 2024
8da405f
fix(synapse-interface): hide Blast WETH (#3033)
ChiTimesChi Aug 16, 2024
b8b895f
Publish
ChiTimesChi Aug 16, 2024
e32854b
feat(promexporter): Grafana usdc balances (#3034)
golangisfun123 Aug 16, 2024
1d61605
update pause canto timing
aureliusbtc Aug 16, 2024
9dfde6c
fix(listener): latest block query (#3030)
dwasse Aug 19, 2024
aa898d4
Update blacklist.json (#3037)
Defi-Moses Aug 19, 2024
7976f7a
Publish
aureliusbtc Aug 19, 2024
c26fce3
revert(relayer): potential deadlock (#3036)
dwasse Aug 19, 2024
898b5b9
feat(relapi): get QuoteRequest by txhash (#3032)
golangisfun123 Aug 20, 2024
44f1399
Updating rfq contracts in docs (#3041)
Defi-Moses Aug 20, 2024
914c25a
Publish
trajan0x Aug 20, 2024
b1ddc86
re-pause canto
aureliusbtc Aug 20, 2024
4fd9ef1
feat(rfq-relayer): highly concurrent e2e test (#3042)
dwasse Aug 20, 2024
f789485
feat(rfq-relayer): add balances mutex (#3039)
trajan0x Aug 21, 2024
d73373b
feat(synapse-interface): METIS token (#3044)
bigboydiamonds Aug 21, 2024
d952e4c
Publish
bigboydiamonds Aug 21, 2024
1d06a74
first pass at updating RFQ relayer documentation (#3000)
Defi-Moses Aug 22, 2024
961356a
Publish
Defi-Moses Aug 22, 2024
c0b30cc
fix(promexporter) add new external relayer (#3040)
golangisfun123 Aug 22, 2024
08b9e9e
Add METIS token support (#3046)
bigboydiamonds Aug 22, 2024
ead107f
Publish
bigboydiamonds Aug 22, 2024
3499bd2
fix relayer dashboard
trajan0x Aug 22, 2024
469f0cd
Merge branch 'master' of https://github.com/synapsecns/sanguine
trajan0x Aug 22, 2024
c1e56ba
fix relayer dashboard
trajan0x Aug 22, 2024
b65003c
Feat: add listener_name as attribute (#3050)
dwasse Aug 23, 2024
e50d90e
fix relayer dashboard
trajan0x Aug 23, 2024
214614b
Exports metis (#3052)
abtestingalpha Aug 23, 2024
1aee96b
Publish
abtestingalpha Aug 23, 2024
6304351
hotfix for blockExplorerUrls (#3054)
bigboydiamonds Aug 23, 2024
eae2795
Publish
bigboydiamonds Aug 23, 2024
8b44c1c
chore(widget): update block explorers (#3055)
bigboydiamonds Aug 24, 2024
ee4a700
Publish
trajan0x Aug 24, 2024
d0c386c
slack token update
trajan0x Aug 25, 2024
8851629
add manifest to readme
trajan0x Aug 25, 2024
9fe0f03
quick doc update
trajan0x Aug 25, 2024
96ec352
update new-from-rev
trajan0x Aug 25, 2024
99bf33b
Extend canto pause (#3058)
Defi-Moses Aug 25, 2024
813317e
Publish
aureliusbtc Aug 25, 2024
013d4b9
basic listener docs (#3060)
trajan0x Aug 26, 2024
649b3f5
feat(synapse-interface): bridge quote state validations (#3019)
abtestingalpha Aug 26, 2024
85b5f53
feat(sdk): uuid `BridgeQuote.id` (#2896)
bigboydiamonds Aug 26, 2024
ef021dc
Script to check token exports match bridgeable.ts (#3053)
abtestingalpha Aug 26, 2024
7793703
Publish
abtestingalpha Aug 26, 2024
224606f
chore(deps): update graphqlcodegenerator monorepo (#2747)
renovate[bot] Aug 26, 2024
c366782
Publish
abtestingalpha Aug 26, 2024
0e64a98
standardize middleware (#3066)
trajan0x Aug 27, 2024
88a6b1c
fix(deps): update github.com/charmbracelet/huh/spinner digest to 5fd7…
renovate[bot] Aug 27, 2024
e61e1bf
[explorer ui] units for time elapsed (#3064)
nautsimon Aug 27, 2024
fca6b36
Extend canto pause (#3069)
bigboydiamonds Aug 27, 2024
aa5796a
Publish
abtestingalpha Aug 27, 2024
6d971c2
Display days remaining when more than 24h left (#3070)
bigboydiamonds Aug 27, 2024
af233c2
Publish
bigboydiamonds Aug 27, 2024
8226c60
feat(widget): visual update (#2992)
bigboydiamonds Aug 27, 2024
cf2f3e9
Publish
abtestingalpha Aug 27, 2024
bb13b4b
fix(rfq-relayer): check request status before forwarding (#3073)
dwasse Aug 27, 2024
eccbfd1
refactor(relapi): deprecate `GetQuoteRequestStatusResponse` model (#3…
golangisfun123 Aug 28, 2024
b568cbe
feat(synapse-interface): bridge quote uuid (#2900)
bigboydiamonds Aug 29, 2024
7d50e75
Publish
abtestingalpha Aug 29, 2024
e38d1e4
REST API Migration (#3049)
Defi-Moses Aug 29, 2024
89871e9
Publish
aureliusbtc Aug 29, 2024
a6e1781
feat(opbot): add screener to opbot (#3076)
golangisfun123 Aug 30, 2024
debe263
add all modules output [goreleaser] (#3083)
trajan0x Aug 30, 2024
252fb54
feat(rfq-relayer): wait for finality before proving (#3062)
dwasse Aug 30, 2024
c6953ed
fix(opbot): fix refund forever (#3082)
golangisfun123 Aug 30, 2024
7e0b8f1
small bug fix [goreleaser] (#3086)
golangisfun123 Sep 1, 2024
4a17c15
feat(opbot): print explorer refund tx link (#3087)
golangisfun123 Sep 2, 2024
db72b4b
update bl
aureliusbtc Sep 3, 2024
48d8082
chore(synapse-interface): tailwind intellisense setting (#3085)
bigboydiamonds Sep 3, 2024
784fb3e
Publish
abtestingalpha Sep 3, 2024
9ceacfe
fix(rfq-relayer): e2e test flakes (#3075)
dwasse Sep 3, 2024
2a74772
recovery id validate & normalize
parodime Sep 4, 2024
07c16b0
Reduces FastBridge deadline to two hours (#3090)
abtestingalpha Sep 4, 2024
62ca720
Publish
abtestingalpha Sep 4, 2024
a364bbd
update first time ontributor docs
trajan0x Sep 4, 2024
dfb97a8
refactor(rfq-relayer): rebalancing with multiple tokens (#3003)
dwasse Sep 4, 2024
3216321
+TestEIP191_SuccessfulSignature_vCodeNormalize
parodime Sep 4, 2024
29d75bb
Fixes logo (#3100)
abtestingalpha Sep 4, 2024
17e7eba
Publish
abtestingalpha Sep 4, 2024
131fe33
tweak comments, logging
parodime Sep 4, 2024
06c7ba1
Merge pull request #3098 from synapsecns/feat/eip191recovId
parodime Sep 4, 2024
ae734cc
add squash and merge guide
trajan0x Sep 5, 2024
715269a
ignore roookout on go 1.23 (#3093)
trajan0x Sep 5, 2024
ebc1577
Update rebalancing docs (#3103)
dwasse Sep 5, 2024
69ec859
Publish
dwasse Sep 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions packages/synapse-interface/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [0.34.5](https://github.com/synapsecns/sanguine/compare/@synapsecns/[email protected]...@synapsecns/[email protected]) (2024-08-15)

**Note:** Version bump only for package @synapsecns/synapse-interface





## [0.34.4](https://github.com/synapsecns/sanguine/compare/@synapsecns/[email protected]...@synapsecns/[email protected]) (2024-08-14)


Expand Down
2 changes: 1 addition & 1 deletion packages/synapse-interface/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@synapsecns/synapse-interface",
"version": "0.34.4",
"version": "0.34.5",
"private": true,
"engines": {
"node": ">=18.18.0"
Expand Down
30 changes: 18 additions & 12 deletions services/rfq/api/rest/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,22 +274,28 @@ func (r *QuoterAPIServer) checkRole(c *gin.Context, destChainID uint32) (address
return addressRecovered, err
}

hasRole := r.roleCache[destChainID].Get(addressRecovered.Hex())
// Check and update cache
cachedRoleItem := r.roleCache[destChainID].Get(addressRecovered.Hex())
var hasRole bool

if hasRole == nil || hasRole.IsExpired() {
has, roleErr := bridge.HasRole(ops, relayerRole, addressRecovered)
if roleErr == nil {
r.roleCache[destChainID].Set(addressRecovered.Hex(), has, cacheInterval)
if cachedRoleItem == nil || cachedRoleItem.IsExpired() {
// Cache miss or expired, check on-chain
hasRole, err = bridge.HasRole(ops, relayerRole, addressRecovered)
if err != nil {
return addressRecovered, fmt.Errorf("unable to check relayer role on-chain: %w", err)
}
// Update cache
r.roleCache[destChainID].Set(addressRecovered.Hex(), hasRole, cacheInterval)
} else {
Comment on lines +277 to +289
Copy link
Contributor

Choose a reason for hiding this comment

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

Ensure proper handling of cache expiration.

The method checks if the cachedRoleItem is expired but does not handle the case where the cache interval is not set. Ensure proper handling of cache expiration to avoid potential issues.

Apply this diff to handle cache expiration:

  if cachedRoleItem == nil || cachedRoleItem.IsExpired() {
    // Cache miss or expired, check on-chain
    hasRole, err = bridge.HasRole(ops, relayerRole, addressRecovered)
    if err != nil {
      return addressRecovered, fmt.Errorf("unable to check relayer role on-chain: %w", err)
    }
    // Update cache
-    r.roleCache[destChainID].Set(addressRecovered.Hex(), hasRole, cacheInterval)
+    r.roleCache[destChainID].Set(addressRecovered.Hex(), hasRole, r.roleCache[destChainID].TTL())
  } else {
    // Use cached value
    hasRole = cachedRoleItem.Value()
  }
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// Check and update cache
cachedRoleItem := r.roleCache[destChainID].Get(addressRecovered.Hex())
var hasRole bool
if hasRole == nil || hasRole.IsExpired() {
has, roleErr := bridge.HasRole(ops, relayerRole, addressRecovered)
if roleErr == nil {
r.roleCache[destChainID].Set(addressRecovered.Hex(), has, cacheInterval)
if cachedRoleItem == nil || cachedRoleItem.IsExpired() {
// Cache miss or expired, check on-chain
hasRole, err = bridge.HasRole(ops, relayerRole, addressRecovered)
if err != nil {
return addressRecovered, fmt.Errorf("unable to check relayer role on-chain: %w", err)
}
// Update cache
r.roleCache[destChainID].Set(addressRecovered.Hex(), hasRole, cacheInterval)
} else {
// Check and update cache
cachedRoleItem := r.roleCache[destChainID].Get(addressRecovered.Hex())
var hasRole bool
if cachedRoleItem == nil || cachedRoleItem.IsExpired() {
// Cache miss or expired, check on-chain
hasRole, err = bridge.HasRole(ops, relayerRole, addressRecovered)
if err != nil {
return addressRecovered, fmt.Errorf("unable to check relayer role on-chain: %w", err)
}
// Update cache
r.roleCache[destChainID].Set(addressRecovered.Hex(), hasRole, r.roleCache[destChainID].TTL())
} else {

// Use cached value
hasRole = cachedRoleItem.Value()
}

if roleErr != nil {
err = fmt.Errorf("unable to check relayer role on-chain")
return addressRecovered, err
} else if !has {
err = fmt.Errorf("q.Relayer not an on-chain relayer")
return addressRecovered, err
}
// Verify role
if !hasRole {
return addressRecovered, fmt.Errorf("relayer not an on-chain relayer")
}

return addressRecovered, nil
}

Expand Down
44 changes: 44 additions & 0 deletions services/rfq/api/rest/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,50 @@ func (c *ServerSuite) TestPutAndGetQuoteByRelayer() {
c.Assert().True(found, "Newly added quote not found")
}

func (c *ServerSuite) TestMultiplePutRequestsWithIncorrectAuth() {
// Start the API server in a separate goroutine and wait for it to initialize.
c.startQuoterAPIServer()

// Create a random wallet for incorrect authorization
randomWallet, err := wallet.FromRandom()
c.Require().NoError(err)

// Prepare the authorization header with a signed timestamp using the incorrect wallet
header, err := c.prepareAuthHeader(randomWallet)
c.Require().NoError(err)

// Perform multiple PUT requests to the API server with the incorrect authorization header
for i := 0; i < 3; i++ {
resp, err := c.sendPutQuoteRequest(header)
c.Require().NoError(err)
defer func() {
err = resp.Body.Close()
c.Require().NoError(err)
}()

// Read the response body
body, err := io.ReadAll(resp.Body)
c.Require().NoError(err)

// Log the response body for debugging
fmt.Printf("Request %d response: Status: %d, Body: %s\n", i+1, resp.StatusCode, string(body))

switch resp.StatusCode {
case http.StatusBadRequest, http.StatusUnauthorized, http.StatusForbidden:
// These are acceptable error status codes for failed authentication
c.Assert().True(true, "Request %d correctly failed with status %d", i+1, resp.StatusCode)
case http.StatusOK:
// The ModifyQuote method returns 200 OK with an empty body on success
c.Assert().Empty(string(body), "Request %d should return an empty body on success", i+1)

// Since this shouldn't happen with incorrect auth, fail the test
c.Fail("Request %d unexpectedly succeeded, while submitting incorrect authentication", i+1)
default:
c.Fail("Unexpected status code %d for request %d", resp.StatusCode, i+1)
}
}
}
Comment on lines +242 to +284
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider moving the defer statement outside the loop.

The use of defer inside the loop may cause issues with closing the response body. Consider moving the defer statement outside the loop to ensure proper resource management.

Apply this diff to move the defer statement outside the loop:

 for i := 0; i < 3; i++ {
   resp, err := c.sendPutQuoteRequest(header)
   c.Require().NoError(err)
-  defer func() {
-    err = resp.Body.Close()
-    c.Require().NoError(err)
-  }()
+  body, err := io.ReadAll(resp.Body)
+  c.Require().NoError(err)
+  fmt.Printf("Request %d response: Status: %d, Body: %s\n", i+1, resp.StatusCode, string(body))
+  err = resp.Body.Close()
+  c.Require().NoError(err)

   switch resp.StatusCode {
   case http.StatusBadRequest, http.StatusUnauthorized, http.StatusForbidden:
     c.Assert().True(true, "Request %d correctly failed with status %d", i+1, resp.StatusCode)
   case http.StatusOK:
     c.Assert().Empty(string(body), "Request %d should return an empty body on success", i+1)
     c.Fail("Request %d unexpectedly succeeded, while submitting incorrect authentication", i+1)
   default:
     c.Fail("Unexpected status code %d for request %d", resp.StatusCode, i+1)
   }
 }
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
func (c *ServerSuite) TestMultiplePutRequestsWithIncorrectAuth() {
// Start the API server in a separate goroutine and wait for it to initialize.
c.startQuoterAPIServer()
// Create a random wallet for incorrect authorization
randomWallet, err := wallet.FromRandom()
c.Require().NoError(err)
// Prepare the authorization header with a signed timestamp using the incorrect wallet
header, err := c.prepareAuthHeader(randomWallet)
c.Require().NoError(err)
// Perform multiple PUT requests to the API server with the incorrect authorization header
for i := 0; i < 3; i++ {
resp, err := c.sendPutQuoteRequest(header)
c.Require().NoError(err)
defer func() {
err = resp.Body.Close()
c.Require().NoError(err)
}()
// Read the response body
body, err := io.ReadAll(resp.Body)
c.Require().NoError(err)
// Log the response body for debugging
fmt.Printf("Request %d response: Status: %d, Body: %s\n", i+1, resp.StatusCode, string(body))
switch resp.StatusCode {
case http.StatusBadRequest, http.StatusUnauthorized, http.StatusForbidden:
// These are acceptable error status codes for failed authentication
c.Assert().True(true, "Request %d correctly failed with status %d", i+1, resp.StatusCode)
case http.StatusOK:
// The ModifyQuote method returns 200 OK with an empty body on success
c.Assert().Empty(string(body), "Request %d should return an empty body on success", i+1)
// Since this shouldn't happen with incorrect auth, fail the test
c.Fail("Request %d unexpectedly succeeded, while submitting incorrect authentication", i+1)
default:
c.Fail("Unexpected status code %d for request %d", resp.StatusCode, i+1)
}
}
}
for i := 0; i < 3; i++ {
resp, err := c.sendPutQuoteRequest(header)
c.Require().NoError(err)
body, err := io.ReadAll(resp.Body)
c.Require().NoError(err)
fmt.Printf("Request %d response: Status: %d, Body: %s\n", i+1, resp.StatusCode, string(body))
err = resp.Body.Close()
c.Require().NoError(err)
switch resp.StatusCode {
case http.StatusBadRequest, http.StatusUnauthorized, http.StatusForbidden:
c.Assert().True(true, "Request %d correctly failed with status %d", i+1, resp.StatusCode)
case http.StatusOK:
c.Assert().Empty(string(body), "Request %d should return an empty body on success", i+1)
c.Fail("Request %d unexpectedly succeeded, while submitting incorrect authentication", i+1)
default:
c.Fail("Unexpected status code %d for request %d", resp.StatusCode, i+1)
}
}


func (c *ServerSuite) TestFilterQuoteAge() {
now := time.Now()

Expand Down
Loading