Skip to content

Commit

Permalink
Updated TestStruct to include dynamic and static nested structs
Browse files Browse the repository at this point in the history
  • Loading branch information
silaslenihan committed Sep 27, 2024
1 parent f318966 commit e88b57d
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 13 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ require (
github.com/jpillora/backoff v1.0.0
github.com/pelletier/go-toml/v2 v2.2.0
github.com/prometheus/client_golang v1.17.0
github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925150249-664dd5a59715
github.com/smartcontractkit/chainlink-common v0.2.3-0.20240926180110-0784a13b2536
github.com/smartcontractkit/libocr v0.0.0-20240702141926-063ceef8c42e
github.com/stretchr/testify v1.9.0
go.uber.org/zap v1.27.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -435,8 +435,8 @@ github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeV
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925150249-664dd5a59715 h1:6s5a5g62qvUiHSyknLLw9h8Y0FfdVEsNHc5o/Q/T9w4=
github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925150249-664dd5a59715/go.mod h1:F6WUS6N4mP5ScwpwyTyAJc9/vjR+GXbMCRUOVekQi1g=
github.com/smartcontractkit/chainlink-common v0.2.3-0.20240926180110-0784a13b2536 h1:k6DLMavlqxr7cnZN1DOZLwxeiZfCK2UHeCJ0tyXSuw4=
github.com/smartcontractkit/chainlink-common v0.2.3-0.20240926180110-0784a13b2536/go.mod h1:F6WUS6N4mP5ScwpwyTyAJc9/vjR+GXbMCRUOVekQi1g=
github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7 h1:12ijqMM9tvYVEm+nR826WsrNi6zCKpwBhuApq127wHs=
github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7/go.mod h1:FX7/bVdoep147QQhsOPkYsPEXhGZjeYx6lBSaSXtZOA=
github.com/smartcontractkit/libocr v0.0.0-20240702141926-063ceef8c42e h1:9ypZ/8aW8Vm497i1gXHcT96oNLiu88jbg9QdX+IUE3E=
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ require (
github.com/lib/pq v1.10.9
github.com/pelletier/go-toml/v2 v2.2.2
github.com/rs/zerolog v1.33.0
github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925150249-664dd5a59715
github.com/smartcontractkit/chainlink-common v0.2.3-0.20240926180110-0784a13b2536
github.com/smartcontractkit/chainlink-solana v1.1.1-0.20240911182932-3c609a6ac664
github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.9
github.com/smartcontractkit/chainlink-testing-framework/seth v1.50.1
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1394,8 +1394,8 @@ github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8um
github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240924115754-8858b0423283 h1:f0vdqcOL9kJZwfmWE76roIyEuiZx/R82js0IfXNAvXg=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240924115754-8858b0423283/go.mod h1:KP82vFCqm+M1G1t6Vos5CewGUGYJkxxCEdxnta4uLlE=
github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925150249-664dd5a59715 h1:6s5a5g62qvUiHSyknLLw9h8Y0FfdVEsNHc5o/Q/T9w4=
github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925150249-664dd5a59715/go.mod h1:F6WUS6N4mP5ScwpwyTyAJc9/vjR+GXbMCRUOVekQi1g=
github.com/smartcontractkit/chainlink-common v0.2.3-0.20240926180110-0784a13b2536 h1:k6DLMavlqxr7cnZN1DOZLwxeiZfCK2UHeCJ0tyXSuw4=
github.com/smartcontractkit/chainlink-common v0.2.3-0.20240926180110-0784a13b2536/go.mod h1:F6WUS6N4mP5ScwpwyTyAJc9/vjR+GXbMCRUOVekQi1g=
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7 h1:lTGIOQYLk1Ufn++X/AvZnt6VOcuhste5yp+C157No/Q=
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7/go.mod h1:BMYE1vC/pGmdFSsOJdPrAA0/4gZ0Xo0SxTMdGspBtRo=
github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240916152957-433914114bd2 h1:yRk4ektpx/UxwarqAfgxUXLrsYXlaNeP1NOwzHGrK2Q=
Expand Down
37 changes: 30 additions & 7 deletions pkg/solana/chainreader/chain_reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,7 @@ func fullStructIDL(t *testing.T) string {
return fmt.Sprintf(
baseIDL,
strings.Join([]string{testStructAIDL, testStructBIDL}, ","),
strings.Join([]string{midLevelStructIDL, innerStructIDL}, ","),
strings.Join([]string{midLevelDynamicStructIDL, midLevelStaticStructIDL, innerDynamicStructIDL, innerStaticStructIDL}, ","),
)
}

Expand All @@ -877,7 +877,8 @@ const (
{"name": "field","type": {"option": "i32"}},
{"name": "differentField","type": "string"},
{"name": "bigField","type": "i128"},
{"name": "nestedStruct","type": {"defined": "MidLevelStruct"}}
{"name": "nestedDynamicStruct","type": {"defined": "MidLevelDynamicStruct"}},
{"name": "nestedStaticStruct","type": {"defined": "MidLevelStaticStruct"}}
]
}
}`
Expand All @@ -895,19 +896,30 @@ const (
}
}`

midLevelStructIDL = `{
"name": "MidLevelStruct",
midLevelDynamicStructIDL = `{
"name": "MidLevelDynamicStruct",
"type": {
"kind": "struct",
"fields": [
{"name": "fixedBytes", "type": {"array": ["u8",2]}},
{"name": "inner", "type": {"defined": "InnerTestStruct"}}
{"name": "inner", "type": {"defined": "InnerDynamicTestStruct"}}
]
}
}`

innerStructIDL = `{
"name": "InnerTestStruct",
midLevelStaticStructIDL = `{
"name": "MidLevelStaticStruct",
"type": {
"kind": "struct",
"fields": [
{"name": "fixedBytes", "type": {"array": ["u8",2]}},
{"name": "inner", "type": {"defined": "InnerStaticTestStruct"}}
]
}
}`

innerDynamicStructIDL = `{
"name": "InnerDynamicTestStruct",
"type": {
"kind": "struct",
"fields": [
Expand All @@ -917,6 +929,17 @@ const (
}
}`

innerStaticStructIDL = `{
"name": "InnerStaticTestStruct",
"type": {
"kind": "struct",
"fields": [
{"name": "i", "type": "i32"},
{"name": "a", "type": "bytes"}
]
}
}`

uint64BaseTypeIDL = `{
"name": "SimpleUint64Value",
"type": {
Expand Down

0 comments on commit e88b57d

Please sign in to comment.