[Sol->Yul] Implementing copying dynamically encoded structs from calldata to memory

Co-authored-by: Leonardo <leo@ethereum.org>
This commit is contained in:
Djordje MijovicandLeonardo committed 2020-11-23 23:22:34 +01:00
1 parent 61425e3541
commit eea6513b5d
7 files changed
+159 -8

No files matched your search

+8 -6
View File
@@ -2992,14 +2992,16 @@ string YulUtilFunctions::conversionFunction(Type const& _from, Type const& _to)
solUnimplementedAssert(fromStructType.location() != DataLocation::Memory, "");
if (fromStructType.location() == DataLocation::CallData)
{
solUnimplementedAssert(!fromStructType.isDynamicallyEncoded(), "");
body = Whiskers(R"(
converted := <abiDecode>(value, calldatasize())
)")("abiDecode", ABIFunctions(m_evmVersion, m_revertStrings, m_functionCollector).tupleDecoder(
{&toStructType}
)).render();
}
)")
(
"abiDecode",
ABIFunctions(m_evmVersion, m_revertStrings, m_functionCollector).abiDecodingFunctionStruct(
toStructType,
false
)
).render();
else
{
solAssert(fromStructType.location() == DataLocation::Storage, "");