vyper
vyper copied to clipboard
Cannot pass a mere 4-byte signature via '_abi_encode'
Version Information
- vyper Version (output of
vyper --version
): 0.3.2 - OS: linux
- Python Version (output of
python --version
): 3.10.2
What's your issue about?
Perhaps, there is no way to pass a mere selector. The way like this does not work as well:
METHOD_ID: constant(Bytes[4]) = b"\x12\x34\x56\x78"
@external
@pure
def f0() -> Bytes[100]:
return _abi_encode(METHOD_ID, ensure_tuple=False)
this does not work either:
@external
@pure
def f1() -> Bytes[100]:
return _abi_encode(method_id=METHOD_ID)
For giggles, can you try METHOD_ID: constant(bytes4) = 0x12345678
?
meeting notes: _abi_encode
must have at least one positional arg. we should document this, and note in the docs that if you just want the 4-byte selector, you can use a constant - e.g. b"\x01\x02\x03\x04"
or method_id("foo(uint256)"