From 4d82d4f57acf11745bb2e1610c5777128f68bee4 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Tue, 8 Aug 2017 21:32:57 +0100 Subject: Store experimental flag in metadata CBOR --- libsolidity/interface/CompilerStack.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'libsolidity/interface') diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp index 7c66a843..bc52ff7a 100644 --- a/libsolidity/interface/CompilerStack.cpp +++ b/libsolidity/interface/CompilerStack.cpp @@ -653,6 +653,12 @@ void CompilerStack::compileContract( // CBOR-encoding of {"bzzr0": dev::swarmHash(metadata)} bytes{0xa1, 0x65, 'b', 'z', 'z', 'r', '0', 0x58, 0x20} + dev::swarmHash(metadata).asBytes(); + if (!_contract.sourceUnit().annotation().experimentalFeatures.empty()) + cborEncodedMetadata = + // CBOR-encoding of {"bzzr0": dev::swarmHash(metadata), "experimental": true} + bytes{0xa2, 0x65, 'b', 'z', 'z', 'r', '0', 0x58, 0x20} + + dev::swarmHash(metadata).asBytes() + + bytes{0x6c, 'e', 'x', 'p', 'e', 'r', 'i', 'm', 'e', 'n', 't', 'a', 'l', 0xf5}; solAssert(cborEncodedMetadata.size() <= 0xffff, "Metadata too large"); // 16-bit big endian length cborEncodedMetadata += toCompactBigEndian(cborEncodedMetadata.size(), 2); -- cgit