From 8a65262e985545afe43b5d952f4167b58695aaa3 Mon Sep 17 00:00:00 2001 From: Jared Wasinger Date: Thu, 31 Oct 2024 15:04:53 +0900 Subject: [PATCH] add back code that got mistakenly removed in the rebase --- accounts/abi/bind/bind.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/accounts/abi/bind/bind.go b/accounts/abi/bind/bind.go index 53f7e9dace..d5aab35a5d 100644 --- a/accounts/abi/bind/bind.go +++ b/accounts/abi/bind/bind.go @@ -266,6 +266,14 @@ func bind(types []string, abis []string, bytecodes []string, fsigs []map[string] // Ensure there is no duplicated identifier normalizedName := methodNormalizer(alias(aliases, original.Name)) + // Name shouldn't start with a digit. It will make the generated code invalid. + if len(normalizedName) > 0 && unicode.IsDigit(rune(normalizedName[0])) { + normalizedName = fmt.Sprintf("E%s", normalizedName) + normalizedName = abi.ResolveNameConflict(normalizedName, func(name string) bool { + _, ok := eventIdentifiers[name] + return ok + }) + } if eventIdentifiers[normalizedName] { return nil, fmt.Errorf("duplicated identifier \"%s\"(normalized \"%s\"), use --alias for renaming", original.Name, normalizedName) }