@aztec/sequencer-client 0.1.0-alpha47 → 0.1.0-alpha48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.tsbuildinfo +1 -1
- package/dest/block_builder/solo_block_builder.test.d.ts.map +1 -1
- package/dest/block_builder/solo_block_builder.test.js +3 -3
- package/dest/global_variable_builder/index.d.ts +1 -0
- package/dest/global_variable_builder/index.d.ts.map +1 -1
- package/dest/global_variable_builder/index.js +1 -1
- package/dest/index.d.ts +2 -0
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +4 -1
- package/dest/publisher/l1-publisher.d.ts +12 -6
- package/dest/publisher/l1-publisher.d.ts.map +1 -1
- package/dest/publisher/l1-publisher.js +3 -3
- package/dest/publisher/viem-tx-sender.d.ts +3 -3
- package/dest/publisher/viem-tx-sender.d.ts.map +1 -1
- package/dest/publisher/viem-tx-sender.js +10 -7
- package/dest/sequencer/processed_tx.d.ts +13 -0
- package/dest/sequencer/processed_tx.d.ts.map +1 -1
- package/dest/sequencer/processed_tx.js +1 -1
- package/dest/sequencer/public_processor.d.ts +2 -2
- package/dest/sequencer/public_processor.d.ts.map +1 -1
- package/dest/sequencer/public_processor.js +10 -5
- package/dest/sequencer/public_processor.test.js +9 -7
- package/dest/sequencer/sequencer.d.ts +2 -2
- package/dest/sequencer/sequencer.d.ts.map +1 -1
- package/dest/sequencer/sequencer.js +11 -10
- package/dest/simulator/index.d.ts +1 -0
- package/dest/simulator/index.d.ts.map +1 -1
- package/dest/simulator/index.js +2 -2
- package/package.json +10 -10
- package/src/block_builder/solo_block_builder.test.ts +2 -1
- package/src/global_variable_builder/index.ts +1 -0
- package/src/index.ts +4 -0
- package/src/publisher/l1-publisher.ts +15 -13
- package/src/publisher/viem-tx-sender.ts +10 -7
- package/src/sequencer/processed_tx.ts +14 -0
- package/src/sequencer/public_processor.test.ts +16 -7
- package/src/sequencer/public_processor.ts +11 -7
- package/src/sequencer/sequencer.ts +10 -20
- package/src/simulator/index.ts +2 -0
|
@@ -3,15 +3,7 @@ import { Fr } from '@aztec/foundation/fields';
|
|
|
3
3
|
import { createDebugLogger } from '@aztec/foundation/log';
|
|
4
4
|
import { RunningPromise } from '@aztec/foundation/running-promise';
|
|
5
5
|
import { P2P } from '@aztec/p2p';
|
|
6
|
-
import {
|
|
7
|
-
ContractData,
|
|
8
|
-
ContractDataAndBytecode,
|
|
9
|
-
L1ToL2MessageSource,
|
|
10
|
-
L2Block,
|
|
11
|
-
L2BlockSource,
|
|
12
|
-
MerkleTreeId,
|
|
13
|
-
Tx,
|
|
14
|
-
} from '@aztec/types';
|
|
6
|
+
import { L1ToL2MessageSource, L2Block, L2BlockSource, MerkleTreeId, Tx } from '@aztec/types';
|
|
15
7
|
import { WorldStateStatus, WorldStateSynchroniser } from '@aztec/world-state';
|
|
16
8
|
|
|
17
9
|
import times from 'lodash.times';
|
|
@@ -149,8 +141,9 @@ export class Sequencer {
|
|
|
149
141
|
const processor = await this.publicProcessorFactory.create(prevGlobalVariables, newGlobalVariables);
|
|
150
142
|
const [processedTxs, failedTxs] = await processor.process(validTxs);
|
|
151
143
|
if (failedTxs.length > 0) {
|
|
152
|
-
|
|
153
|
-
|
|
144
|
+
const failedTxData = failedTxs.map(fail => fail.tx);
|
|
145
|
+
this.log(`Dropping failed txs ${(await Tx.getHashes(failedTxData)).join(', ')}`);
|
|
146
|
+
await this.p2pClient.deleteTxs(await Tx.getHashes(failedTxData));
|
|
154
147
|
}
|
|
155
148
|
|
|
156
149
|
if (processedTxs.length === 0) {
|
|
@@ -170,7 +163,7 @@ export class Sequencer {
|
|
|
170
163
|
const block = await this.buildBlock(processedTxs, l1ToL2Messages, emptyTx, newGlobalVariables);
|
|
171
164
|
this.log(`Assembled block ${block.number}`);
|
|
172
165
|
|
|
173
|
-
await this.
|
|
166
|
+
await this.publishExtendedContractData(validTxs, block);
|
|
174
167
|
|
|
175
168
|
await this.publishL2Block(block);
|
|
176
169
|
this.log.info(`Submitted rollup block ${block.number} with ${processedTxs.length} transactions`);
|
|
@@ -182,28 +175,25 @@ export class Sequencer {
|
|
|
182
175
|
}
|
|
183
176
|
|
|
184
177
|
/**
|
|
185
|
-
* Gets new contract data
|
|
178
|
+
* Gets new extended contract data from the txs and publishes it on chain.
|
|
186
179
|
* @param validTxs - The set of real transactions being published as part of the block.
|
|
187
180
|
* @param block - The L2Block to be published.
|
|
188
181
|
*/
|
|
189
|
-
protected async
|
|
182
|
+
protected async publishExtendedContractData(validTxs: Tx[], block: L2Block) {
|
|
190
183
|
// Publishes contract data for txs to the network and awaits the tx to be mined
|
|
191
184
|
this.state = SequencerState.PUBLISHING_CONTRACT_DATA;
|
|
192
185
|
const newContractData = validTxs
|
|
193
186
|
.map(tx => {
|
|
194
187
|
// Currently can only have 1 new contract per tx
|
|
195
188
|
const newContract = tx.data?.end.newContracts[0];
|
|
196
|
-
if (newContract
|
|
197
|
-
return
|
|
198
|
-
new ContractData(newContract.contractAddress, newContract.portalContractAddress),
|
|
199
|
-
tx.newContractPublicFunctions,
|
|
200
|
-
);
|
|
189
|
+
if (newContract) {
|
|
190
|
+
return tx.newContracts[0];
|
|
201
191
|
}
|
|
202
192
|
})
|
|
203
193
|
.filter((cd): cd is Exclude<typeof cd, undefined> => cd !== undefined);
|
|
204
194
|
|
|
205
195
|
const blockHash = block.getCalldataHash();
|
|
206
|
-
this.log(`Publishing contract data
|
|
196
|
+
this.log(`Publishing extended contract data with block hash ${blockHash.toString('hex')}`);
|
|
207
197
|
|
|
208
198
|
const publishedContractData = await this.publisher.processNewContractData(block.number, blockHash, newContractData);
|
|
209
199
|
if (publishedContractData) {
|