Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
DOBEN committed Jan 29, 2025
1 parent 4e8a7d9 commit d559496
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 21 deletions.

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

14 changes: 10 additions & 4 deletions backend-rust/src/graphql_api/baker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ impl Baker {
before,
config.transactions_per_block_connection_limit,
)?;

// Retrieves the transactions related to a baker account ('AddBaker',
// 'RemoveBaker', 'UpdateBakerStake', 'UpdateBakerRestakeEarnings',
// 'UpdateBakerKeys', 'ConfigureBaker'). The transactions are ordered in
Expand Down Expand Up @@ -194,8 +193,7 @@ impl Baker {
FROM transactions
WHERE transactions.sender_index = $5
AND index > $1 AND index < $2
AND type_account IN ('AddBaker', 'RemoveBaker', 'UpdateBakerStake',
'UpdateBakerRestakeEarnings', 'UpdateBakerKeys', 'ConfigureBaker')
AND type_account = ANY($6)
ORDER BY
CASE WHEN NOT $3 THEN index END DESC,
CASE WHEN $3 THEN index END ASC
Expand All @@ -205,7 +203,15 @@ impl Baker {
query.to,
query.desc,
query.limit,
self.id.0
self.id.0,
&[
AccountTransactionType::AddBaker,
AccountTransactionType::RemoveBaker,
AccountTransactionType::UpdateBakerStake,
AccountTransactionType::UpdateBakerRestakeEarnings,
AccountTransactionType::UpdateBakerKeys,
AccountTransactionType::ConfigureBaker
] as &[AccountTransactionType]
)
.fetch(pool);

Expand Down
28 changes: 14 additions & 14 deletions backend-rust/src/migrations/m0001-initialize.sql
Original file line number Diff line number Diff line change
Expand Up @@ -793,19 +793,19 @@ CREATE TABLE account_statements (

CREATE INDEX account_statements_entry_type_idx ON account_statements (id, account_index, entry_type);

-- Type of a special transaction outcome in a block.
CREATE TYPE special_transaction_outcome_type AS ENUM (
'BakingRewards',
'Mint',
'FinalizationRewards',
'BlockRewards',
'PaydayFoundationReward',
'PaydayAccountReward',
'BlockAccrueReward',
'PaydayPoolReward',
'ValidatorSuspended',
'ValidatorPrimedForSuspension'
);
-- -- Type of a special transaction outcome in a block.
-- CREATE TYPE special_transaction_outcome_type AS ENUM (
-- 'BakingRewards',
-- 'Mint',
-- 'FinalizationRewards',
-- 'BlockRewards',
-- 'PaydayFoundationReward',
-- 'PaydayAccountReward',
-- 'BlockAccrueReward',
-- 'PaydayPoolReward',
-- 'ValidatorSuspended',
-- 'ValidatorPrimedForSuspension'
-- );

-- Table indexing special transaction outcomes in blocks.
CREATE TABLE block_special_transaction_outcomes (
Expand All @@ -820,7 +820,7 @@ CREATE TABLE block_special_transaction_outcomes (
NOT NULL,
-- The type of the special transaction outcome.
outcome_type
special_transaction_outcome_type
account_transaction_type
NOT NULL,
-- The special transaction outcome stored as JSON.
outcome
Expand Down

0 comments on commit d559496

Please sign in to comment.