From d5d9ff65138d2fd522c815ddad967e1987505de4 Mon Sep 17 00:00:00 2001 From: Mathias Baumann Date: Thu, 7 May 2020 18:49:54 +0200 Subject: [PATCH 1/8] Update picosha2 from upstream --- libsolutil/picosha2.h | 561 ++++++++++++++++++++++++----------------- scripts/check_style.sh | 25 +- 2 files changed, 345 insertions(+), 241 deletions(-) diff --git a/libsolutil/picosha2.h b/libsolutil/picosha2.h index 61aeb3b95..fdfabb5ac 100644 --- a/libsolutil/picosha2.h +++ b/libsolutil/picosha2.h @@ -1,7 +1,7 @@ /* The MIT License (MIT) -Copyright (C) 2014 okdshin +Copyright (C) 2017 okdshin Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -21,268 +21,365 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#pragma once +#ifndef PICOSHA2_H +#define PICOSHA2_H +// picosha2:20140213 + +#ifndef PICOSHA2_BUFFER_SIZE_FOR_INPUT_ITERATOR +#define PICOSHA2_BUFFER_SIZE_FOR_INPUT_ITERATOR \ + 1048576 //=1024*1024: default is 1MB memory +#endif -//picosha2:20140213 -#include -#include -#include -#include -#include -#include #include +#include +#include +#include +#include +#include +namespace picosha2 { +typedef unsigned long word_t; +typedef unsigned char byte_t; -namespace picosha2 -{ +static const size_t k_digest_size = 32; -namespace detail -{ +namespace detail { +inline byte_t mask_8bit(byte_t x) { return x & 0xff; } -inline uint8_t mask_8bit(uint8_t x) -{ - return x & 0xff; +inline word_t mask_32bit(word_t x) { return x & 0xffffffff; } + +const word_t add_constant[64] = { + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, + 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, + 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, + 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, + 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, + 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, + 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, + 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, + 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2}; + +const word_t initial_message_digest[8] = {0x6a09e667, 0xbb67ae85, 0x3c6ef372, + 0xa54ff53a, 0x510e527f, 0x9b05688c, + 0x1f83d9ab, 0x5be0cd19}; + +inline word_t ch(word_t x, word_t y, word_t z) { return (x & y) ^ ((~x) & z); } + +inline word_t maj(word_t x, word_t y, word_t z) { + return (x & y) ^ (x & z) ^ (y & z); } -inline uint32_t mask_32bit(uint32_t x) -{ - return x & 0xffffffff; +inline word_t rotr(word_t x, std::size_t n) { + assert(n < 32); + return mask_32bit((x >> n) | (x << (32 - n))); } -static uint32_t const add_constant[64] = { - 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, - 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, - 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, - 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, - 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, - 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, - 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, - 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, - 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, - 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, - 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, - 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, - 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, - 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, - 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, - 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 +inline word_t bsig0(word_t x) { return rotr(x, 2) ^ rotr(x, 13) ^ rotr(x, 22); } + +inline word_t bsig1(word_t x) { return rotr(x, 6) ^ rotr(x, 11) ^ rotr(x, 25); } + +inline word_t shr(word_t x, std::size_t n) { + assert(n < 32); + return x >> n; +} + +inline word_t ssig0(word_t x) { return rotr(x, 7) ^ rotr(x, 18) ^ shr(x, 3); } + +inline word_t ssig1(word_t x) { return rotr(x, 17) ^ rotr(x, 19) ^ shr(x, 10); } + +template +void hash256_block(RaIter1 message_digest, RaIter2 first, RaIter2 last) { + assert(first + 64 == last); + static_cast(last); // for avoiding unused-variable warning + word_t w[64]; + std::fill(w, w + 64, 0); + for (std::size_t i = 0; i < 16; ++i) { + w[i] = (static_cast(mask_8bit(*(first + i * 4))) << 24) | + (static_cast(mask_8bit(*(first + i * 4 + 1))) << 16) | + (static_cast(mask_8bit(*(first + i * 4 + 2))) << 8) | + (static_cast(mask_8bit(*(first + i * 4 + 3)))); + } + for (std::size_t i = 16; i < 64; ++i) { + w[i] = mask_32bit(ssig1(w[i - 2]) + w[i - 7] + ssig0(w[i - 15]) + + w[i - 16]); + } + + word_t a = *message_digest; + word_t b = *(message_digest + 1); + word_t c = *(message_digest + 2); + word_t d = *(message_digest + 3); + word_t e = *(message_digest + 4); + word_t f = *(message_digest + 5); + word_t g = *(message_digest + 6); + word_t h = *(message_digest + 7); + + for (std::size_t i = 0; i < 64; ++i) { + word_t temp1 = h + bsig1(e) + ch(e, f, g) + add_constant[i] + w[i]; + word_t temp2 = bsig0(a) + maj(a, b, c); + h = g; + g = f; + f = e; + e = mask_32bit(d + temp1); + d = c; + c = b; + b = a; + a = mask_32bit(temp1 + temp2); + } + *message_digest += a; + *(message_digest + 1) += b; + *(message_digest + 2) += c; + *(message_digest + 3) += d; + *(message_digest + 4) += e; + *(message_digest + 5) += f; + *(message_digest + 6) += g; + *(message_digest + 7) += h; + for (std::size_t i = 0; i < 8; ++i) { + *(message_digest + i) = mask_32bit(*(message_digest + i)); + } +} + +} // namespace detail + +template +void output_hex(InIter first, InIter last, std::ostream& os) { + os.setf(std::ios::hex, std::ios::basefield); + while (first != last) { + os.width(2); + os.fill('0'); + os << static_cast(*first); + ++first; + } + os.setf(std::ios::dec, std::ios::basefield); +} + +template +void bytes_to_hex_string(InIter first, InIter last, std::string& hex_str) { + std::ostringstream oss; + output_hex(first, last, oss); + hex_str.assign(oss.str()); +} + +template +void bytes_to_hex_string(const InContainer& bytes, std::string& hex_str) { + bytes_to_hex_string(bytes.begin(), bytes.end(), hex_str); +} + +template +std::string bytes_to_hex_string(InIter first, InIter last) { + std::string hex_str; + bytes_to_hex_string(first, last, hex_str); + return hex_str; +} + +template +std::string bytes_to_hex_string(const InContainer& bytes) { + std::string hex_str; + bytes_to_hex_string(bytes, hex_str); + return hex_str; +} + +class hash256_one_by_one { + public: + hash256_one_by_one() { init(); } + + void init() { + buffer_.clear(); + std::fill(data_length_digits_, data_length_digits_ + 4, 0); + std::copy(detail::initial_message_digest, + detail::initial_message_digest + 8, h_); + } + + template + void process(RaIter first, RaIter last) { + add_to_data_length(static_cast(std::distance(first, last))); + std::copy(first, last, std::back_inserter(buffer_)); + std::size_t i = 0; + for (; i + 64 <= buffer_.size(); i += 64) { + detail::hash256_block(h_, buffer_.begin() + i, + buffer_.begin() + i + 64); + } + buffer_.erase(buffer_.begin(), buffer_.begin() + i); + } + + void finish() { + byte_t temp[64]; + std::fill(temp, temp + 64, 0); + std::size_t remains = buffer_.size(); + std::copy(buffer_.begin(), buffer_.end(), temp); + temp[remains] = 0x80; + + if (remains > 55) { + std::fill(temp + remains + 1, temp + 64, 0); + detail::hash256_block(h_, temp, temp + 64); + std::fill(temp, temp + 64 - 4, 0); + } else { + std::fill(temp + remains + 1, temp + 64 - 4, 0); + } + + write_data_bit_length(&(temp[56])); + detail::hash256_block(h_, temp, temp + 64); + } + + template + void get_hash_bytes(OutIter first, OutIter last) const { + for (const word_t* iter = h_; iter != h_ + 8; ++iter) { + for (std::size_t i = 0; i < 4 && first != last; ++i) { + *(first++) = detail::mask_8bit( + static_cast((*iter >> (24 - 8 * i)))); + } + } + } + + private: + void add_to_data_length(word_t n) { + word_t carry = 0; + data_length_digits_[0] += n; + for (std::size_t i = 0; i < 4; ++i) { + data_length_digits_[i] += carry; + if (data_length_digits_[i] >= 65536u) { + carry = data_length_digits_[i] >> 16; + data_length_digits_[i] &= 65535u; + } else { + break; + } + } + } + void write_data_bit_length(byte_t* begin) { + word_t data_bit_length_digits[4]; + std::copy(data_length_digits_, data_length_digits_ + 4, + data_bit_length_digits); + + // convert byte length to bit length (multiply 8 or shift 3 times left) + word_t carry = 0; + for (std::size_t i = 0; i < 4; ++i) { + word_t before_val = data_bit_length_digits[i]; + data_bit_length_digits[i] <<= 3; + data_bit_length_digits[i] |= carry; + data_bit_length_digits[i] &= 65535u; + carry = (before_val >> (16 - 3)) & 65535u; + } + + // write data_bit_length + for (int i = 3; i >= 0; --i) { + (*begin++) = static_cast(data_bit_length_digits[i] >> 8); + (*begin++) = static_cast(data_bit_length_digits[i]); + } + } + std::vector buffer_; + word_t data_length_digits_[4]; // as 64bit integer (16bit x 4 integer) + word_t h_[8]; }; -static uint32_t const initial_message_digest[8] = { - 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, - 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 -}; - -inline uint32_t ch(uint32_t x, uint32_t y, uint32_t z) -{ - return (x & y) ^ ((~x) & z); +inline void get_hash_hex_string(const hash256_one_by_one& hasher, + std::string& hex_str) { + byte_t hash[k_digest_size]; + hasher.get_hash_bytes(hash, hash + k_digest_size); + return bytes_to_hex_string(hash, hash + k_digest_size, hex_str); } -inline uint32_t maj(uint32_t x, uint32_t y, uint32_t z) -{ - return (x & y) ^ (x & z) ^ (y & z); +inline std::string get_hash_hex_string(const hash256_one_by_one& hasher) { + std::string hex_str; + get_hash_hex_string(hasher, hex_str); + return hex_str; } -inline uint32_t rotr(uint32_t x, std::size_t n) -{ - assert(n < 32); - return mask_32bit((x >> n) | (x << (32 - n))); +namespace impl { +template +void hash256_impl(RaIter first, RaIter last, OutIter first2, OutIter last2, int, + std::random_access_iterator_tag) { + hash256_one_by_one hasher; + // hasher.init(); + hasher.process(first, last); + hasher.finish(); + hasher.get_hash_bytes(first2, last2); } -inline uint32_t bsig0(uint32_t x) -{ - return rotr(x, 2) ^ rotr(x, 13) ^ rotr(x, 22); +template +void hash256_impl(InputIter first, InputIter last, OutIter first2, + OutIter last2, int buffer_size, std::input_iterator_tag) { + std::vector buffer(buffer_size); + hash256_one_by_one hasher; + // hasher.init(); + while (first != last) { + int size = buffer_size; + for (int i = 0; i != buffer_size; ++i, ++first) { + if (first == last) { + size = i; + break; + } + buffer[i] = *first; + } + hasher.process(buffer.begin(), buffer.begin() + size); + } + hasher.finish(); + hasher.get_hash_bytes(first2, last2); +} } -inline uint32_t bsig1(uint32_t x) -{ - return rotr(x, 6) ^ rotr(x, 11) ^ rotr(x, 25); +template +void hash256(InIter first, InIter last, OutIter first2, OutIter last2, + int buffer_size = PICOSHA2_BUFFER_SIZE_FOR_INPUT_ITERATOR) { + picosha2::impl::hash256_impl( + first, last, first2, last2, buffer_size, + typename std::iterator_traits::iterator_category()); } -inline uint32_t shr(uint32_t x, std::size_t n) -{ - assert(n < 32); - return x >> n; +template +void hash256(InIter first, InIter last, OutContainer& dst) { + hash256(first, last, dst.begin(), dst.end()); } -inline uint32_t ssig0(uint32_t x) -{ - return rotr(x, 7) ^ rotr(x, 18) ^ shr(x, 3); +template +void hash256(const InContainer& src, OutIter first, OutIter last) { + hash256(src.begin(), src.end(), first, last); } -inline uint32_t ssig1(uint32_t x) -{ - return rotr(x, 17) ^ rotr(x, 19) ^ shr(x, 10); +template +void hash256(const InContainer& src, OutContainer& dst) { + hash256(src.begin(), src.end(), dst.begin(), dst.end()); } -template -void hash256_block(RaIter1 message_digest, RaIter2 first, RaIter2 last) -{ - (void)last; // FIXME: check this is valid - uint32_t w[64]; - std::fill(w, w+64, 0); - for (std::size_t i = 0; i < 16; ++i) - w[i] = (static_cast(mask_8bit(*(first + i * 4))) << 24) - | (static_cast(mask_8bit(*(first + i * 4 + 1))) << 16) - | (static_cast(mask_8bit(*(first + i * 4 + 2))) << 8) - | (static_cast(mask_8bit(*(first + i * 4 + 3)))); - for (std::size_t i = 16; i < 64; ++i) - w[i] = mask_32bit(ssig1(w[i-2])+w[i-7]+ssig0(w[i-15])+w[i-16]); - - uint32_t a = *message_digest; - uint32_t b = *(message_digest + 1); - uint32_t c = *(message_digest + 2); - uint32_t d = *(message_digest + 3); - uint32_t e = *(message_digest + 4); - uint32_t f = *(message_digest + 5); - uint32_t g = *(message_digest + 6); - uint32_t h = *(message_digest + 7); - - for (std::size_t i = 0; i < 64; ++i) - { - uint32_t temp1 = h+bsig1(e)+ch(e,f,g)+add_constant[i]+w[i]; - uint32_t temp2 = bsig0(a)+maj(a,b,c); - h = g; - g = f; - f = e; - e = mask_32bit(d+temp1); - d = c; - c = b; - b = a; - a = mask_32bit(temp1+temp2); - } - *message_digest += a; - *(message_digest+1) += b; - *(message_digest+2) += c; - *(message_digest+3) += d; - *(message_digest+4) += e; - *(message_digest+5) += f; - *(message_digest+6) += g; - *(message_digest+7) += h; - for (std::size_t i = 0; i < 8; ++i) - *(message_digest+i) = mask_32bit(*(message_digest+i)); -} - -}//namespace detail - -class hash256_one_by_one -{ -public: - hash256_one_by_one() - { - init(); - } - - void init() - { - buffer_.clear(); - std::fill(data_length_digits_, data_length_digits_ + 4, 0); - std::copy(detail::initial_message_digest, detail::initial_message_digest+8, h_); - } - - template - void process(RaIter first, RaIter last) - { - add_to_data_length(std::distance(first, last)); - std::copy(first, last, std::back_inserter(buffer_)); - std::size_t i = 0; - for (;i + 64 <= buffer_.size(); i+=64) - detail::hash256_block(h_, buffer_.begin()+i, buffer_.begin()+i+64); - buffer_.erase(buffer_.begin(), buffer_.begin()+i); - } - - void finish() - { - uint8_t temp[64]; - std::fill(temp, temp+64, 0); - std::size_t remains = buffer_.size(); - std::copy(buffer_.begin(), buffer_.end(), temp); - temp[remains] = 0x80; - - if (remains > 55) - { - std::fill(temp+remains+1, temp+64, 0); - detail::hash256_block(h_, temp, temp+64); - std::fill(temp, temp+64-4, 0); - } - else - std::fill(temp+remains+1, temp+64-4, 0); - - write_data_bit_length(&(temp[56])); - detail::hash256_block(h_, temp, temp+64); - } - - template - void get_hash_bytes(OutIter first, OutIter last) const - { - for (uint32_t const* iter = h_; iter != h_ + 8; ++iter) - for (std::size_t i = 0; i < 4 && first != last; ++i) - *(first++) = detail::mask_8bit(static_cast(*iter >> (24 - 8 * i))); - } - -private: - void add_to_data_length(uint32_t n) - { - uint32_t carry = 0; - data_length_digits_[0] += n; - for (std::size_t i = 0; i < 4; ++i) - { - data_length_digits_[i] += carry; - if (data_length_digits_[i] >= 65536u) - { - carry = data_length_digits_[i] >> 16; - data_length_digits_[i] &= 65535u; - } - else - break; - } - } - void write_data_bit_length(uint8_t* begin) - { - uint32_t data_bit_length_digits[4]; - std::copy( - data_length_digits_, data_length_digits_ + 4, - data_bit_length_digits - ); - - // convert byte length to bit length (multiply 8 or shift 3 times left) - uint32_t carry = 0; - for (std::size_t i = 0; i < 4; ++i) - { - uint32_t before_val = data_bit_length_digits[i]; - data_bit_length_digits[i] <<= 3; - data_bit_length_digits[i] |= carry; - data_bit_length_digits[i] &= 65535u; - carry = (before_val >> (16-3)) & 65535u; - } - - // write data_bit_length - for (int i = 3; i >= 0; --i) - { - (*begin++) = static_cast(data_bit_length_digits[i] >> 8); - (*begin++) = static_cast(data_bit_length_digits[i]); - } - } - std::vector buffer_; - uint32_t data_length_digits_[4]; //as 64bit integer (16bit x 4 integer) - uint32_t h_[8]; -}; - -template -void hash256(RaIter first, RaIter last, OutIter first2, OutIter last2) -{ - hash256_one_by_one hasher; - //hasher.init(); - hasher.process(first, last); - hasher.finish(); - hasher.get_hash_bytes(first2, last2); +template +void hash256_hex_string(InIter first, InIter last, std::string& hex_str) { + byte_t hashed[k_digest_size]; + hash256(first, last, hashed, hashed + k_digest_size); + std::ostringstream oss; + output_hex(hashed, hashed + k_digest_size, oss); + hex_str.assign(oss.str()); } template std::vector hash256(RaContainer const& _src) { - std::vector ret(32); - hash256(_src.begin(), _src.end(), ret.begin(), ret.end()); - return ret; + std::vector ret(32); + hash256(_src.begin(), _src.end(), ret.begin(), ret.end()); + return ret; } -}//namespace picosha2 +template +std::string hash256_hex_string(InIter first, InIter last) { + std::string hex_str; + hash256_hex_string(first, last, hex_str); + return hex_str; +} + +inline void hash256_hex_string(const std::string& src, std::string& hex_str) { + hash256_hex_string(src.begin(), src.end(), hex_str); +} + +template +void hash256_hex_string(const InContainer& src, std::string& hex_str) { + hash256_hex_string(src.begin(), src.end(), hex_str); +} + +template +std::string hash256_hex_string(const InContainer& src) { + return hash256_hex_string(src.begin(), src.end()); +} +templatevoid hash256(std::ifstream& f, OutIter first, OutIter last){ + hash256(std::istreambuf_iterator(f), std::istreambuf_iterator(), first,last); + +} +}// namespace picosha2 +#endif // PICOSHA2_H diff --git a/scripts/check_style.sh b/scripts/check_style.sh index 0bd6f6bc0..f8f6e4a0e 100755 --- a/scripts/check_style.sh +++ b/scripts/check_style.sh @@ -15,18 +15,25 @@ then exit 1 fi +function preparedGrep() +{ + git grep -nIE "$1" -- '*.h' '*.cpp' | grep -v "picosha2.h" + return $? +} + + FORMATERROR=$( ( - git grep -nIE "#include \"" -- '*.h' '*.cpp' | egrep -v -e "license.h" -e "BuildInfo.h" # Use include with <> characters - git grep -nIE "\<(if|for|while|switch)\(" -- '*.h' '*.cpp' # no space after "if", "for", "while" or "switch" - git grep -nIE "\\s*\([^=]*\>\s:\s.*\)" -- '*.h' '*.cpp' # no space before range based for-loop - git grep -nIE "\\s*\(.*\)\s*\{\s*$" -- '*.h' '*.cpp' # "{\n" on same line as "if" / "for" - git grep -nIE "[,\(<]\s*const " -- '*.h' '*.cpp' # const on left side of type - git grep -nIE "^\s*(static)?\s*const " -- '*.h' '*.cpp' # const on left side of type (beginning of line) - git grep -nIE "^ [^*]|[^*] | [^*]" -- '*.h' '*.cpp' # uses spaces for indentation or mixes spaces and tabs - git grep -nIE "[a-zA-Z0-9_]\s*[&][a-zA-Z_]" -- '*.h' '*.cpp' | egrep -v "return [&]" # right-aligned reference ampersand (needs to exclude return) + preparedGrep "#include \"" | egrep -v -e "license.h" -e "BuildInfo.h" # Use include with <> characters + preparedGrep "\<(if|for|while|switch)\(" # no space after "if", "for", "while" or "switch" + preparedGrep "\\s*\([^=]*\>\s:\s.*\)" # no space before range based for-loop + preparedGrep "\\s*\(.*\)\s*\{\s*$" # "{\n" on same line as "if" / "for" + preparedGrep "[,\(<]\s*const " # const on left side of type + preparedGrep "^\s*(static)?\s*const " # const on left side of type (beginning of line) + preparedGrep "^ [^*]|[^*] | [^*]" # uses spaces for indentation or mixes spaces and tabs + preparedGrep "[a-zA-Z0-9_]\s*[&][a-zA-Z_]" | egrep -v "return [&]" # right-aligned reference ampersand (needs to exclude return) # right-aligned reference pointer star (needs to exclude return and comments) - git grep -nIE "[a-zA-Z0-9_]\s*[*][a-zA-Z_]" -- '*.h' '*.cpp' | egrep -v -e "return [*]" -e "^* [*]" -e "^*//.*" + preparedGrep "[a-zA-Z0-9_]\s*[*][a-zA-Z_]" | egrep -v -e "return [*]" -e "^* [*]" -e "^*//.*" ) | egrep -v -e "^[a-zA-Z\./]*:[0-9]*:\s*\/(\/|\*)" -e "^test/" ) From 472fb21ee00aeec35dd8726d9d7c3d7e23050c97 Mon Sep 17 00:00:00 2001 From: Djordje Mijovic Date: Thu, 14 May 2020 12:34:37 +0200 Subject: [PATCH 2/8] [Sol->Yul] Enabling new bytes(n) --- libsolidity/codegen/YulUtilFunctions.cpp | 2 -- .../abiEncoderV1/abi_encode_calldata_slice.sol | 1 + .../abiEncoderV2/abi_encode_calldata_slice.sol | 1 + .../semanticTests/array/create_memory_byte_array.sol | 12 ++++++++++++ .../inlineAssembly/inline_assembly_memory_access.sol | 2 ++ 5 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 test/libsolidity/semanticTests/array/create_memory_byte_array.sol diff --git a/libsolidity/codegen/YulUtilFunctions.cpp b/libsolidity/codegen/YulUtilFunctions.cpp index 4fd681e1f..34b2e1279 100644 --- a/libsolidity/codegen/YulUtilFunctions.cpp +++ b/libsolidity/codegen/YulUtilFunctions.cpp @@ -1499,8 +1499,6 @@ string YulUtilFunctions::zeroComplexMemoryArrayFunction(ArrayType const& _type) string YulUtilFunctions::allocateAndInitializeMemoryArrayFunction(ArrayType const& _type) { - solUnimplementedAssert(!_type.isByteArray(), ""); - string functionName = "allocate_and_zero_memory_array_" + _type.identifier(); return m_functionCollector.createFunction(functionName, [&]() { return Whiskers(R"( diff --git a/test/libsolidity/semanticTests/abiEncoderV1/abi_encode_calldata_slice.sol b/test/libsolidity/semanticTests/abiEncoderV1/abi_encode_calldata_slice.sol index 917704e53..aaffb5b4b 100644 --- a/test/libsolidity/semanticTests/abiEncoderV1/abi_encode_calldata_slice.sol +++ b/test/libsolidity/semanticTests/abiEncoderV1/abi_encode_calldata_slice.sol @@ -56,6 +56,7 @@ contract C { } } // ==== +// compileViaYul: also // EVMVersion: >homestead // ---- // test_bytes() -> diff --git a/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_calldata_slice.sol b/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_calldata_slice.sol index 1f1444672..6253039f1 100644 --- a/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_calldata_slice.sol +++ b/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_calldata_slice.sol @@ -57,6 +57,7 @@ contract C { } } // ==== +// compileViaYul: also // EVMVersion: >homestead // ---- // test_bytes() -> diff --git a/test/libsolidity/semanticTests/array/create_memory_byte_array.sol b/test/libsolidity/semanticTests/array/create_memory_byte_array.sol new file mode 100644 index 000000000..67dcbffc3 --- /dev/null +++ b/test/libsolidity/semanticTests/array/create_memory_byte_array.sol @@ -0,0 +1,12 @@ +contract C { + function f() public returns (bytes1) { + bytes memory x = new bytes(35); + assert(x.length == 35); + x[34] = "A"; + return (x[34]); + } +} +// ==== +// compileViaYul: also +// ---- +// f() -> "A" diff --git a/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_memory_access.sol b/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_memory_access.sol index b43b5f611..857af4243 100644 --- a/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_memory_access.sol +++ b/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_memory_access.sol @@ -9,5 +9,7 @@ contract C { } } +// ==== +// compileViaYul: also // ---- // test() -> 0x20, 0x5, "12345" From e751a1c23d923ad67b9d8468b162faf4714d01ec Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 14 May 2020 11:56:10 +0200 Subject: [PATCH 3/8] Move scopes into resolver. --- libsolidity/analysis/NameAndTypeResolver.cpp | 5 +---- libsolidity/analysis/NameAndTypeResolver.h | 3 +-- libsolidity/interface/CompilerStack.cpp | 4 ++-- libsolidity/interface/CompilerStack.h | 2 -- test/libsolidity/Assembly.cpp | 3 +-- test/libsolidity/SolidityExpressionCompiler.cpp | 3 +-- 6 files changed, 6 insertions(+), 14 deletions(-) diff --git a/libsolidity/analysis/NameAndTypeResolver.cpp b/libsolidity/analysis/NameAndTypeResolver.cpp index 87482b78c..fa1840d06 100644 --- a/libsolidity/analysis/NameAndTypeResolver.cpp +++ b/libsolidity/analysis/NameAndTypeResolver.cpp @@ -37,16 +37,13 @@ namespace solidity::frontend NameAndTypeResolver::NameAndTypeResolver( GlobalContext& _globalContext, langutil::EVMVersion _evmVersion, - map>& _scopes, ErrorReporter& _errorReporter ): - m_scopes(_scopes), m_evmVersion(_evmVersion), m_errorReporter(_errorReporter), m_globalContext(_globalContext) { - if (!m_scopes[nullptr]) - m_scopes[nullptr] = make_shared(); + m_scopes[nullptr] = make_shared(); for (Declaration const* declaration: _globalContext.declarations()) { solAssert(m_scopes[nullptr]->registerDeclaration(*declaration), "Unable to register global declaration."); diff --git a/libsolidity/analysis/NameAndTypeResolver.h b/libsolidity/analysis/NameAndTypeResolver.h index 845b2870f..8a315510f 100644 --- a/libsolidity/analysis/NameAndTypeResolver.h +++ b/libsolidity/analysis/NameAndTypeResolver.h @@ -56,7 +56,6 @@ public: NameAndTypeResolver( GlobalContext& _globalContext, langutil::EVMVersion _evmVersion, - std::map>& _scopes, langutil::ErrorReporter& _errorReporter ); /// Registers all declarations found in the AST node, usually a source unit. @@ -123,7 +122,7 @@ private: /// where nullptr denotes the global scope. Note that structs are not scope since they do /// not contain code. /// Aliases (for example `import "x" as y;`) create multiple pointers to the same scope. - std::map>& m_scopes; + std::map> m_scopes; langutil::EVMVersion m_evmVersion; DeclarationContainer* m_currentScope = nullptr; diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp index e50d8990a..5b79aa0c6 100644 --- a/libsolidity/interface/CompilerStack.cpp +++ b/libsolidity/interface/CompilerStack.cpp @@ -214,7 +214,6 @@ void CompilerStack::reset(bool _keepSettings) m_metadataHash = MetadataHash::IPFS; } m_globalContext.reset(); - m_scopes.clear(); m_sourceOrder.clear(); m_contracts.clear(); m_errorReporter.clear(); @@ -314,7 +313,8 @@ bool CompilerStack::analyze() noErrors = false; m_globalContext = make_shared(); - NameAndTypeResolver resolver(*m_globalContext, m_evmVersion, m_scopes, m_errorReporter); + // We need to keep the same resolver during the whole process. + NameAndTypeResolver resolver(*m_globalContext, m_evmVersion, m_errorReporter); for (Source const* source: m_sourceOrder) if (source->ast && !resolver.registerDeclarations(*source->ast)) return false; diff --git a/libsolidity/interface/CompilerStack.h b/libsolidity/interface/CompilerStack.h index 8bc8828c6..d66f003b7 100644 --- a/libsolidity/interface/CompilerStack.h +++ b/libsolidity/interface/CompilerStack.h @@ -447,8 +447,6 @@ private: std::map m_smtlib2Responses; std::shared_ptr m_globalContext; std::vector m_sourceOrder; - /// This is updated during compilation. - std::map> m_scopes; std::map m_contracts; langutil::ErrorList m_errorList; langutil::ErrorReporter m_errorReporter; diff --git a/test/libsolidity/Assembly.cpp b/test/libsolidity/Assembly.cpp index 2af81c932..898de1427 100644 --- a/test/libsolidity/Assembly.cpp +++ b/test/libsolidity/Assembly.cpp @@ -58,9 +58,8 @@ evmasm::AssemblyItems compileContract(std::shared_ptr _sourceCode) BOOST_REQUIRE_NO_THROW(sourceUnit = parser.parse(make_shared(_sourceCode))); BOOST_CHECK(!!sourceUnit); - map> scopes; GlobalContext globalContext; - NameAndTypeResolver resolver(globalContext, solidity::test::CommonOptions::get().evmVersion(), scopes, errorReporter); + NameAndTypeResolver resolver(globalContext, solidity::test::CommonOptions::get().evmVersion(), errorReporter); DeclarationTypeChecker declarationTypeChecker(errorReporter, solidity::test::CommonOptions::get().evmVersion()); solAssert(Error::containsOnlyWarnings(errorReporter.errors()), ""); resolver.registerDeclarations(*sourceUnit); diff --git a/test/libsolidity/SolidityExpressionCompiler.cpp b/test/libsolidity/SolidityExpressionCompiler.cpp index 875a042fd..d40e64ebf 100644 --- a/test/libsolidity/SolidityExpressionCompiler.cpp +++ b/test/libsolidity/SolidityExpressionCompiler.cpp @@ -116,8 +116,7 @@ bytes compileFirstExpression( ErrorList errors; ErrorReporter errorReporter(errors); GlobalContext globalContext; - map> scopes; - NameAndTypeResolver resolver(globalContext, solidity::test::CommonOptions::get().evmVersion(), scopes, errorReporter); + NameAndTypeResolver resolver(globalContext, solidity::test::CommonOptions::get().evmVersion(), errorReporter); resolver.registerDeclarations(*sourceUnit); for (ASTPointer const& node: sourceUnit->nodes()) if (ContractDefinition* contract = dynamic_cast(node.get())) From 79e62f66008cff4b8c6c6bc1664b4958054bd735 Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 14 May 2020 13:58:00 +0200 Subject: [PATCH 4/8] Set version to 0.6.9. --- CMakeLists.txt | 2 +- Changelog.md | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ee698a715..a5689009e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ include(EthPolicy) eth_policy() # project name and version should be set after cmake_policy CMP0048 -set(PROJECT_VERSION "0.6.8") +set(PROJECT_VERSION "0.6.9") # OSX target needed in order to support std::visit set(CMAKE_OSX_DEPLOYMENT_TARGET "10.14") project(solidity VERSION ${PROJECT_VERSION} LANGUAGES C CXX) diff --git a/Changelog.md b/Changelog.md index 48eea3597..31d1e43a6 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,15 @@ +### 0.6.9 (unreleased) + +Language Features: + + +Compiler Features: + + +Bugfixes: + + + ### 0.6.8 (2020-05-14) Important Bugfixes: From a7f6a4bee644caee42780f55a9ee262c22bc3e11 Mon Sep 17 00:00:00 2001 From: Daniel Kirchner Date: Wed, 13 May 2020 18:09:48 +0200 Subject: [PATCH 5/8] Update PPA scripts. --- scripts/deps-ppa/static_z3.sh | 14 +++++--------- scripts/release_ppa.sh | 6 +++--- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/scripts/deps-ppa/static_z3.sh b/scripts/deps-ppa/static_z3.sh index 7eb461821..c5f6d6ea4 100755 --- a/scripts/deps-ppa/static_z3.sh +++ b/scripts/deps-ppa/static_z3.sh @@ -25,11 +25,9 @@ set -ev keyid=70D110489D66E2F6 email=builds@ethereum.org packagename=libz3-static-dev -# On the next version the git cherry-pick below should be removed and the patch suffix removed from the version string. -version=4.8.7 -version_patchsuffix=-1 +version=4.8.8 -DISTRIBUTIONS="bionic disco eoan focal" +DISTRIBUTIONS="bionic eoan focal" for distribution in $DISTRIBUTIONS do @@ -44,10 +42,8 @@ ppafilesurl=https://launchpad.net/~ethereum/+archive/ubuntu/${pparepo}/+files # Fetch source git clone --branch z3-${version} https://github.com/Z3Prover/z3.git cd z3 -# Patch build failure. -git cherry-pick e212159f4e -debversion="${version}${version_patchsuffix}" +debversion="${version}" CMAKE_OPTIONS="-DZ3_BUILD_LIBZ3_SHARED=OFF -DCMAKE_BUILD_TYPE=Release" @@ -181,7 +177,7 @@ This program is free software: you can redistribute it and/or modify Public License version 3 can be found in "/usr/share/common-licenses/GPL-3". EOF cat < debian/changelog -libz3-static-dev (0.0.1-2ubuntu0) saucy; urgency=low +libz3-static-dev (0.0.1-1ubuntu0) saucy; urgency=low * Initial release. @@ -191,7 +187,7 @@ mkdir debian/source echo "3.0 (quilt)" > debian/source/format chmod +x debian/rules -versionsuffix=2ubuntu0~${distribution} +versionsuffix=1ubuntu0~${distribution} EMAIL="$email" dch -v 1:${debversion}-${versionsuffix} "build of ${version}" # build source package diff --git a/scripts/release_ppa.sh b/scripts/release_ppa.sh index d84b3fd36..6d50e0066 100755 --- a/scripts/release_ppa.sh +++ b/scripts/release_ppa.sh @@ -55,9 +55,9 @@ keyid=70D110489D66E2F6 email=builds@ethereum.org packagename=solc -static_build_distribution=disco +static_build_distribution=focal -DISTRIBUTIONS="bionic disco eoan focal" +DISTRIBUTIONS="bionic eoan focal" if is_release then @@ -85,7 +85,7 @@ else fi if [ $distribution = focal ] then - SMTDEPENDENCY="libz3-dev, + SMTDEPENDENCY="libz3-static-dev, libcvc4-dev, " elif [ $distribution = disco ] From b56536aeb27ed892ea9960e7264f16337a395be8 Mon Sep 17 00:00:00 2001 From: Daniel Kirchner Date: Wed, 13 May 2020 18:16:21 +0200 Subject: [PATCH 6/8] Update Docker images. --- .circleci/config.yml | 4 ++-- .circleci/docker/Dockerfile.ubuntu2004 | 5 ++++- .circleci/docker/Dockerfile.ubuntu2004.clang | 7 +++++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 49f78fa19..0620cd667 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -12,10 +12,10 @@ parameters: default: "4" ubuntu-2004-docker-image-rev: type: string - default: "1" + default: "2" ubuntu-2004-clang-docker-image-rev: type: string - default: "1" + default: "2" ubuntu-1604-clang-ossfuzz-docker-image-rev: type: string default: "2" diff --git a/.circleci/docker/Dockerfile.ubuntu2004 b/.circleci/docker/Dockerfile.ubuntu2004 index d39025809..a021b6533 100644 --- a/.circleci/docker/Dockerfile.ubuntu2004 +++ b/.circleci/docker/Dockerfile.ubuntu2004 @@ -26,6 +26,9 @@ FROM buildpack-deps:focal AS base ARG DEBIAN_FRONTEND=noninteractive RUN set -ex; \ + dist=$(grep DISTRIB_CODENAME /etc/lsb-release | cut -d= -f2); \ + echo "deb http://ppa.launchpad.net/ethereum/cpp-build-deps/ubuntu $dist main" >> /etc/apt/sources.list ; \ + apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 1c52189c923f6ca9 ; \ apt-get update; \ apt-get install -qqy --no-install-recommends \ build-essential \ @@ -33,7 +36,7 @@ RUN set -ex; \ cmake ninja-build \ libboost-filesystem-dev libboost-test-dev libboost-system-dev \ libboost-program-options-dev \ - libcvc4-dev z3 libz3-dev \ + libcvc4-dev libz3-static-dev \ ; \ apt-get install -qy python3-pip python3-sphinx; \ pip3 install codecov; \ diff --git a/.circleci/docker/Dockerfile.ubuntu2004.clang b/.circleci/docker/Dockerfile.ubuntu2004.clang index f436c34b7..c8d057eb1 100644 --- a/.circleci/docker/Dockerfile.ubuntu2004.clang +++ b/.circleci/docker/Dockerfile.ubuntu2004.clang @@ -26,6 +26,9 @@ FROM buildpack-deps:focal AS base ARG DEBIAN_FRONTEND=noninteractive RUN set -ex; \ + dist=$(grep DISTRIB_CODENAME /etc/lsb-release | cut -d= -f2); \ + echo "deb http://ppa.launchpad.net/ethereum/cpp-build-deps/ubuntu $dist main" >> /etc/apt/sources.list ; \ + apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 1c52189c923f6ca9 ; \ apt-get update; \ apt-get install -qqy --no-install-recommends \ build-essential \ @@ -33,8 +36,8 @@ RUN set -ex; \ cmake ninja-build \ libboost-filesystem-dev libboost-test-dev libboost-system-dev \ libboost-program-options-dev \ - clang llvm-dev \ - z3 libz3-dev \ + clang \ + libz3-static-dev \ ; \ rm -rf /var/lib/apt/lists/* From 030390217393dbac1e78664b6b3f54accda2dca6 Mon Sep 17 00:00:00 2001 From: Daniel Kirchner Date: Thu, 14 May 2020 14:09:27 +0200 Subject: [PATCH 7/8] Update smt test expectations. --- .../loops/for_loop_array_assignment_storage_memory.sol | 1 - .../loops/for_loop_array_assignment_storage_storage.sol | 1 - .../loops/while_loop_array_assignment_storage_storage.sol | 1 - .../operators/compound_assignment_division_1.sol | 2 ++ .../operators/compound_assignment_division_2.sol | 2 ++ .../operators/compound_assignment_division_3.sol | 2 ++ .../smtCheckerTests/operators/delete_array_index_2d.sol | 1 - .../operators/division_truncates_correctly_1.sol | 2 ++ .../operators/division_truncates_correctly_2.sol | 2 ++ .../operators/division_truncates_correctly_3.sol | 2 ++ .../operators/division_truncates_correctly_4.sol | 2 ++ .../operators/division_truncates_correctly_5.sol | 2 ++ test/libsolidity/smtCheckerTests/operators/mod.sol | 2 ++ test/libsolidity/smtCheckerTests/operators/mod_even.sol | 2 ++ test/libsolidity/smtCheckerTests/operators/mod_n.sol | 2 ++ test/libsolidity/smtCheckerTests/operators/mod_n_uint16.sol | 2 ++ 16 files changed, 24 insertions(+), 4 deletions(-) diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_array_assignment_storage_memory.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_array_assignment_storage_memory.sol index 0b301505b..2466e1efd 100644 --- a/test/libsolidity/smtCheckerTests/loops/for_loop_array_assignment_storage_memory.sol +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_array_assignment_storage_memory.sol @@ -19,5 +19,4 @@ contract LoopFor2 { } } // ---- -// Warning: (316-336): Assertion violation happens here // Warning: (363-382): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_array_assignment_storage_storage.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_array_assignment_storage_storage.sol index 333273781..a90053024 100644 --- a/test/libsolidity/smtCheckerTests/loops/for_loop_array_assignment_storage_storage.sol +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_array_assignment_storage_storage.sol @@ -19,6 +19,5 @@ contract LoopFor2 { } } // ---- -// Warning: (317-337): Assertion violation happens here // Warning: (341-360): Assertion violation happens here // Warning: (364-383): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/loops/while_loop_array_assignment_storage_storage.sol b/test/libsolidity/smtCheckerTests/loops/while_loop_array_assignment_storage_storage.sol index 92d1ded3e..96f171054 100644 --- a/test/libsolidity/smtCheckerTests/loops/while_loop_array_assignment_storage_storage.sol +++ b/test/libsolidity/smtCheckerTests/loops/while_loop_array_assignment_storage_storage.sol @@ -21,6 +21,5 @@ contract LoopFor2 { } } // ---- -// Warning: (296-316): Assertion violation happens here // Warning: (320-339): Assertion violation happens here // Warning: (343-362): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/compound_assignment_division_1.sol b/test/libsolidity/smtCheckerTests/operators/compound_assignment_division_1.sol index 2e07fc9c1..e3a8ea1fb 100644 --- a/test/libsolidity/smtCheckerTests/operators/compound_assignment_division_1.sol +++ b/test/libsolidity/smtCheckerTests/operators/compound_assignment_division_1.sol @@ -9,4 +9,6 @@ contract C { } } // ---- +// Warning: (129-143): Error trying to invoke SMT solver. +// Warning: (147-161): Error trying to invoke SMT solver. // Warning: (147-161): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/compound_assignment_division_2.sol b/test/libsolidity/smtCheckerTests/operators/compound_assignment_division_2.sol index f7c347047..83bd7cb6b 100644 --- a/test/libsolidity/smtCheckerTests/operators/compound_assignment_division_2.sol +++ b/test/libsolidity/smtCheckerTests/operators/compound_assignment_division_2.sol @@ -10,4 +10,6 @@ contract C { } } // ---- +// Warning: (163-184): Error trying to invoke SMT solver. +// Warning: (188-209): Error trying to invoke SMT solver. // Warning: (188-209): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/compound_assignment_division_3.sol b/test/libsolidity/smtCheckerTests/operators/compound_assignment_division_3.sol index 5b466f173..b941a5767 100644 --- a/test/libsolidity/smtCheckerTests/operators/compound_assignment_division_3.sol +++ b/test/libsolidity/smtCheckerTests/operators/compound_assignment_division_3.sol @@ -10,4 +10,6 @@ contract C { } } // ---- +// Warning: (171-190): Error trying to invoke SMT solver. +// Warning: (194-213): Error trying to invoke SMT solver. // Warning: (194-213): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/delete_array_index_2d.sol b/test/libsolidity/smtCheckerTests/operators/delete_array_index_2d.sol index 8a1ba5e6e..a47763c03 100644 --- a/test/libsolidity/smtCheckerTests/operators/delete_array_index_2d.sol +++ b/test/libsolidity/smtCheckerTests/operators/delete_array_index_2d.sol @@ -16,4 +16,3 @@ contract C // ==== // SMTSolvers: z3 // ---- -// Warning: (174-194): Assertion violation happens here diff --git a/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_1.sol b/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_1.sol index 6bbc56a40..b0ea1e34d 100644 --- a/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_1.sol +++ b/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_1.sol @@ -6,3 +6,5 @@ contract C { assert(x / y == 3); } } +// ---- +// Warning: (107-125): Error trying to invoke SMT solver. diff --git a/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_2.sol b/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_2.sol index 6478e3298..e8afbdf59 100644 --- a/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_2.sol +++ b/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_2.sol @@ -6,3 +6,5 @@ contract C { assert(x / y == 3); } } +// ---- +// Warning: (105-123): Error trying to invoke SMT solver. diff --git a/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_3.sol b/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_3.sol index 1e58d709a..81ab88a4e 100644 --- a/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_3.sol +++ b/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_3.sol @@ -6,3 +6,5 @@ contract C { assert(x / y == -3); } } +// ---- +// Warning: (106-125): Error trying to invoke SMT solver. diff --git a/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_4.sol b/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_4.sol index 9f8452bb2..f6e6b57d1 100644 --- a/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_4.sol +++ b/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_4.sol @@ -6,3 +6,5 @@ contract C { assert(x / y == -3); } } +// ---- +// Warning: (106-125): Error trying to invoke SMT solver. diff --git a/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_5.sol b/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_5.sol index 2ac471156..d93a508f3 100644 --- a/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_5.sol +++ b/test/libsolidity/smtCheckerTests/operators/division_truncates_correctly_5.sol @@ -6,3 +6,5 @@ contract C { assert(x / y == 3); } } +// ---- +// Warning: (107-125): Error trying to invoke SMT solver. diff --git a/test/libsolidity/smtCheckerTests/operators/mod.sol b/test/libsolidity/smtCheckerTests/operators/mod.sol index 6a0730c01..358b52df2 100644 --- a/test/libsolidity/smtCheckerTests/operators/mod.sol +++ b/test/libsolidity/smtCheckerTests/operators/mod.sol @@ -8,3 +8,5 @@ contract C { assert(z1 == z2); } } +// ---- +// Warning: (166-182): Error trying to invoke SMT solver. diff --git a/test/libsolidity/smtCheckerTests/operators/mod_even.sol b/test/libsolidity/smtCheckerTests/operators/mod_even.sol index 184653eac..1bbdc38b7 100644 --- a/test/libsolidity/smtCheckerTests/operators/mod_even.sol +++ b/test/libsolidity/smtCheckerTests/operators/mod_even.sol @@ -8,3 +8,5 @@ contract C assert((y % 2) == 0); } } +// ---- +// Warning: (122-142): Error trying to invoke SMT solver. diff --git a/test/libsolidity/smtCheckerTests/operators/mod_n.sol b/test/libsolidity/smtCheckerTests/operators/mod_n.sol index 8df3ac4be..f4b1ee3e8 100644 --- a/test/libsolidity/smtCheckerTests/operators/mod_n.sol +++ b/test/libsolidity/smtCheckerTests/operators/mod_n.sol @@ -8,3 +8,5 @@ contract C assert(z < y); } } +// ---- +// Warning: (126-139): Error trying to invoke SMT solver. diff --git a/test/libsolidity/smtCheckerTests/operators/mod_n_uint16.sol b/test/libsolidity/smtCheckerTests/operators/mod_n_uint16.sol index fc6c7a8d6..9c4241f0b 100644 --- a/test/libsolidity/smtCheckerTests/operators/mod_n_uint16.sol +++ b/test/libsolidity/smtCheckerTests/operators/mod_n_uint16.sol @@ -8,3 +8,5 @@ contract C assert(z < 100_000); } } +// ---- +// Warning: (130-149): Error trying to invoke SMT solver. From af87d39bd67c79f78fdb2aae62616867be68e521 Mon Sep 17 00:00:00 2001 From: Daniel Kirchner Date: Thu, 14 May 2020 14:53:38 +0200 Subject: [PATCH 8/8] Update osx deps script. --- .circleci/osx_install_dependencies.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.circleci/osx_install_dependencies.sh b/.circleci/osx_install_dependencies.sh index 2409cbad7..064680139 100755 --- a/.circleci/osx_install_dependencies.sh +++ b/.circleci/osx_install_dependencies.sh @@ -43,13 +43,13 @@ then ./scripts/install_obsolete_jsoncpp_1_7_4.sh # z3 - wget https://github.com/Z3Prover/z3/releases/download/z3-4.8.7/z3-4.8.7-x64-osx-10.14.6.zip - unzip z3-4.8.7-x64-osx-10.14.6.zip - rm -f z3-4.8.7-x64-osx-10.14.6.zip - cp z3-4.8.7-x64-osx-10.14.6/bin/libz3.a /usr/local/lib - cp z3-4.8.7-x64-osx-10.14.6/bin/z3 /usr/local/bin - cp z3-4.8.7-x64-osx-10.14.6/include/* /usr/local/include - rm -rf z3-4.8.7-x64-osx-10.14.6 + wget https://github.com/Z3Prover/z3/releases/download/z3-4.8.8/z3-4.8.8-x64-osx-10.14.6.zip + unzip z3-4.8.8-x64-osx-10.14.6.zip + rm -f z3-4.8.8-x64-osx-10.14.6.zip + cp z3-4.8.8-x64-osx-10.14.6/bin/libz3.a /usr/local/lib + cp z3-4.8.8-x64-osx-10.14.6/bin/z3 /usr/local/bin + cp z3-4.8.8-x64-osx-10.14.6/include/* /usr/local/include + rm -rf z3-4.8.8-x64-osx-10.14.6 # evmone wget https://github.com/ethereum/evmone/releases/download/v0.4.0/evmone-0.4.0-darwin-x86_64.tar.gz