Skip to content

Commit cf6e49c

Browse files
committed
Refactorings
1 parent 46d8ea4 commit cf6e49c

File tree

6 files changed

+25
-23
lines changed

6 files changed

+25
-23
lines changed

packages/protocol/test/prover/block/BlockProver.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable max-len */
12
/**
23
* Testing strategy:
34
*
@@ -9,3 +10,5 @@
910
* - Test correct integration of the STProof - both defer and notDefer
1011
* - proveBlock: correct blockNumber progression, closed flag (doesn't accepts closed proofs as tx proofs)
1112
*/
13+
14+
/* eslint-enable max-len */

packages/protocol/test/prover/statetransition/StateTransitionProver.test.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,19 @@ describe("StateTransitionProver", () => {
4444
});
4545
}
4646

47-
function applyToTree(
48-
tree: RollupMerkleTree,
49-
batches: StateTransitionProvableBatch[],
50-
indizes: number[]
51-
) {
52-
const flat = batches.flatMap((batch) => batch.batch);
53-
indizes.forEach((index) => {
54-
const st = flat[index].stateTransition;
55-
if (st.to.isSome) {
56-
tree.setLeaf(st.path.toBigInt(), st.to.value);
57-
}
58-
});
59-
}
47+
// function applyToTree(
48+
// tree: RollupMerkleTree,
49+
// batches: StateTransitionProvableBatch[],
50+
// indizes: number[]
51+
// ) {
52+
// const flat = batches.flatMap((batch) => batch.batch);
53+
// indizes.forEach((index) => {
54+
// const st = flat[index].stateTransition;
55+
// if (st.to.isSome) {
56+
// tree.setLeaf(st.path.toBigInt(), st.to.value);
57+
// }
58+
// });
59+
// }
6060

6161
describe("currentBatchHash", () => {
6262
it.each([

packages/sequencer/src/mempool/private/PrivateMempool.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ export class PrivateMempool extends SequencerModule implements Mempool {
119119
// in the skipped txs list and when later txs succeed we check to see if any state transition
120120
// paths are shared between the just succeeded tx and any of the skipped txs. This is
121121
// because a failed tx may succeed now if the failure was to do with a nonce issue, say.
122+
// TODO Refactor
123+
// eslint-disable-next-line sonarjs/cognitive-complexity
122124
private async checkTxValid(
123125
transactions: PendingTransaction[],
124126
baseService: CachedStateService,

packages/sequencer/src/protocol/production/tracing/BlockTracingService.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,6 @@ export type BlockTrace = {
4343
export class BlockTracingService {
4444
public constructor(
4545
private readonly transactionTracing: TransactionTracingService
46-
// TODO Think about remove the state service for tracing
47-
// TODO Properly replace AsyncStateService by masking
48-
// @inject("AsyncStateService")
49-
// stateService: AsyncStateService
5046
) {}
5147

5248
public async traceBlock(

packages/sequencer/src/protocol/production/tracing/StateTransitionTracingService.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,10 @@ export class StateTransitionTracingService {
155155

156156
finalizedStateRoot = danglingStateRoot;
157157

158+
// We can reuse the batchMerkleStore here, since mergeIntoParent()
159+
// resets the only state that the store has, therefore its equivalent
160+
// to creating a new one
158161
batchMerkleStore.mergeIntoParent();
159-
// TODO See if reusing the existing store works
160162
} else if (
161163
type.type
162164
.equals(StateTransitionType.closeAndThrowAway)

packages/sequencer/test/integration/StorageIntegration.test.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,18 +149,17 @@ describe.each([["InMemory", InMemoryDatabase]])(
149149

150150
expect(blocks).toHaveLength(1);
151151

152-
const { lastBlockResult, block } = blocks[0];
152+
const { block } = blocks[0];
153153

154-
expect(lastBlockResult).toBeUndefined();
155-
expect(block.block.hash.toBigInt()).toStrictEqual(
154+
expect(block.hash.toBigInt()).toStrictEqual(
156155
generatedBlock.hash.toBigInt()
157156
);
158157

159158
const blockStorage = sequencer.resolve(
160159
"BlockStorage"
161160
) as HistoricalBlockStorage & BlockStorage;
162161
const block2 = await blockStorage.getBlockAt(
163-
Number(blocks[0].block.block.height.toString())
162+
Number(blocks[0].block.height.toString())
164163
);
165164

166165
expectDefined(block2);
@@ -169,7 +168,7 @@ describe.each([["InMemory", InMemoryDatabase]])(
169168
);
170169

171170
const stateDiff = collectStateDiff(
172-
block.block.transactions.flatMap((tx) =>
171+
block.transactions.flatMap((tx) =>
173172
tx.stateTransitions.flatMap((batch) => batch.stateTransitions)
174173
)
175174
);

0 commit comments

Comments
 (0)