Skip to content

Commit

Permalink
save
Browse files Browse the repository at this point in the history
  • Loading branch information
Giulio2002 committed Apr 8, 2024
1 parent e6baf99 commit 501686b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion cl/antiquary/state_antiquary.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@ func (s *Antiquary) IncrementBeaconState(ctx context.Context, to uint64) error {
return err
}
defer rwTx.Rollback()

start = time.Now()
// We now need to store the state
if err := stateAntiquaryCollector.flush(ctx, rwTx); err != nil {
Expand Down Expand Up @@ -392,6 +393,7 @@ func (s *Antiquary) IncrementBeaconState(ctx context.Context, to uint64) error {
if err != nil {
return err
}
//s.validatorsTable.SetSlot(s.currentState.Slot())
log.Info("Historical states antiquated", "slot", s.currentState.Slot(), "root", libcommon.Hash(stateRoot), "latency", endTime)
return nil
}
Expand Down Expand Up @@ -473,6 +475,5 @@ func computeSlotToBeRequested(tx kv.Tx, cfg *clparams.BeaconChainConfig, genesis
if targetSlot > clparams.SlotsPerDump*backoffStep {
return findNearestSlotBackwards(tx, cfg, targetSlot-clparams.SlotsPerDump*backoffStep)
}
fmt.Println(genesisSlot)
return genesisSlot, nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package historical_states_reader_test

import (
"context"
"fmt"
"testing"

libcommon "github.com/ledgerwatch/erigon-lib/common"
Expand Down Expand Up @@ -41,6 +42,7 @@ func runTest(t *testing.T, blocks []*cltypes.SignedBeaconBlock, preState, postSt
require.NoError(t, err)
_, err = postState.HashSSZ()
require.NoError(t, err)
fmt.Println(s.Validators().Get(0).PublicKey(), postState.Validators().Get(0).PublicKey())
require.Equal(t, libcommon.Hash(postHash), blocks[len(blocks)-1].Block.StateRoot)
}

Expand Down
4 changes: 3 additions & 1 deletion cl/persistence/state/static_validator_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,9 @@ func (s *StaticValidatorTable) GetStaticValidator(validatorIndex uint64) *Static
func (s *StaticValidatorTable) SetSlot(slot uint64) {
s.sync.Lock()
defer s.sync.Unlock()
s.resetTable(slot)
if slot <= s.slot && s.slot != 0 {
return
}
s.slot = slot
}

Expand Down

0 comments on commit 501686b

Please sign in to comment.