From 4be5477f642a17abefaa4da655e741f7663954ee Mon Sep 17 00:00:00 2001 From: atvanguard <93arpit@gmail.com> Date: Sun, 17 May 2020 17:28:55 +0530 Subject: [PATCH] dev: cleanup comments --- consensus/bor/bor.go | 4 ---- consensus/bor/bor_test/bor_test.go | 4 +--- consensus/bor/bor_test/helper.go | 2 +- consensus/bor/genesis_contracts_client.go | 3 --- 4 files changed, 2 insertions(+), 11 deletions(-) diff --git a/consensus/bor/bor.go b/consensus/bor/bor.go index 4b2b9b59f..03fddbf5d 100644 --- a/consensus/bor/bor.go +++ b/consensus/bor/bor.go @@ -1118,10 +1118,6 @@ func (c *Bor) CommitStates( chain chainContext, ) error { number := header.Number.Uint64() - if number < c.config.Sprint { - return errors.New("Requested to commit states too soon") - } - lastSync, err := c.genesisContractsClient.LastStateSyncTime(number - 1) if err != nil { return err diff --git a/consensus/bor/bor_test/bor_test.go b/consensus/bor/bor_test/bor_test.go index 950281262..72b40d956 100644 --- a/consensus/bor/bor_test/bor_test.go +++ b/consensus/bor/bor_test/bor_test.go @@ -3,8 +3,6 @@ package bortest import ( "encoding/hex" "fmt" - // "encoding/json" - // "fmt" "math/big" "testing" @@ -165,7 +163,7 @@ func getMockedHeimdallClient(t *testing.T) (*mocks.IHeimdallClient, *bor.Heimdal h := &mocks.IHeimdallClient{} h.On("FetchWithRetry", "bor", "span", "1").Return(res, nil) - res = zeroResultPayload(t) + res = stateSyncEventsPayload(t) // query := fmt.Sprintf("clerk/event-record/list?from-time=%d&to-time=%d&page=1&limit=50", 1, 1589709047) h.On("FetchWithRetry", mock.AnythingOfType("string")).Return(res, nil) return h, heimdallSpan diff --git a/consensus/bor/bor_test/helper.go b/consensus/bor/bor_test/helper.go index f95bf6cb0..d02c3463f 100644 --- a/consensus/bor/bor_test/helper.go +++ b/consensus/bor/bor_test/helper.go @@ -156,7 +156,7 @@ func sign(t *testing.T, header *types.Header, signer []byte) { copy(header.Extra[len(header.Extra)-extraSeal:], sig) } -func zeroResultPayload(t *testing.T) *bor.ResponseWithHeight { +func stateSyncEventsPayload(t *testing.T) *bor.ResponseWithHeight { stateData, err := ioutil.ReadFile("states.json") if err != nil { t.Fatalf("%s", err) diff --git a/consensus/bor/genesis_contracts_client.go b/consensus/bor/genesis_contracts_client.go index 3e2606c07..d616c6f12 100644 --- a/consensus/bor/genesis_contracts_client.go +++ b/consensus/bor/genesis_contracts_client.go @@ -5,7 +5,6 @@ import ( "math" "math/big" - // "math/big" "strings" "time" @@ -65,8 +64,6 @@ func (gc *GenesisContractsClient) CommitState( method := "commitState" t := event.Time.Unix() data, err := gc.stateReceiverABI.Pack(method, recordBytes, big.NewInt(0).SetInt64(t)) - // t, err := time.Parse(event.Time, time.RFC3339) - // data, err := gc.stateReceiverABI.Pack(method, recordBytes, t.Unix()) if err != nil { log.Error("Unable to pack tx for commitState", "error", err) return err -- GitLab