I'm running tests against 3rd-parties smart contracts. All of them use truffle and are placed as git subrepo. For now, I'm running only one ganache-cli instance and running truffle migrate from each subrepo (The only change is overriding their migration scripts when necessary).
After those steps (ganache start & truffle migrate for each project) my test suites are running correcty.
Now, I'm trying to use the external compiler configuration to bring those contracts management to my truffle project to have all migrations scripts on my migrations/ folder (instead of overriding approach) and take advantage of new features from updated truffle.
I'm facing problems when moving to external compiler approach.
Inside of my truffle project I have these 3rd-parties projects as git subrepos:
land
truffle: 4.1.13
marketplace-contracts
truffle: 4.1.14
safe-contracts
truffle: 4.1.14
I've wrote a script that runs the command truffle compile inside of each repo and then I'm using external config pointing to json files:
external: {
command: "...",
targets: [
{
path:
"./3rd-parties/decentraland/mana/build/contracts/MANAToken.json",
},
{
path:
"./3rd-parties/decentraland/land/build/contracts/EstateRegistry.json",
},
{
path:
"./3rd-parties/decentraland/land/build/contracts/LANDRegistry.json",
},
{
path:
"./3rd-parties/decentraland/land/build/contracts/LANDProxy.json",
},
{
path:
"./3rd-parties/decentraland/marketplace-contracts/build/contracts/Marketplace.json",
},
{
path:
"./3rd-parties/gnosis/safe-contracts/build/contracts/ProxyFactory.json",
},
{
path:
"./3rd-parties/gnosis/safe-contracts/build/contracts/GnosisSafe.json",
},
],
},
I was expected that external compiler approach (run ganache + compile from external + one migrate for all + test all) works as my current setup (run ganache + run migrate from each project + test all).
land and marketplace-contracts are passing on my test suite (that could be because of low coverage from tests but I'm assuming that is working fine).
mana
Compiling your contracts...
===========================
Error: Schema validation failed. Errors:
should NOT have additional properties (additionalProperties):
{ dataPath: '',
schemaPath: '#/additionalProperties',
params: { additionalProperty: 'contract_name' },
data:
{ contract_name: 'MANAToken',
abi:
[ { constant: true,
inputs: [],
name: 'mintingFinished',
outputs: [ { name: '', type: 'bool' } ],
payable: false,
type: 'function' },
{ constant: true,
inputs: [],
name: 'name',
outputs: [ { name: '', type: 'string' } ],
payable: false,
type: 'function' },
{ constant: false,
inputs:
[ { name: '_spender', type: 'address' },
{ name: '_value', type: 'uint256' } ],
name: 'approve',
outputs: [ { name: '', type: 'bool' } ],
payable: false,
type: 'function' },
{ constant: true,
inputs: [],
name: 'totalSupply',
outputs: [ { name: '', type: 'uint256' } ],
payable: false,
type: 'function' },
{ constant: false,
inputs:
[ { name: '_from', type: 'address' },
{ name: '_to', type: 'address' },
{ name: '_value', type: 'uint256' } ],
name: 'transferFrom',
outputs: [ { name: '', type: 'bool' } ],
payable: false,
type: 'function' },
{ constant: true,
inputs: [],
name: 'decimals',
outputs: [ { name: '', type: 'uint8' } ],
payable: false,
type: 'function' },
{ constant: false,
inputs: [],
name: 'unpause',
outputs: [ { name: '', type: 'bool' } ],
payable: false,
type: 'function' },
{ constant: false,
inputs:
[ { name: '_to', type: 'address' },
{ name: '_amount', type: 'uint256' } ],
name: 'mint',
outputs: [ { name: '', type: 'bool' } ],
payable: false,
type: 'function' },
{ constant: false,
inputs: [ { name: '_value', type: 'uint256' } ],
name: 'burn',
outputs: [],
payable: false,
type: 'function' },
{ constant: true,
inputs: [],
name: 'paused',
outputs: [ { name: '', type: 'bool' } ],
payable: false,
type: 'function' },
{ constant: true,
inputs: [ { name: '_owner', type: 'address' } ],
name: 'balanceOf',
outputs: [ { name: 'balance', type: 'uint256' } ],
payable: false,
type: 'function' },
{ constant: false,
inputs: [],
name: 'finishMinting',
outputs: [ { name: '', type: 'bool' } ],
payable: false,
type: 'function' },
{ constant: false,
inputs: [],
name: 'pause',
outputs: [ { name: '', type: 'bool' } ],
payable: false,
type: 'function' },
{ constant: true,
inputs: [],
name: 'owner',
outputs: [ { name: '', type: 'address' } ],
payable: false,
type: 'function' },
{ constant: true,
inputs: [],
name: 'symbol',
outputs: [ { name: '', type: 'string' } ],
payable: false,
type: 'function' },
{ constant: false,
inputs:
[ { name: '_to', type: 'address' },
{ name: '_value', type: 'uint256' } ],
name: 'transfer',
outputs: [ { name: '', type: 'bool' } ],
payable: false,
type: 'function' },
{ constant: true,
inputs:
[ { name: '_owner', type: 'address' },
{ name: '_spender', type: 'address' } ],
name: 'allowance',
outputs: [ { name: 'remaining', type: 'uint256' } ],
payable: false,
type: 'function' },
{ constant: false,
inputs: [ { name: 'newOwner', type: 'address' } ],
name: 'transferOwnership',
outputs: [],
payable: false,
type: 'function' },
{ anonymous: false,
inputs:
[ { indexed: true, name: 'to', type: 'address' },
{ indexed: false, name: 'amount', type: 'uint256' } ],
name: 'Mint',
type: 'event' },
{ anonymous: false,
inputs: [],
name: 'MintFinished',
type: 'event' },
{ anonymous: false, inputs: [], name: 'Pause', type: 'event' },
{ anonymous: false, inputs: [], name: 'Unpause', type: 'event' },
{ anonymous: false,
inputs:
[ { indexed: true, name: 'burner', type: 'address' },
{ indexed: false, name: 'value', type: 'uint256' } ],
name: 'Burn',
type: 'event' },
{ anonymous: false,
inputs:
[ { indexed: true, name: 'owner', type: 'address' },
{ indexed: true, name: 'spender', type: 'address' },
{ indexed: false, name: 'value', type: 'uint256' } ],
name: 'Approval',
type: 'event' },
{ anonymous: false,
inputs:
[ { indexed: true, name: 'from', type: 'address' },
{ indexed: true, name: 'to', type: 'address' },
{ indexed: false, name: 'value', type: 'uint256' } ],
name: 'Transfer',
type: 'event' } ],
unlinked_binary:
'0x60606040526003805460a060020a61ffff02191690555b60038054600160a060020a03191633600160a060020a03161790555b5b610cb5806100426000396000f300606060405236156100f95763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166305d2035b81146100fe57806306fdde0314610125578063095ea7b3146101b057806318160ddd146101e657806323b872dd1461020b578063313ce567146102475780633f4ba83a1461027057806340c10f191461029757806342966c68146102cd5780635c975abb146102e557806370a082311461030c5780637d64bcb41461033d5780638456cb59146103645780638da5cb5b1461038b57806395d89b41146103ba578063a9059cbb14610445578063dd62ed3e1461047b578063f2fde38b146104b2575b600080fd5b341561010957600080fd5b6101116104d3565b604051901515815260200160405180910390f35b341561013057600080fd5b6101386104f5565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156101755780820151818401525b60200161015c565b50505050905090810190601f1680156101a25780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101bb57600080fd5b610111600160a060020a036004351660243561052c565b604051901515815260200160405180910390f35b34156101f157600080fd5b6101f96105d3565b60405190815260200160405180910390f35b341561021657600080fd5b610111600160a060020a03600435811690602435166044356105d9565b604051901515815260200160405180910390f35b341561025257600080fd5b61025a610609565b60405160ff909116815260200160405180910390f35b341561027b57600080fd5b61011161060e565b604051901515815260200160405180910390f35b34156102a257600080fd5b610111600160a060020a0360043516602435610697565b604051901515815260200160405180910390f35b34156102d857600080fd5b6102e360043561077a565b005b34156102f057600080fd5b61011161079f565b604051901515815260200160405180910390f35b341561031757600080fd5b6101f9600160a060020a03600435166107af565b60405190815260200160405180910390f35b341561034857600080fd5b6101116107ce565b604051901515815260200160405180910390f35b341561036f57600080fd5b610111610857565b604051901515815260200160405180910390f35b341561039657600080fd5b61039e6108e5565b604051600160a060020a03909116815260200160405180910390f35b34156103c557600080fd5b6101386108f4565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156101755780820151818401525b60200161015c565b50505050905090810190601f1680156101a25780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561045057600080fd5b610111600160a060020a036004351660243561092b565b604051901515815260200160405180910390f35b341561048657600080fd5b6101f9600160a060020a0360043581169060243516610959565b60405190815260200160405180910390f35b34156104bd57600080fd5b6102e3600160a060020a0360043516610986565b005b6003547501000000000000000000000000000000000000000000900460ff1681565b60408051908101604052601181527f446563656e7472616c616e64204d414e41000000000000000000000000000000602082015281565b600081158061055e5750600160a060020a03338116600090815260026020908152604080832093871683529290522054155b151561056957600080fd5b600160a060020a03338116600081815260026020908152604080832094881680845294909152908190208590557f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a35060015b92915050565b60005481565b60035460009060a060020a900460ff16156105f357600080fd5b6105fe8484846109de565b90505b5b9392505050565b601281565b60035460009033600160a060020a0390811691161461062c57600080fd5b60035460a060020a900460ff16151561064457600080fd5b6003805474ff0000000000000000000000000000000000000000191690557f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a15060015b5b5b90565b60035460009033600160a060020a039081169116146106b557600080fd5b6003547501000000000000000000000000000000000000000000900460ff16156106de57600080fd5b6000546106f1908363ffffffff610af316565b6000908155600160a060020a03841681526001602052604090205461071c908363ffffffff610af316565b600160a060020a0384166000818152600160205260409081902092909255907f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d41213968859084905190815260200160405180910390a25060015b5b5b92915050565b60035460a060020a900460ff161561079157600080fd5b61079a81610b0d565b5b5b50565b60035460a060020a900460ff1681565b600160a060020a0381166000908152600160205260409020545b919050565b60035460009033600160a060020a039081169116146107ec57600080fd5b6003805475ff000000000000000000000000000000000000000000191675010000000000000000000000000000000000000000001790557fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a15060015b5b90565b60035460009033600160a060020a0390811691161461087557600080fd5b60035460a060020a900460ff161561088c57600080fd5b6003805474ff0000000000000000000000000000000000000000191660a060020a1790557f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a15060015b5b5b90565b600354600160a060020a031681565b60408051908101604052600481527f4d414e4100000000000000000000000000000000000000000000000000000000602082015281565b60035460009060a060020a900460ff161561094557600080fd5b61094f8383610bb2565b90505b5b92915050565b600160a060020a038083166000908152600260209081526040808320938516835292905220545b92915050565b60035433600160a060020a039081169116146109a157600080fd5b600160a060020a0381161561079a576003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b5b50565b600160a060020a038084166000908152600260209081526040808320338516845282528083205493861683526001909152812054909190610a25908463ffffffff610af316565b600160a060020a038086166000908152600160205260408082209390935590871681522054610a5a908463ffffffff610c7216565b600160a060020a038616600090815260016020526040902055610a83818463ffffffff610c7216565b600160a060020a03808716600081815260026020908152604080832033861684529091529081902093909355908616917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9086905190815260200160405180910390a3600191505b509392505050565b600082820183811015610b0257fe5b8091505b5092915050565b6000808211610b1b57600080fd5b5033600160a060020a038116600090815260016020526040902054610b409083610c72565b600160a060020a03821660009081526001602052604081209190915554610b6d908363ffffffff610c7216565b600055600160a060020a0333167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca58360405190815260200160405180910390a25b5050565b600160a060020a033316600090815260016020526040812054610bdb908363ffffffff610c7216565b600160a060020a033381166000908152600160205260408082209390935590851681522054610c10908363ffffffff610af316565b600160a060020a0380851660008181526001602052604090819020939093559133909116907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a35060015b92915050565b600082821115610c7e57fe5b508082035b929150505600a165627a7a723058206d15acab9088b0b2a5ec9adfa928633f11e8c2e32526da817cf60b465d40a7a80029',
networks:
{ '1551886015434':
{ events:
{ '0x0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885':
{ anonymous: false, inputs: [Array], name: 'Mint', type: 'event' },
'0xae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa08':
{ anonymous: false,
inputs: [],
name: 'MintFinished',
type: 'event' },
'0x6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff625':
{ anonymous: false, inputs: [], name: 'Pause', type: 'event' },
'0x7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b33':
{ anonymous: false, inputs: [], name: 'Unpause', type: 'event' },
'0xcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5':
{ anonymous: false, inputs: [Array], name: 'Burn', type: 'event' },
'0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925':
{ anonymous: false,
inputs: [Array],
name: 'Approval',
type: 'event' },
'0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef':
{ anonymous: false,
inputs: [Array],
name: 'Transfer',
type: 'event' } },
links: {},
address: '0xf2ca89e8fc88989c366ce6616e5c8a3de4f65081',
updated_at: 1551886031258 } },
schema_version: '0.0.5',
updated_at: 1551886031258 },
parentSchema:
{ id: 'contract-object.spec.json',
'$schema': 'http://json-schema.org/schema#',
title: 'Contract Object',
description:
'Describes a contract consumable by Truffle, possibly including deployed instances on networks',
type: 'object',
properties:
{ contractName:
{ allOf: [ { '$ref': '#/definitions/ContractName' } ],
description: 'Name used to identify the contract',
default: 'Contract' },
abi:
{ allOf: [ { '$ref': 'abi.spec.json#' } ],
description: 'Interface description returned by compiler for source' },
bytecode:
{ allOf: [ { '$ref': '#/definitions/Bytecode' } ],
description:
'Bytecode sent as contract-creation transaction data, with unresolved link references' },
deployedBytecode:
{ allOf: [ { '$ref': '#/definitions/Bytecode' } ],
description:
'On-chain deployed contract bytecode, with unresolved link references' },
sourceMap:
{ allOf: [ { '$ref': '#/definitions/SourceMap' } ],
description:
'Source mapping for contract-creation transaction data bytecode' },
deployedSourceMap:
{ allOf: [ { '$ref': '#/definitions/SourceMap' } ],
description: 'Source mapping for contract bytecode' },
source: { '$ref': '#/definitions/Source' },
sourcePath: { '$ref': '#/definitions/SourcePath' },
ast: { '$ref': '#/definitions/AST' },
legacyAST: { '$ref': '#/definitions/LegacyAST' },
compiler:
{ type: 'object',
properties: { name: { type: 'string' }, version: { type: 'string' } } },
networks:
{ patternProperties:
{ '^[a-zA-Z0-9]+$': { '$ref': 'network-object.spec.json#' } },
additionalProperties: false },
schemaVersion: { '$ref': '#/definitions/SchemaVersion' },
updatedAt: { type: 'string', format: 'date-time' },
devdoc: { '$ref': '#/definitions/NatSpec' },
userdoc: { '$ref': '#/definitions/NatSpec' } },
required: [ 'abi' ],
patternProperties:
{ '^x-':
{ anyOf:
[ { type: 'string' },
{ type: 'number' },
{ type: 'object' },
{ type: 'array' } ] } },
additionalProperties: false,
definitions:
{ ContractName: { type: 'string', pattern: '^[a-zA-Z_][a-zA-Z0-9_]*$' },
NatSpec: { type: 'object' },
Bytecode:
{ type: 'string',
pattern: '^0x0$|^0x([a-fA-F0-9]{2}|__.{38})+$' },
Source: { type: 'string' },
SourceMap:
{ type: 'string',
examples:
[ '315:637:1:-;;;452:55;;;;;;;-1:-1:-1;;;;;485:9:1;476:19;:8;:19;;;;;;;;;;498:5;476:27;;452:55;315:637;;;;;;;' ] },
SourcePath: { type: 'string' },
AST: { type: 'object' },
LegacyAST: { type: 'object' },
SchemaVersion: { type: 'string', pattern: '[0-9]+\\.[0-9]+\\.[0-9]+' } } } }
at Object.validate (/home/cmarcelo/git/TasitSDK/node_modules/truffle/build/webpack:/packages/truffle-contract-schema/index.js:197:1)
at processTargets (/home/cmarcelo/git/TasitSDK/node_modules/truffle/build/webpack:/packages/truffle-external-compile/index.js:154:1)
Testcase using web3
With migration from 3rd-party project: Passed
With external compiler: Failed
contract("GnosisSafe", accounts => {
const gnosisSafe = new web3.eth.Contract(abi, address);
const jonh = accounts[9];
it("should get the GnosisSafe owner", async () => {
const [owner] = await gnosisSafe.methods.getOwners().call();
assert.equal(owner, jonh, "John isn't the contract owner.");
});
});
Output using web3
1) Contract: GnosisSafe
should get the GnosisSafe owner:
Error: Returned values aren't valid, did it run Out of Gas?
at ABICoder.decodeParameters (/home/cmarcelo/git/TasitSDK/node_modules/truffle/build/webpack:/~/web3-eth-abi/src/index.js:226:1)
at Contract._decodeMethodReturn (/home/cmarcelo/git/TasitSDK/node_modules/truffle/build/webpack:/~/web3-eth-contract/src/index.js:465:1)
at Method.outputFormatter (/home/cmarcelo/git/TasitSDK/node_modules/truffle/build/webpack:/~/web3-eth-contract/src/index.js:818:1)
at Method.formatOutput (/home/cmarcelo/git/TasitSDK/node_modules/truffle/build/webpack:/~/web3-eth-contract/~/web3-core-method/src/index.js:163:1)
at sendTxCallback (/home/cmarcelo/git/TasitSDK/node_modules/truffle/build/webpack:/~/web3-eth-contract/~/web3-core-method/src/index.js:473:1)
at /home/cmarcelo/git/TasitSDK/node_modules/truffle/build/webpack:/~/web3-eth-contract/~/web3-core-requestmanager/src/index.js:147:1
at /home/cmarcelo/git/TasitSDK/node_modules/truffle/build/webpack:/packages/truffle-provider/wrapper.js:112:1
at XMLHttpRequest.request.onreadystatechange (/home/cmarcelo/git/TasitSDK/node_modules/truffle/build/webpack:/~/web3/~/web3-providers-http/src/index.js:96:1)
at XMLHttpRequestEventTarget.dispatchEvent (/home/cmarcelo/git/TasitSDK/node_modules/truffle/build/webpack:/~/xhr2-cookies/dist/xml-http-request-event-target.js:34:1)
at XMLHttpRequest._setReadyState (/home/cmarcelo/git/TasitSDK/node_modules/truffle/build/webpack:/~/xhr2-cookies/dist/xml-http-request.js:208:1)
at XMLHttpRequest._onHttpResponseEnd (/home/cmarcelo/git/TasitSDK/node_modules/truffle/build/webpack:/~/xhr2-cookies/dist/xml-http-request.js:318:1)
at IncomingMessage.<anonymous> (/home/cmarcelo/git/TasitSDK/node_modules/truffle/build/webpack:/~/xhr2-cookies/dist/xml-http-request.js:289:47)
at endReadableNT (_stream_readable.js:1094:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
safe-contracts
Compilation working but one test case that was working before is failing now:
Testcase using truffle artifact
With external compiler: Failed
const GnosisSafe = artifacts.require("./GnosisSafe.sol");
contract("GnosisSafe", accounts => {
const jonh = accounts[9];
let gnosisSafe;
before("", async () => {
gnosisSafe = await GnosisSafe.deployed();
});
it("should get the GnosisSafe owner", async () => {
const [owner] = await gnosisSafe.getOwners();
assert.equal(owner, jonh, "John isn't the contract owner.");
});
});
Ouput using truffle artifact
1) Contract: GnosisSafe
should get the GnosisSafe owner:
Error: Returned values aren't valid, did it run Out of Gas?
at ABICoder.decodeParameters (/home/cmarcelo/git/TasitSDK/node_modules/truffle/build/webpack:/~/web3-eth-abi/src/index.js:226:1)
at Contract._decodeMethodReturn (/home/cmarcelo/git/TasitSDK/node_modules/truffle/build/webpack:/~/web3-eth-contract/src/index.js:465:1)
at Method.outputFormatter (/home/cmarcelo/git/TasitSDK/node_modules/truffle/build/webpack:/~/web3-eth-contract/src/index.js:818:1)
at Method.formatOutput (/home/cmarcelo/git/TasitSDK/node_modules/truffle/build/webpack:/~/web3-eth-contract/~/web3-core-method/src/index.js:163:1)
at sendTxCallback (/home/cmarcelo/git/TasitSDK/node_modules/truffle/build/webpack:/~/web3-eth-contract/~/web3-core-method/src/index.js:473:1)
at /home/cmarcelo/git/TasitSDK/node_modules/truffle/build/webpack:/~/web3-eth-contract/~/web3-core-requestmanager/src/index.js:147:1
at /home/cmarcelo/git/TasitSDK/node_modules/truffle/build/webpack:/packages/truffle-provider/wrapper.js:112:1
at XMLHttpRequest.request.onreadystatechange (/home/cmarcelo/git/TasitSDK/node_modules/truffle/build/webpack:/~/web3/~/web3-providers-http/src/index.js:96:1)
at XMLHttpRequestEventTarget.dispatchEvent (/home/cmarcelo/git/TasitSDK/node_modules/truffle/build/webpack:/~/xhr2-cookies/dist/xml-http-request-event-target.js:34:1)
at XMLHttpRequest._setReadyState (/home/cmarcelo/git/TasitSDK/node_modules/truffle/build/webpack:/~/xhr2-cookies/dist/xml-http-request.js:208:1)
at XMLHttpRequest._onHttpResponseEnd (/home/cmarcelo/git/TasitSDK/node_modules/truffle/build/webpack:/~/xhr2-cookies/dist/xml-http-request.js:318:1)
at IncomingMessage.<anonymous> (/home/cmarcelo/git/TasitSDK/node_modules/truffle/build/webpack:/~/xhr2-cookies/dist/xml-http-request.js:289:47)
at endReadableNT (_stream_readable.js:1094:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
truffle version): Truffle v5.0.7 (core: 5.0.7)node --version): Node v10.13.0npm --version): 6.4.1My broken branch: https://github.com/tasitlabs/TasitSDK/tree/feature/decentraland-testnet/packages/tasit-contracts
Thanks!
Hey @marcelomorgado, there is currently an issue with the truffle schema validator that we are looking into right now. This might be the cause of the issue you are experiencing...we are going to try and get this fixed soon!
@marcelomorgado We just released Truffle v5.0.8 today. Try and upgrade and see if the problem persists.
Hey @eggplantzzz thanks for the response.
The Returned values aren't valid, did it run Out of Gas? (GnosisSafe contract) error was gone, thanks.
But remains the problem with the MANAToken contract. It's seems some kind of backward compatibilty with the older json schema because after do these changes manually on MANAToken.json the problem apparently was solved:
renaming contract_name => contractName
renaming unlinked_binary => bytecode
renaming schema_version => schemaVersion
renaming updated_at => updatedAt
changing updated_at field value format (epoch => date-time)
adding stateMutability field to all functions
Oh, wait. Sorry @eggplantzzz the "The Returned values aren't valid, did it run Out of Gas?" (GnosisSafe contract) error wasn't gone.
The compiling process is working for that contract but a simple function call test is failing as related above.
I'm trying to find some extra information about that.
An update here. I've found out what was happening with GnosisSafe contract: I wasn't initialized properly and now it's solved. Oddly the same test case was passing with same contract/migration code + compiling/deployment from its truffle project.
Said that, seems that the only remain problem is about old schema MANAToken json.
@marcelomorgado Sorry for the delay, you are getting the same error with another artifact, MANAToken.json?
Can you give me some more information about what you are doing and what message you are receiving?
Hi @eggplantzzz Sure,
I'm trying to compile that old truffle project https://github.com/decentraland/mana using external compiler feature from my updated truffle project. The error is this:
Compiling your contracts...
===========================
Error: Schema validation failed. Errors:
should NOT have additional properties (additionalProperties):
{ dataPath: '',
schemaPath: '#/additionalProperties',
params: { additionalProperty: 'contract_name' },
data:
{ contract_name: 'MANAToken',
abi:
[ { constant: true,
inputs: [],
name: 'mintingFinished',
outputs: [ { name: '', type: 'bool' } ],
payable: false,
type: 'function' },
{ constant: true,
inputs: [],
name: 'name',
outputs: [ { name: '', type: 'string' } ],
payable: false,
type: 'function' },
{ constant: false,
inputs:
[ { name: '_spender', type: 'address' },
{ name: '_value', type: 'uint256' } ],
name: 'approve',
outputs: [ { name: '', type: 'bool' } ],
payable: false,
type: 'function' },
{ constant: true,
inputs: [],
name: 'totalSupply',
outputs: [ { name: '', type: 'uint256' } ],
payable: false,
type: 'function' },
{ constant: false,
inputs:
[ { name: '_from', type: 'address' },
{ name: '_to', type: 'address' },
{ name: '_value', type: 'uint256' } ],
name: 'transferFrom',
outputs: [ { name: '', type: 'bool' } ],
payable: false,
type: 'function' },
{ constant: true,
inputs: [],
name: 'decimals',
outputs: [ { name: '', type: 'uint8' } ],
payable: false,
type: 'function' },
{ constant: false,
inputs: [],
name: 'unpause',
outputs: [ { name: '', type: 'bool' } ],
payable: false,
type: 'function' },
{ constant: false,
inputs:
[ { name: '_to', type: 'address' },
{ name: '_amount', type: 'uint256' } ],
name: 'mint',
outputs: [ { name: '', type: 'bool' } ],
payable: false,
type: 'function' },
{ constant: false,
inputs: [ { name: '_value', type: 'uint256' } ],
name: 'burn',
outputs: [],
payable: false,
type: 'function' },
{ constant: true,
inputs: [],
name: 'paused',
outputs: [ { name: '', type: 'bool' } ],
payable: false,
type: 'function' },
{ constant: true,
inputs: [ { name: '_owner', type: 'address' } ],
name: 'balanceOf',
outputs: [ { name: 'balance', type: 'uint256' } ],
payable: false,
type: 'function' },
{ constant: false,
inputs: [],
name: 'finishMinting',
outputs: [ { name: '', type: 'bool' } ],
payable: false,
type: 'function' },
{ constant: false,
inputs: [],
name: 'pause',
outputs: [ { name: '', type: 'bool' } ],
payable: false,
type: 'function' },
{ constant: true,
inputs: [],
name: 'owner',
outputs: [ { name: '', type: 'address' } ],
payable: false,
type: 'function' },
{ constant: true,
inputs: [],
name: 'symbol',
outputs: [ { name: '', type: 'string' } ],
payable: false,
type: 'function' },
{ constant: false,
inputs:
[ { name: '_to', type: 'address' },
{ name: '_value', type: 'uint256' } ],
name: 'transfer',
outputs: [ { name: '', type: 'bool' } ],
payable: false,
type: 'function' },
{ constant: true,
inputs:
[ { name: '_owner', type: 'address' },
{ name: '_spender', type: 'address' } ],
name: 'allowance',
outputs: [ { name: 'remaining', type: 'uint256' } ],
payable: false,
type: 'function' },
{ constant: false,
inputs: [ { name: 'newOwner', type: 'address' } ],
name: 'transferOwnership',
outputs: [],
payable: false,
type: 'function' },
{ anonymous: false,
inputs:
[ { indexed: true, name: 'to', type: 'address' },
{ indexed: false, name: 'amount', type: 'uint256' } ],
name: 'Mint',
type: 'event' },
{ anonymous: false,
inputs: [],
name: 'MintFinished',
type: 'event' },
{ anonymous: false, inputs: [], name: 'Pause', type: 'event' },
{ anonymous: false, inputs: [], name: 'Unpause', type: 'event' },
{ anonymous: false,
inputs:
[ { indexed: true, name: 'burner', type: 'address' },
{ indexed: false, name: 'value', type: 'uint256' } ],
name: 'Burn',
type: 'event' },
{ anonymous: false,
inputs:
[ { indexed: true, name: 'owner', type: 'address' },
{ indexed: true, name: 'spender', type: 'address' },
{ indexed: false, name: 'value', type: 'uint256' } ],
name: 'Approval',
type: 'event' },
{ anonymous: false,
inputs:
[ { indexed: true, name: 'from', type: 'address' },
{ indexed: true, name: 'to', type: 'address' },
{ indexed: false, name: 'value', type: 'uint256' } ],
name: 'Transfer',
type: 'event' } ],
unlinked_binary:
'0x60606040526003805460a060020a61ffff02191690555b60038054600160a060020a03191633600160a060020a03161790555b5b610cb5806100426000396000f300606060405236156100f95763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166305d2035b81146100fe57806306fdde0314610125578063095ea7b3146101b057806318160ddd146101e657806323b872dd1461020b578063313ce567146102475780633f4ba83a1461027057806340c10f191461029757806342966c68146102cd5780635c975abb146102e557806370a082311461030c5780637d64bcb41461033d5780638456cb59146103645780638da5cb5b1461038b57806395d89b41146103ba578063a9059cbb14610445578063dd62ed3e1461047b578063f2fde38b146104b2575b600080fd5b341561010957600080fd5b6101116104d3565b604051901515815260200160405180910390f35b341561013057600080fd5b6101386104f5565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156101755780820151818401525b60200161015c565b50505050905090810190601f1680156101a25780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101bb57600080fd5b610111600160a060020a036004351660243561052c565b604051901515815260200160405180910390f35b34156101f157600080fd5b6101f96105d3565b60405190815260200160405180910390f35b341561021657600080fd5b610111600160a060020a03600435811690602435166044356105d9565b604051901515815260200160405180910390f35b341561025257600080fd5b61025a610609565b60405160ff909116815260200160405180910390f35b341561027b57600080fd5b61011161060e565b604051901515815260200160405180910390f35b34156102a257600080fd5b610111600160a060020a0360043516602435610697565b604051901515815260200160405180910390f35b34156102d857600080fd5b6102e360043561077a565b005b34156102f057600080fd5b61011161079f565b604051901515815260200160405180910390f35b341561031757600080fd5b6101f9600160a060020a03600435166107af565b60405190815260200160405180910390f35b341561034857600080fd5b6101116107ce565b604051901515815260200160405180910390f35b341561036f57600080fd5b610111610857565b604051901515815260200160405180910390f35b341561039657600080fd5b61039e6108e5565b604051600160a060020a03909116815260200160405180910390f35b34156103c557600080fd5b6101386108f4565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156101755780820151818401525b60200161015c565b50505050905090810190601f1680156101a25780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561045057600080fd5b610111600160a060020a036004351660243561092b565b604051901515815260200160405180910390f35b341561048657600080fd5b6101f9600160a060020a0360043581169060243516610959565b60405190815260200160405180910390f35b34156104bd57600080fd5b6102e3600160a060020a0360043516610986565b005b6003547501000000000000000000000000000000000000000000900460ff1681565b60408051908101604052601181527f446563656e7472616c616e64204d414e41000000000000000000000000000000602082015281565b600081158061055e5750600160a060020a03338116600090815260026020908152604080832093871683529290522054155b151561056957600080fd5b600160a060020a03338116600081815260026020908152604080832094881680845294909152908190208590557f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a35060015b92915050565b60005481565b60035460009060a060020a900460ff16156105f357600080fd5b6105fe8484846109de565b90505b5b9392505050565b601281565b60035460009033600160a060020a0390811691161461062c57600080fd5b60035460a060020a900460ff16151561064457600080fd5b6003805474ff0000000000000000000000000000000000000000191690557f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a15060015b5b5b90565b60035460009033600160a060020a039081169116146106b557600080fd5b6003547501000000000000000000000000000000000000000000900460ff16156106de57600080fd5b6000546106f1908363ffffffff610af316565b6000908155600160a060020a03841681526001602052604090205461071c908363ffffffff610af316565b600160a060020a0384166000818152600160205260409081902092909255907f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d41213968859084905190815260200160405180910390a25060015b5b5b92915050565b60035460a060020a900460ff161561079157600080fd5b61079a81610b0d565b5b5b50565b60035460a060020a900460ff1681565b600160a060020a0381166000908152600160205260409020545b919050565b60035460009033600160a060020a039081169116146107ec57600080fd5b6003805475ff000000000000000000000000000000000000000000191675010000000000000000000000000000000000000000001790557fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a15060015b5b90565b60035460009033600160a060020a0390811691161461087557600080fd5b60035460a060020a900460ff161561088c57600080fd5b6003805474ff0000000000000000000000000000000000000000191660a060020a1790557f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a15060015b5b5b90565b600354600160a060020a031681565b60408051908101604052600481527f4d414e4100000000000000000000000000000000000000000000000000000000602082015281565b60035460009060a060020a900460ff161561094557600080fd5b61094f8383610bb2565b90505b5b92915050565b600160a060020a038083166000908152600260209081526040808320938516835292905220545b92915050565b60035433600160a060020a039081169116146109a157600080fd5b600160a060020a0381161561079a576003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b5b50565b600160a060020a038084166000908152600260209081526040808320338516845282528083205493861683526001909152812054909190610a25908463ffffffff610af316565b600160a060020a038086166000908152600160205260408082209390935590871681522054610a5a908463ffffffff610c7216565b600160a060020a038616600090815260016020526040902055610a83818463ffffffff610c7216565b600160a060020a03808716600081815260026020908152604080832033861684529091529081902093909355908616917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9086905190815260200160405180910390a3600191505b509392505050565b600082820183811015610b0257fe5b8091505b5092915050565b6000808211610b1b57600080fd5b5033600160a060020a038116600090815260016020526040902054610b409083610c72565b600160a060020a03821660009081526001602052604081209190915554610b6d908363ffffffff610c7216565b600055600160a060020a0333167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca58360405190815260200160405180910390a25b5050565b600160a060020a033316600090815260016020526040812054610bdb908363ffffffff610c7216565b600160a060020a033381166000908152600160205260408082209390935590851681522054610c10908363ffffffff610af316565b600160a060020a0380851660008181526001602052604090819020939093559133909116907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a35060015b92915050565b600082821115610c7e57fe5b508082035b929150505600a165627a7a723058206d15acab9088b0b2a5ec9adfa928633f11e8c2e32526da817cf60b465d40a7a80029',
networks:
{ '1551886015434':
{ events:
{ '0x0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885':
{ anonymous: false, inputs: [Array], name: 'Mint', type: 'event' },
'0xae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa08':
{ anonymous: false,
inputs: [],
name: 'MintFinished',
type: 'event' },
'0x6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff625':
{ anonymous: false, inputs: [], name: 'Pause', type: 'event' },
'0x7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b33':
{ anonymous: false, inputs: [], name: 'Unpause', type: 'event' },
'0xcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5':
{ anonymous: false, inputs: [Array], name: 'Burn', type: 'event' },
'0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925':
{ anonymous: false,
inputs: [Array],
name: 'Approval',
type: 'event' },
'0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef':
{ anonymous: false,
inputs: [Array],
name: 'Transfer',
type: 'event' } },
links: {},
address: '0xf2ca89e8fc88989c366ce6616e5c8a3de4f65081',
updated_at: 1551886031258 } },
schema_version: '0.0.5',
updated_at: 1551886031258 },
parentSchema:
{ id: 'contract-object.spec.json',
'$schema': 'http://json-schema.org/schema#',
title: 'Contract Object',
description:
'Describes a contract consumable by Truffle, possibly including deployed instances on networks',
type: 'object',
properties:
{ contractName:
{ allOf: [ { '$ref': '#/definitions/ContractName' } ],
description: 'Name used to identify the contract',
default: 'Contract' },
abi:
{ allOf: [ { '$ref': 'abi.spec.json#' } ],
description: 'Interface description returned by compiler for source' },
bytecode:
{ allOf: [ { '$ref': '#/definitions/Bytecode' } ],
description:
'Bytecode sent as contract-creation transaction data, with unresolved link references' },
deployedBytecode:
{ allOf: [ { '$ref': '#/definitions/Bytecode' } ],
description:
'On-chain deployed contract bytecode, with unresolved link references' },
sourceMap:
{ allOf: [ { '$ref': '#/definitions/SourceMap' } ],
description:
'Source mapping for contract-creation transaction data bytecode' },
deployedSourceMap:
{ allOf: [ { '$ref': '#/definitions/SourceMap' } ],
description: 'Source mapping for contract bytecode' },
source: { '$ref': '#/definitions/Source' },
sourcePath: { '$ref': '#/definitions/SourcePath' },
ast: { '$ref': '#/definitions/AST' },
legacyAST: { '$ref': '#/definitions/LegacyAST' },
compiler:
{ type: 'object',
properties: { name: { type: 'string' }, version: { type: 'string' } } },
networks:
{ patternProperties:
{ '^[a-zA-Z0-9]+$': { '$ref': 'network-object.spec.json#' } },
additionalProperties: false },
schemaVersion: { '$ref': '#/definitions/SchemaVersion' },
updatedAt: { type: 'string', format: 'date-time' },
devdoc: { '$ref': '#/definitions/NatSpec' },
userdoc: { '$ref': '#/definitions/NatSpec' } },
required: [ 'abi' ],
patternProperties:
{ '^x-':
{ anyOf:
[ { type: 'string' },
{ type: 'number' },
{ type: 'object' },
{ type: 'array' } ] } },
additionalProperties: false,
definitions:
{ ContractName: { type: 'string', pattern: '^[a-zA-Z_][a-zA-Z0-9_]*$' },
NatSpec: { type: 'object' },
Bytecode:
{ type: 'string',
pattern: '^0x0$|^0x([a-fA-F0-9]{2}|__.{38})+$' },
Source: { type: 'string' },
SourceMap:
{ type: 'string',
examples:
[ '315:637:1:-;;;452:55;;;;;;;-1:-1:-1;;;;;485:9:1;476:19;:8;:19;;;;;;;;;;498:5;476:27;;452:55;315:637;;;;;;;' ] },
SourcePath: { type: 'string' },
AST: { type: 'object' },
LegacyAST: { type: 'object' },
SchemaVersion: { type: 'string', pattern: '[0-9]+\\.[0-9]+\\.[0-9]+' } } } }
at Object.validate (/home/cmarcelo/git/TasitSDK/node_modules/truffle/build/webpack:/packages/truffle-contract-schema/index.js:197:1)
at processTargets (/home/cmarcelo/git/TasitSDK/node_modules/truffle/build/webpack:/packages/truffle-external-compile/index.js:154:1)
Seems that the error is becuase this project is using an older JSON schema because after some manual changes (https://github.com/trufflesuite/truffle/issues/1799#issuecomment-472821965) it's working.
@marcelomorgado Ok so does that just mean you have to edit your external compile script? If you think it is something on our end, could you give me some steps to reproduce the error and investigate?
I cloned your project but it doesn't have an external compiler setup in the config.
Oh I see what you mean. Is upgrading your version of Truffle not an option? I know, for example, versions of the Solidity compiler earlier than 4.8 (I think?) have a slightly different schema and I'm not sure what version of solc version 3 of Truffle used. We currently don't have a "ready-made" solution for that problem. You could write your own script to make the schema valid, or you could open a PR if you have a fix ;)
Hmm yeah,
I think that the point here is the compatibility with an older schema. For me, this issue can be closed since I've solved my problem manually as commented above. Thanks!
Understood, thanks @marcelomorgado!