Skip to content

Commit

Permalink
linting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
silaslenihan committed Sep 25, 2024
1 parent ce6d47a commit fe50d58
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
12 changes: 8 additions & 4 deletions pkg/codec/encodings/type_codec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,9 @@ func (b *bigEndianInterfaceTester) encode(t *testing.T, bytes []byte, ts TestStr
bytes = rawbin.BigEndian.AppendUint32(bytes, uint32(len(ts.NestedDynamicStruct.Inner.S)))
bytes = append(bytes, []byte(ts.NestedDynamicStruct.Inner.S)...)
bytes = append(bytes, ts.NestedStaticStruct.FixedBytes[:]...)
bytes = rawbin.BigEndian.AppendUint64(bytes, uint64(ts.NestedStaticStruct.Inner.Int))
bytes = rawbin.BigEndian.AppendUint64(bytes, uint64(ts.NestedStaticStruct.Inner.I))
bytes = rawbin.BigEndian.AppendUint32(bytes, uint32(len(ts.NestedStaticStruct.Inner.A)))
bytes = append(bytes, []byte(ts.NestedStaticStruct.Inner.A)...)
bytes = append(bytes, ts.NestedStaticStruct.Inner.A...)
if request.ExtraField {
bytes = append(bytes, 5)
}
Expand All @@ -201,29 +201,33 @@ func newTestStructCodec(t *testing.T, builder encodings.Builder) encodings.TypeC
sCodec, err := builder.String(math.MaxInt32)
require.NoError(t, err)

require.NoError(t, err)
arr2, err := encodings.NewArray(2, builder.Uint8())
require.NoError(t, err)

size, err := builder.Int(1)
require.NoError(t, err)

require.NoError(t, err)
acc, err := encodings.NewSlice(builder.Uint8(), size)
require.NoError(t, err)

innerDynamicTestStruct, err := encodings.NewStructCodec([]encodings.NamedTypeCodec{
{Name: "I", Codec: builder.Int64()},
{Name: "S", Codec: sCodec},
})
require.NoError(t, err)

innerStaticTestStruct, err := encodings.NewStructCodec([]encodings.NamedTypeCodec{
{Name: "I", Codec: builder.Int64()},
{Name: "A", Codec: acc},
})
require.NoError(t, err)

midDyanmicCodec, err := encodings.NewStructCodec([]encodings.NamedTypeCodec{
{Name: "FixedBytes", Codec: arr2},
{Name: "Inner", Codec: innerDynamicTestStruct},
})
require.NoError(t, err)

midStaticCodec, err := encodings.NewStructCodec([]encodings.NamedTypeCodec{
{Name: "FixedBytes", Codec: arr2},
{Name: "Inner", Codec: innerStaticTestStruct},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,6 @@ func (f *fakeContractReader) SetBatchLatestValues(batchCallEntry BatchCallEntry)
}

func (f *fakeContractReader) GetLatestValue(_ context.Context, readIdentifier string, confidenceLevel primitives.ConfidenceLevel, params, returnVal any) error {

if strings.HasSuffix(readIdentifier, MethodReturningAlterableUint64) {
r := returnVal.(*uint64)
for i := len(f.vals) - 1; i >= 0; i-- {
Expand Down Expand Up @@ -520,7 +519,6 @@ func (f *fakeContractReader) GetLatestValue(_ context.Context, readIdentifier st
}

return nil

}

func (f *fakeContractReader) BatchGetLatestValues(_ context.Context, request types.BatchGetLatestValuesRequest) (types.BatchGetLatestValuesResult, error) {
Expand Down Expand Up @@ -602,7 +600,6 @@ func (f *fakeContractReader) QueryKey(_ context.Context, _ types.BoundContract,
}
}
if len(filter.Expressions) == 0 || doAppend {

if isValueType {
value, err := values.Wrap(trigger.testStruct)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions pkg/types/interfacetests/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ type InnerDynamicTestStruct struct {

type InnerStaticTestStruct struct {
I int
A []byte
A []byte
}

type MidLevelDynamicTestStruct struct {
Expand Down Expand Up @@ -231,7 +231,7 @@ func CreateTestStruct[T any](i int, tester BasicTester[T]) TestStruct {
FixedBytes: [2]byte{uint8(i), uint8(i + 1)},
Inner: InnerStaticTestStruct{
I: i,
A: tester.GetAccountBytes(i + 6),
A: tester.GetAccountBytes(i + 6),
},
},
}
Expand Down

0 comments on commit fe50d58

Please sign in to comment.