hyperledger-firefly / hyperledger-firefly/firefly
FFI not handling overloaded methods
- Dominant language
- Go
- Stars
- 602
- Forks
- 246
- Avg merge
- 18h 47m
- Merged PRs (30d)
- 6
Description
EVM based blockchain has the capability to overload methods with different signatures. While converting the ABI of those methods into FFI, I have found that overloaded methods are not properly converted and only the first reference is converted into FFI representation.
**Steps to reproduce**
Call the `POST` `/contracts/interfaces/generate` endpoint with the following payload:
```
{
"description": "greeter contract",
"input": {
"abi": [
{
"inputs": [
{
"internalType": "contract IERC20",
"name": "_token",
"type": "address"
}
],
"name": "sendGreeting",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "string",
"name": "_a",
"type": "string"
}
],
"name": "sendGreeting",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract IERC20",
"name": "_token",
"type": "address"
},
{
"internalType": "uint256",
"name": "_amount",
"type": "uint256"
}
],
"name": "sendGreeting",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
]
},
"name": "greeting-test",
"namespace": "default",
"version": "1.0.0"
}
```
Actual outcome
```
{
"namespace": "default",
"name": "greeting-test",
"description": "greeter contract",
"version": "1.0.0",
"methods": [
{
"name": "sendGreeting",
"pathname": "",
"description": "",
"params": [
{
"name": "_token",
"schema": {
"type": "string",
"details": {
"type": "address",
"internalType": "contract IERC20"
},
"description": "A hex encoded set of bytes, with an optional '0x' prefix"
}
},
{
"name": "_amount",
"schema": {
"oneOf": [
{
"type": "string"
},
{
"type": "integer"
}
],
"details": {
"type": "uint256",
"internalType": "uint256"
},
"description": "An integer. You are recommended to use a JSON string. A JSON number can be used for values up to the safe maximum."
}
}
],
"returns": [],
"details": {
"stateMutability": "nonpayable"
}
}
]
}
```
Here the two other signatures for the method `sendGreeting` is ignored.
Contributor guide
Assessment
This issue has not been assessed yet.