-
Notifications
You must be signed in to change notification settings - Fork 21.5k
Closed
Description
go-ethereum/accounts/abi/bind/base.go
Lines 168 to 203 in 127dc59
| if opts.Pending { | |
| pb, ok := c.caller.(PendingContractCaller) | |
| if !ok { | |
| return ErrNoPendingState | |
| } | |
| output, err = pb.PendingCallContract(ctx, msg) | |
| if err == nil && len(output) == 0 { | |
| // Make sure we have a contract to operate on, and bail out otherwise. | |
| if code, err = pb.PendingCodeAt(ctx, c.address); err != nil { | |
| return err | |
| } else if len(code) == 0 { | |
| return ErrNoCode | |
| } | |
| } | |
| } else { | |
| output, err = c.caller.CallContract(ctx, msg, opts.BlockNumber) | |
| if err != nil { | |
| return err | |
| } | |
| if len(output) == 0 { | |
| // Make sure we have a contract to operate on, and bail out otherwise. | |
| if code, err = c.caller.CodeAt(ctx, c.address, opts.BlockNumber); err != nil { | |
| return err | |
| } else if len(code) == 0 { | |
| return ErrNoCode | |
| } | |
| } | |
| } | |
| if len(*results) == 0 { | |
| res, err := c.abi.Unpack(method, output) | |
| *results = res | |
| return err | |
| } | |
| res := *results | |
| return c.abi.UnpackIntoInterface(res[0], method, output) |
Here, if pb.PendingCallContract returns an non-nil error such as context.DeadlineExceeded that error is eaten. It will later error with abi: attempting to unmarshall an empty string while arguments are expected when attempting c.abi.Unpack(method, output) which is ambiguous. It would be more helpful to callers to return the deadline exceeded error. If Pending is false, you do get the "correct" error.
Metadata
Metadata
Assignees
Labels
No labels