argotorg / argotorg/solidity

abi.decode: function type cannot be decoded

Open
#6,942 3 comments 0 reactions 1 assignee Claimed by @chriseth View on GitHub
bug :bug: should compile without error
Dominant language
C++
Stars
25.7k
Forks
6.2k
Avg merge
1d 11h
Merged PRs (30d)
21

Description

## Description

Function types are now available in solidity : I would like to abi.encode a function and then be able to abi.decode this function. The encoding works but the decoding bugs

## Environment

- Compiler version: 0.5.1
- Target EVM version (as per compiler settings):
- Framework/IDE (e.g. Truffle or Remix): truffle 5.0.21
- EVM execution environment / backend / blockchain client: ganache
- Operating system: ubuntu 18.10

## Steps to Reproduce

In solidity, encoding function type works
```
uint256 id;
address from;
function func (uint256 id1, uint256 id2) external { } ;
bytes memory data = abi.encode(id, from, func);
```

The decoding part here bugs
```
(uint orderId, address add, function (uint,uint) external thisFunc) = abi.decode(data, (uint,address,function));
```
Run : truffle compile
=> Error message
CompileError: ParsedContract.sol:88:158: ParserError: Expected primary expression.

I also tried this
```
(uint orderId, address add, function (uint,uint) external func) = abi.decode(data, (uint,address,function(uint,uint) external));
```
Run : truffle compile
=> Error message
CompileError: ParsedContract.sol:88:158: ParserError: Expected primary expression.

Could someone help me with this issue ?

Thank you very much in advance ! ^^

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.