Skip to content

Commit

Permalink
Update to use the ErrSliceWrongLen
Browse files Browse the repository at this point in the history
  • Loading branch information
nolag committed Jan 2, 2024
1 parent cd919be commit 087b8eb
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion core/scripts/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ require (
github.com/pelletier/go-toml/v2 v2.1.1
github.com/shopspring/decimal v1.3.1
github.com/smartcontractkit/chainlink-automation v1.0.1
github.com/smartcontractkit/chainlink-common v0.1.7-0.20231222013743-f67285bba7bd
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240102192919-ec2eb47ea322
github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868
github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000
github.com/smartcontractkit/libocr v0.0.0-20231130143053-c5102a9c0fb7
Expand Down
4 changes: 2 additions & 2 deletions core/scripts/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1148,8 +1148,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv
github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M=
github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk=
github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k=
github.com/smartcontractkit/chainlink-common v0.1.7-0.20231222013743-f67285bba7bd h1:DsExL564kL/YwKWvUIMUKgdcpUE4Ryfi0aYIS/uXxmY=
github.com/smartcontractkit/chainlink-common v0.1.7-0.20231222013743-f67285bba7bd/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q=
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240102192919-ec2eb47ea322 h1:jkN1563+NFZPKnZtQfG7s0fuvaDkfQ4jOv7osmQTowg=
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240102192919-ec2eb47ea322/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q=
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 h1:Ju0cxdrzGFwHGDPp16IzkOyX87LZ/kKDFG1A+VSEJHY=
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI=
github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ=
Expand Down
2 changes: 1 addition & 1 deletion core/services/relay/evm/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func decodeAccountHook(from, to reflect.Type, data any) (any, error) {
} else if len(decoded) != common.AddressLength {
return nil, fmt.Errorf(
"%w: wrong number size for address expected %v got %v",
commontypes.ErrWrongNumberOfElements,
commontypes.ErrSliceWrongLen,
common.AddressLength, len(decoded))
}
return common.Address(decoded), nil
Expand Down
2 changes: 1 addition & 1 deletion core/services/relay/evm/decoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func (m *decoder) decodeArray(into any, rDecode reflect.Value) error {
iInto := reflect.Indirect(reflect.ValueOf(into))
length := rDecode.Len()
if length != iInto.Len() {
return commontypes.ErrWrongNumberOfElements
return commontypes.ErrSliceWrongLen
}
iInto.Set(reflect.New(iInto.Type()).Elem())
return setElements(length, rDecode, iInto)
Expand Down
2 changes: 1 addition & 1 deletion core/services/relay/evm/encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func encodeArray(item reflect.Value, info *codecEntry) ([]byte, error) {
switch info.checkedType.Kind() {
case reflect.Array:
if info.checkedType.Len() != length {
return nil, commontypes.ErrWrongNumberOfElements
return nil, commontypes.ErrSliceWrongLen
}
native = reflect.New(info.nativeType).Elem()
case reflect.Slice:
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ require (
github.com/shopspring/decimal v1.3.1
github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704
github.com/smartcontractkit/chainlink-automation v1.0.1
github.com/smartcontractkit/chainlink-common v0.1.7-0.20231222013743-f67285bba7bd
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240102192919-ec2eb47ea322
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71
github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1
github.com/smartcontractkit/chainlink-feeds v0.0.0-20231222013040-c93f24a1b105
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1134,8 +1134,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv
github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M=
github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk=
github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k=
github.com/smartcontractkit/chainlink-common v0.1.7-0.20231222013743-f67285bba7bd h1:DsExL564kL/YwKWvUIMUKgdcpUE4Ryfi0aYIS/uXxmY=
github.com/smartcontractkit/chainlink-common v0.1.7-0.20231222013743-f67285bba7bd/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q=
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240102192919-ec2eb47ea322 h1:jkN1563+NFZPKnZtQfG7s0fuvaDkfQ4jOv7osmQTowg=
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240102192919-ec2eb47ea322/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q=
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 h1:Ju0cxdrzGFwHGDPp16IzkOyX87LZ/kKDFG1A+VSEJHY=
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI=
github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ=
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ require (
github.com/segmentio/ksuid v1.0.4
github.com/slack-go/slack v0.12.2
github.com/smartcontractkit/chainlink-automation v1.0.1
github.com/smartcontractkit/chainlink-common v0.1.7-0.20231222013743-f67285bba7bd
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240102192919-ec2eb47ea322
github.com/smartcontractkit/chainlink-testing-framework v1.22.1
github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868
github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1465,8 +1465,8 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv
github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M=
github.com/smartcontractkit/chainlink-automation v1.0.1 h1:vVjBFq2Zsz21kPy1Pb0wpjF9zrbJX+zjXphDeeR4XZk=
github.com/smartcontractkit/chainlink-automation v1.0.1/go.mod h1:INSchkV3ntyDdlZKGWA030MPDpp6pbeuiRkRKYFCm2k=
github.com/smartcontractkit/chainlink-common v0.1.7-0.20231222013743-f67285bba7bd h1:DsExL564kL/YwKWvUIMUKgdcpUE4Ryfi0aYIS/uXxmY=
github.com/smartcontractkit/chainlink-common v0.1.7-0.20231222013743-f67285bba7bd/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q=
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240102192919-ec2eb47ea322 h1:jkN1563+NFZPKnZtQfG7s0fuvaDkfQ4jOv7osmQTowg=
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240102192919-ec2eb47ea322/go.mod h1:f+0ei9N4PlTJHu7pbGzEjTnBUr45syPdGFu5+31lS5Q=
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71 h1:Ju0cxdrzGFwHGDPp16IzkOyX87LZ/kKDFG1A+VSEJHY=
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231222201016-da3f0a763f71/go.mod h1:Ppv5X8MTUkkpKdb270dLefjio724vMkCWmSSaWo7CzI=
github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 h1:xYqRgZO0nMSO8CBCMR0r3WA+LZ4kNL8a6bnbyk/oBtQ=
Expand Down

0 comments on commit 087b8eb

Please sign in to comment.