Skip to content

Commit

Permalink
fix existing tests and remove go-eth
Browse files Browse the repository at this point in the history
  • Loading branch information
Farber98 committed Sep 25, 2024
1 parent 1beed88 commit f0d8ce8
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
3 changes: 0 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ require (
github.com/bytecodealliance/wasmtime-go/v23 v23.0.0
github.com/confluentinc/confluent-kafka-go/v2 v2.3.0
github.com/dominikbraun/graph v0.23.0
github.com/ethereum/go-ethereum v1.13.8
github.com/fxamacker/cbor/v2 v2.5.0
github.com/go-json-experiment/json v0.0.0-20231102232822-2e55bd4e08b0
github.com/go-playground/validator/v10 v10.4.1
Expand Down Expand Up @@ -61,8 +60,6 @@ require (
sigs.k8s.io/yaml v1.4.0
)

require github.com/holiman/uint256 v1.2.4 // indirect

require (
github.com/bahlo/generic-list-go v0.2.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
Expand Down
4 changes: 0 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/ethereum/go-ethereum v1.13.8 h1:1od+thJel3tM52ZUNQwvpYOeRHlbkVFZ5S8fhi0Lgsg=
github.com/ethereum/go-ethereum v1.13.8/go.mod h1:sc48XYQxCzH3fG9BcrXCOOgQk2JfZzNAmIKnceogzsA=
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4=
github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI=
Expand Down Expand Up @@ -131,8 +129,6 @@ github.com/hashicorp/go-plugin v1.6.2-0.20240829161738-06afb6d7ae99 h1:OSQYEsRT3
github.com/hashicorp/go-plugin v1.6.2-0.20240829161738-06afb6d7ae99/go.mod h1:CkgLQ5CZqNmdL9U9JzM532t8ZiYQ35+pj3b1FD37R0Q=
github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE=
github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ=
github.com/holiman/uint256 v1.2.4 h1:jUc4Nk8fm9jZabQuqr2JzednajVmBpC+oiTiXZJEApU=
github.com/holiman/uint256 v1.2.4/go.mod h1:EOMSn4q6Nyt9P6efbI3bueV4e1b3dGlUCXeiRV4ng7E=
github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI=
github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
github.com/invopop/jsonschema v0.12.0 h1:6ovsNSuvn9wEQVOyc72aycBMVQFKz7cPdMJn10CvzRI=
Expand Down
7 changes: 7 additions & 0 deletions pkg/codec/encodings/type_codec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ func (*interfaceTesterBase) GetAccountBytes(i int) []byte {
return []byte{ib, ib + 1, ib + 2, ib + 3, ib + 4, ib + 5, ib + 6, ib + 7}
}

func (t *interfaceTesterBase) GetAccountString(i int) string {
return string(t.GetAccountBytes(i))
}

type bigEndianInterfaceTester struct {
interfaceTesterBase
lenient bool
Expand Down Expand Up @@ -170,6 +174,8 @@ func (b *bigEndianInterfaceTester) encode(t *testing.T, bytes []byte, ts TestStr
}
bytes = append(bytes, byte(len(ts.Account)))
bytes = append(bytes, ts.Account...)
bytes = rawbin.BigEndian.AppendUint32(bytes, uint32(len(ts.AccountStr)))
bytes = append(bytes, []byte(ts.AccountStr)...)
bytes = append(bytes, byte(len(ts.Accounts)))
for _, account := range ts.Accounts {
bytes = append(bytes, byte(len(account)))
Expand Down Expand Up @@ -230,6 +236,7 @@ func newTestStructCodec(t *testing.T, builder encodings.Builder) encodings.TypeC
{Name: "OracleID", Codec: builder.OracleID()},
{Name: "OracleIDs", Codec: oIDs},
{Name: "Account", Codec: acc},
{Name: "AccountStr", Codec: sCodec},
{Name: "Accounts", Codec: accs},
{Name: "BigField", Codec: bi},
{Name: "NestedStruct", Codec: midCodec},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,16 @@ func (*cannotEncode) UnmarshalText() error {
type interfaceTesterBase struct{}

var anyAccountBytes = []byte{1, 2, 3}
var anyAccountString = string(anyAccountBytes)

func (it *interfaceTesterBase) GetAccountBytes(_ int) []byte {
return anyAccountBytes
}

func (it *interfaceTesterBase) GetAccountString(_ int) string {
return anyAccountString
}

func (it *interfaceTesterBase) Name() string {
return "relay client"
}
Expand Down
3 changes: 3 additions & 0 deletions pkg/types/interfacetests/codec_interface_tests.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ func RunCodecInterfaceTests(t *testing.T, tester CodecInterfaceTester) {
resp := tester.EncodeFields(t, req)
compatibleItem := compatibleTestStruct{
Account: item.Account,
AccountStr: item.AccountStr,
Accounts: item.Accounts,
BigField: item.BigField,
DifferentField: item.DifferentField,
Expand Down Expand Up @@ -94,6 +95,7 @@ func RunCodecInterfaceTests(t *testing.T, tester CodecInterfaceTester) {
resp := tester.EncodeFields(t, req)
compatibleMap := map[string]any{
"Account": item.Account,
"AccountStr": item.AccountStr,
"Accounts": item.Accounts,
"BigField": item.BigField,
"DifferentField": item.DifferentField,
Expand Down Expand Up @@ -130,6 +132,7 @@ func RunCodecInterfaceTests(t *testing.T, tester CodecInterfaceTester) {
OracleID: ts.OracleID,
OracleIDs: ts.OracleIDs,
Account: ts.Account,
AccountStr: ts.AccountStr,
Accounts: ts.Accounts,
BigField: ts.BigField,
NestedStruct: ts.NestedStruct,
Expand Down

0 comments on commit f0d8ce8

Please sign in to comment.