Skip to content

abigen produces invalid go-code, redeclares structs #20282

@MariusVanDerWijden

Description

@MariusVanDerWijden

Hey guys,
I'm currently running into a bug while generating go-bindings out of our smart contracts.

Our current setup of the contract is the following:
contract X contains the definition of struct2
contract A includes contract B
contract B includes contract X
contract A includes contract X
both A and B use struct2 as function parameters for public + external functions.

If I generate the go bindings for A like this
go:generate abigen --pkg a --sol A.sol --out ../a/a.go
Abigen generates some structs twice. e.g.

// Struct2 is an auto generated low-level Go binding around an user-defined struct.
type Struct2 struct {
	a   []common.Address
	b [][]*big.Int
	c   []Struct1
}

//...

// Struct2 is an auto generated low-level Go binding around an user-defined struct.
type Struct2 struct {
	a   []common.Address
	b [][]*big.Int
	c   []Struct1
}

The issue still persists with 1.9.7-stable-a718daa6

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions