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

Server config by passing config files, remove create2 verification #1232

Merged
merged 6 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
14 changes: 0 additions & 14 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@
"program": "${workspaceRoot}/node_modules/.bin/mocha",
"env": {
// "DEBUG": "express:*", // Debug all express modules *
"TESTING": "true",
},
"args": [
"${workspaceFolder}/services/server/test/server.js",
Expand All @@ -124,7 +123,6 @@
"program": "${workspaceRoot}/node_modules/.bin/mocha",
"env": {
// "DEBUG": "express:*", // Debug all express modules *
"TESTING": "true",
},
"args": [
"${workspaceFolder}/services/server/test/etherscan.js",
Expand All @@ -147,7 +145,6 @@
"name": "Mocha - Etherscan Instances",
"program": "${workspaceRoot}/node_modules/.bin/mocha",
"env": {
"TESTING": "true",
// "TEST_CHAIN": "100"
},
"args": [
Expand All @@ -171,10 +168,6 @@
"name": "Mocha - lib-sourcify",
"cwd": "${workspaceFolder}/packages/lib-sourcify",
"program": "./node_modules/.bin/mocha",
"env": {
// "DEBUG": "express:*", // Debug all express modules *
"TESTING": "true",
},
"args": [
"-r",
"ts-node/register",
Expand All @@ -195,9 +188,6 @@
"name": "Mocha - Contract Call Decoder",
"cwd": "${workspaceFolder}/packages/contract-call-decoder",
"program": "./node_modules/ava/cli.js",
"env": {
"TESTING": "true",
},
"args": [
],
"outFiles": [
Expand Down Expand Up @@ -232,7 +222,6 @@
"name": "Mocha - Chains",
"program": "${workspaceRoot}/node_modules/.bin/mocha",
"env": {
"TESTING": "true",
// "NEW_CHAIN_ID": "333000333"
},
"args": [
Expand All @@ -255,9 +244,6 @@
"request": "launch",
"name": "Mocha - Source Fetcher",
"program": "${workspaceRoot}/node_modules/.bin/mocha",
"env": {
"TESTING": "true",
},
"args": [
"${workspaceFolder}/test/sourceFetcher.js",
"--no-timeout",
Expand Down
101 changes: 35 additions & 66 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 3 additions & 45 deletions packages/lib-sourcify/test/compiler/solidityCompiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import path from 'path';
import fs from 'fs';
import { exec, spawnSync } from 'child_process';
import { StatusCodes } from 'http-status-codes';
import { CompilerOutput, JsonInput, PathBuffer } from '../../src';
import { CompilerOutput, JsonInput } from '../../src';
import { logDebug, logError, logInfo, logWarn } from './logger';
import semver from 'semver';
import { Worker, WorkerOptions } from 'worker_threads';
Expand Down Expand Up @@ -138,53 +138,12 @@ export async function useCompiler(
return compiledJSON;
}

export async function getAllMetadataAndSourcesFromSolcJson(
solcJson: JsonInput,
compilerVersion: string
): Promise<PathBuffer[]> {
if (solcJson.language !== 'Solidity')
throw new Error(
'Only Solidity is supported, the json has language: ' + solcJson.language
);

const outputSelection = {
'*': {
'*': ['metadata'],
},
};
if (!solcJson.settings) {
solcJson.settings = {
outputSelection: outputSelection,
};
}
solcJson.settings.outputSelection = outputSelection;
const compiled = await useCompiler(compilerVersion, solcJson);
const metadataAndSources: PathBuffer[] = [];
if (!compiled.contracts)
throw new Error('No contracts found in the compiled json output');
for (const contractPath in compiled.contracts) {
for (const contract in compiled.contracts[contractPath]) {
const metadata = compiled.contracts[contractPath][contract].metadata;
const metadataPath = `${contractPath}-metadata.json`;
metadataAndSources.push({
path: metadataPath,
buffer: Buffer.from(metadata),
});
metadataAndSources.push({
path: `${contractPath}`,
buffer: Buffer.from(solcJson.sources[contractPath].content as string),
});
}
}
return metadataAndSources;
}

export async function getSolcExecutable(
platform: string,
version: string
): Promise<string | null> {
const fileName = `solc-${platform}-v${version}`;
const repoPath = process.env.SOLC_REPO || path.join('/tmp', 'solc-repo');
const repoPath = path.join('/tmp', 'solc-repo');
const solcPath = path.join(repoPath, fileName);
if (fs.existsSync(solcPath) && validateSolcPath(solcPath)) {
logDebug(`Found solc ${version} with platform ${platform} at ${solcPath}`);
Expand Down Expand Up @@ -299,8 +258,7 @@ export async function getSolcJs(version = 'latest'): Promise<any> {
version = 'v' + version;
}

const soljsonRepo =
process.env.SOLJSON_REPO || path.join('/tmp', 'soljson-repo');
const soljsonRepo = path.join('/tmp', 'soljson-repo');
const fileName = `soljson-${version}.js`;
const soljsonPath = path.resolve(soljsonRepo, fileName);

Expand Down
3 changes: 1 addition & 2 deletions serverless/compiler-lambda/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,7 @@ async function getSolcJs(version = "latest") {
version = "v" + version;
}

const soljsonRepo =
process.env.SOLJSON_REPO || path.join("/tmp", "soljson-repo");
const soljsonRepo = path.join("/tmp", "soljson-repo");
const fileName = `soljson-${version}.js`;
const soljsonPath = path.resolve(soljsonRepo, fileName);

Expand Down
Loading