Require compiler field in published artifacts for v3 (#1961)

This commit is contained in:
Xianny 2019-07-16 12:25:08 -07:00 committed by GitHub
parent 6d6e7e1468
commit a977957946
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 0 deletions

View File

@ -7,6 +7,7 @@ export const REQUIRED_PROPERTIES: string[] = [
'compilerOutput.evm.bytecode.object', 'compilerOutput.evm.bytecode.object',
'compilerOutput.abi', 'compilerOutput.abi',
'compilerOutput.devdoc', 'compilerOutput.devdoc',
'compiler',
]; ];
export const FORBIDDEN_PROPERTIES: string[] = [ export const FORBIDDEN_PROPERTIES: string[] = [

View File

@ -29,6 +29,10 @@ describe('Contract Artifacts', () => {
const missingRequiredPropertiesByArtifact: ObjectMap<string[]> = {}; const missingRequiredPropertiesByArtifact: ObjectMap<string[]> = {};
for (const [artifactName, artifact] of Object.entries(artifacts)) { for (const [artifactName, artifact] of Object.entries(artifacts)) {
for (const requiredProperty of REQUIRED_PROPERTIES) { for (const requiredProperty of REQUIRED_PROPERTIES) {
// HACK (xianny): Remove after `compiler` field is added in v3.
if (requiredProperty === 'compiler' && artifact.schemaVersion === '2.0.0') {
continue;
}
const requiredValue = get(artifact, requiredProperty); const requiredValue = get(artifact, requiredProperty);
if (requiredValue === undefined || requiredValue === '') { if (requiredValue === undefined || requiredValue === '') {
const previousMissing = missingRequiredPropertiesByArtifact[artifactName]; const previousMissing = missingRequiredPropertiesByArtifact[artifactName];