Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Commit

Permalink
Merge branch 'develop' into yultide
Browse files Browse the repository at this point in the history
  • Loading branch information
haltman-at committed May 22, 2020
2 parents 06a9cb5 + 567181a commit ca01e1c
Show file tree
Hide file tree
Showing 99 changed files with 1,966 additions and 1,012 deletions.
23 changes: 23 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
version: 2.1
orbs:
node: circleci/[email protected]
jobs:
build-and-test-COLONY:
executor:
name: node/default
tag: '10.20'
steps:
- checkout
- setup_remote_docker
- run: yarn bootstrap
- run: npx truffle obtain --solc=0.5.16
- run: COLONY=true yarn ci

workflows:
colony:
jobs:
- build-and-test-COLONY:
filters:
branches:
only:
- develop
5 changes: 0 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ matrix:
env: FABRICEVM=true
- node_js: 8
env: COVERAGE=true
- if: |
branch = develop AND \
type = push
node_js: 10
env: COLONY=true
allow_failures:
- node_js: 8
env: COVERAGE=true
Expand Down
6 changes: 3 additions & 3 deletions packages/artifactor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"license": "MIT",
"author": "Tim Coulter",
"repository": "https://github.com/trufflesuite/truffle/tree/master/packages/artifactor",
"version": "4.0.57",
"version": "4.0.60",
"main": "dist/index.js",
"scripts": {
"build": "tsc",
Expand All @@ -17,10 +17,10 @@
"fs-extra": "^8.1.0",
"lodash.assign": "^4.2.0",
"lodash.merge": "^4.6.2",
"source-map-support": "^0.5.16"
"source-map-support": "^0.5.19"
},
"devDependencies": {
"@truffle/contract": "^4.2.2",
"@truffle/contract": "^4.2.5",
"@types/fs-extra": "^8.1.0",
"@types/lodash.assign": "^4.2.6",
"@types/lodash.merge": "^4.6.6",
Expand Down
112 changes: 58 additions & 54 deletions packages/blockchain-utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,63 +51,67 @@ const Blockchain = {
return parsed;
},

asURI(provider: Provider, callback: Callback<any>) {
let genesis: any, latest;

this.getBlockByNumber(
"0x0",
provider,
(err: Error, { result }: JsonRPCResponse) => {
if (err) return callback(err);
genesis = result;

this.getBlockByNumber(
"latest",
provider,
(err: Error, { result }: JsonRPCResponse) => {
if (err) return callback(err);
latest = result;
const url = `blockchain://${genesis.hash.replace(
"0x",
""
)}/block/${latest.hash.replace("0x", "")}`;
callback(null, url);
}
);
}
);
asURI(provider: Provider) {
return new Promise((resolve, reject) => {
let genesis: any, latest;

this.getBlockByNumber(
"0x0",
provider,
(err: Error, { result }: JsonRPCResponse) => {
if (err) return reject(err);
genesis = result;

this.getBlockByNumber(
"latest",
provider,
(err: Error, { result }: JsonRPCResponse) => {
if (err) return reject(err);
latest = result;
const url = `blockchain://${genesis.hash.replace(
"0x",
""
)}/block/${latest.hash.replace("0x", "")}`;
resolve(url);
}
);
}
);
});
},

matches(uri: string, provider: Provider, callback: Callback<any>) {
const parsedUri = this.parse(uri);

const expected_genesis = parsedUri.genesis_hash;
const expected_block = parsedUri.block_hash;

this.getBlockByNumber(
"0x0",
provider,
(err: Error, { result }: JsonRPCResponse) => {
if (err) return callback(err);
const block = result;
if (block.hash !== expected_genesis) return callback(null, false);

this.getBlockByHash(
expected_block,
provider,
(err: Error, { result }: JsonRPCResponse) => {
// Treat an error as if the block didn't exist. This is because
// some clients respond differently.
const block = result;
if (err || block == null) {
return callback(null, false);
matches(uri: string, provider: Provider) {
return new Promise((resolve, reject) => {
const parsedUri = this.parse(uri);

const expected_genesis = parsedUri.genesis_hash;
const expected_block = parsedUri.block_hash;

this.getBlockByNumber(
"0x0",
provider,
(err: Error, { result }: JsonRPCResponse) => {
if (err) return reject(err);
const block = result;
if (block.hash !== expected_genesis) return resolve(false);

this.getBlockByHash(
expected_block,
provider,
(err: Error, { result }: JsonRPCResponse) => {
// Treat an error as if the block didn't exist. This is because
// some clients respond differently.
const block = result;
if (err || block == null) {
return resolve(false);
}

resolve(true);
}

callback(null, true);
}
);
}
);
);
}
);
});
}
};

Expand Down
4 changes: 2 additions & 2 deletions packages/blockchain-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"bugs": {
"url": "https://github.com/trufflesuite/truffle/issues"
},
"version": "0.0.18",
"version": "0.0.19",
"main": "dist/index.js",
"scripts": {
"build": "tsc",
Expand All @@ -34,6 +34,6 @@
"access": "public"
},
"dependencies": {
"source-map-support": "^0.5.16"
"source-map-support": "^0.5.19"
}
}
6 changes: 3 additions & 3 deletions packages/box/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"license": "MIT",
"author": "g. nicholas d'andrea <[email protected]>",
"repository": "https://github.com/trufflesuite/truffle/tree/master/packages/box",
"version": "1.0.59",
"version": "1.0.60",
"main": "dist/box.js",
"scripts": {
"build": "tsc",
Expand All @@ -13,13 +13,13 @@
},
"types": "./typings/index.d.ts",
"dependencies": {
"@truffle/config": "^1.2.17",
"@truffle/config": "^1.2.18",
"fs-extra": "^8.1.0",
"github-download": "^0.5.0",
"inquirer": "^7.0.0",
"request": "^2.85.0",
"request-promise-native": "^1.0.7",
"source-map-support": "^0.5.16",
"source-map-support": "^0.5.19",
"tmp": "0.0.33",
"vcsurl": "^0.1.1"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/code-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"license": "MIT",
"author": "",
"repository": "https://github.com/trufflesuite/truffle/tree/master/packages/code-utils",
"version": "1.2.14",
"version": "1.2.15",
"main": "dist/index.js",
"scripts": {
"build": "tsc",
Expand All @@ -23,6 +23,6 @@
"access": "public"
},
"dependencies": {
"source-map-support": "^0.5.16"
"source-map-support": "^0.5.19"
}
}
4 changes: 4 additions & 0 deletions packages/codec/lib/abi-data/allocate/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,10 @@ function getCalldataAllocationsForContract(
//(if it doesn't then it will remain as default)
functionAllocations: {}
};
if (!abi) {
//if no ABI, can't do much!
return allocations;
}
for (let abiEntry of abi) {
if (
AbiDataUtils.abiEntryIsObviouslyIllTyped(abiEntry) ||
Expand Down
5 changes: 3 additions & 2 deletions packages/codec/lib/ast/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,9 @@ export function spliceLocation(
*/
export function regularizeTypeIdentifier(identifier: string): string {
return identifier.replace(
/(?<=_(storage|memory|calldata))((_slice)?_ptr)?$/,
"_ptr"
/(_(storage|memory|calldata))((_slice)?_ptr)?$/,
"$1_ptr" //this used to use lookbehind for clarity, but Firefox...
//(see: https://github.com/trufflesuite/truffle/issues/3068 )
);
}

Expand Down
4 changes: 2 additions & 2 deletions packages/codec/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@truffle/codec",
"version": "0.5.1",
"version": "0.5.3",
"description": "Library for encoding and decoding smart contract data",
"main": "dist/lib/index.js",
"types": "dist/lib/index.d.ts",
Expand Down Expand Up @@ -60,7 +60,7 @@
"lodash.partition": "^4.6.0",
"lodash.sum": "^4.0.2",
"semver": "^6.3.0",
"source-map-support": "^0.5.16",
"source-map-support": "^0.5.19",
"utf8": "^3.0.0",
"web3-utils": "1.2.1"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ class Native extends LoadingStrategy {
load() {
const versionString = this.validateAndGetSolcVersion();
const command = "solc --standard-json";
const maxBuffer = 1024 * 1024 * 10;

try {
return {
compile: options => String(execSync(command, { input: options })),
compile: options =>
String(execSync(command, { input: options, maxBuffer })),
version: () => versionString
};
} catch (error) {
Expand Down
6 changes: 3 additions & 3 deletions packages/compile-solidity/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "@truffle/compile-solidity",
"description": "Compiler helper and artifact manager for Solidity files",
"version": "4.3.2",
"version": "4.3.5",
"main": "index.js",
"dependencies": {
"@truffle/config": "^1.2.17",
"@truffle/config": "^1.2.18",
"@truffle/contract-sources": "^0.1.7",
"@truffle/error": "^0.0.8",
"@truffle/expect": "^0.0.13",
Expand All @@ -20,7 +20,7 @@
"solc": "^0.6.0"
},
"devDependencies": {
"@truffle/resolver": "^5.1.11",
"@truffle/resolver": "^6.0.1",
"babel-core": "^6.26.0",
"babel-polyfill": "^6.26.0",
"babel-preset-env": "^1.6.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/compile-solidity/profiler/getImports.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const getImports = (file, { body, source }, solc, parserSolc) => {
return imports.map(
dependencyPath =>
isExplicitlyRelative(dependencyPath)
? source.resolve_dependency_path(file, dependencyPath)
? source.resolveDependencyPath(file, dependencyPath)
: dependencyPath
);
};
Expand Down
20 changes: 11 additions & 9 deletions packages/compile-solidity/profiler/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,19 +195,16 @@ module.exports = {
} else {
file = candidate;
}
const promise = new Promise((accept, reject) => {
resolver.resolve(file, parent, (err, body, absolutePath, source) => {
err ? reject(err) : accept({ file: absolutePath, body, source });
});
});
promises.push(promise);
promises.push(resolver.resolve(file, parent));
}

// Resolve everything known and add it to the map, then inspect each file's
// imports and add those to the list of paths to resolve if we don't have it.
return Promise.all(promises).then(async results => {
// Generate the sources mapping
results.forEach(item => (mapping[item.file] = Object.assign({}, item)));
results.forEach(
item => (mapping[item.filePath] = Object.assign({}, item))
);

// Queue unknown imports for the next resolver cycle
while (results.length) {
Expand All @@ -216,7 +213,12 @@ module.exports = {
// Inspect the imports
let imports;
try {
imports = await getImports(result.file, result, solc, parserSolc);
imports = await getImports(
result.filePath,
result,
solc,
parserSolc
);
} catch (err) {
if (err.message.includes("requires different compiler version")) {
const contractSolcPragma = err.message.match(
Expand All @@ -238,7 +240,7 @@ module.exports = {
// Keep track of location of this import because we need to report that.
imports.forEach(item => {
if (!mapping[item])
allPaths.push({ file: item, parent: result.file });
allPaths.push({ file: item, parent: result.filePath });
});
}
});
Expand Down
Loading

0 comments on commit ca01e1c

Please sign in to comment.