From e6b1f5ccee25d47567b1aa03093b43abd03d3a29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Wed, 14 Jun 2023 09:19:37 +0200 Subject: [PATCH 1/2] cmdlineTest.sh: Remove compiler version from metadata in Standard JSON output as well --- test/cmdlineTests.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/test/cmdlineTests.sh b/test/cmdlineTests.sh index 3edcc5db3..e1d8a5746 100755 --- a/test/cmdlineTests.sh +++ b/test/cmdlineTests.sh @@ -221,6 +221,7 @@ EOF # shellcheck disable=SC1003 sed -i.bak -E -e 's/\\n/\'$'\n/g' "$stdout_path" sed -i.bak -e 's/\(^[ ]*auxdata:[[:space:]]\)0x[0-9a-f]*$/\1/' "$stdout_path" + sed -i.bak -e 's/\(\\"version\\":[ ]*\\"\)[^"\\]*\(\\"\)/\1\2/' "$stdout_path" rm "$stdout_path.bak" else sed -i.bak -e '/^Warning: This is a pre-release compiler version, please do not use it in production./d' "$stderr_path" From e45e6cc31dfbdf6479112a8b5f182002f28be6c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Wed, 14 Jun 2023 09:11:36 +0200 Subject: [PATCH 2/2] CLI tests for metadata output --- test/cmdlineTests/metadata/args | 1 + test/cmdlineTests/metadata/input.sol | 4 ++++ test/cmdlineTests/metadata/output | 4 ++++ test/cmdlineTests/standard_metadata/args | 1 + test/cmdlineTests/standard_metadata/in.sol | 4 ++++ .../cmdlineTests/standard_metadata/input.json | 11 +++++++++++ .../standard_metadata/output.json | 19 +++++++++++++++++++ 7 files changed, 44 insertions(+) create mode 100644 test/cmdlineTests/metadata/args create mode 100644 test/cmdlineTests/metadata/input.sol create mode 100644 test/cmdlineTests/metadata/output create mode 100644 test/cmdlineTests/standard_metadata/args create mode 100644 test/cmdlineTests/standard_metadata/in.sol create mode 100644 test/cmdlineTests/standard_metadata/input.json create mode 100644 test/cmdlineTests/standard_metadata/output.json diff --git a/test/cmdlineTests/metadata/args b/test/cmdlineTests/metadata/args new file mode 100644 index 000000000..5cbfceb47 --- /dev/null +++ b/test/cmdlineTests/metadata/args @@ -0,0 +1 @@ +--metadata diff --git a/test/cmdlineTests/metadata/input.sol b/test/cmdlineTests/metadata/input.sol new file mode 100644 index 000000000..a3a86cc8d --- /dev/null +++ b/test/cmdlineTests/metadata/input.sol @@ -0,0 +1,4 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity *; + +contract C {} diff --git a/test/cmdlineTests/metadata/output b/test/cmdlineTests/metadata/output new file mode 100644 index 000000000..bf1e750c9 --- /dev/null +++ b/test/cmdlineTests/metadata/output @@ -0,0 +1,4 @@ + +======= metadata/input.sol:C ======= +Metadata: +{"compiler":{"version": ""},"language":"Solidity","output":{"abi":[],"devdoc":{"kind":"dev","methods":{},"version":1},"userdoc":{"kind":"user","methods":{},"version":1}},"settings":{"compilationTarget":{"metadata/input.sol":"C"},"evmVersion":"shanghai","libraries":{},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":false,"runs":200},"remappings":[]},"sources":{"metadata/input.sol":{"keccak256":"0x5cf617b1707a484e3c4bd59643013dec76ab7d75900b46855214729ae3e0ceb0","license":"GPL-3.0","urls":["bzz-raw://ac418a02dfadf87234150d3568f33269e3f49460345cb39300e017a6d755eff2","dweb:/ipfs/QmQq3owBu25x2WV46HB1WyKzJpxiAPecU7eMKqtXCF7eeS"]}},"version":1} diff --git a/test/cmdlineTests/standard_metadata/args b/test/cmdlineTests/standard_metadata/args new file mode 100644 index 000000000..18532c5a6 --- /dev/null +++ b/test/cmdlineTests/standard_metadata/args @@ -0,0 +1 @@ +--allow-paths . diff --git a/test/cmdlineTests/standard_metadata/in.sol b/test/cmdlineTests/standard_metadata/in.sol new file mode 100644 index 000000000..a3a86cc8d --- /dev/null +++ b/test/cmdlineTests/standard_metadata/in.sol @@ -0,0 +1,4 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity *; + +contract C {} diff --git a/test/cmdlineTests/standard_metadata/input.json b/test/cmdlineTests/standard_metadata/input.json new file mode 100644 index 000000000..ae4bfe8f5 --- /dev/null +++ b/test/cmdlineTests/standard_metadata/input.json @@ -0,0 +1,11 @@ +{ + "language": "Solidity", + "sources": { + "C": {"urls": ["standard_metadata/in.sol"]} + }, + "settings": { + "outputSelection": { + "*": {"*": ["metadata"]} + } + } +} diff --git a/test/cmdlineTests/standard_metadata/output.json b/test/cmdlineTests/standard_metadata/output.json new file mode 100644 index 000000000..442946667 --- /dev/null +++ b/test/cmdlineTests/standard_metadata/output.json @@ -0,0 +1,19 @@ +{ + "contracts": + { + "C": + { + "C": + { + "metadata": "{\"compiler\":{\"version\":\"\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"C\":\"C\"},\"evmVersion\":\"shanghai\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"C\":{\"keccak256\":\"0x5cf617b1707a484e3c4bd59643013dec76ab7d75900b46855214729ae3e0ceb0\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://ac418a02dfadf87234150d3568f33269e3f49460345cb39300e017a6d755eff2\",\"dweb:/ipfs/QmQq3owBu25x2WV46HB1WyKzJpxiAPecU7eMKqtXCF7eeS\"]}},\"version\":1}" + } + } + }, + "sources": + { + "C": + { + "id": 0 + } + } +}