Skip to content

Commit c15faa3

Browse files
committed
remove detectTruffle and stack-trace dependency
1 parent 81205ba commit c15faa3

File tree

6 files changed

+6
-74
lines changed

6 files changed

+6
-74
lines changed

.syncpackrc.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,3 @@ semverGroups:
1616
range: ""
1717
- label: Use looser range by default
1818
range: "^"
19-
versionGroups:
20-
- label: Pin stack-trace to the same version, since newer version starts to use ES module
21-
dependencies:
22-
- "stack-trace"
23-
pinVersion: "0.0.10"

packages/ethereum-contracts/ops-scripts/libs/common.js

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -50,23 +50,6 @@ function builtTruffleContractLoader(name) {
5050
}
5151
}
5252

53-
//
54-
// Detect truffle environment
55-
//
56-
function detectTruffle() {
57-
const stackTrace = require("stack-trace");
58-
const trace = stackTrace.get();
59-
//trace.forEach((callSite) => console.debug(callSite.getFileName()));
60-
const truffleDetected =
61-
trace.filter((callSite) =>
62-
(callSite.getFileName() || "").match(
63-
/node_modules\/truffle\/build\/[^/]+\.bundled\.js/
64-
)
65-
).length > 0;
66-
console.log("truffle detected", truffleDetected);
67-
return truffleDetected;
68-
}
69-
7053
// extracts the gas related config for the given network from the truffle config
7154
// returns an object with the relevant fields set in the config (empty if none)
7255
//
@@ -494,13 +477,11 @@ async function getPastEvents({config, contract, eventName, filter, topics}) {
494477
*/
495478
function getScriptRunnerFactory(runnerOpts = {}) {
496479
return (logicFn) => {
497-
const {detectTruffle} = require("./libs/common");
498480
return require("./libs/truffleScriptRunnerFactory")(
499481
() => ({
500482
artifacts:
501483
typeof artifacts !== "undefined" ? artifacts : undefined,
502484
web3: typeof web3 !== "undefined" ? web3 : undefined,
503-
truffleDetected: detectTruffle(),
504485
}),
505486
logicFn,
506487
runnerOpts
@@ -546,7 +527,6 @@ module.exports = {
546527
rl,
547528
extractWeb3Options,
548529
builtTruffleContractLoader,
549-
detectTruffle,
550530
getGasConfig,
551531

552532
hasCode,

packages/ethereum-contracts/ops-scripts/libs/truffleScriptRunnerFactory.js

Lines changed: 6 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function parseColonArgs(argv) {
2727
module.exports = function (ctxFn, logicFn, runnerOpts) {
2828
return async function (cb, argv, options = {}) {
2929
try {
30-
const {artifacts, web3, truffleDetected} = ctxFn();
30+
const {artifacts, web3} = ctxFn();
3131

3232
let args;
3333
if (runnerOpts.skipArgv) {
@@ -40,42 +40,13 @@ module.exports = function (ctxFn, logicFn, runnerOpts) {
4040
console.log("Colon arguments", args);
4141
}
4242

43-
// if isTruffle is not set explicitly
44-
if (!("isTruffle" in options)) {
45-
if ("DISABLE_NATIVE_TRUFFLE" in process.env) {
46-
options.isTruffle = !process.env.DISABLE_NATIVE_TRUFFLE;
47-
} else {
48-
options.isTruffle = truffleDetected;
49-
}
50-
}
51-
5243
// normalize web3 environment
53-
console.log(
54-
"use truffle native environment (isTruffle)",
55-
options.isTruffle
56-
);
57-
if (options.isTruffle) {
58-
if (options.web3) {
59-
throw Error(
60-
"Flag 'isTruffle' cannot be 'true' when using a web3 instance."
61-
);
62-
}
63-
// set these globally so that it's available throughout the executions
64-
global.web3 = web3;
65-
global.artifacts = artifacts;
66-
} else {
67-
if (!truffleDetected) {
68-
if (!options.web3) {
69-
throw Error(
70-
"A web3 instance is not provided when not using truffle."
71-
);
72-
}
73-
global.web3 = options.web3;
74-
} else {
75-
// use web3 of truffle
76-
options.web3 = global.web3 = web3;
77-
}
44+
if (!options.web3) {
45+
throw Error(
46+
"A web3 instance is not provided."
47+
);
7848
}
49+
global.web3 = options.web3;
7950

8051
// Use common environment variables
8152
options.protocolReleaseVersion =

packages/ethereum-contracts/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
"readline": "^1.3.0",
2727
"solidity-coverage": "^0.8.17",
2828
"solidity-docgen": "^0.6.0-beta.36",
29-
"stack-trace": "0.0.10",
3029
"truffle-flattener": "^1.6.0"
3130
},
3231
"files": [

packages/ethereum-contracts/test/ops-scripts/deployment.test.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ unset USE_MOCKS
3131
unset NON_UPGRADABLE
3232
unset ENABLE_APP_WHITELISTING
3333

34-
# force to load artifacts from build folder instead
35-
export DISABLE_NATIVE_TRUFFLE=1
36-
3734
# if any of them fail, exit
3835
set -xe
3936

yarn.lock

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3677,11 +3677,6 @@
36773677
resolved "https://registry.yarnpkg.com/@solidity-parser/parser/-/parser-0.20.2.tgz#e07053488ed60dae1b54f6fe37bb6d2c5fe146a7"
36783678
integrity sha512-rbu0bzwNvMcwAjH86hiEAcOeRI2EeK8zCkHDrFykh/Al8mvJeFmjy3UrE7GYQjNwOgbGUUtCn5/k8CB8zIu7QA==
36793679

3680-
"@solidity-parser/parser@^0.20.2":
3681-
version "0.20.2"
3682-
resolved "https://registry.yarnpkg.com/@solidity-parser/parser/-/parser-0.20.2.tgz#e07053488ed60dae1b54f6fe37bb6d2c5fe146a7"
3683-
integrity sha512-rbu0bzwNvMcwAjH86hiEAcOeRI2EeK8zCkHDrFykh/Al8mvJeFmjy3UrE7GYQjNwOgbGUUtCn5/k8CB8zIu7QA==
3684-
36853680
"@standard-schema/spec@^1.0.0":
36863681
version "1.0.0"
36873682
resolved "https://registry.yarnpkg.com/@standard-schema/spec/-/spec-1.0.0.tgz#f193b73dc316c4170f2e82a881da0f550d551b9c"
@@ -16737,11 +16732,6 @@ ssri@^10.0.0, ssri@^10.0.6:
1673716732
dependencies:
1673816733
minipass "^7.0.3"
1673916734

16740-
stack-trace@0.0.10:
16741-
version "0.0.10"
16742-
resolved "https://registry.yarnpkg.com/stack-trace/-/stack-trace-0.0.10.tgz#547c70b347e8d32b4e108ea1a2a159e5fdde19c0"
16743-
integrity sha512-KGzahc7puUKkzyMt+IqAep+TVNbKP+k2Lmwhub39m1AsTSkaDutx56aDCo+HLDzf/D26BIHTJWNiTG1KAJiQCg==
16744-
1674516735
stacktrace-parser@^0.1.10:
1674616736
version "0.1.10"
1674716737
resolved "https://registry.yarnpkg.com/stacktrace-parser/-/stacktrace-parser-0.1.10.tgz#29fb0cae4e0d0b85155879402857a1639eb6051a"

0 commit comments

Comments
 (0)