Skip to content
Draft
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
4 changes: 0 additions & 4 deletions .syncpackrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ semverGroups:
- label: Use looser range by default
range: "^"
versionGroups:
- label: Pin stack-trace to the same version, since newer version starts to use ES module
dependencies:
- "stack-trace"
pinVersion: "0.0.10"
- label: Pin hardhat due to a bug during deployment of contracts
dependencies:
- "hardhat"
Expand Down
20 changes: 0 additions & 20 deletions packages/ethereum-contracts/ops-scripts/libs/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,23 +50,6 @@ function builtTruffleContractLoader(name) {
}
}

//
// Detect truffle environment
//
function detectTruffle() {
const stackTrace = require("stack-trace");
const trace = stackTrace.get();
//trace.forEach((callSite) => console.debug(callSite.getFileName()));
const truffleDetected =
trace.filter((callSite) =>
(callSite.getFileName() || "").match(
/node_modules\/truffle\/build\/[^/]+\.bundled\.js/
)
).length > 0;
console.log("truffle detected", truffleDetected);
return truffleDetected;
}

// extracts the gas related config for the given network from the truffle config
// returns an object with the relevant fields set in the config (empty if none)
//
Expand Down Expand Up @@ -494,13 +477,11 @@ async function getPastEvents({config, contract, eventName, filter, topics}) {
*/
function getScriptRunnerFactory(runnerOpts = {}) {
return (logicFn) => {
const {detectTruffle} = require("./libs/common");
return require("./libs/truffleScriptRunnerFactory")(
() => ({
artifacts:
typeof artifacts !== "undefined" ? artifacts : undefined,
web3: typeof web3 !== "undefined" ? web3 : undefined,
truffleDetected: detectTruffle(),
}),
logicFn,
runnerOpts
Expand Down Expand Up @@ -546,7 +527,6 @@ module.exports = {
rl,
extractWeb3Options,
builtTruffleContractLoader,
detectTruffle,
getGasConfig,

hasCode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function parseColonArgs(argv) {
module.exports = function (ctxFn, logicFn, runnerOpts) {
return async function (cb, argv, options = {}) {
try {
const {artifacts, web3, truffleDetected} = ctxFn();
const {artifacts, web3} = ctxFn();

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

// if isTruffle is not set explicitly
if (!("isTruffle" in options)) {
if ("DISABLE_NATIVE_TRUFFLE" in process.env) {
options.isTruffle = !process.env.DISABLE_NATIVE_TRUFFLE;
} else {
options.isTruffle = truffleDetected;
}
}

// normalize web3 environment
console.log(
"use truffle native environment (isTruffle)",
options.isTruffle
);
if (options.isTruffle) {
if (options.web3) {
throw Error(
"Flag 'isTruffle' cannot be 'true' when using a web3 instance."
);
}
// set these globally so that it's available throughout the executions
global.web3 = web3;
global.artifacts = artifacts;
} else {
if (!truffleDetected) {
if (!options.web3) {
throw Error(
"A web3 instance is not provided when not using truffle."
);
}
global.web3 = options.web3;
} else {
// use web3 of truffle
options.web3 = global.web3 = web3;
}
if (!options.web3) {
throw Error(
"A web3 instance is not provided."
);
}
global.web3 = options.web3;

// Use common environment variables
options.protocolReleaseVersion =
Expand Down
1 change: 0 additions & 1 deletion packages/ethereum-contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"readline": "^1.3.0",
"solidity-coverage": "^0.8.17",
"solidity-docgen": "^0.6.0-beta.36",
"stack-trace": "0.0.10",
"truffle-flattener": "^1.6.0"
},
"files": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ unset USE_MOCKS
unset NON_UPGRADABLE
unset ENABLE_APP_WHITELISTING

# force to load artifacts from build folder instead
export DISABLE_NATIVE_TRUFFLE=1

# if any of them fail, exit
set -xe

Expand Down
5 changes: 0 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -17351,11 +17351,6 @@ ssri@^10.0.0, ssri@^10.0.6:
dependencies:
minipass "^7.0.3"

stack-trace@0.0.10:
version "0.0.10"
resolved "https://registry.yarnpkg.com/stack-trace/-/stack-trace-0.0.10.tgz#547c70b347e8d32b4e108ea1a2a159e5fdde19c0"
integrity sha512-KGzahc7puUKkzyMt+IqAep+TVNbKP+k2Lmwhub39m1AsTSkaDutx56aDCo+HLDzf/D26BIHTJWNiTG1KAJiQCg==

stacktrace-parser@^0.1.10:
version "0.1.11"
resolved "https://registry.yarnpkg.com/stacktrace-parser/-/stacktrace-parser-0.1.11.tgz#c7c08f9b29ef566b9a6f7b255d7db572f66fabc4"
Expand Down
Loading