Store experimental flag in metadata CBOR#2712
Conversation
b1f2aba to
d12c138
Compare
bea518c to
ab84520
Compare
|
|
||
| namespace | ||
| { | ||
| bool safeExperimentalFeature(set<ExperimentalFeature> features) |
There was a problem hiding this comment.
const& for a bool?
error: returning reference to local temporary object
|
|
||
| namespace | ||
| { | ||
| bool safeExperimentalFeature(set<ExperimentalFeature> features) |
There was a problem hiding this comment.
also naming: activatesSomeUnsafeFeature, onlySafeFeaturesActivated?
| if (!safeExperimentalFeature(_contract.sourceUnit().annotation().experimentalFeatures)) | ||
| cborEncodedMetadata = | ||
| // CBOR-encoding of {"bzzr0": dev::swarmHash(metadata), "experimental": true} | ||
| bytes{0xa2, 0x65, 'b', 'z', 'z', 'r', '0', 0x58, 0x20} + |
There was a problem hiding this comment.
Also, can you extract the common part?
There was a problem hiding this comment.
Common part of cborEncodedMetadata? Note the first byte is different too.
There was a problem hiding this comment.
yes, so basically everything apart from the first byte. CBOR is defined in a way so that it can be composed at byte-level, isn't it?
There was a problem hiding this comment.
Yes and no. 0xa1 means hash map with one element, 0x65 b z ... is the key and the hash is the value.
I could pull out the key+value into a separate bytes variable, which is fine for this piece of code, but won't make it valid CBOR elements :)
12f5013 to
6525da8
Compare
None of the tests helpers Alternatively we could allow duplicates. |
95dc2a9 to
873aab2
Compare
873aab2 to
2d1bab0
Compare
|
@chriseth skipping that one test (to be fixed separately), should be ready |
Depends on #2690 and #2704.