Skip to content

Commit

Permalink
Various errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ejMina226 committed Oct 10, 2024
1 parent 645a632 commit 69652e5
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions packages/sequencer/src/mempool/private/PrivateMempool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export class PrivateMempool extends SequencerModule implements Mempool {
if (success) {
this.events.emit("mempool-transaction-added", tx);
log.info(
`Transaction added to mempool: ${tx.hash().toString()} (${(await this.getTxs()).length} transactions in mempool)`
`Transaction added to mempool: ${tx.hash().toString()} (${(await this.transactionStorage.getPendingUserTransactions()).length} transactions in mempool)`
);
} else {
log.error(
Expand Down Expand Up @@ -97,23 +97,18 @@ export class PrivateMempool extends SequencerModule implements Mempool {
);
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
const networkState = (await this.getStagedNetworkState()) as NetworkState;
console.log("EJ - tx Should be 6", txs.length);
const checkTxValid = async (transactions: PendingTransaction[]) => {
for await (const tx of transactions) {
console.log("EJ - sender", tx.sender.toBase58());
console.log("EJ - nonce", tx.nonce.toBigInt());

const txStateService = new CachedStateService(baseCachedStateService);
this.protocol.stateServiceProvider.setCurrentStateService(
txStateService
);
const contextInputs: RuntimeMethodExecutionData = {
networkState: networkState,
transaction: tx.toProtocolTransaction().transaction,
};
executionContext.setup(contextInputs);

const txStateService = new CachedStateService(baseCachedStateService);
this.protocol.stateServiceProvider.setCurrentStateService(
txStateService
);

const signedTransaction = tx.toProtocolTransaction();
await this.accountStateHook.onTransaction({
networkState: networkState,
Expand All @@ -123,14 +118,14 @@ export class PrivateMempool extends SequencerModule implements Mempool {
const { status, statusMessage } = executionContext.current().result;
console.log("EJ - status message", statusMessage);
if (status.toBoolean()) {
console.log("EJ - Boolean True");
sortedTxs.push(tx);
if (skippedTxs.includes(tx)) {
console.log("EJ - skippedTxs includes tx", skippedTxs);
skippedTxs.splice(skippedTxs.indexOf(tx), 1);
}
txStateService.mergeIntoParent();
await txStateService.mergeIntoParent();
this.protocol.stateServiceProvider.popCurrentStateService();

if (skippedTxs.length > 0) {
console.log("EJ - skippedTxs", skippedTxs.length);
checkTxValid(skippedTxs);
Expand Down

0 comments on commit 69652e5

Please sign in to comment.