Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

Struct inside struct in event make cargo build fail #1220

Open
nikkolasg opened this issue May 4, 2022 · 7 comments
Open

Struct inside struct in event make cargo build fail #1220

nikkolasg opened this issue May 4, 2022 · 7 comments
Labels
bug Something isn't working

Comments

@nikkolasg
Copy link
Contributor

Version

 > cargo tree | grep ethers                                                                               
│   ├── ethers v0.6.0 (https://github.com/gakonst/ethers-rs#a6568307)
│   │   ├── ethers-addressbook v0.1.0 (https://github.com/gakonst/ethers-rs#a6568307)
│   │   │   ├── ethers-core v0.6.0 (https://github.com/gakonst/ethers-rs#a6568307)
│   │   ├── ethers-contract v0.6.0 (https://github.com/gakonst/ethers-rs#a6568307)
│   │   │   ├── ethers-contract-abigen v0.6.0 (https://github.com/gakonst/ethers-rs#a6568307)
│   │   │   │   ├── ethers-core v0.6.0 (https://github.com/gakonst/ethers-rs#a6568307) (*)
│   │   │   ├── ethers-contract-derive v0.6.0 (proc-macro) (https://github.com/gakonst/ethers-rs#a6568307)
│   │   │   │   ├── ethers-contract-abigen v0.6.0 (https://github.com/gakonst/ethers-rs#a6568307) (*)
│   │   │   │   ├── ethers-core v0.6.0 (https://github.com/gakonst/ethers-rs#a6568307) (*)
│   │   │   ├── ethers-core v0.6.0 (https://github.com/gakonst/ethers-rs#a6568307) (*)
│   │   │   ├── ethers-providers v0.6.0 (https://github.com/gakonst/ethers-rs#a6568307)
│   │   │   │   ├── ethers-core v0.6.0 (https://github.com/gakonst/ethers-rs#a6568307) (*)
│   │   ├── ethers-core v0.6.0 (https://github.com/gakonst/ethers-rs#a6568307) (*)
│   │   ├── ethers-etherscan v0.2.0 (https://github.com/gakonst/ethers-rs#a6568307)
│   │   │   ├── ethers-core v0.6.0 (https://github.com/gakonst/ethers-rs#a6568307) (*)
│   │   │   ├── ethers-solc v0.3.0 (https://github.com/gakonst/ethers-rs#a6568307)
│   │   │   │   ├── ethers-core v0.6.0 (https://github.com/gakonst/ethers-rs#a6568307) (*)
│   │   ├── ethers-middleware v0.6.0 (https://github.com/gakonst/ethers-rs#a6568307)
│   │   │   ├── ethers-contract v0.6.0 (https://github.com/gakonst/ethers-rs#a6568307) (*)
│   │   │   ├── ethers-core v0.6.0 (https://github.com/gakonst/ethers-rs#a6568307) (*)
│   │   │   ├── ethers-etherscan v0.2.0 (https://github.com/gakonst/ethers-rs#a6568307) (*)
│   │   │   ├── ethers-providers v0.6.0 (https://github.com/gakonst/ethers-rs#a6568307) (*)
│   │   │   ├── ethers-signers v0.6.0 (https://github.com/gakonst/ethers-rs#a6568307)
│   │   │   │   ├── ethers-core v0.6.0 (https://github.com/gakonst/ethers-rs#a6568307) (*)
│   │   ├── ethers-providers v0.6.0 (https://github.com/gakonst/ethers-rs#a6568307) (*)
│   │   ├── ethers-signers v0.6.0 (https://github.com/gakonst/ethers-rs#a6568307) (*)
│   │   └── ethers-solc v0.3.0 (https://github.com/gakonst/ethers-rs#a6568307) (*)
├── ethers v0.6.0 (https://github.com/gakonst/ethers-rs#a6568307) (*)

Platform
64 bit - linux 5.15

Description

Having a contract with an event whose input is a struct containing substruct doesn't work.
See contract here.
Extract:

struct Bundle {
        Point[] points;
        SubBundle[] sub;
    }

    struct SubBundle {
        uint256 id;
        Point point;
    }
    event NewBundle(Bundle b);

cargo build returns

error: No such file or directory (os error 2)
   --> bindings/src/my_contract.rs:143:15
    |
143 |         abi = "NewBundle(((uint256,uint256)[],(uint256,(uint256,uint256))[]))"
    |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@nikkolasg nikkolasg added the bug Something isn't working label May 4, 2022
@nikkolasg nikkolasg changed the title Struct inside struct in event don't work Struct inside struct in event make cargo build fail May 4, 2022
@mattsse
Copy link
Collaborator

mattsse commented May 7, 2022

Ref #887

@nikkolasg
Copy link
Contributor Author

Hey - thanks for starting the work in #1234 ! <3
Any idea when the full parser is gonna be integrated into master ? My workaround so far is to flatten everything manually in events, but it'd be so much better with structs.

@mattsse
Copy link
Collaborator

mattsse commented May 20, 2022

will try to wrap this up in the upcoming days, hard work is completed though

@sveitser
Copy link
Contributor

sveitser commented Jun 2, 2022

I don't know if this is the same issue but I think it may be. I also got a compilation error when trying to emit a rather large struct here.

I first tried to just abi.encode the whole struct (which is a workaround we have used successfully in other cases) but in this case it led to runtime errors when decoding with AbiDecode. The current workaround is to emit abi encoded individual fields.

Please let me know if it's useful if I provide additional information.

@mattsse
Copy link
Collaborator

mattsse commented Jun 2, 2022

thanks,

do you have rust bindings, or the abi json for this? this would make it easier to debug

@sveitser
Copy link
Contributor

sveitser commented Jun 2, 2022

Sure. They are here: https://gist.github.com/sveitser/436b32469d191bb650d6cd4206abffe0

  • abi.json and bindings.rs is what works (using the workaround mentioned above).
  • abi_with_struct_event.json and binding_with_struct_event.rs is what fails.

I also added the output of cargo build. What looks somewhat weird are

error: File name too long (os error 36)
    --> contracts/rust/src/bindings/mod.rs:1194:15
     |
1194 | ... = "BlockCommitted(uint64,uint256[],((uint256,uint256),uint8[],(uint256[],uint256[],((uint256,uint256),(uint256,uint256),(uint256,uint256),(uint256,uint256),(uint256,uint256),(uint256,uint256),(uint256,uint256),(uint256,uint256),(uint256,uint256),(uint256,uint256),(uint256,uint256),(uint256,uint256),(uint256,uint256),uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256),((uint256,uint256),uint256[]),(uint256,uint128,uint64,(uint256,uint256),bytes))[],(uint256,uint256,uint256,uint128,(uint256,((uint256,uint256),(uint256,uint256),(uint256,uint256),uint256,uint128)),uint256,((uint256,uint256),(uint256,uint256),(uint256,uint256),(uint256,uint256),(uint256,uint256),(uint256,uint256),(uint256,uint256),(uint256,uint256),(uint256,uint256),(uint256,uint256),(uint256,uint256),(uint256,uint256),(uint256,uint256),uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256),((uint256,uint256),uint256[]),(uint256,uint128,(uint256,uint256)))[],(uint256[],uint256[],((uint256,uint256),(uint256,uint256),(uint256,uint256),(uint256,uint256),(uint256,uint256),(uint256,uint256),(uint256,uint256),(uint256,uint256),(uint256,uint256),(uint256,uint256),(uint256,uint256),(uint256,uint256),(uint256,uint256),uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256),(uint256,uint128,(uint256,uint256)))[],((uint256[],uint256[],((uint256,uint256),(uint256,uint256),(uint256,uint256),(uint256,uint256),(uint256,uint256),(uint256,uint256),(uint256,uint256),(uint256,uint256),(uint256,uint256),(uint256,uint256),(uint256,uint256),(uint256,uint256),(uint256,uint256),uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256),((uint256,uint256),uint256[]),(uint256,uint128,uint64,(uint256,uint256),bytes)),(uint128,(uint256,((uint256,uint256),(uint256,uint256),(uint256,uint256),uint256,uint128)),(uint256,uint256),bytes32,bool,uint256))[]))"
     |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

errors.

@mattsse
Copy link
Collaborator

mattsse commented Jul 19, 2022

vote close, this limitation should now be resolved with the new human readable parser

jaeaster added a commit to medusa-network/medusa-contracts that referenced this issue Sep 28, 2022
jaeaster added a commit to medusa-network/medusa-contracts that referenced this issue Sep 28, 2022
jaeaster added a commit to medusa-network/medusa-contracts that referenced this issue Sep 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants