@@ -85,7 +85,7 @@ var selectorRegexp = regexp.MustCompile(`^([^\)]+)\(([A-Za-z0-9,\[\]]*)\)`)
8585
8686// parseSelector converts a method selector into an ABI JSON spec. The returned
8787// data is a valid JSON string which can be consumed by the standard abi package.
88- func parseSelector (selector string ) ([]byte , error ) {
88+ func parseSelector (unescapedSelector string ) ([]byte , error ) {
8989 // Define a tiny fake ABI struct for JSON marshalling
9090 type fakeArg struct {
9191 Type string `json:"type"`
@@ -95,10 +95,10 @@ func parseSelector(selector string) ([]byte, error) {
9595 Type string `json:"type"`
9696 Inputs []fakeArg `json:"inputs"`
9797 }
98- // Validate the selector and extract it's components
99- groups := selectorRegexp .FindStringSubmatch (selector )
98+ // Validate the unescapedSelector and extract it's components
99+ groups := selectorRegexp .FindStringSubmatch (unescapedSelector )
100100 if len (groups ) != 3 {
101- return nil , fmt .Errorf ("invalid selector %s (%v matches)" , selector , len (groups ))
101+ return nil , fmt .Errorf ("invalid selector %q (%v matches)" , unescapedSelector , len (groups ))
102102 }
103103 name := groups [1 ]
104104 args := groups [2 ]
@@ -115,7 +115,7 @@ func parseSelector(selector string) ([]byte, error) {
115115
116116// parseCallData matches the provided call data against the ABI definition and
117117// returns a struct containing the actual go-typed values.
118- func parseCallData (calldata []byte , abidata string ) (* decodedCallData , error ) {
118+ func parseCallData (calldata []byte , unescapedAbidata string ) (* decodedCallData , error ) {
119119 // Validate the call data that it has the 4byte prefix and the rest divisible by 32 bytes
120120 if len (calldata ) < 4 {
121121 return nil , fmt .Errorf ("invalid call data, incomplete method signature (%d bytes < 4)" , len (calldata ))
@@ -127,9 +127,9 @@ func parseCallData(calldata []byte, abidata string) (*decodedCallData, error) {
127127 return nil , fmt .Errorf ("invalid call data; length should be a multiple of 32 bytes (was %d)" , len (argdata ))
128128 }
129129 // Validate the called method and upack the call data accordingly
130- abispec , err := abi .JSON (strings .NewReader (abidata ))
130+ abispec , err := abi .JSON (strings .NewReader (unescapedAbidata ))
131131 if err != nil {
132- return nil , fmt .Errorf ("invalid method signature (%s ): %v" , abidata , err )
132+ return nil , fmt .Errorf ("invalid method signature (%q ): %v" , unescapedAbidata , err )
133133 }
134134 method , err := abispec .MethodById (sigdata )
135135 if err != nil {
0 commit comments