Skip to content

Commit

Permalink
abi: fix abigen issue with make devtools (#10091)
Browse files Browse the repository at this point in the history
fixes #7593 

it introduced a regression: `"fmt"` and `"reflect"` imports were added
for all files generated by `abigen` assuming that they will be used in
all cases, however that assumption was wrong for some cases resulting in
invalid code being generated (in this case after running `make
devtools`):
<img width="982" alt="Screenshot 2024-04-27 at 10 50 37"
src="https://github.com/ledgerwatch/erigon/assets/94537774/9a1b93a5-2141-40d9-8c9e-01a1ff6c031c">
  • Loading branch information
taratorio authored Apr 27, 2024
1 parent 2241e11 commit 00850e0
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 2 deletions.
17 changes: 15 additions & 2 deletions accounts/abi/bind/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,21 @@ package {{.Package}}
import (
"math/big"
"strings"
"fmt"
"reflect"
{{range .Contracts}}
{{$stop := false}}
{{range .Transacts}}
{{if ne (len .Normalized.Inputs) 0}}
"fmt"
"reflect"
{{$stop = true}}
{{break}}
{{end}}
{{end}}
{{if $stop}}
{{break}}
{{end}}
{{end}}
ethereum "github.com/ledgerwatch/erigon"
"github.com/ledgerwatch/erigon/accounts/abi"
Expand Down
42 changes: 42 additions & 0 deletions consensus/aura/auraabi/gen_block_reward.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 00850e0

Please sign in to comment.