Skip to content

Commit

Permalink
Merge pull request #185 from covalenthq/develop
Browse files Browse the repository at this point in the history
Bsp-agent-DTM-RC:v1.4.4 @noslav @sudeepdino008
  • Loading branch information
noslav authored Apr 19, 2023
2 parents 94fe955 + 25f8f57 commit d6815d3
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 33 deletions.
67 changes: 37 additions & 30 deletions codec/block-ethereum.avsc
Original file line number Diff line number Diff line change
Expand Up @@ -285,11 +285,14 @@
},
{
"name":"uncles",
"type":{
"type":"array",
"items":"Header"
},
"default": []
"type":[
"null",
{
"type":"array",
"items":"Header"
}
],
"default":"null"
},
{
"name":"Receipts",
Expand Down Expand Up @@ -488,31 +491,35 @@
},
{
"name":"Withdrawals",
"type":{
"type":"array",
"items":{
"name":"Withdrawals_record",
"type":"record",
"fields":[
{
"name":"index",
"type":"long"
},
{
"name":"validatorIndex",
"type":"long"
},
{
"name":"address",
"type":"string"
},
{
"name":"amount",
"type":"long"
}
]
"type":[
"null",
{
"type":"array",
"items":{
"name":"Withdrawals_record",
"type":"record",
"fields":[
{
"name":"index",
"type":"long"
},
{
"name":"validatorIndex",
"type":"long"
},
{
"name":"address",
"type":"string"
},
{
"name":"amount",
"type":"long"
}
]
}
}
}
],
"default":"null"
}
]
}
Expand All @@ -536,7 +543,7 @@
{
"name":"codecVersion",
"type":"double",
"default":0.33
"default":0.34
}
]
}
Binary file modified data/redis/dump.rdb
Binary file not shown.
8 changes: 8 additions & 0 deletions internal/types/types_test/int_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,14 @@ func TestAvroConversion(t *testing.T) {
CodeRead: []*types.CodeRead{},
BlockhashRead: []*types.BlockhashRead{},
},
Withdrawals: []*types.Withdrawal{
{
Index: 1,
Validator: 33,
Address: from,
Amount: 123455,
},
},
},
},
},
Expand Down
19 changes: 16 additions & 3 deletions internal/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const (
// BspAgentVersionMinor is Minor version component of the current release
BspAgentVersionMinor = 4
// BspAgentVersionPatch is Patch version component of the current release
BspAgentVersionPatch = 3
BspAgentVersionPatch = 4
)

// BspAgentVersion holds the textual version string.
Expand Down Expand Up @@ -304,7 +304,8 @@ func MapToAvroUnion(data map[string]interface{}) map[string]interface{} {
m3 := m2[k3].(map[string]interface{})
vsd := m3
for k4 := range m3 {
if k4 == "Transactions" {
switch k4 {
case "Transactions":
m4 := m3[k4].([]interface{})
vst := m4
for k5 := range m4 {
Expand All @@ -328,7 +329,8 @@ func MapToAvroUnion(data map[string]interface{}) map[string]interface{} {
vst[k5] = vsm
}
vsd[k4] = vst
} else if k4 == "Header" {

case "Header":
m4 := m3[k4].(map[string]interface{})
vst := m4
for k5, v5 := range m4 {
Expand All @@ -341,8 +343,19 @@ func MapToAvroUnion(data map[string]interface{}) map[string]interface{} {
}
}
vsd[k4] = vst

case "Withdrawals":
if m3[k4] == nil {
vsd[k4] = goavro.Union("null", nil)
} else {
m4 := m3[k4].([]interface{})
vsd[k4] = goavro.Union("array", m4)
}
}
}
if vsd["Withdrawals"] == nil {
vsd["Withdrawals"] = goavro.Union("null", nil)
}
vso[k3] = vsd
}
}
Expand Down

0 comments on commit d6815d3

Please sign in to comment.