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

2024-09-26 FE Release #3155

Merged
merged 74 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from 70 commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
89907ce
update bl
aureliusbtc Sep 18, 2024
b07d94e
remove global solidity extension settings
ChiTimesChi Sep 18, 2024
6e41b29
use monorepo support in global workspace only
ChiTimesChi Sep 18, 2024
9049299
- use Solidity extension for formatting *.sol files
ChiTimesChi Sep 18, 2024
7a118c9
REST API Improvements [SLT-179] (#3133)
Defi-Moses Sep 18, 2024
0b64779
Publish
Defi-Moses Sep 18, 2024
d4d1c5a
fix harmony proxy (#3149)
trajan0x Sep 19, 2024
bf22448
merging rfq indexer into monorepo [SLT-164] [SLT-176] (#3136)
Defi-Moses Sep 19, 2024
5052439
Publish
Defi-Moses Sep 19, 2024
a03677e
Adds /destinationTokens route [SLT-204] (#3151)
abtestingalpha Sep 19, 2024
4ed82b0
Publish
abtestingalpha Sep 19, 2024
1b821a0
boba pause (#3150)
Defi-Moses Sep 19, 2024
965736b
Publish
Defi-Moses Sep 19, 2024
fd1540d
fix(synapse-interface): Reorders validation to check existence first …
abtestingalpha Sep 19, 2024
8e12c27
Publish
abtestingalpha Sep 19, 2024
4f4c201
Fix boba pause (#3158)
abtestingalpha Sep 19, 2024
b1eca8a
Publish
abtestingalpha Sep 19, 2024
86415c0
update bl
trajan0x Sep 20, 2024
49cf94d
Merge branch 'master' of https://github.com/synapsecns/sanguine
trajan0x Sep 20, 2024
01ec2d4
feat(rest-api): Adds Swagger for api docs [SLT-205] (#3159)
abtestingalpha Sep 20, 2024
8127a4c
Publish
abtestingalpha Sep 20, 2024
d7599c3
Pulls version from package json (#3160)
abtestingalpha Sep 20, 2024
c262b01
Publish
abtestingalpha Sep 20, 2024
c32b70b
Require vs import due to file location (#3161)
abtestingalpha Sep 20, 2024
ce1defe
Publish
abtestingalpha Sep 20, 2024
304ecda
Prevent caching of api docs (#3162)
abtestingalpha Sep 20, 2024
fd0aecb
Publish
abtestingalpha Sep 20, 2024
23f6c4c
feat(contracts-rfq): relay/prove/claim with different address [SLT-13…
parodime Sep 20, 2024
dd67210
Publish
parodime Sep 20, 2024
4a0f2e7
fix(promexporter): make spans better (#3164)
golangisfun123 Sep 21, 2024
1eb52a0
changing native token address standard [SLT-210] (#3157)
Defi-Moses Sep 21, 2024
3b507bd
Publish
Defi-Moses Sep 21, 2024
f4101f2
Refactoring rfq-indexer API and adding swagger docs [SLT-228] (#3167)
Defi-Moses Sep 22, 2024
4cb5d73
Publish
Defi-Moses Sep 22, 2024
1891fed
fix read mes (#3168)
Defi-Moses Sep 22, 2024
4680ddc
Merge pull request #3145 from synapsecns/chore/solidity-vscode-settings
ChiTimesChi Sep 23, 2024
faf9387
Publish
ChiTimesChi Sep 23, 2024
8c702c7
fix(opbot): use submitter get tx status [SLT-158] (#3134)
golangisfun123 Sep 23, 2024
9418b40
fix(synapse-interface): Additional checks on screen [SLT-166] (#3152)
abtestingalpha Sep 23, 2024
1eb6fa0
Publish
abtestingalpha Sep 23, 2024
6f21b1a
feat(synapse-interface): confirm new price [SLT-150] (#3084)
bigboydiamonds Sep 23, 2024
1de17e0
Publish
bigboydiamonds Sep 23, 2024
b6651b1
fix: formatted bridge fee amount (#3165)
bigboydiamonds Sep 23, 2024
0daec70
Publish
bigboydiamonds Sep 23, 2024
74b620e
fix(contracts-rfq): CI workflows [SLT-245] (#3178)
ChiTimesChi Sep 24, 2024
038605d
Publish
ChiTimesChi Sep 24, 2024
98362bb
feat(api): bridge limits [SLT-165] (#3179)
bigboydiamonds Sep 24, 2024
67a04cd
Publish
bigboydiamonds Sep 24, 2024
c15ec86
fix(contracts-rfq): limit the amount of solhint warnings [SLT-245] (#…
ChiTimesChi Sep 25, 2024
11ac650
Publish
ChiTimesChi Sep 25, 2024
8113d0b
ci: Solidity gas diff [SLT-259] (#3181)
ChiTimesChi Sep 25, 2024
e89b363
Publish
ChiTimesChi Sep 25, 2024
7594100
fix(contracts-core): set very high gas limit for intensive tests [SLT…
ChiTimesChi Sep 25, 2024
6ec996d
Publish
ChiTimesChi Sep 25, 2024
ceff8bc
feat(rest-api): Adds validateRouteExists validation [SLT-260] (#3180)
abtestingalpha Sep 25, 2024
3af3438
Publish
abtestingalpha Sep 25, 2024
3e75b0d
add duplicate command warning (#3174)
trajan0x Sep 26, 2024
2e808e6
reduce solhint warnings on FbV2 (#3189)
parodime Sep 26, 2024
1bdfee6
Publish
parodime Sep 26, 2024
2709e85
ci: solidity gas diff options [SLT-267] (#3193)
ChiTimesChi Sep 26, 2024
9742f8f
prove w/ tx id [SLT-181] (#3169)
parodime Sep 26, 2024
abeea4d
Publish
parodime Sep 26, 2024
fc6ddae
fix(sdk-router): disable ARB airdrop tests (#3195)
ChiTimesChi Sep 26, 2024
90ac800
Publish
ChiTimesChi Sep 26, 2024
fe71628
Fixing issue for wallet integration [SLT-270] (#3194)
Defi-Moses Sep 26, 2024
5c8a069
Publish
Defi-Moses Sep 26, 2024
65ee496
store relayer on relay [SLT-182] (#3170)
parodime Sep 26, 2024
1c5e21d
Publish
parodime Sep 26, 2024
4a45bcf
Adjust text to trigger build (#3199)
abtestingalpha Sep 26, 2024
d8338fe
Publish
abtestingalpha Sep 26, 2024
f0b13bc
feat(synapse-interface): refund RFQ transaction [SLT-272] (#3197)
bigboydiamonds Sep 26, 2024
96bf50f
Publish
abtestingalpha Sep 26, 2024
e897b18
no empty sender recip [SLT-184] (#3171)
parodime Sep 26, 2024
ebf102c
Publish
parodime Sep 26, 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
76 changes: 49 additions & 27 deletions .github/workflows/solidity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ jobs:
env:
VERCEL_PROJECT_ID: ${{ steps.project_id.outputs.VERCEL_PROJECT_ID}}


cancel-outdated:
name: Cancel Outdated Jobs
runs-on: ubuntu-latest
Expand All @@ -130,6 +129,9 @@ jobs:
fail-fast: false
matrix:
package: ${{ fromJson(needs.changes.outputs.packages) }}
# Slither is irrelevant for solidity-devops, as it only contains devops scripts rather than deployed contracts
exclude:
- package: solidity-devops
permissions:
# always required
security-events: write
Expand All @@ -138,40 +140,34 @@ jobs:
contents: read
steps:
- name: Checkout repository
if: ${{ matrix.package != 'solidity-devops' }}
uses: actions/checkout@v4
with:
fetch-depth: 2
submodules: 'recursive'

- name: Setup NodeJS
if: ${{ matrix.package != 'solidity-devops' }}
uses: ./.github/actions/setup-nodejs

- name: Install Foundry
if: ${{ matrix.package != 'solidity-devops' }}
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

# TODO: find a flag for this
- name: Delete Untested Files
if: ${{ matrix.package != 'solidity-devops' }}
working-directory: './packages/${{matrix.package}}'
run: |
rm -rf test/ || true
rm -rf script/ || true
- name: Build Contracts
if: ${{ matrix.package != 'solidity-devops' }}
# TODO: unforunately, as of now concurrency needs to be 1 since if multiple instances of forge try to install the same version
# of solc at the same time, we get "text file busy" errors. See https://github.com/synapsecns/sanguine/actions/runs/8457116792/job/23168392860?pr=2234
# for an example.
run: |
npx lerna exec npm run build:slither --concurrency=1
- name: Run Slither
if: ${{ matrix.package != 'solidity-devops' }}
uses: crytic/slither-action@v0.3.0
continue-on-error: true
id: slither
Expand All @@ -183,7 +179,7 @@ jobs:
solc-version: 0.8.17

- name: Upload SARIF file
if: ${{!github.event.repository.private && matrix.package != 'solidity-devops'}}
if: ${{!github.event.repository.private}}
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: ./results.sarif
Expand All @@ -199,28 +195,32 @@ jobs:
package: ${{ fromJson(needs.changes.outputs.packages) }}
steps:
- uses: actions/checkout@v4
if: ${{ matrix.package != 'solidity-devops' }}
with:
submodules: recursive

- name: Setup Node JS
if: ${{ matrix.package != 'solidity-devops' }}
uses: ./.github/actions/setup-nodejs

- name: Installing dependencies
if: ${{ matrix.package != 'solidity-devops' }}
run: yarn install --immutable

- name: Install Foundry
if: ${{ matrix.package != 'solidity-devops' }}
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Run Foundry Tests
working-directory: './packages/${{matrix.package}}'
run: forge test -vvv

# We skip only the coverage steps for solidity-devops before we establish a good coverage there
- name: Run Foundry Coverage
if: ${{ matrix.package != 'solidity-devops' }}
working-directory: './packages/${{matrix.package}}'
run: forge coverage -vvv --report lcov --report summary >> $GITHUB_STEP_SUMMARY
run: forge coverage --report lcov --report summary >> $GITHUB_STEP_SUMMARY
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix potential shell scripting issue

There's a potential issue with the shell command on this line. Unquoted variables can lead to unexpected behavior if they contain spaces or special characters.

To address this, please modify the line as follows:

- run: forge coverage --report lcov --report summary >> $GITHUB_STEP_SUMMARY
+ run: forge coverage --report lcov --report summary >> "$GITHUB_STEP_SUMMARY"

This change ensures that the $GITHUB_STEP_SUMMARY variable is properly quoted, preventing potential issues with globbing and word splitting.

📝 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
run: forge coverage --report lcov --report summary >> $GITHUB_STEP_SUMMARY
run: forge coverage --report lcov --report summary >> "$GITHUB_STEP_SUMMARY"
🧰 Tools
actionlint

220-220: shellcheck reported issue in this script: SC2086:info:1:50: Double quote to prevent globbing and word splitting

(shellcheck)

# Limit the number of fuzz runs to speed up the coverage
env:
FOUNDRY_FUZZ_RUNS: 10
Comment on lines +216 to +223
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

LGTM: Improved coverage configuration and output

The changes to the "Run Foundry Coverage" step are well-thought-out:

  1. Skipping coverage for 'solidity-devops' is consistent with its exclusion from other Solidity-specific tasks.
  2. Appending the coverage summary to the GitHub step summary improves result visibility.
  3. Limiting fuzz runs will speed up the coverage job significantly.

There's a minor shell scripting issue in the run command. To prevent potential issues with globbing and word splitting, please modify the line as follows:

- run: forge coverage --report lcov --report summary >> $GITHUB_STEP_SUMMARY
+ run: forge coverage --report lcov --report summary >> "$GITHUB_STEP_SUMMARY"

This change ensures that the $GITHUB_STEP_SUMMARY variable is properly quoted.

📝 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
# We skip only the coverage steps for solidity-devops before we establish a good coverage there
- name: Run Foundry Coverage
if: ${{ matrix.package != 'solidity-devops' }}
working-directory: './packages/${{matrix.package}}'
run: forge coverage -vvv --report lcov --report summary >> $GITHUB_STEP_SUMMARY
run: forge coverage --report lcov --report summary >> $GITHUB_STEP_SUMMARY
# Limit the number of fuzz runs to speed up the coverage
env:
FOUNDRY_FUZZ_RUNS: 10
# We skip only the coverage steps for solidity-devops before we establish a good coverage there
- name: Run Foundry Coverage
if: ${{ matrix.package != 'solidity-devops' }}
working-directory: './packages/${{matrix.package}}'
run: forge coverage --report lcov --report summary >> "$GITHUB_STEP_SUMMARY"
# Limit the number of fuzz runs to speed up the coverage
env:
FOUNDRY_FUZZ_RUNS: 10
🧰 Tools
🪛 actionlint

220-220: shellcheck reported issue in this script: SC2086:info:1:50: Double quote to prevent globbing and word splitting

(shellcheck)


- name: Send Coverage (Codecov)
if: ${{ matrix.package != 'solidity-devops' }}
Expand All @@ -236,39 +236,62 @@ jobs:
attempt_limit: 5
attempt_delay: 30000


snapshot:
gas-diff:
runs-on: ubuntu-latest
name: Foundry Gas Snapshot
name: Foundry Gas Diff
if: ${{ needs.changes.outputs.package_count > 0 }}
needs: changes
strategy:
fail-fast: false
matrix:
package: ${{ fromJson(needs.changes.outputs.packages) }}
# Gas diff is irrelevant for solidity-devops, as it only contains devops scripts rather than deployed contracts
exclude:
- package: solidity-devops
steps:
- uses: actions/checkout@v4
if: ${{ matrix.package != 'solidity-devops' }}
with:
submodules: recursive

- name: Setup Node JS
if: ${{ matrix.package != 'solidity-devops' }}
uses: ./.github/actions/setup-nodejs

- name: Installing dependencies
if: ${{ matrix.package != 'solidity-devops' }}
run: yarn install --immutable

- name: Install Foundry
if: ${{ matrix.package != 'solidity-devops' }}
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- name: Run snapshot
if: ${{ matrix.package != 'solidity-devops' }}

# TODO: consider defining a package-specific script for this
- name: Run tests and generate gas report
working-directory: './packages/${{matrix.package}}'
run: forge snapshot >> $GITHUB_STEP_SUMMARY
# Excluding tests with reverts to get accurate average gas cost estimates
run: forge test --nmt "(fail|revert)" --gas-report > "../../gas-report-${{ matrix.package }}.ansi"
env:
# make fuzzing semi-deterministic to avoid noisy gas cost estimation
# due to non-deterministic fuzzing (but still use pseudo-random fuzzing seeds)
FOUNDRY_FUZZ_SEED: 0x${{ github.event.pull_request.base.sha || github.sha }}

- name: Compare gas reports
uses: Rubilmax/foundry-gas-diff@v3.18
with:
ignore: 'test/**/*'
report: 'gas-report-${{ matrix.package }}.ansi'
sortCriteria: avg
sortOrders: desc
summaryQuantile: 0.5
id: gas_diff

- name: Add gas diff to sticky comment
if: ${{ github.event_name == 'pull_request' || github.event_name == 'pull_request_target' }}
uses: marocchino/sticky-pull-request-comment@v2
with:
# delete the comment in case changes no longer impact gas costs
delete: ${{ !steps.gas_diff.outputs.markdown }}
message: ${{ steps.gas_diff.outputs.markdown }}

size-check:
name: Foundry Size Check
runs-on: ubuntu-latest
Expand All @@ -278,25 +301,24 @@ jobs:
fail-fast: false
matrix:
package: ${{ fromJson(needs.changes.outputs.packages) }}
# Size check is irrelevant for solidity-devops, as it only contains devops scripts rather than deployed contracts
exclude:
- package: solidity-devops
steps:
- uses: actions/checkout@v4
if: ${{ matrix.package != 'solidity-devops' }}
with:
submodules: recursive

- name: Setup Node JS
if: ${{ matrix.package != 'solidity-devops' }}
uses: ./.github/actions/setup-nodejs

- name: Install Foundry
if: ${{ matrix.package != 'solidity-devops' }}
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

# This will run https://book.getfoundry.sh/reference/forge/forge-build#build-options
- name: Run forge build --sizes
if: ${{ matrix.package != 'solidity-devops' }}
run: |
forge build --sizes
working-directory: './packages/${{matrix.package}}'
10 changes: 5 additions & 5 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"editor.fontLigatures": "'calt', 'liga', 'ss01', 'ss02', 'ss03', 'ss04', 'ss05', 'ss06', 'ss07', 'ss08', 'ss09'",
"[solidity]": {
"editor.defaultFormatter": "JuanBlanco.solidity"
},
"[typescript]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
Expand All @@ -16,11 +19,8 @@
"eslint.format.enable": true,
"editorconfig.generateAuto": false,
"files.trimTrailingWhitespace": true,
"solidity.packageDefaultDependenciesContractsDirectory": "contracts",
"solidity.packageDefaultDependenciesDirectory": "lib",
"solidity.compileUsingRemoteVersion": "v0.8.17+commit.8df45f5f",
"solidity.formatter": "prettier",
"solidity.defaultCompiler": "remote",
"solidity.formatter": "forge",
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

Solidity formatter change to 'forge' may be ineffective due to missing 'forge' command.

The forge command was not found in the environment, which prevents the Solidity formatter from functioning correctly. Please ensure that forge is installed to apply the new formatter and maintain consistent code formatting.

Analysis chain

Verify the impact of changing Solidity formatter to forge.

Changing the Solidity formatter from "prettier" to "forge" is consistent with the new default formatter configuration. However, this change might affect the formatting style of existing Solidity files.

Please run the following script to check the impact on Solidity files:

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check the impact of changing Solidity formatter to forge

# Test: List all Solidity files that might be affected
echo "Solidity files that might be affected:"
fd -e sol

# Test: Show a diff of formatting changes (if forge is available)
if command -v forge &> /dev/null
then
    echo "Formatting diff (sample of up to 5 files):"
    fd -e sol | head -n 5 | xargs -I {} sh -c 'echo "File: {}"; forge fmt --check {}'
else
    echo "Note: 'forge' command not found. Unable to show formatting diff."
fi

Length of output: 14973

"solidity.monoRepoSupport": true,
"tailwindCSS.classAttributes": [
".*class.*",
".*Class.*",
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ root
│ ├── <a href="./packages/coverage-aggregator">coverage-aggregator</a>: Javascript coverage aggregator based on <a href="https://www.npmjs.com/package/nyc">nyc</a>
│ ├── <a href="./packages/docs">docs</a>: Docasaurus documentation. Note: this is not yet in use, and docs are still maintained on gitbook
│ ├── <a href="./packages/explorer-ui">explorer-ui</a>: Explorer UI
│ ├── <a href="./packages/rfq-indexer">rfq-indexer</a>: RFQ indexer
│ ├── <a href="./packages/rest-api">rest-api</a>: Rest API
│ ├── <a href="./packages/sdk-router">sdk-router</a>: SDK router
│ ├── <a href="./packages/solidity-devops">solidity-devops</a>: provides a set of tools and scripts to help with the development of Solidity smart contracts
Expand Down
14 changes: 5 additions & 9 deletions contrib/opbot/botmd/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"github.com/synapsecns/sanguine/core/retry"
"github.com/synapsecns/sanguine/ethergo/chaindata"
"github.com/synapsecns/sanguine/ethergo/client"
"github.com/synapsecns/sanguine/ethergo/submitter"
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"
Expand Down Expand Up @@ -347,17 +348,12 @@ func (b *Bot) rfqRefund() *slacker.CommandDefinition {
return
}

var txHash *relapi.TxHashByNonceResponse
var status submitter.SubmissionStatus
err = retry.WithBackoff(
ctx.Context(),
func(ctx context.Context) error {
txHash, err = relClient.GetTxHashByNonce(
ctx,
&relapi.GetTxByNonceRequest{
ChainID: rawRequest.OriginChainID,
Nonce: nonce,
})
if err != nil {
status, err = b.submitter.GetSubmissionStatus(ctx, big.NewInt(int64(rawRequest.OriginChainID)), nonce)
if err != nil || !status.HasTx() {
b.logger.Errorf(ctx, "error fetching quote request: %v", err)
return fmt.Errorf("error fetching quote request: %w", err)
Comment on lines +356 to 358
Copy link
Contributor

Choose a reason for hiding this comment

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

Correct the error messages to reflect the actual operation.

The error messages in the logging and returned error incorrectly state "error fetching quote request," but the code is fetching the submission status. To avoid confusion and improve clarity, please update the error messages to accurately describe the error.

Apply this diff to correct the error messages:

- b.logger.Errorf(ctx, "error fetching quote request: %v", err)
+ b.logger.Errorf(ctx, "error fetching submission status: %v", err)

- return fmt.Errorf("error fetching quote request: %w", err)
+ return fmt.Errorf("error fetching submission status: %w", err)
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 err != nil || !status.HasTx() {
b.logger.Errorf(ctx, "error fetching quote request: %v", err)
return fmt.Errorf("error fetching quote request: %w", err)
if err != nil || !status.HasTx() {
b.logger.Errorf(ctx, "error fetching submission status: %v", err)
return fmt.Errorf("error fetching submission status: %w", err)

}
Expand All @@ -373,7 +369,7 @@ func (b *Bot) rfqRefund() *slacker.CommandDefinition {
return
}

_, err = ctx.Response().Reply(fmt.Sprintf("refund submitted: %s", toExplorerSlackLink(txHash.Hash)))
_, err = ctx.Response().Reply(fmt.Sprintf("refund submitted: %s", toExplorerSlackLink(status.TxHash().String())))
if err != nil {
log.Println(err)
}
Expand Down
11 changes: 6 additions & 5 deletions contrib/promexporter/exporters/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,17 +142,17 @@ func (e *exporter) collectMetrics(parentCtx context.Context) (err error) {
for _, pending := range e.cfg.DFKPending {
if err := e.stuckHeroCountStats(ctx, common.HexToAddress(pending.Owner), pending.ChainName); err != nil {
errs = append(errs, fmt.Errorf("could not get stuck hero count: %w", err))
span.AddEvent("could not get stuck hero count")
}
span.AddEvent("could not get stuck hero count")
}

for _, gasCheck := range e.cfg.SubmitterChecks {
for _, chainID := range gasCheck.ChainIDs {
if err := e.submitterStats(common.HexToAddress(gasCheck.Address), chainID, gasCheck.Name); err != nil {
errs = append(errs, fmt.Errorf("could setup metric: %w", err))
errs = append(errs, fmt.Errorf("could not get submitter stats: %w", err))
span.AddEvent("could not get submitter stats")
}
}
span.AddEvent("could get submitter stats")
}

for chainID := range e.cfg.BridgeChecks {
Expand All @@ -161,7 +161,8 @@ func (e *exporter) collectMetrics(parentCtx context.Context) (err error) {
return retry.WithBackoff(ctx, func(ctx context.Context) error {
err := e.vpriceStats(ctx, chainID, token)
if err != nil && !errors.Is(err, errPoolNotExist) {
errs = append(errs, fmt.Errorf("stuck hero stats: %w", err))
errs = append(errs, fmt.Errorf("could not get vprice %w", err))
span.AddEvent("could not get vprice stats")
}

return nil
Expand All @@ -172,7 +173,7 @@ func (e *exporter) collectMetrics(parentCtx context.Context) (err error) {

if len(errs) > 0 {
span.AddEvent("could not collect metrics")
return fmt.Errorf("could not collect metrics: %v", errs)
return fmt.Errorf("could not collect metrics: %w", combineErrors(errs))
}

return nil
Expand Down
8 changes: 8 additions & 0 deletions core/commandline/shell.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package commandline
import (
"context"
"fmt"
"k8s.io/apimachinery/pkg/util/sets"
"os"
"os/signal"
"os/user"
Expand Down Expand Up @@ -90,11 +91,18 @@ func GenerateShellCommand(shellCommands []*cli.Command) *cli.Command {
// pruneShellCommands gets a list of commands including the shell command.
func pruneShellCommands(commands []*cli.Command) (prunedCommands []*cli.Command) {
// initialize shell commands
nameSet := sets.NewString()
for _, command := range commands {
if command.Name != shellCommandName {
prunedCommands = append(prunedCommands, command)
}
if !nameSet.Has(command.Name) {
fmt.Printf("Command %s already exists, skipping\n", command.Name)
}

nameSet.Insert(command.Name)
}

Comment on lines +94 to +105
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix logic for handling duplicate command names.

The current implementation has a few issues:

  1. The error message is printed when the command name is not in the set, which is the opposite of what we want.
  2. Duplicate commands are still being added to prunedCommands.

Please apply the following changes to fix these issues:

 func pruneShellCommands(commands []*cli.Command) (prunedCommands []*cli.Command) {
 	// initialize shell commands
 	nameSet := sets.NewString()
 	for _, command := range commands {
-		if command.Name != shellCommandName {
-			prunedCommands = append(prunedCommands, command)
-		}
-		if !nameSet.Has(command.Name) {
-			fmt.Printf("Command %s already exists, skipping\n", command.Name)
+		if command.Name == shellCommandName {
+			continue
 		}
-
-		nameSet.Insert(command.Name)
+		if nameSet.Has(command.Name) {
+			fmt.Printf("Command %s already exists, skipping\n", command.Name)
+			continue
+		}
+		nameSet.Insert(command.Name)
+		prunedCommands = append(prunedCommands, command)
 	}

 	return prunedCommands
 }

These changes will:

  1. Skip the shell command.
  2. Correctly detect and skip duplicate commands.
  3. Only add non-duplicate commands to prunedCommands.
  4. Print the correct message when a duplicate is found.
📝 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
nameSet := sets.NewString()
for _, command := range commands {
if command.Name != shellCommandName {
prunedCommands = append(prunedCommands, command)
}
if !nameSet.Has(command.Name) {
fmt.Printf("Command %s already exists, skipping\n", command.Name)
}
nameSet.Insert(command.Name)
}
nameSet := sets.NewString()
for _, command := range commands {
if command.Name == shellCommandName {
continue
}
if nameSet.Has(command.Name) {
fmt.Printf("Command %s already exists, skipping\n", command.Name)
continue
}
nameSet.Insert(command.Name)
prunedCommands = append(prunedCommands, command)
}

return prunedCommands
}

Expand Down
1 change: 1 addition & 0 deletions lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"useWorkspaces": true,
"packages": [
"packages/*",
"packages/rfq-indexer/*",
"docs/*"
],
"version": "independent"
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"workspaces": {
"packages": [
"packages/*",
"packages/rfq-indexer/*",
"docs/*"
],
"nohoist": [
Expand Down Expand Up @@ -73,7 +74,8 @@
"ts-mocha": "^10.0.0",
"typedoc": "^0.23.24",
"typedoc-plugin-markdown": "^3.14.0",
"typescript": "^5.0.4"
"typescript": "^5.0.4",
"wagmi": "^2.12.12"
},
"dependencies": {
"@changesets/cli": "2.22.0",
Expand Down
7 changes: 7 additions & 0 deletions packages/contracts-core/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"[solidity]": {
"editor.defaultFormatter": "JuanBlanco.solidity"
},
"solidity.formatter": "forge",
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

Issue: Forge is set as Solidity formatter but is not installed

Forge is specified as the Solidity formatter in the settings, but it is not installed in the development environment. Please install Forge to ensure the formatter works correctly.

  • File: packages/contracts-core/.vscode/settings.json
Analysis chain

LGTM: Forge set as Solidity formatter

Using Forge as the Solidity formatter is a good choice, aligning with modern development practices.

Ensure that Forge is installed and properly configured in the development environment. Run the following command to verify:

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if Forge is installed
if command -v forge &> /dev/null
then
    echo "Forge is installed. Version:"
    forge --version
else
    echo "Forge is not installed. Please install it to use the specified formatter."
fi

Length of output: 175

"solidity.monoRepoSupport": false
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

Mono-repo support setting may be misconfigured

The project structure indicates a monorepo setup with multiple packages and services. Consider setting "solidity.monoRepoSupport": true to ensure the Solidity extension correctly handles the repository's structure.

  • File: packages/contracts-core/.vscode/settings.json
  • Line: 6
Analysis chain

Verify project structure for mono-repo setting

The "solidity.monoRepoSupport": false setting is appropriate if this project is not part of a monorepo structure for Solidity contracts.

Please confirm that this setting aligns with the project's structure. You can verify this by checking the root directory structure:

If you see multiple packages or projects at the same level, you might need to reconsider this setting.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check the root directory structure
echo "Project root structure:"
ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//  /g' -e 's/^/    /' -e 's/-/|/'

Length of output: 17137

}
Loading