Skip to content

Commit 00cb79e

Browse files
author
Aurélien Richez
committed
rename BlockchainBranch to Branch
1 parent 98f6687 commit 00cb79e

File tree

7 files changed

+17
-16
lines changed

7 files changed

+17
-16
lines changed

src/it/scala/io/iohk/ethereum/txExecTest/util/DumpChainApp.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import io.iohk.ethereum.db.storage.pruning.PruningMode
2626
import io.iohk.ethereum.domain.BlockHeader.HeaderExtraFields.HefEmpty
2727
import io.iohk.ethereum.domain.Blockchain
2828
import io.iohk.ethereum.domain._
29-
import io.iohk.ethereum.domain.branch.BlockchainBranch
29+
import io.iohk.ethereum.domain.branch.Branch
3030
import io.iohk.ethereum.jsonrpc.ProofService.EmptyStorageValueProof
3131
import io.iohk.ethereum.jsonrpc.ProofService.StorageProof
3232
import io.iohk.ethereum.jsonrpc.ProofService.StorageProofKey
@@ -102,7 +102,7 @@ object DumpChainApp
102102

103103
val blockchain: Blockchain = new BlockchainMock(genesisHash)
104104
val blockchainReader: BlockchainReader = mock[BlockchainReader]
105-
val bestChain: BlockchainBranch = mock[BlockchainBranch]
105+
val bestChain: Branch = mock[Branch]
106106
(blockchainReader.getBestBranch _).expects().anyNumberOfTimes().returning(bestChain)
107107
(bestChain.getHashByBlockNumber _).expects(*).returning(Some(genesisHash))
108108

src/main/scala/io/iohk/ethereum/domain/BlockchainReader.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ import io.iohk.ethereum.db.storage.BlockHeadersStorage
88
import io.iohk.ethereum.db.storage.BlockNumberMappingStorage
99
import io.iohk.ethereum.db.storage.ReceiptStorage
1010
import io.iohk.ethereum.db.storage.StateStorage
11-
import io.iohk.ethereum.domain.branch.BestBlockchainBranch
12-
import io.iohk.ethereum.domain.branch.BlockchainBranch
13-
import io.iohk.ethereum.domain.branch.EmptyBlockchainBranch
11+
import io.iohk.ethereum.domain.branch.BestBranch
12+
import io.iohk.ethereum.domain.branch.Branch
13+
import io.iohk.ethereum.domain.branch.EmptyBranch$
1414
import io.iohk.ethereum.mpt.MptNode
1515
import io.iohk.ethereum.utils.Logger
1616

@@ -71,16 +71,16 @@ class BlockchainReader(
7171
def getReceiptsByHash(blockhash: ByteString): Option[Seq[Receipt]] = receiptStorage.get(blockhash)
7272

7373
/** get the current best stored branch */
74-
def getBestBranch(): BlockchainBranch =
74+
def getBestBranch(): Branch =
7575
getBestBlock()
7676
.map { block =>
77-
new BestBlockchainBranch(
77+
new BestBranch(
7878
block.header,
7979
blockNumberMappingStorage,
8080
this
8181
)
8282
}
83-
.getOrElse(EmptyBlockchainBranch)
83+
.getOrElse(EmptyBranch$)
8484

8585
def getBestBlockNumber(): BigInt = {
8686
val bestSavedBlockNumber = appStateStorage.getBestBlockNumber()

src/main/scala/io/iohk/ethereum/domain/branch/BestBlockchainBranch.scala renamed to src/main/scala/io/iohk/ethereum/domain/branch/BestBranch.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ import io.iohk.ethereum.domain.BlockchainReader
99
/** A Branch instance which only works for the best canonical branch or a subset of this branch.
1010
* This implementation uses the existing storage indexes to access blocks by number more efficiently.
1111
*/
12-
class BestBlockchainBranch(
12+
class BestBranch(
1313
tipBlockHeader: BlockHeader,
1414
bestChainBlockNumberMappingStorage: BlockNumberMappingStorage,
1515
blockchainReader: BlockchainReader
16-
) extends BlockchainBranch {
16+
) extends Branch {
1717

1818
/* The following assumptions are made in this class :
1919
* - The whole branch exists in storage

src/main/scala/io/iohk/ethereum/domain/branch/BlockchainBranch.scala renamed to src/main/scala/io/iohk/ethereum/domain/branch/Branch.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import akka.util.ByteString
44

55
import io.iohk.ethereum.domain.Block
66

7-
trait BlockchainBranch {
7+
/** An interface to manipulate blockchain branches */
8+
trait Branch {
89

910
/** Returns a block inside this branch based on its number */
1011
def getBlockByNumber(number: BigInt): Option[Block]

src/main/scala/io/iohk/ethereum/domain/branch/EmptyBlockchainBranch.scala renamed to src/main/scala/io/iohk/ethereum/domain/branch/EmptyBranch$.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import akka.util.ByteString
33

44
import io.iohk.ethereum.domain.Block
55

6-
object EmptyBlockchainBranch extends BlockchainBranch {
6+
object EmptyBranch$ extends Branch {
77

88
override def getBlockByNumber(number: BigInt): Option[Block] = None
99

src/test/scala/io/iohk/ethereum/jsonrpc/CheckpointingServiceSpec.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import io.iohk.ethereum.domain.BlockBody
2323
import io.iohk.ethereum.domain.BlockchainImpl
2424
import io.iohk.ethereum.domain.BlockchainReader
2525
import io.iohk.ethereum.domain.Checkpoint
26-
import io.iohk.ethereum.domain.branch.BlockchainBranch
26+
import io.iohk.ethereum.domain.branch.Branch
2727
import io.iohk.ethereum.jsonrpc.CheckpointingService._
2828
import io.iohk.ethereum.ledger.BlockQueue
2929

@@ -186,7 +186,7 @@ class CheckpointingServiceSpec
186186
trait TestSetup {
187187
val blockchain: BlockchainImpl = mock[BlockchainImpl]
188188
val blockchainReader: BlockchainReader = mock[BlockchainReader]
189-
val bestChain: BlockchainBranch = mock[BlockchainBranch]
189+
val bestChain: Branch = mock[Branch]
190190
(blockchainReader.getBestBranch _).expects().anyNumberOfTimes().returning(bestChain)
191191
val blockQueue: BlockQueue = mock[BlockQueue]
192192
val syncController: TestProbe = TestProbe()

src/test/scala/io/iohk/ethereum/ledger/LedgerTestSetup.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import io.iohk.ethereum.consensus.validators.BlockHeaderValidator
3232
import io.iohk.ethereum.crypto.generateKeyPair
3333
import io.iohk.ethereum.crypto.kec256
3434
import io.iohk.ethereum.domain._
35-
import io.iohk.ethereum.domain.branch.BlockchainBranch
35+
import io.iohk.ethereum.domain.branch.Branch
3636
import io.iohk.ethereum.ledger.BlockExecutionError.ValidationAfterExecError
3737
import io.iohk.ethereum.ledger.PC
3838
import io.iohk.ethereum.ledger.PR
@@ -412,7 +412,7 @@ trait TestSetupWithVmAndValidators extends EphemBlockchainTestSetup {
412412
trait MockBlockchain extends MockFactory { self: TestSetupWithVmAndValidators =>
413413
//+ cake overrides
414414

415-
val bestChain: BlockchainBranch = mock[BlockchainBranch]
415+
val bestChain: Branch = mock[Branch]
416416
override lazy val blockchainReader: BlockchainReader = mock[BlockchainReader]
417417
override lazy val blockchainWriter: BlockchainWriter = mock[BlockchainWriter]
418418
(blockchainReader.getBestBranch _).expects().anyNumberOfTimes().returning(bestChain)

0 commit comments

Comments
 (0)