Unimplemented Feature in Solidity compiler
prince-hope1975 opened this issue · 2 comments
prince-hope1975 commented
Describe the error
The error occurred while trying to store a struct in a Map
To Reproduce
Here is the GitHub gist: https://gist.github.com/prince-hope1975/2b597699662c6091119b2eb941b2a6e7#file-index-rsh
The Error occurred in the API of a parallel reduce
const Blogger = API({createblog: Fun([Bytes(280)], Null),})
const defaultBlogType = Struct([
["blog", Array(Maybe(Bytes), MAX_BLOGS_PER_BLOGGER)],
["blogger", Maybe(Address)],
["likes", UInt],
["dislikes", UInt],
]);
const bloggerInfo = new Map(defaultBlogType);
.api(
Blogger.createblog,
(_) => {
check(true, "");
},
(_) => {
if (isSome(bloggerInfo[this])) return 0;
else {
return 10000;
}
},
(blob, k) => {
k(null);
const newBal = isSome(bloggerInfo[this]) ? 0 : 10000;
E.created(true);
const userBlog = extractBlog(bloggerInfo, this);
const blogField = Struct.toObject(userBlog);
bloggerInfo[this] = defaultBlogType.fromObject({
blog: isNone(bloggerInfo[this])
? Array.set(defaultBlogEntries, 0, MByte.Some(blob))
: Array.set(
blogField.blog,
fromSome(getNoneIndex(blogField.blog), 0) %
MAX_BLOGS_PER_BLOGGER,
MByte.Some(blob)
),
blogger: MAddr.Some(this),
likes: 0,
dislikes: 0,
});
return [blog, bal+newBal];
}
)
Error
Verifying knowledge assertions
Verifying for generic connector
Verifying when ALL participants are honest
Verifying when NO participants are honest
Checked 76 theorems; No failures!
reachc: The compiler has encountered an internal error:
The Solidity compiler failed with the message:
Unimplemented feature:
/solidity/libsolidity/codegen/ArrayUtils.cpp(240): Throw in function solidity::frontend::ArrayUtils::copyArrayToStorage(const solidity::frontend::ArrayType&, const solidity::frontend::ArrayType&) const::<lambda(solidity::frontend::CompilerContext&)>
Dynamic exception type: boost::wrapexcept<solidity::langutil::UnimplementedFeatureError>
std::exception::what: Copying of type struct T1 memory[7] memory to storage not yet supported.
[solidity::util::tag_comment*] = Copying of type struct T1 memory[7] memory to storage not yet supported.
Expected behavior
It was expected to just compile with no failures
Extra information
reach 0.1.11
jeapostrophe commented
Thank you for finding this. We'll work on it.
jeapostrophe commented
This was fixed in #1422