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-07-17] #2881

Merged
merged 6 commits into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
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/explorer-ui/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.1.48](https://github.com/synapsecns/sanguine/compare/@synapsecns/[email protected]...@synapsecns/[email protected]) (2024-07-17)

**Note:** Version bump only for package @synapsecns/explorer-ui





## [0.1.47](https://github.com/synapsecns/sanguine/compare/@synapsecns/[email protected]...@synapsecns/[email protected]) (2024-07-03)

**Note:** Version bump only for package @synapsecns/explorer-ui
Expand Down
4 changes: 2 additions & 2 deletions packages/explorer-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@synapsecns/explorer-ui",
"version": "0.1.47",
"version": "0.1.48",
"private": true,
"engines": {
"node": ">=18.17.0"
Expand Down Expand Up @@ -38,7 +38,7 @@
"recharts": "^2.3.2",
"sharp": "^0.31.3",
"swr": "^1.3.0",
"synapse-constants": "^1.3.19",
"synapse-constants": "^1.3.20",
"tailwind-merge": "^1.3.0",
"tiny-warning": "^1.0.3",
"web-vitals": "^2.1.4"
Expand Down
8 changes: 8 additions & 0 deletions packages/synapse-constants/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.

## [1.3.20](https://github.com/synapsecns/sanguine/compare/[email protected]@1.3.20) (2024-07-17)

**Note:** Version bump only for package synapse-constants





## [1.3.19](https://github.com/synapsecns/sanguine/compare/[email protected]@1.3.19) (2024-07-03)

**Note:** Version bump only for package synapse-constants
Expand Down
2 changes: 1 addition & 1 deletion packages/synapse-constants/constants/chains/master.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export const ETH: Chain = {
primary: 'https://rpc.ankr.com/eth',
fallback: 'https://1rpc.io/eth',
},
explorerUrl: 'https://etherscan.com',
explorerUrl: 'https://etherscan.io',
explorerName: 'Etherscan',
explorerImg: ethExplorerImg,
blockTime: 12000,
Expand Down
2 changes: 1 addition & 1 deletion packages/synapse-constants/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "synapse-constants",
"version": "1.3.19",
"version": "1.3.20",
"description": "This is an npm package that maintains all synapse constants",
"main": "dist/index.js",
"module": "dist/index.js",
Expand Down
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.28.3](https://github.com/synapsecns/sanguine/compare/@synapsecns/[email protected]...@synapsecns/[email protected]) (2024-07-16)

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





## [0.28.2](https://github.com/synapsecns/sanguine/compare/@synapsecns/[email protected]...@synapsecns/[email protected]) (2024-07-16)

**Note:** Version bump only for package @synapsecns/synapse-interface
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.28.2",
"version": "0.28.3",
"private": true,
"engines": {
"node": ">=18.18.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ const StateManagedBridge = () => {
destinationToken: toToken?.routeSymbol,
exchangeRate: BigInt(bridgeQuote.exchangeRate.toString()),
routerAddress: bridgeQuote.routerAddress,
bridgeQuote,
},
true
)
Expand Down Expand Up @@ -464,6 +465,7 @@ const StateManagedBridge = () => {
destinationToken: toToken?.routeSymbol,
exchangeRate: BigInt(bridgeQuote.exchangeRate.toString()),
routerAddress: bridgeQuote.routerAddress,
bridgeQuote,
})
dispatch(
updatePendingBridgeTransaction({
Expand Down
1 change: 1 addition & 0 deletions packages/synapse-interface/store/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ store.subscribe(() => {
outputAmountString,
routerAddress,
exchangeRate: BigInt(exchangeRate.toString()),
bridgeQuote: currentState.bridge.bridgeQuote,
}
segmentAnalyticsEvent(eventTitle, eventData)
}
Expand Down
2 changes: 1 addition & 1 deletion services/rfq/guard/service/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func (g *Guard) handleProveCalled(parentCtx context.Context, proven *guarddb.Pen
// first, get the corresponding bridge request
bridgeRequest, err := g.db.GetBridgeRequestByID(ctx, proven.TransactionID)
if err != nil {
return fmt.Errorf("could not get bridge request: %w", err)
return fmt.Errorf("could not get bridge request for txid %s: %w", hexutil.Encode(proven.TransactionID[:]), err)
}

valid, err := g.isProveValid(ctx, proven, bridgeRequest)
Expand Down
4 changes: 4 additions & 0 deletions services/rfq/relayer/service/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,10 @@ func (q *QuoteRequestHandler) handleRelayCompleted(ctx context.Context, _ trace.
//
// This is the seventh step in the bridge process. Here we process the event that the proof was posted on chain.
func (r *Relayer) handleProofProvided(ctx context.Context, req *fastbridge.FastBridgeBridgeProofProvided) (err error) {
if req.Relayer != r.signer.Address() {
return nil
}

Comment on lines +376 to +379
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 authorization and state transition.

The addition of a conditional check to ensure the req.Relayer matches r.signer.Address() is crucial for security, ensuring that only the intended relayer can make the status update. This is a good practice to prevent unauthorized state changes.

However, the function should also verify that the previous status is ProvePosting before updating it to ProvePosted to ensure correct state transitions.

+  # Verify previous status before updating
+  current_status = r.db.GetQuoteRequestStatus(ctx, req.TransactionId)
+  if current_status != reldb.ProvePosting:
+      return fmt.Errorf("invalid state transition: current status is not ProvePosting")
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
if req.Relayer != r.signer.Address() {
return nil
}
if req.Relayer != r.signer.Address() {
return nil
}
# Verify previous status before updating
current_status = r.db.GetQuoteRequestStatus(ctx, req.TransactionId)
if current_status != reldb.ProvePosting:
return fmt.Errorf("invalid state transition: current status is not ProvePosting")

// TODO: this can still get re-orged
// ALso: we should make sure the previous status is ProvePosting
err = r.db.UpdateQuoteRequestStatus(ctx, req.TransactionId, reldb.ProvePosted, nil)
Expand Down
Loading