We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vyper --version
interface Foo: def get_counter() -> (uint256, String[6]): payable @external def foo() -> Bytes[128]: return _abi_encode(Foo(msg.sender).get_counter(), method_id=method_id("foo()"))
In the generated code the following sequence appears twice [assert, [call, gas, caller, 0, [seq, [mstore, 320, 3932606317], 348], 4, 416, 128]]
[assert, [call, gas, caller, 0, [seq, [mstore, 320, 3932606317], 348], 4, 416, 128]]
commit 8f6ca4d contains the fix:
diff --git a/vyper/old_codegen/abi.py b/vyper/old_codegen/abi.py index 04b39797..16ae1a27 100644 --- a/vyper/old_codegen/abi.py +++ b/vyper/old_codegen/abi.py @@ -414,10 +414,18 @@ def abi_encode(dst, lll_node, pos=None, bufsz=None, returns_len=False): return LLLnode.from_list(lll_ret, pos=pos, annotation=f"abi_encode {lll_node.typ}") lll_ret = ["seq"] + + # contains some computation, we need to only do it once. + is_complex_lll = lll_node.value in ("seq", "seq_unchecked") + if is_complex_lll: + to_encode = LLLnode.from_list("to_encode", typ=lll_node.typ, location=lll_node.location, encoding=lll_node.encoding) + else: + to_encode = lll_node + dyn_ofst = "dyn_ofst" # current offset in the dynamic section dst_begin = "dst" # pointer to beginning of buffer dst_loc = "dst_loc" # pointer to write location in static section - os = o_list(lll_node, pos=pos) + os = o_list(to_encode, pos=pos) for i, o in enumerate(os): abi_t = abi_type_of(o.typ) @@ -477,6 +485,9 @@ def abi_encode(dst, lll_node, pos=None, bufsz=None, returns_len=False): lll_ret = ["with", dst_begin, dst, ["with", dst_loc, dst_begin, lll_ret]] + if is_complex_lll: + lll_ret = ["with", to_encode, lll_node, lll_ret] + return LLLnode.from_list(lll_ret, pos=pos, annotation=f"abi_encode {lll_node.typ}")
The text was updated successfully, but these errors were encountered:
fixed in #2447
Sorry, something went wrong.
charles-cooper
No branches or pull requests
Version Information
vyper --version
): v0.2.16What's your issue about?
In the generated code the following sequence appears twice
[assert, [call, gas, caller, 0, [seq, [mstore, 320, 3932606317], 348], 4, 416, 128]]
How can it be fixed?
commit 8f6ca4d contains the fix:
The text was updated successfully, but these errors were encountered: