-
Notifications
You must be signed in to change notification settings - Fork 395
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
Reusable server module #1637
Reusable server module #1637
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple small things, otherwise lgtm! Thanks a lot.
Tbh I didn't know you could do app.get('var')
so this makes things a lot easier.
I made some changes directly myself mainly:
- getting rid of injecting
req.services
after learningapp.get('services')
- Renaming
repoPath
tosolcRepoPath
and also adding missingsolcJsonRepoPath
s
Added couple comments for your review. I still need to look at the tests if they'll work fine, let's see.
Tests are passing if you want to check the comments @RaoulSchaffranek I'll handle the conflicts and the rest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Thanks @RaoulSchaffranek for the big PR! I have only one doubt regarding the compiler.
Also, I moved process.env.LOGGING_TOKEN
and hideIpInLogs
into Server's options, see 339cc7e and 4d77f98
services/server/src/server/services/compiler/local/solidityCompiler.ts
Outdated
Show resolved
Hide resolved
@coderabbitai review |
WalkthroughThe changes involve significant refactoring and updates across multiple files in the codebase. Key modifications include the introduction of a new Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Server
participant ChainRepository
participant VerificationService
Client->>Server: Request verification
Server->>ChainRepository: Check supported chain ID
ChainRepository-->>Server: Return validation result
Server->>VerificationService: Verify contracts
VerificationService-->>Server: Return verification result
Server-->>Client: Respond with verification result
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 16
Outside diff range and nitpick comments (11)
services/server/src/server/services/compiler/lambda-with-fallback/SolcLambdaWithLocalFallback.ts (1)
14-29
: Constructor looks good. Minor suggestion.The new constructor enhances flexibility. Consider using object destructuring for cleaner parameter handling.
constructor( - awsRegion: string, - awsAccessKeyId: string, - awsSecretAccessKey: string, - lambdaCompilerFunctionName: string = "compile", - solcRepoPath: string, - solJsonRepoPath: string, + { + awsRegion, + awsAccessKeyId, + awsSecretAccessKey, + lambdaCompilerFunctionName = "compile", + solcRepoPath, + solJsonRepoPath, + }: { + awsRegion: string; + awsAccessKeyId: string; + awsSecretAccessKey: string; + lambdaCompilerFunctionName?: string; + solcRepoPath: string; + solJsonRepoPath: string; + } ) { // ... rest of the constructor }services/server/src/server/controllers/controllers.common.ts (1)
56-60
: Good refactor, but add a safety check.Centralizing service access is good. Add a null check for
services
to prevent potential runtime errors.Consider this change:
- const services = req.app.get("services") as Services; + const services = req.app.get("services") as Services; + if (!services) { + return next(new InternalServerError("Services not initialized")); + }services/server/src/server/routes.ts (1)
36-37
: LGTM: ChainRepository usage implemented correctly.Consider adding a type assertion for app.get("chainRepository") to ensure type safety.
- const chainRepository = _req.app.get("chainRepository") as ChainRepository; + const chainRepository = _req.app.get("chainRepository"); + if (!(chainRepository instanceof ChainRepository)) { + throw new Error("ChainRepository not found in app context"); + }services/server/src/server/controllers/verification/etherscan/etherscan.common.ts (1)
Line range hint
234-238
: Function signature update looks good.The new
solc
parameter improves flexibility. Consider adding a null check forsolc
to prevent runtime errors.services/server/src/server/services/StorageService.ts (1)
145-145
: LGTM. Consider extracting the URL.The addition of
repositoryServerUrl
is good. For clarity, consider extracting it to a variable before passing.+const { repositoryServerUrl } = options.repositoryV1ServiceOptions; const sourcifyDatabase = new SourcifyDatabaseService( this, options.sourcifyDatabaseServiceOptions, - options.repositoryV1ServiceOptions.repositoryServerUrl, + repositoryServerUrl, );services/server/src/server/controllers/verification/etherscan/session/etherscan.session.handlers.ts (1)
Line range hint
74-74
: Unreachable code after throw statementThe
return;
statement after thethrow
at line 74 is unreachable and can be safely removed.services/server/src/sourcify-chain-repository.ts (2)
29-29
: Typo in comment: 'netorks' should be 'networks'There's a small typo in the comment on line 29. Correcting it improves readability.
Apply this diff to fix the typo:
- // Use long form name for Ethereum netorks e.g. "Ethereum Testnet Goerli" instead of "Goerli" + // Use long form name for Ethereum networks e.g. "Ethereum Testnet Goerli" instead of "Goerli"
95-95
: Grammar correction in commentIn the comment on line 95, consider changing "different that" to "different from" for grammatical accuracy.
Apply this diff to correct the grammar:
- * This is different that checking for verification support i.e. supported: true or monitoring support i.e. monitored: true + * This is different from checking for verification support i.e. supported: true or monitoring support i.e. monitored: trueservices/server/src/server/cli.ts (1)
258-258
: Set 'saveUninitialized' to falseSetting
saveUninitialized
tofalse
prevents storing uninitialized sessions, enhancing security and compliance.services/server/src/server/server.ts (1)
Line range hint
224-257
: Handle undefinedrateLimit
properties to prevent runtime errorsThe
rateLimit
configuration propertieswindowMs
,max
, andwhitelist
are optional inServerOptions
, but they are accessed without checks. If any of these are undefined, it may cause unexpected behavior or runtime errors.Ensure default values are provided for these properties or validate them before use. For example:
const hideIpInLogs = options.rateLimit.hideIpInLogs; + const windowMs = options.rateLimit.windowMs || 15 * 60 * 1000; // default 15 minutes + const max = options.rateLimit.max || 100; // default 100 requests - windowMs: options.rateLimit.windowMs, - max: options.rateLimit.max, + windowMs: windowMs, + max: max, const whitelist = options.rateLimit.whitelist as string[]; + if (!whitelist) { + whitelist = []; + }services/server/src/server/controllers/verification/verification.common.ts (1)
Missing
solc
Parameter increateCheckedContract
CallsSeveral invocations of
createCheckedContract
are missing the requiredsolc
parameter, which could lead to runtime errors.Affected files:
services/server/src/server/controllers/verification/verification.common.ts
services/server/src/server/controllers/verification/etherscan/stateless/etherscan.stateless.handlers.ts
Analysis chain
Line range hint
27-33
: Ensure all calls to 'createCheckedContract' include the new 'solc' parameterThe function
createCheckedContract
now requiressolc
as a parameter. Please verify that all invocations of this function have been updated to pass thesolc
compiler instance to prevent runtime errors.Run the following script to locate calls to
createCheckedContract
that may need updating:Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Find all calls to 'createCheckedContract' in the codebase. rg --type ts $'createCheckedContract('Length of output: 143
Script:
#!/bin/bash # Description: Find all calls to 'createCheckedContract' in the codebase. rg -F --type ts 'createCheckedContract('Length of output: 610
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (1)
package-lock.json
is excluded by!**/package-lock.json
Files selected for processing (43)
- .vscode/launch.json (1 hunks)
- packages/lib-sourcify/test/compiler/solidityCompiler.ts (1 hunks)
- serverless/compiler-lambda/index.js (1 hunks)
- services/server/README.md (1 hunks)
- services/server/package.json (1 hunks)
- services/server/src/common/errors/GenericErrorHandler.ts (1 hunks)
- services/server/src/server/cli.ts (1 hunks)
- services/server/src/server/common.ts (0 hunks)
- services/server/src/server/controllers/controllers.common.ts (2 hunks)
- services/server/src/server/controllers/repository/repository.handlers.ts (6 hunks)
- services/server/src/server/controllers/verification/etherscan/etherscan.common.ts (2 hunks)
- services/server/src/server/controllers/verification/etherscan/session/etherscan.session.handlers.ts (3 hunks)
- services/server/src/server/controllers/verification/etherscan/stateless/etherscan.stateless.handlers.ts (1 hunks)
- services/server/src/server/controllers/verification/session-state/session-state.handlers.ts (4 hunks)
- services/server/src/server/controllers/verification/solc-json/session/solc-json.session.handlers.ts (3 hunks)
- services/server/src/server/controllers/verification/solc-json/stateless/solc-json.stateless.handlers.ts (5 hunks)
- services/server/src/server/controllers/verification/verification.common.ts (7 hunks)
- services/server/src/server/controllers/verification/verify/session/verify.session.handlers.ts (2 hunks)
- services/server/src/server/controllers/verification/verify/stateless/verify.stateless.handlers.ts (7 hunks)
- services/server/src/server/controllers/verification/verify/stateless/verify.stateless.routes.ts (1 hunks)
- services/server/src/server/routes.ts (2 hunks)
- services/server/src/server/server.ts (9 hunks)
- services/server/src/server/services/StorageService.ts (1 hunks)
- services/server/src/server/services/VerificationService.ts (4 hunks)
- services/server/src/server/services/compiler/lambda-with-fallback/SolcLambdaWithLocalFallback.ts (1 hunks)
- services/server/src/server/services/compiler/lambda/SolcLambda.ts (2 hunks)
- services/server/src/server/services/compiler/local/SolcLocal.ts (1 hunks)
- services/server/src/server/services/compiler/local/compilerWorker.ts (1 hunks)
- services/server/src/server/services/compiler/local/solidityCompiler.ts (8 hunks)
- services/server/src/server/services/storageServices/AbstractDatabaseService.ts (1 hunks)
- services/server/src/server/services/storageServices/RepositoryV1Service.ts (2 hunks)
- services/server/src/server/services/storageServices/RepositoryV2Service.ts (1 hunks)
- services/server/src/server/services/storageServices/SourcifyDatabaseService.ts (4 hunks)
- services/server/src/server/session.ts (1 hunks)
- services/server/src/sourcify-chain-repository.ts (1 hunks)
- services/server/src/sourcify-chains.ts (2 hunks)
- services/server/test/helpers/ServerFixture.ts (6 hunks)
- services/server/test/integration/etherscan.spec.ts (0 hunks)
- services/server/test/integration/path-sanitization.spec.ts (4 hunks)
- services/server/test/integration/verification-handlers/verify.session.spec.ts (4 hunks)
- services/server/test/integration/verification-handlers/verify.stateless.spec.ts (2 hunks)
- services/server/test/unit/VerificationService.spec.ts (1 hunks)
- services/server/test/unit/utils/contract-creation-util.spec.ts (7 hunks)
Files not reviewed due to no reviewable changes (2)
- services/server/src/server/common.ts
- services/server/test/integration/etherscan.spec.ts
Files skipped from review due to trivial changes (1)
- serverless/compiler-lambda/index.js
Additional context used
Biome
services/server/src/sourcify-chain-repository.ts
[error] 51-51: The assignment should not be in an expression.
The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.(lint/suspicious/noAssignInExpressions)
Additional comments not posted (72)
services/server/src/server/services/compiler/local/compilerWorker.ts (1)
4-21
: Changes look good. Watch for downstream effects.The new
solJsonRepoPath
parameter allows for more flexible compiler initialization. Ensure all call sites are updated.services/server/src/server/services/compiler/local/SolcLocal.ts (2)
9-12
: Constructor looks good.
19-25
: Compile method updated correctly.services/server/src/common/errors/GenericErrorHandler.ts (1)
9-10
: Good comment addition.Explains the
_next
parameter's purpose. Nice touch with the ESLint directive.services/server/src/server/controllers/verification/verify/stateless/verify.stateless.routes.ts (1)
14-26
: Middleware added forverifyDeprecated
check.New middleware checks app context for
verifyDeprecated
setting. Looks good, but ensureverifyDeprecated
is set correctly in the app context.Verification successful
verifyDeprecated
is correctly set and retrieved from app context. No issues found.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify `verifyDeprecated` setting in app context rg --type typescript 'app\.set\("verifyDeprecated"'Length of output: 88
Script:
#!/bin/bash # Verify `verifyDeprecated` setting in app context by searching .ts and .tsx files rg 'app\.set\("verifyDeprecated"' --glob '*.ts' --glob '*.tsx'Length of output: 165
services/server/src/server/controllers/verification/solc-json/session/solc-json.session.handlers.ts (3)
9-12
: New imports look good.
20-21
: Changes align with modularization goals.Also applies to: 35-37
50-50
: Consistent change in function call.services/server/src/server/controllers/verification/verify/session/verify.session.handlers.ts (4)
9-9
: New imports look good.Also applies to: 12-13
19-22
: Service retrieval from app context: Nice!
59-64
: Updated params forverifyContractsInSession
: Good to go!
Line range hint
1-68
: Overall changes look solid.The refactoring improves modularity without introducing bugs. Nice work!
services/server/src/server/controllers/controllers.common.ts (1)
7-7
: New import looks good.The
Services
type import enhances type safety.services/server/src/server/routes.ts (1)
9-9
: LGTM: Import added for ChainRepository.services/server/test/unit/VerificationService.spec.ts (1)
66-67
: New params for VerificationService. Check impact.The changes look good, aligning with the PR objectives. Ensure these new params are properly handled in the VerificationService implementation.
services/server/src/server/services/compiler/lambda/SolcLambda.ts (1)
50-50
: LGTM: Function name now configurable.Change aligns with new constructor, allowing dynamic function name setting.
services/server/package.json (4)
5-5
: Main entry point added. Good.
6-6
: TypeScript types added. Nice.
7-7
: Executable file specified. Looks good.
15-15
: Start script updated to use CLI. Consistent with other changes.Verification successful
Start script correctly updated to use CLI. Consistent with other changes.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify consistency of main, bin, and start script grep -E '"main"|"bin"|"start"' package.jsonLength of output: 45
Script:
#!/bin/bash # Verify the "start" script in services/server/package.json grep -E '"start"' services/server/package.jsonLength of output: 90
services/server/test/unit/utils/contract-creation-util.spec.ts (7)
3-4
: LGTM: Import changes look good.
8-9
: LGTM: ChainRepository initialization looks good.
47-48
: LGTM: Consistent ChainRepository initialization.
67-68
: LGTM: Consistent ChainRepository initialization.
87-88
: LGTM: Consistent ChainRepository initialization.
107-108
: LGTM: Consistent ChainRepository initialization.
132-133
: LGTM: Consistent ChainRepository initialization in remaining test cases.Also applies to: 152-153
.vscode/launch.json (1)
11-11
: LGTM. Aligns with modularization goal.Path update reflects server module split into declarative and CLI parts.
services/server/src/server/controllers/repository/repository.handlers.ts (6)
40-40
: LGTM. Service retrieval standardized.Also applies to: 44-44
64-64
: Looks good. Consistent with previous changes.Also applies to: 67-67
82-82
: Approved. Maintains consistency with other changes.Also applies to: 86-86
111-111
: Approved, but verifyperformServiceOperation
.
Ensure this method exists and accepts the given parameters.Also applies to: 119-122
165-166
: LGTM. Double-checkperformServiceOperation
.
Confirm method existence and parameter compatibility.
182-182
: Approved. VerifyperformServiceOperation
usage.
Ensure method exists and accepts given parameters.Also applies to: 190-193
services/server/src/server/services/storageServices/RepositoryV2Service.ts (1)
16-16
: Verify unused imports removal.Imports for
MatchLevel
andRepositoryTag
were removed. Ensure they're not used elsewhere in the file to avoid compilation errors.Verification successful
Unused imports successfully removed. No references to
MatchLevel
orRepositoryTag
found in the file.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Check for any remaining usage of MatchLevel or RepositoryTag rg --type typescript 'MatchLevel|RepositoryTag' services/server/src/server/services/storageServices/RepositoryV2Service.tsLength of output: 159
Script:
#!/bin/bash # Check for any remaining usage of MatchLevel or RepositoryTag without specifying file type rg 'MatchLevel|RepositoryTag' services/server/src/server/services/storageServices/RepositoryV2Service.tsLength of output: 217
services/server/src/server/controllers/verification/etherscan/etherscan.common.ts (1)
3-7
: New import looks good.The addition of
ISolidityCompiler
aligns with the function signature update.services/server/test/integration/path-sanitization.spec.ts (4)
14-15
: New imports look good.The added imports align with the changes in the underlying storage service logic.
70-73
: Path update looks good.The change from
serverFixture.server.repository
toserverFixture.repositoryV1Path
is consistent with the refactoring.
141-143
: Path update looks good.The change from
serverFixture.server.repository
toserverFixture.repositoryV1Path
is consistent with the refactoring.
236-238
: Path update looks good.The change from
serverFixture.server.repository
toserverFixture.repositoryV1Path
is consistent with the refactoring.services/server/src/server/controllers/verification/verify/stateless/verify.stateless.handlers.ts (4)
9-9
: New imports look good.Also applies to: 19-20
26-29
: Service access improved, but check chain existence.The new way of accessing services is good. But ensure
sourcifyChainMap[req.body.chain]
always exists.Also applies to: 76-78, 90-92
100-100
: Storage access looks good.Also applies to: 109-109
118-119
: Service access good, but why comment outcreationLinkReferences
?New service access is fine. But why remove
creationLinkReferences
? Might it break something?Also applies to: 190-190
services/server/README.md (1)
29-37
: Storage config updated. Check if it aligns with current implementation.The
writeOrWarn
is now an empty array, andwriteOrErr
structure is corrected. Ensure this matches the current server behavior.packages/lib-sourcify/test/compiler/solidityCompiler.ts (1)
179-180
: LGTM! Improved variable naming.The change from
repoPath
tocompilersPath
enhances code clarity.services/server/src/server/services/storageServices/RepositoryV1Service.ts (3)
36-36
: LGTM: New property addedThe
repositoryServerUrl
property is correctly added and typed.
40-40
: LGTM: Constructor updatedThe constructor now correctly initializes the new
repositoryServerUrl
property from the options.
73-73
: LGTM: Updated to use instance propertyThe method now correctly uses
this.repositoryServerUrl
. Note the TODO about using a relative URL in the future.services/server/src/server/services/storageServices/SourcifyDatabaseService.ts (4)
25-25
: LGTM: Import statement updated.The removal of the
config
import aligns with the refactoring goal.
39-39
: New property added for server URL.The
repositoryV1ServerUrl
property centralizes the server URL management.
46-46
: Constructor updated to accept server URL.The constructor now takes
repositoryV1ServerUrl
as a parameter and assigns it to the class property.Also applies to: 50-50
425-425
: Server URL usage updated in methods.The
getTree
andgetContent
methods now usethis.repositoryV1ServerUrl
instead ofconfig.get("repositoryV1.serverUrl")
.Also applies to: 435-435
services/server/src/server/services/storageServices/AbstractDatabaseService.ts (1)
1-1
: Unused import removed. Good job!services/server/test/integration/verification-handlers/verify.session.spec.ts (2)
345-345
: Simplified promise chain.Removed unused parameter in the promise chain. Good cleanup.
Line range hint
376-380
: Updated file path references.File path references now use
serverFixture.repositoryV1Path
instead ofserverFixture.server.repository
. Ensure this change is consistent with the new structure.Also applies to: 394-398
services/server/test/integration/verification-handlers/verify.stateless.spec.ts (1)
572-572
: LGTM! Consistent path updates.The changes look good. Repository path consistently updated.
Also applies to: 850-850
services/server/src/server/session.ts (1)
5-7
: LGTM!The function now accepts
sessionOptions
, simplifying the session middleware configuration.services/server/src/server/controllers/verification/etherscan/stateless/etherscan.stateless.handlers.ts (3)
15-19
: Initialization of services, chainRepository, and solcThe retrieval and initialization of
services
,chainRepository
, andsolc
fromreq.app
are correctly implemented.
47-47
: Verify compatibility ofstoreMatch
with updated parametersEnsure that
services.storage.storeMatch
correctly handlescheckedContract
andmatch
with the new changes.Run the following script to confirm the parameters of
storeMatch
:#!/bin/bash # Description: Check the definition of storeMatch and its expected arguments. # Test: Search for the method definition. Expect: It accepts checkedContract and match as parameters. fd --type f "storage.ts" | xargs rg "storeMatch" # Alternatively, use ast-grep to find the function signature. ast-grep --lang typescript --pattern 'storeMatch($_$)'
43-43
: ConfirmverifyDeployed
acceptssourcifyChain
Ensure that the
verifyDeployed
method acceptssourcifyChain
as an argument. If it previously expected a chain ID string, this change might require adjustments.Run the following script to verify the parameters of
verifyDeployed
:services/server/src/server/controllers/verification/solc-json/stateless/solc-json.stateless.handlers.ts (1)
15-17
: Verify that services are properly initialized.Ensure that
services
,solc
, andchainRepository
are available inreq.app
to prevent possibleundefined
errors.services/server/src/server/controllers/verification/session-state/session-state.handlers.ts (1)
23-24
: Verify correctness of import pathsEnsure that the relative paths for importing
Services
andChainRepository
are accurate. Incorrect paths could lead to module resolution errors during runtime.services/server/test/helpers/ServerFixture.ts (1)
56-56
: Verify all references to 'fixtureOptions_'The constructor parameter has been renamed to
fixtureOptions_
. Please ensure that all references to the old parameter nameoptions_
within the class have been updated to prevent any undefined variable errors.services/server/src/server/server.ts (1)
341-343
: [Duplicate Comment] Entry point consideration already addressedA previous review comment discussed consolidating entry points to reduce confusion. Since this has been addressed, no further action is needed here.
services/server/src/server/services/compiler/local/solidityCompiler.ts (5)
10-10
: Import ofISolidityCompiler
added.The addition of
ISolidityCompiler
to the imports improves type safety and code clarity.
Line range hint
98-129
: UpdateduseCompiler
function to accept repository paths.The
useCompiler
function now includessolcRepoPath
andsolJsonRepoPath
parameters, enhancing flexibility in specifying compiler locations.
179-200
: RefactoredgetAllMetadataAndSourcesFromSolcJson
to useISolidityCompiler
.The function signature now accepts
solc: ISolidityCompiler
, which streamlines the compilation process and promotes modularity.
224-229
: ModifiedgetSolcExecutable
to includesolcRepoPath
.The function now accepts
solcRepoPath
as a parameter, allowing dynamic specification of the compiler executable's repository path.
331-354
: EnhancedgetSolcJs
to acceptsolJsonRepoPath
.By adding the
solJsonRepoPath
parameter, the function gains increased flexibility in locating the Solidity JSON files.services/server/src/server/controllers/verification/verification.common.ts (2)
213-216
: Update 'checkContractsInSession' calls with the new 'solc' parameterThe function
checkContractsInSession
now acceptssolc
as a parameter. Ensure all calls to this function pass thesolc
instance to maintain proper functionality.Run the following script to find usages of
checkContractsInSession
:#!/bin/bash # Description: Find all calls to 'checkContractsInSession' in the codebase. rg --type ts $'checkContractsInSession('
331-338
: Verify 'verifyContractsInSession' invocations include 'solc' and 'chainRepository'The function
verifyContractsInSession
now requiressolc
andchainRepository
as parameters. Please check that all invocations have been updated accordingly to prevent potential issues.Run the following script to identify calls to
verifyContractsInSession
:#!/bin/bash # Description: Find all calls to 'verifyContractsInSession' in the codebase. rg --type ts $'verifyContractsInSession('
...rver/src/server/controllers/verification/solc-json/stateless/solc-json.stateless.handlers.ts
Outdated
Show resolved
Hide resolved
...rver/src/server/controllers/verification/solc-json/stateless/solc-json.stateless.handlers.ts
Show resolved
Hide resolved
services/server/src/server/controllers/verification/session-state/session-state.handlers.ts
Show resolved
Hide resolved
services/server/src/server/controllers/verification/verification.common.ts
Show resolved
Hide resolved
Thanks for pushing this forward. I gave this PR another pass, and I believe I addressed all the comments you had for me. Could you let me know if I missed something? |
@RaoulSchaffranek all good from your side, thanks. Just working out the final details and that everyone in the team becomes aware of the changes. Thankyou! |
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@marcocastignoli need approval here |
Overview
This PR aims to make the
sourcify-server
module available as a library that can be distributed via package registries like npm.Background
We are developing a Solidity debugger that utilizes Sourcify as a source-code repository. Our goal is to leverage Sourcify for debugging public transactions on mainnet and testnets, as well as on local testnets such as Anvil. Given the complexity of installing Sourcify, we plan to bundle a Sourcify server within our VSCode extension and manage the server process ourselves for local development.
Changes Summary
To achieve this, the following changes have been made:
Modularization of the Server Module:
Splitting the sourcify-chains Module:
sourcify-chains
module has been split into:sourcify-chain-repository
.sourcify-chains
.Decoupling from node-config:
node-config
have been removed. Configuration files are now read exclusively by the CLI module. All other modules explicitly pass down their configuration options.This modular approach allows us to integrate Sourcify more seamlessly into our project. We tried to keep the changes at a minimum and barely modified the existing code. The biggest diffs stem from moving imperative code to the cli module.
Summary by CodeRabbit
ChainRepository
class for managing blockchain networks and validating chain IDs.