From 1dab403a82e3d37fb9363f8e4d3d18f778ee16da Mon Sep 17 00:00:00 2001 From: Francisco Moura Date: Fri, 6 Sep 2024 21:40:07 -0300 Subject: [PATCH] chore: fix formatting --- internal/evmreader/inputsource_adapter.go | 3 +-- internal/repository/evmreader.go | 8 +++----- internal/repository/validator.go | 16 ++++++++-------- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/internal/evmreader/inputsource_adapter.go b/internal/evmreader/inputsource_adapter.go index eda9754a4..750bb3f16 100644 --- a/internal/evmreader/inputsource_adapter.go +++ b/internal/evmreader/inputsource_adapter.go @@ -47,8 +47,7 @@ func (i *InputSourceAdapter) RetrieveInputs( inputAddedEvent := itr.Event events = append(events, *inputAddedEvent) } - err = itr.Error() - if err != nil { + if err = itr.Error(); err != nil { return nil, err } return events, nil diff --git a/internal/repository/evmreader.go b/internal/repository/evmreader.go index 52bbb307e..ceafbe171 100644 --- a/internal/repository/evmreader.go +++ b/internal/repository/evmreader.go @@ -60,8 +60,7 @@ func (pg *Database) StoreEpochAndInputsTransaction( @appAddress, @epochId) RETURNING - id - ` + id` updateLastBlockQuery := ` UPDATE application @@ -178,12 +177,11 @@ func (pg *Database) getAllApplicationsByStatus( status, iconsensus_address FROM - application - ` + application` var args []any if criteria != nil { - query = query + "WHERE status=$1" + query = query + " WHERE status=$1" args = append(args, string(*criteria)) } diff --git a/internal/repository/validator.go b/internal/repository/validator.go index ca6748b74..8a9989368 100644 --- a/internal/repository/validator.go +++ b/internal/repository/validator.go @@ -23,7 +23,7 @@ func (pg *Database) GetOutputsProducedInBlockRange( endBlock uint64, ) ([]Output, error) { query := ` - SELECT + SELECT o.id, o.index, o.raw_data, @@ -89,9 +89,9 @@ func (pg *Database) GetProcessedEpochs(ctx context.Context, application Address) claim_hash, transaction_hash, status - FROM + FROM epoch - WHERE + WHERE application_address=@appAddress AND status=@status ORDER BY index ASC` @@ -167,7 +167,7 @@ func (pg *Database) GetLastInputOutputsHash( query := ` SELECT outputs_hash - FROM + FROM input WHERE epoch_id = @id @@ -274,7 +274,7 @@ func (pg *Database) SetEpochClaimAndInsertProofsTransaction( SET claim_hash=@claimHash, status=@status - WHERE + WHERE id = @id ` @@ -303,12 +303,12 @@ func (pg *Database) SetEpochClaimAndInsertProofsTransaction( } query2 := ` - UPDATE + UPDATE output - SET + SET hash = @hash, output_hashes_siblings = @outputHashesSiblings - WHERE + WHERE id = @id `