accounts/abi: Prevent recalculation of internal fields (#20895)
* accounts/abi: prevent recalculation of ID, Sig and String * accounts/abi: fixed unpacking of no values * accounts/abi: multiple fixes to arguments * accounts/abi: refactored methodName and eventName This commit moves the complicated logic of how we assign method names and event names if they already exist into their own functions for better readability. * accounts/abi: prevent recalculation of internal In this commit, I changed the way we calculate the string representations, sig representations and the id's of methods. Before that these fields would be recalculated everytime someone called .Sig() .String() or .ID() on a method or an event. Additionally this commit fixes issue #20856 as we assign names to inputs with no name (input with name "" becomes "arg0") * accounts/abi: added unnamed event params test * accounts/abi: fixed rebasing errors in method sig * accounts/abi: fixed rebasing errors in method sig * accounts/abi: addressed comments * accounts/abi: added FunctionType enumeration * accounts/abi/bind: added test for unnamed arguments * accounts/abi: improved readability in NewMethod, nitpicks * accounts/abi: method/eventName -> overloadedMethodName
Showing
- accounts/abi/abi.go 44 additions, 80 deletionsaccounts/abi/abi.go
- accounts/abi/abi_test.go 48 additions, 29 deletionsaccounts/abi/abi_test.go
- accounts/abi/argument.go 24 additions, 31 deletionsaccounts/abi/argument.go
- accounts/abi/bind/base.go 2 additions, 2 deletionsaccounts/abi/bind/base.go
- accounts/abi/bind/bind.go 2 additions, 2 deletionsaccounts/abi/bind/bind.go
- accounts/abi/bind/bind_test.go 8 additions, 1 deletionaccounts/abi/bind/bind_test.go
- accounts/abi/event.go 46 additions, 23 deletionsaccounts/abi/event.go
- accounts/abi/event_test.go 2 additions, 2 deletionsaccounts/abi/event_test.go
- accounts/abi/method.go 78 additions, 41 deletionsaccounts/abi/method.go
- accounts/abi/method_test.go 1 addition, 1 deletionaccounts/abi/method_test.go
- accounts/abi/pack_test.go 7 additions, 7 deletionsaccounts/abi/pack_test.go
- accounts/abi/reflect.go 7 additions, 10 deletionsaccounts/abi/reflect.go
- signer/fourbyte/abi.go 2 additions, 2 deletionssigner/fourbyte/abi.go
- signer/fourbyte/fourbyte_test.go 2 additions, 2 deletionssigner/fourbyte/fourbyte_test.go
Loading
Please register or sign in to comment