Skip to content

Commit

Permalink
Remove the updates and participation params
Browse files Browse the repository at this point in the history
Remove the `updates` and `participation` parameters from `GET
/v2/block-headers`.

The underlying SQL code is now simpler.
  • Loading branch information
agodnic committed Nov 21, 2024
1 parent a302e5b commit 8cb90c1
Show file tree
Hide file tree
Showing 8 changed files with 435 additions and 675 deletions.
35 changes: 1 addition & 34 deletions api/converter_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -897,14 +897,8 @@ func (si *ServerImplementation) blockParamsToBlockFilter(params generated.Search
if params.Absent != nil {
numParticipationFilters++
}
if params.Updates != nil {
numParticipationFilters++
}
if params.Participation != nil {
numParticipationFilters++
}
if numParticipationFilters > 1 {
errorArr = append(errorArr, "only one of `proposer`, `expired`, `absent`, `updates`, or `participation` can be specified")
errorArr = append(errorArr, "only one of `proposer`, `expired`, or `absent` can be specified")
}

// Validate the number of items in the participation account lists
Expand All @@ -917,12 +911,6 @@ func (si *ServerImplementation) blockParamsToBlockFilter(params generated.Search
if params.Absent != nil && uint64(len(*params.Absent)) > si.opts.MaxAccountListSize {
errorArr = append(errorArr, fmt.Sprintf("absent list too long, max size is %d", si.opts.MaxAccountListSize))
}
if params.Updates != nil && uint64(len(*params.Updates)) > si.opts.MaxAccountListSize {
errorArr = append(errorArr, fmt.Sprintf("updates list too long, max size is %d", si.opts.MaxAccountListSize))
}
if params.Participation != nil && uint64(len(*params.Participation)) > si.opts.MaxAccountListSize {
errorArr = append(errorArr, fmt.Sprintf("participation list too long, max size is %d", si.opts.MaxAccountListSize))
}

filter.Proposers = make(map[sdk.Address]struct{}, 0)
if params.Proposer != nil {
Expand Down Expand Up @@ -950,27 +938,6 @@ func (si *ServerImplementation) blockParamsToBlockFilter(params generated.Search
filter.AbsentParticipationAccounts[addr] = struct{}{}
}
}

// Updates = absent || expired
if params.Updates != nil {
for _, s := range *params.Updates {
var addr sdk.Address
addr, errorArr = decodeAddress(s, "updates", errorArr)
filter.AbsentParticipationAccounts[addr] = struct{}{}
filter.ExpiredParticipationAccounts[addr] = struct{}{}
}
}

// Participation = proposer || absent || expired
if params.Participation != nil {
for _, s := range *params.Participation {
var addr sdk.Address
addr, errorArr = decodeAddress(s, "participation", errorArr)
filter.Proposers[addr] = struct{}{}
filter.AbsentParticipationAccounts[addr] = struct{}{}
filter.ExpiredParticipationAccounts[addr] = struct{}{}
}
}
}

// If there were any errorArr while setting up the BlockFilter, return now.
Expand Down
325 changes: 162 additions & 163 deletions api/generated/common/routes.go

Large diffs are not rendered by default.

6 changes: 0 additions & 6 deletions api/generated/common/types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

425 changes: 205 additions & 220 deletions api/generated/v2/routes.go

Large diffs are not rendered by default.

12 changes: 0 additions & 12 deletions api/generated/v2/types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 0 additions & 28 deletions api/indexer.oas2.json
Original file line number Diff line number Diff line change
Expand Up @@ -893,12 +893,6 @@
},
{
"$ref": "#/parameters/absent"
},
{
"$ref": "#/parameters/updates"
},
{
"$ref": "#/parameters/participation"
}
],
"responses": {
Expand Down Expand Up @@ -2771,28 +2765,6 @@
"in": "query",
"required": false
},
"updates": {
"type": "array",
"items": {
"type": "string",
"x-algorand-format": "Address"
},
"description": "Accounts marked as expired or absent in the block header's participation updates. This parameter accepts a comma separated list of addresses.",
"name": "updates",
"in": "query",
"required": false
},
"participation": {
"type": "array",
"items": {
"type": "string",
"x-algorand-format": "Address"
},
"description": "Accounts marked as expired, absent or as proposer in the block header's participation updates. This parameter accepts a comma separated list of addresses.",
"name": "participation",
"in": "query",
"required": false
},
"account-id": {
"type": "string",
"description": "account string",
Expand Down
56 changes: 0 additions & 56 deletions api/indexer.oas3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -221,20 +221,6 @@
},
"x-algorand-format": "base64"
},
"participation": {
"description": "Accounts marked as expired, absent or as proposer in the block header's participation updates. This parameter accepts a comma separated list of addresses.",
"explode": false,
"in": "query",
"name": "participation",
"schema": {
"items": {
"type": "string",
"x-algorand-format": "Address"
},
"type": "array"
},
"style": "form"
},
"proposer": {
"description": "Accounts marked as proposer in the block header's participation updates. This parameter accepts a comma separated list of addresses.",
"explode": false,
Expand Down Expand Up @@ -320,20 +306,6 @@
"schema": {
"type": "string"
}
},
"updates": {
"description": "Accounts marked as expired or absent in the block header's participation updates. This parameter accepts a comma separated list of addresses.",
"explode": false,
"in": "query",
"name": "updates",
"schema": {
"items": {
"type": "string",
"x-algorand-format": "Address"
},
"type": "array"
},
"style": "form"
}
},
"responses": {
Expand Down Expand Up @@ -4963,34 +4935,6 @@
"type": "array"
},
"style": "form"
},
{
"description": "Accounts marked as expired or absent in the block header's participation updates. This parameter accepts a comma separated list of addresses.",
"explode": false,
"in": "query",
"name": "updates",
"schema": {
"items": {
"type": "string",
"x-algorand-format": "Address"
},
"type": "array"
},
"style": "form"
},
{
"description": "Accounts marked as expired, absent or as proposer in the block header's participation updates. This parameter accepts a comma separated list of addresses.",
"explode": false,
"in": "query",
"name": "participation",
"schema": {
"items": {
"type": "string",
"x-algorand-format": "Address"
},
"type": "array"
},
"style": "form"
}
],
"responses": {
Expand Down
Loading

0 comments on commit 8cb90c1

Please sign in to comment.