diff --git a/internal/evmreader/evmreader_test.go b/internal/evmreader/evmreader_test.go index 13f6c81fb..ab859880d 100644 --- a/internal/evmreader/evmreader_test.go +++ b/internal/evmreader/evmreader_test.go @@ -684,7 +684,7 @@ func newMockRepository() *MockRepository { Index: 0, FirstBlock: 0, LastBlock: math.MaxUint64, - Status: model.EpochStatusReceivingInputs, + Status: model.EpochStatusOpen, AppAddress: common.HexToAddress("0x2E663fe9aE92275242406A185AA4fC8174339D3E"), ClaimHash: nil, TransactionHash: nil, diff --git a/internal/node/model/models.go b/internal/node/model/models.go index f7d4dc98f..0a7da5468 100644 --- a/internal/node/model/models.go +++ b/internal/node/model/models.go @@ -42,13 +42,13 @@ const ( ) const ( - EpochStatusReceivingInputs EpochStatus = "RECEIVING_INPUTS" - EpochStatusReceivedLastInput EpochStatus = "RECEIVED_LAST_INPUT" + EpochStatusOpen EpochStatus = "OPEN" + EpochStatusClosed EpochStatus = "CLOSED" EpochStatusProcessedAllInputs EpochStatus = "PROCESSED_ALL_INPUTS" - EpochStatusCalculatedClaim EpochStatus = "CALCULATED_CLAIM" - EpochStatusSubmittedClaim EpochStatus = "SUBMITTED_CLAIM" - EpochStatusAcceptedClaim EpochStatus = "ACCEPTED_CLAIM" - EpochStatusRejectedClaim EpochStatus = "REJECTED_CLAIM" + EpochStatusClaimComputed EpochStatus = "CLAIM_COMPUTED" + EpochStatusClaimSubmitted EpochStatus = "CLAIM_SUBMITTED" + EpochStatusClaimAccepted EpochStatus = "CLAIM_ACCEPTED" + EpochStatusClaimRejected EpochStatus = "CLAIM_REJECTED" ) type NodePersistentConfig struct { diff --git a/internal/repository/base_test.go b/internal/repository/base_test.go index 258dcfb69..a5b7c3349 100644 --- a/internal/repository/base_test.go +++ b/internal/repository/base_test.go @@ -99,7 +99,7 @@ func (s *RepositorySuite) SetupDatabase() { AppAddress: app.ContractAddress, ClaimHash: nil, TransactionHash: nil, - Status: EpochStatusReceivingInputs, + Status: EpochStatusOpen, } _, err = s.database.InsertEpoch(s.ctx, &epoch1) @@ -113,7 +113,7 @@ func (s *RepositorySuite) SetupDatabase() { AppAddress: app.ContractAddress, ClaimHash: nil, TransactionHash: nil, - Status: EpochStatusReceivingInputs, + Status: EpochStatusOpen, } _, err = s.database.InsertEpoch(s.ctx, &epoch2) @@ -403,7 +403,7 @@ func (s *RepositorySuite) TestEpochExists() { epoch := Epoch{ Id: 1, - Status: EpochStatusReceivingInputs, + Status: EpochStatusOpen, Index: 0, FirstBlock: 0, LastBlock: (math.MaxUint64 / 2), @@ -425,7 +425,7 @@ func (s *RepositorySuite) TestEpochDoesntExist() { func (s *RepositorySuite) TestEpochFailsDuplicateRow() { epoch := Epoch{ - Status: EpochStatusReceivingInputs, + Status: EpochStatusOpen, Index: 0, FirstBlock: 0, LastBlock: math.MaxUint64, @@ -441,7 +441,7 @@ func (s *RepositorySuite) TestEpochFailsDuplicateRow() { func (s *RepositorySuite) TestEpochFailsApplicationDoesntExist() { hash := common.HexToHash("deadbeef") epoch := Epoch{ - Status: EpochStatusReceivingInputs, + Status: EpochStatusOpen, Index: 2, FirstBlock: 0, LastBlock: math.MaxUint64, diff --git a/internal/repository/migrations/000001_create_application_input_claim_output_report_nodeconfig.up.sql b/internal/repository/migrations/000001_create_application_input_claim_output_report_nodeconfig.up.sql index 7d259326a..67b01eb75 100644 --- a/internal/repository/migrations/000001_create_application_input_claim_output_report_nodeconfig.up.sql +++ b/internal/repository/migrations/000001_create_application_input_claim_output_report_nodeconfig.up.sql @@ -7,7 +7,7 @@ CREATE TYPE "InputCompletionStatus" AS ENUM ('NONE', 'ACCEPTED', 'REJECTED', 'EX CREATE TYPE "DefaultBlock" AS ENUM ('FINALIZED', 'LATEST', 'PENDING', 'SAFE'); -CREATE TYPE "EpochStatus" AS ENUM ('RECEIVING_INPUTS', 'RECEIVED_LAST_INPUT', 'PROCESSED_ALL_INPUTS', 'CALCULATED_CLAIM', 'SUBMITTED_CLAIM', 'ACCEPTED_CLAIM', 'REJECTED_CLAIM'); +CREATE TYPE "EpochStatus" AS ENUM ('OPEN', 'CLOSED', 'PROCESSED_ALL_INPUTS', 'CLAIM_COMPUTED', 'CLAIM_SUBMITTED', 'CLAIM_ACCEPTED', 'CLAIM_REJECTED'); CREATE FUNCTION public.f_maxuint64() RETURNS NUMERIC(20,0) diff --git a/internal/repository/validator.go b/internal/repository/validator.go index ffb6b9f76..f65ccaa7f 100644 --- a/internal/repository/validator.go +++ b/internal/repository/validator.go @@ -147,7 +147,7 @@ func (pg *Database) SetEpochClaimAndInsertProofsTransaction( args := pgx.NamedArgs{ "id": epoch.Id, "claimHash": epoch.ClaimHash, - "status": EpochStatusCalculatedClaim, + "status": EpochStatusClaimComputed, } tx, err := pg.db.Begin(ctx) diff --git a/internal/repository/validator_test.go b/internal/repository/validator_test.go index 1d48003b1..dc59942dd 100644 --- a/internal/repository/validator_test.go +++ b/internal/repository/validator_test.go @@ -69,13 +69,13 @@ func (s *RepositorySuite) TestSetEpochClaimAndInsertProofsTransaction() { s.Require().Nil(err) expectedEpoch.ClaimHash = &hash - expectedEpoch.Status = EpochStatusCalculatedClaim + expectedEpoch.Status = EpochStatusClaimComputed epoch, err := s.database.GetEpoch(s.ctx, 0, common.HexToAddress("deadbeef")) s.Require().Nil(err) epoch.ClaimHash = &hash - epoch.Status = EpochStatusCalculatedClaim + epoch.Status = EpochStatusClaimComputed var outputs []Output outputs = append(outputs, output) @@ -110,7 +110,7 @@ func (s *RepositorySuite) TestSetEpochClaimAndInsertProofsTransactionRollback() s.Require().Nil(err) epoch.ClaimHash = &hash - epoch.Status = EpochStatusCalculatedClaim + epoch.Status = EpochStatusClaimComputed expectedEpoch, err := s.database.GetEpoch(s.ctx, epoch.Index, common.HexToAddress("deadbeef")) s.Require().Nil(err)