Skip to content

Commit

Permalink
fix: Remove circular dependency in GrandpaSetState.
Browse files Browse the repository at this point in the history
  • Loading branch information
Zurcusa committed Jan 27, 2025
1 parent 93cf2d8 commit 9cc5b22
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
import com.limechain.network.protocol.grandpa.messages.vote.VoteMessage;
import com.limechain.runtime.Runtime;
import com.limechain.state.AbstractState;
import com.limechain.state.StateManager;
import com.limechain.storage.DBConstants;
import com.limechain.storage.KVRepository;
import com.limechain.storage.StateUtil;
import com.limechain.storage.block.state.BlockState;
import com.limechain.storage.crypto.KeyStore;
import com.limechain.storage.crypto.KeyType;
import com.limechain.sync.warpsync.dto.AuthoritySetChange;
Expand Down Expand Up @@ -55,7 +55,7 @@ public class GrandpaSetState extends AbstractState implements ServiceConsensusSt
private BigInteger disabledAuthority;
private BigInteger setId;

private final StateManager stateManager;
private final BlockState blockState;
private final RoundCache roundCache;
private final KeyStore keyStore;
private final KVRepository<String, Object> repository;
Expand Down Expand Up @@ -160,7 +160,7 @@ public void startNewSet(List<Authority> authorities) {
this.setId = setId.add(BigInteger.ONE);
this.authorities = authorities;

var lastFinalizedBlock = stateManager.getBlockState().getLastFinalizedBlockAsVote();
var lastFinalizedBlock = blockState.getLastFinalizedBlockAsVote();

GrandpaRound initGrandpaRound = new GrandpaRound();
initGrandpaRound.setRoundNumber(BigInteger.ZERO);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/limechain/rpc/config/CommonConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ public SystemInfo systemInfo(HostConfig hostConfig, NetworkService network, Sync
public GrandpaSetState grandpaSetState(RoundCache roundCache,
KeyStore keyStore,
KVRepository<String, Object> repository,
StateManager stateManager) {
return new GrandpaSetState(stateManager, roundCache, keyStore, repository);
BlockState blockState) {
return new GrandpaSetState(blockState, roundCache, keyStore, repository);
}

@Bean
Expand Down

0 comments on commit 9cc5b22

Please sign in to comment.