Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pool registration/retirement active/inactive epoch fix #246

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion files/grest/rpc/pool/pool_registrations.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ RETURNS TABLE (
block_height word31type,
epoch_no word31type,
epoch_slot word31type,
active_epoch_no word31type
active_epoch_no bigint
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While the change presented seems OK, it might be worth checking see why it fails for you - it didnt seem to give trouble for any of the core instances. In fact I just re-ran with a reset again on my testnet instance. In fact , as you might see - it is currently live with word31type as output field for mentioned column.
Is there any additional detail that might help understand here why you got the mentioned error?

  • dbsync version
  • postgres version
  • Output of \dD+ word31type tho I doubt that should change at all.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it's probably the warnings/error settings specifically in our dockered koios(-tiny) stack, I just pointed it out. This seems to work without error in the original version.

  • postgres 12.14-alpine
  • dbsync 13.1.1.3

In DBSync schema active_epoch_no is integer (64), so that's why I think it's throwing an error:

Screenshot 2023-11-21 at 14 07 23

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In pool_updates.sql (as the parent of pool_registrations.sql and pool_retirements.sql) active_epoch_no specified as bigint, and I think it should be brought to the same format, especially as you see on other versions of postgres it crashes in error:

tx_hash text,
block_time integer,
pool_id_bech32 character varying,
pool_id_hex text,
active_epoch_no bigint,
vrf_key_hash text,
margin double precision,
fixed_cost text,
pledge text,
reward_addr character varying,
owners character varying [],
relays jsonb [],
meta_url character varying,
meta_hash text,
meta_json jsonb,
update_type text,
retiring_epoch word31type

Copy link
Contributor

@rdlrt rdlrt Nov 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

postgres 12.14-alpine

Gotcha, maybe it is the version, happy for that part of update (aligning bigint vs word31type) to be from this PR

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

)
LANGUAGE SQL STABLE
AS $$
Expand Down
2 changes: 1 addition & 1 deletion files/grest/rpc/pool/pool_retirements.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ RETURNS TABLE (
block_height word31type,
epoch_no word31type,
epoch_slot word31type,
active_epoch_no word31type
retiring_epoch word31type
rdlrt marked this conversation as resolved.
Show resolved Hide resolved
)
LANGUAGE SQL STABLE
AS $$
Expand Down
24 changes: 22 additions & 2 deletions specs/results/koiosapi-guild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1475,7 +1475,7 @@ paths:
content:
application/json:
schema:
$ref: "#/components/schemas/pool_registrations"
$ref: "#/components/schemas/pool_retirements"
"400":
$ref: "#/components/responses/BadRequest"
"401":
Expand Down Expand Up @@ -2745,7 +2745,7 @@ components:
description: Latest transaction hash used for delegation by the account
example: 368d08fe86804d637649341d3aec4a9baa7dffa6d00f16de2ba9dba814f1c948
pool_registrations:
description: Array of pool registrations/retirements
description: Array of pool registrations
type: array
items:
type: object
Expand All @@ -2764,6 +2764,26 @@ components:
$ref: "#/components/schemas/blocks/items/properties/epoch_slot"
active_epoch_no:
$ref: "#/components/schemas/pool_updates/items/properties/active_epoch_no"
pool_retirements:
description: Array of pool retirements
type: array
items:
type: object
properties:
pool_id_bech32:
$ref: "#/components/schemas/pool_info/items/properties/pool_id_bech32"
tx_hash:
$ref: "#/components/schemas/tx_info/items/properties/tx_hash"
block_hash:
$ref: "#/components/schemas/blocks/items/properties/hash"
block_height:
$ref: "#/components/schemas/blocks/items/properties/block_height"
epoch_no:
$ref: "#/components/schemas/epoch_info/items/properties/epoch_no"
epoch_slot:
$ref: "#/components/schemas/blocks/items/properties/epoch_slot"
retiring_epoch:
$ref: "#/components/schemas/pool_updates/items/properties/retiring_epoch"
pool_delegators_history:
description: Array of pool delegators (historical)
type:
Expand Down
24 changes: 22 additions & 2 deletions specs/results/koiosapi-mainnet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1475,7 +1475,7 @@ paths:
content:
application/json:
schema:
$ref: "#/components/schemas/pool_registrations"
$ref: "#/components/schemas/pool_retirements"
"400":
$ref: "#/components/responses/BadRequest"
"401":
Expand Down Expand Up @@ -2745,7 +2745,7 @@ components:
description: Latest transaction hash used for delegation by the account
example: 368d08fe86804d637649341d3aec4a9baa7dffa6d00f16de2ba9dba814f1c948
pool_registrations:
description: Array of pool registrations/retirements
description: Array of pool registrations
type: array
items:
type: object
Expand All @@ -2764,6 +2764,26 @@ components:
$ref: "#/components/schemas/blocks/items/properties/epoch_slot"
active_epoch_no:
$ref: "#/components/schemas/pool_updates/items/properties/active_epoch_no"
pool_retirements:
description: Array of pool retirements
type: array
items:
type: object
properties:
pool_id_bech32:
$ref: "#/components/schemas/pool_info/items/properties/pool_id_bech32"
tx_hash:
$ref: "#/components/schemas/tx_info/items/properties/tx_hash"
block_hash:
$ref: "#/components/schemas/blocks/items/properties/hash"
block_height:
$ref: "#/components/schemas/blocks/items/properties/block_height"
epoch_no:
$ref: "#/components/schemas/epoch_info/items/properties/epoch_no"
epoch_slot:
$ref: "#/components/schemas/blocks/items/properties/epoch_slot"
retiring_epoch:
$ref: "#/components/schemas/pool_updates/items/properties/retiring_epoch"
pool_delegators_history:
description: Array of pool delegators (historical)
type:
Expand Down
24 changes: 22 additions & 2 deletions specs/results/koiosapi-preprod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1475,7 +1475,7 @@ paths:
content:
application/json:
schema:
$ref: "#/components/schemas/pool_registrations"
$ref: "#/components/schemas/pool_retirements"
"400":
$ref: "#/components/responses/BadRequest"
"401":
Expand Down Expand Up @@ -2745,7 +2745,7 @@ components:
description: Latest transaction hash used for delegation by the account
example: 368d08fe86804d637649341d3aec4a9baa7dffa6d00f16de2ba9dba814f1c948
pool_registrations:
description: Array of pool registrations/retirements
description: Array of pool registrations
type: array
items:
type: object
Expand All @@ -2764,6 +2764,26 @@ components:
$ref: "#/components/schemas/blocks/items/properties/epoch_slot"
active_epoch_no:
$ref: "#/components/schemas/pool_updates/items/properties/active_epoch_no"
pool_retirements:
description: Array of pool retirements
type: array
items:
type: object
properties:
pool_id_bech32:
$ref: "#/components/schemas/pool_info/items/properties/pool_id_bech32"
tx_hash:
$ref: "#/components/schemas/tx_info/items/properties/tx_hash"
block_hash:
$ref: "#/components/schemas/blocks/items/properties/hash"
block_height:
$ref: "#/components/schemas/blocks/items/properties/block_height"
epoch_no:
$ref: "#/components/schemas/epoch_info/items/properties/epoch_no"
epoch_slot:
$ref: "#/components/schemas/blocks/items/properties/epoch_slot"
retiring_epoch:
$ref: "#/components/schemas/pool_updates/items/properties/retiring_epoch"
pool_delegators_history:
description: Array of pool delegators (historical)
type:
Expand Down
24 changes: 22 additions & 2 deletions specs/results/koiosapi-preview.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1475,7 +1475,7 @@ paths:
content:
application/json:
schema:
$ref: "#/components/schemas/pool_registrations"
$ref: "#/components/schemas/pool_retirements"
"400":
$ref: "#/components/responses/BadRequest"
"401":
Expand Down Expand Up @@ -2745,7 +2745,7 @@ components:
description: Latest transaction hash used for delegation by the account
example: 368d08fe86804d637649341d3aec4a9baa7dffa6d00f16de2ba9dba814f1c948
pool_registrations:
description: Array of pool registrations/retirements
description: Array of pool registrations
type: array
items:
type: object
Expand All @@ -2764,6 +2764,26 @@ components:
$ref: "#/components/schemas/blocks/items/properties/epoch_slot"
active_epoch_no:
$ref: "#/components/schemas/pool_updates/items/properties/active_epoch_no"
pool_retirements:
description: Array of pool retirements
type: array
items:
type: object
properties:
pool_id_bech32:
$ref: "#/components/schemas/pool_info/items/properties/pool_id_bech32"
tx_hash:
$ref: "#/components/schemas/tx_info/items/properties/tx_hash"
block_hash:
$ref: "#/components/schemas/blocks/items/properties/hash"
block_height:
$ref: "#/components/schemas/blocks/items/properties/block_height"
epoch_no:
$ref: "#/components/schemas/epoch_info/items/properties/epoch_no"
epoch_slot:
$ref: "#/components/schemas/blocks/items/properties/epoch_slot"
retiring_epoch:
$ref: "#/components/schemas/pool_updates/items/properties/retiring_epoch"
pool_delegators_history:
description: Array of pool delegators (historical)
type:
Expand Down
22 changes: 21 additions & 1 deletion specs/templates/4-api-schemas.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ schemas:
description: Latest transaction hash used for delegation by the account
example: 368d08fe86804d637649341d3aec4a9baa7dffa6d00f16de2ba9dba814f1c948
pool_registrations:
description: Array of pool registrations/retirements
description: Array of pool registrations
type: array
items:
type: object
Expand All @@ -476,6 +476,26 @@ schemas:
$ref: "#/components/schemas/blocks/items/properties/epoch_slot"
active_epoch_no:
$ref: "#/components/schemas/pool_updates/items/properties/active_epoch_no"
pool_retirements:
description: Array of pool retirements
type: array
items:
type: object
properties:
pool_id_bech32:
$ref: "#/components/schemas/pool_info/items/properties/pool_id_bech32"
tx_hash:
$ref: "#/components/schemas/tx_info/items/properties/tx_hash"
block_hash:
$ref: "#/components/schemas/blocks/items/properties/hash"
block_height:
$ref: "#/components/schemas/blocks/items/properties/block_height"
epoch_no:
$ref: "#/components/schemas/epoch_info/items/properties/epoch_no"
epoch_slot:
$ref: "#/components/schemas/blocks/items/properties/epoch_slot"
retiring_epoch:
$ref: "#/components/schemas/pool_updates/items/properties/retiring_epoch"
pool_delegators_history:
description: Array of pool delegators (historical)
type:
Expand Down
2 changes: 1 addition & 1 deletion specs/templates/api-main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1323,7 +1323,7 @@ paths:
content:
application/json:
schema:
$ref: "#/components/schemas/pool_registrations"
$ref: "#/components/schemas/pool_retirements"
"400":
$ref: "#/components/responses/BadRequest"
"401":
Expand Down
Loading