@aztec/sequencer-client 0.0.1-commit.f2ce05ee → 0.0.1-commit.f5a9928
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/README.md +283 -21
- package/dest/client/sequencer-client.d.ts +34 -11
- package/dest/client/sequencer-client.d.ts.map +1 -1
- package/dest/client/sequencer-client.js +77 -39
- package/dest/config.d.ts +34 -5
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +103 -39
- package/dest/global_variable_builder/fee_predictor.d.ts +37 -0
- package/dest/global_variable_builder/fee_predictor.d.ts.map +1 -0
- package/dest/global_variable_builder/fee_predictor.js +138 -0
- package/dest/global_variable_builder/fee_provider.d.ts +21 -0
- package/dest/global_variable_builder/fee_provider.d.ts.map +1 -0
- package/dest/global_variable_builder/fee_provider.js +80 -0
- package/dest/global_variable_builder/global_builder.d.ts +13 -28
- package/dest/global_variable_builder/global_builder.d.ts.map +1 -1
- package/dest/global_variable_builder/global_builder.js +9 -66
- package/dest/global_variable_builder/index.d.ts +4 -2
- package/dest/global_variable_builder/index.d.ts.map +1 -1
- package/dest/global_variable_builder/index.js +2 -0
- package/dest/publisher/config.d.ts +51 -17
- package/dest/publisher/config.d.ts.map +1 -1
- package/dest/publisher/config.js +131 -42
- package/dest/publisher/index.d.ts +2 -1
- package/dest/publisher/index.d.ts.map +1 -1
- package/dest/publisher/l1_to_l2_messaging.d.ts +21 -0
- package/dest/publisher/l1_to_l2_messaging.d.ts.map +1 -0
- package/dest/publisher/l1_to_l2_messaging.js +70 -0
- package/dest/publisher/l1_tx_failed_store/factory.d.ts +11 -0
- package/dest/publisher/l1_tx_failed_store/factory.d.ts.map +1 -0
- package/dest/publisher/l1_tx_failed_store/factory.js +22 -0
- package/dest/publisher/l1_tx_failed_store/failed_tx_store.d.ts +58 -0
- package/dest/publisher/l1_tx_failed_store/failed_tx_store.d.ts.map +1 -0
- package/dest/publisher/l1_tx_failed_store/failed_tx_store.js +1 -0
- package/dest/publisher/l1_tx_failed_store/file_store_failed_tx_store.d.ts +15 -0
- package/dest/publisher/l1_tx_failed_store/file_store_failed_tx_store.d.ts.map +1 -0
- package/dest/publisher/l1_tx_failed_store/file_store_failed_tx_store.js +34 -0
- package/dest/publisher/l1_tx_failed_store/index.d.ts +4 -0
- package/dest/publisher/l1_tx_failed_store/index.d.ts.map +1 -0
- package/dest/publisher/l1_tx_failed_store/index.js +2 -0
- package/dest/publisher/sequencer-bundle-simulator.d.ts +96 -0
- package/dest/publisher/sequencer-bundle-simulator.d.ts.map +1 -0
- package/dest/publisher/sequencer-bundle-simulator.js +198 -0
- package/dest/publisher/sequencer-publisher-factory.d.ts +11 -5
- package/dest/publisher/sequencer-publisher-factory.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher-factory.js +27 -3
- package/dest/publisher/sequencer-publisher.d.ts +112 -71
- package/dest/publisher/sequencer-publisher.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher.js +571 -392
- package/dest/publisher/write_json.d.ts +11 -0
- package/dest/publisher/write_json.d.ts.map +1 -0
- package/dest/publisher/write_json.js +57 -0
- package/dest/sequencer/automine/automine_factory.d.ts +56 -0
- package/dest/sequencer/automine/automine_factory.d.ts.map +1 -0
- package/dest/sequencer/automine/automine_factory.js +85 -0
- package/dest/sequencer/automine/automine_sequencer.d.ts +189 -0
- package/dest/sequencer/automine/automine_sequencer.d.ts.map +1 -0
- package/dest/sequencer/automine/automine_sequencer.js +696 -0
- package/dest/sequencer/automine/index.d.ts +3 -0
- package/dest/sequencer/automine/index.d.ts.map +1 -0
- package/dest/sequencer/automine/index.js +2 -0
- package/dest/sequencer/checkpoint_proposal_job.d.ts +75 -19
- package/dest/sequencer/checkpoint_proposal_job.d.ts.map +1 -1
- package/dest/sequencer/checkpoint_proposal_job.js +886 -264
- package/dest/sequencer/checkpoint_proposal_job_metrics.d.ts +34 -0
- package/dest/sequencer/checkpoint_proposal_job_metrics.d.ts.map +1 -0
- package/dest/sequencer/checkpoint_proposal_job_metrics.js +72 -0
- package/dest/sequencer/checkpoint_voter.d.ts +1 -2
- package/dest/sequencer/checkpoint_voter.d.ts.map +1 -1
- package/dest/sequencer/checkpoint_voter.js +2 -5
- package/dest/sequencer/errors.d.ts +1 -8
- package/dest/sequencer/errors.d.ts.map +1 -1
- package/dest/sequencer/errors.js +0 -9
- package/dest/sequencer/events.d.ts +62 -5
- package/dest/sequencer/events.d.ts.map +1 -1
- package/dest/sequencer/metrics.d.ts +23 -8
- package/dest/sequencer/metrics.d.ts.map +1 -1
- package/dest/sequencer/metrics.js +117 -21
- package/dest/sequencer/requests_tracker.d.ts +22 -0
- package/dest/sequencer/requests_tracker.d.ts.map +1 -0
- package/dest/sequencer/requests_tracker.js +33 -0
- package/dest/sequencer/sequencer.d.ts +181 -44
- package/dest/sequencer/sequencer.d.ts.map +1 -1
- package/dest/sequencer/sequencer.js +635 -218
- package/dest/sequencer/types.d.ts +2 -2
- package/dest/sequencer/types.d.ts.map +1 -1
- package/dest/test/index.d.ts +5 -7
- package/dest/test/index.d.ts.map +1 -1
- package/dest/test/mock_checkpoint_builder.d.ts +11 -11
- package/dest/test/mock_checkpoint_builder.d.ts.map +1 -1
- package/dest/test/mock_checkpoint_builder.js +45 -34
- package/dest/test/utils.d.ts +17 -3
- package/dest/test/utils.d.ts.map +1 -1
- package/dest/test/utils.js +28 -9
- package/package.json +28 -28
- package/src/client/sequencer-client.ts +110 -47
- package/src/config.ts +126 -44
- package/src/global_variable_builder/README.md +44 -0
- package/src/global_variable_builder/fee_predictor.ts +182 -0
- package/src/global_variable_builder/fee_provider.ts +97 -0
- package/src/global_variable_builder/global_builder.ts +20 -89
- package/src/global_variable_builder/index.ts +3 -1
- package/src/publisher/config.ts +173 -40
- package/src/publisher/index.ts +3 -0
- package/src/publisher/l1_to_l2_messaging.ts +85 -0
- package/src/publisher/l1_tx_failed_store/factory.ts +32 -0
- package/src/publisher/l1_tx_failed_store/failed_tx_store.ts +57 -0
- package/src/publisher/l1_tx_failed_store/file_store_failed_tx_store.ts +46 -0
- package/src/publisher/l1_tx_failed_store/index.ts +3 -0
- package/src/publisher/sequencer-bundle-simulator.ts +254 -0
- package/src/publisher/sequencer-publisher-factory.ts +38 -9
- package/src/publisher/sequencer-publisher.ts +667 -484
- package/src/publisher/write_json.ts +78 -0
- package/src/sequencer/automine/README.md +60 -0
- package/src/sequencer/automine/automine_factory.ts +152 -0
- package/src/sequencer/automine/automine_sequencer.ts +800 -0
- package/src/sequencer/automine/index.ts +6 -0
- package/src/sequencer/checkpoint_proposal_job.ts +1073 -290
- package/src/sequencer/checkpoint_proposal_job_metrics.ts +128 -0
- package/src/sequencer/checkpoint_voter.ts +1 -12
- package/src/sequencer/errors.ts +0 -15
- package/src/sequencer/events.ts +66 -5
- package/src/sequencer/metrics.ts +138 -26
- package/src/sequencer/requests_tracker.ts +43 -0
- package/src/sequencer/sequencer.ts +745 -243
- package/src/sequencer/types.ts +1 -1
- package/src/test/index.ts +4 -6
- package/src/test/mock_checkpoint_builder.ts +63 -49
- package/src/test/utils.ts +64 -10
- package/dest/sequencer/timetable.d.ts +0 -87
- package/dest/sequencer/timetable.d.ts.map +0 -1
- package/dest/sequencer/timetable.js +0 -223
- package/src/sequencer/README.md +0 -531
- package/src/sequencer/timetable.ts +0 -283
package/dest/publisher/config.js
CHANGED
|
@@ -1,48 +1,137 @@
|
|
|
1
1
|
import { blobClientConfigMapping } from '@aztec/blob-client/client/config';
|
|
2
2
|
import { l1ReaderConfigMappings } from '@aztec/ethereum/l1-reader';
|
|
3
3
|
import { l1TxUtilsConfigMappings } from '@aztec/ethereum/l1-tx-utils/config';
|
|
4
|
-
import { SecretValue, booleanConfigHelper,
|
|
4
|
+
import { SecretValue, booleanConfigHelper, numberConfigHelper } from '@aztec/foundation/config';
|
|
5
5
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
fallback: [
|
|
14
|
-
scope === 'PROVER' ? `PROVER_PUBLISHER_PRIVATE_KEY` : `SEQ_PUBLISHER_PRIVATE_KEY`
|
|
15
|
-
]
|
|
16
|
-
},
|
|
17
|
-
publisherAddresses: {
|
|
18
|
-
env: scope === 'PROVER' ? `PROVER_PUBLISHER_ADDRESSES` : `SEQ_PUBLISHER_ADDRESSES`,
|
|
19
|
-
description: 'The addresses of the publishers to use with remote signers',
|
|
20
|
-
parseEnv: (val)=>val.split(',').map((address)=>EthAddress.fromString(address)),
|
|
21
|
-
defaultValue: []
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
export function getTxSenderConfigFromEnv(scope) {
|
|
25
|
-
return getConfigFromMappings(getTxSenderConfigMappings(scope));
|
|
6
|
+
import { parseEther } from 'viem';
|
|
7
|
+
export function getTxSenderConfigFromProverConfig(config) {
|
|
8
|
+
return {
|
|
9
|
+
...config,
|
|
10
|
+
publisherPrivateKeys: config.proverPublisherPrivateKeys,
|
|
11
|
+
publisherAddresses: config.proverPublisherAddresses
|
|
12
|
+
};
|
|
26
13
|
}
|
|
27
|
-
export
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
fishermanMode: {
|
|
34
|
-
env: 'FISHERMAN_MODE',
|
|
35
|
-
description: 'Whether to run in fisherman mode: builds blocks on every slot for validation without publishing to L1',
|
|
36
|
-
...booleanConfigHelper(false)
|
|
37
|
-
},
|
|
38
|
-
publisherForwarderAddress: {
|
|
39
|
-
env: scope === `PROVER` ? `PROVER_PUBLISHER_FORWARDER_ADDRESS` : `SEQ_PUBLISHER_FORWARDER_ADDRESS`,
|
|
40
|
-
description: 'Address of the forwarder contract to wrap all L1 transactions through (for testing purposes only)',
|
|
41
|
-
parseEnv: (val)=>val ? EthAddress.fromString(val) : undefined
|
|
42
|
-
},
|
|
43
|
-
...l1TxUtilsConfigMappings,
|
|
44
|
-
...blobClientConfigMapping
|
|
45
|
-
});
|
|
46
|
-
export function getPublisherConfigFromEnv(scope) {
|
|
47
|
-
return getConfigFromMappings(getPublisherConfigMappings(scope));
|
|
14
|
+
export function getTxSenderConfigFromSequencerConfig(config) {
|
|
15
|
+
return {
|
|
16
|
+
...config,
|
|
17
|
+
publisherPrivateKeys: config.sequencerPublisherPrivateKeys,
|
|
18
|
+
publisherAddresses: config.sequencerPublisherAddresses
|
|
19
|
+
};
|
|
48
20
|
}
|
|
21
|
+
/** Shared config mappings for publisher funding, used by both sequencer and prover publisher configs. */ const publisherFundingConfigMappings = {
|
|
22
|
+
publisherFundingThreshold: {
|
|
23
|
+
env: 'PUBLISHER_FUNDING_THRESHOLD',
|
|
24
|
+
description: 'Min ETH balance below which a publisher gets funded. Specified in ether (e.g. 0.1). Unset = funding disabled.',
|
|
25
|
+
parseEnv: (val)=>parseEther(val)
|
|
26
|
+
},
|
|
27
|
+
publisherFundingAmount: {
|
|
28
|
+
env: 'PUBLISHER_FUNDING_AMOUNT',
|
|
29
|
+
description: 'Amount of ETH to send when funding a publisher. Specified in ether (e.g. 0.5). Unset = funding disabled.',
|
|
30
|
+
parseEnv: (val)=>parseEther(val)
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
export function getPublisherConfigFromProverConfig(config) {
|
|
34
|
+
return {
|
|
35
|
+
...config,
|
|
36
|
+
publisherAllowInvalidStates: config.proverPublisherAllowInvalidStates,
|
|
37
|
+
publisherForwarderAddress: config.proverPublisherForwarderAddress
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export function getPublisherConfigFromSequencerConfig(config) {
|
|
41
|
+
return {
|
|
42
|
+
...config,
|
|
43
|
+
publisherAllowInvalidStates: config.sequencerPublisherAllowInvalidStates,
|
|
44
|
+
publisherForwarderAddress: config.sequencerPublisherForwarderAddress,
|
|
45
|
+
l1TxFailedStore: config.l1TxFailedStore
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
export const proverTxSenderConfigMappings = {
|
|
49
|
+
...l1ReaderConfigMappings,
|
|
50
|
+
proverPublisherPrivateKeys: {
|
|
51
|
+
env: `PROVER_PUBLISHER_PRIVATE_KEYS`,
|
|
52
|
+
description: 'The private keys to be used by the prover publisher.',
|
|
53
|
+
parseEnv: (val)=>val.split(',').map((key)=>new SecretValue(`0x${key.replace('0x', '')}`)),
|
|
54
|
+
defaultValue: [],
|
|
55
|
+
fallback: [
|
|
56
|
+
`PROVER_PUBLISHER_PRIVATE_KEY`
|
|
57
|
+
]
|
|
58
|
+
},
|
|
59
|
+
proverPublisherAddresses: {
|
|
60
|
+
env: `PROVER_PUBLISHER_ADDRESSES`,
|
|
61
|
+
description: 'The addresses of the publishers to use with remote signers',
|
|
62
|
+
parseEnv: (val)=>val.split(',').map((address)=>EthAddress.fromString(address)),
|
|
63
|
+
defaultValue: []
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
export const sequencerTxSenderConfigMappings = {
|
|
67
|
+
...l1ReaderConfigMappings,
|
|
68
|
+
sequencerPublisherPrivateKeys: {
|
|
69
|
+
env: `SEQ_PUBLISHER_PRIVATE_KEYS`,
|
|
70
|
+
description: 'The private keys to be used by the sequencer publisher.',
|
|
71
|
+
parseEnv: (val)=>val.split(',').map((key)=>new SecretValue(`0x${key.replace('0x', '')}`)),
|
|
72
|
+
defaultValue: [],
|
|
73
|
+
fallback: [
|
|
74
|
+
`SEQ_PUBLISHER_PRIVATE_KEY`
|
|
75
|
+
]
|
|
76
|
+
},
|
|
77
|
+
sequencerPublisherAddresses: {
|
|
78
|
+
env: `SEQ_PUBLISHER_ADDRESSES`,
|
|
79
|
+
description: 'The addresses of the publishers to use with remote signers',
|
|
80
|
+
parseEnv: (val)=>val.split(',').map((address)=>EthAddress.fromString(address)),
|
|
81
|
+
defaultValue: []
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
export const sequencerPublisherConfigMappings = {
|
|
85
|
+
...l1TxUtilsConfigMappings,
|
|
86
|
+
...blobClientConfigMapping,
|
|
87
|
+
sequencerPublisherAllowInvalidStates: {
|
|
88
|
+
env: `SEQ_PUBLISHER_ALLOW_INVALID_STATES`,
|
|
89
|
+
description: 'True to use publishers in invalid states (timed out, cancelled, etc) if no other is available',
|
|
90
|
+
...booleanConfigHelper(true)
|
|
91
|
+
},
|
|
92
|
+
fishermanMode: {
|
|
93
|
+
env: 'FISHERMAN_MODE',
|
|
94
|
+
description: 'Whether to run in fisherman mode: builds blocks on every slot for validation without publishing to L1',
|
|
95
|
+
...booleanConfigHelper(false)
|
|
96
|
+
},
|
|
97
|
+
sequencerPublisherForwarderAddress: {
|
|
98
|
+
env: `SEQ_PUBLISHER_FORWARDER_ADDRESS`,
|
|
99
|
+
description: 'Address of the forwarder contract to wrap all L1 transactions through (for testing purposes only)',
|
|
100
|
+
parseEnv: (val)=>EthAddress.fromString(val)
|
|
101
|
+
},
|
|
102
|
+
sequencerPublisherPreviousL1BlockWaitTimeoutMs: {
|
|
103
|
+
env: `SEQ_PUBLISHER_PREVIOUS_L1_BLOCK_WAIT_TIMEOUT_MS`,
|
|
104
|
+
description: 'How long to wait for the previous L1 block before sending scheduled publisher txs anyway, in milliseconds.',
|
|
105
|
+
...numberConfigHelper(8_000)
|
|
106
|
+
},
|
|
107
|
+
sequencerPublisherPreviousL1BlockWaitPollIntervalMs: {
|
|
108
|
+
env: `SEQ_PUBLISHER_PREVIOUS_L1_BLOCK_WAIT_POLL_INTERVAL_MS`,
|
|
109
|
+
description: 'Poll interval while waiting for the previous L1 block before scheduled publisher txs, in milliseconds.',
|
|
110
|
+
...numberConfigHelper(500)
|
|
111
|
+
},
|
|
112
|
+
l1TxFailedStore: {
|
|
113
|
+
env: 'L1_TX_FAILED_STORE',
|
|
114
|
+
description: 'Store for failed L1 transaction inputs (test networks only). Format: gs://bucket/path'
|
|
115
|
+
},
|
|
116
|
+
...publisherFundingConfigMappings
|
|
117
|
+
};
|
|
118
|
+
export const proverPublisherConfigMappings = {
|
|
119
|
+
...l1TxUtilsConfigMappings,
|
|
120
|
+
...blobClientConfigMapping,
|
|
121
|
+
proverPublisherAllowInvalidStates: {
|
|
122
|
+
env: `PROVER_PUBLISHER_ALLOW_INVALID_STATES`,
|
|
123
|
+
description: 'True to use publishers in invalid states (timed out, cancelled, etc) if no other is available',
|
|
124
|
+
...booleanConfigHelper(true)
|
|
125
|
+
},
|
|
126
|
+
fishermanMode: {
|
|
127
|
+
env: 'FISHERMAN_MODE',
|
|
128
|
+
description: 'Whether to run in fisherman mode: builds blocks on every slot for validation without publishing to L1',
|
|
129
|
+
...booleanConfigHelper(false)
|
|
130
|
+
},
|
|
131
|
+
proverPublisherForwarderAddress: {
|
|
132
|
+
env: `PROVER_PUBLISHER_FORWARDER_ADDRESS`,
|
|
133
|
+
description: 'Address of the forwarder contract to wrap all L1 transactions through (for testing purposes only)',
|
|
134
|
+
parseEnv: (val)=>EthAddress.fromString(val)
|
|
135
|
+
},
|
|
136
|
+
...publisherFundingConfigMappings
|
|
137
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { SequencerPublisher } from './sequencer-publisher.js';
|
|
2
2
|
export { SequencerPublisherFactory } from './sequencer-publisher-factory.js';
|
|
3
3
|
export { SequencerPublisherMetrics } from './sequencer-publisher-metrics.js';
|
|
4
|
-
|
|
4
|
+
export { type FailedL1Tx, type FailedL1TxUri, type L1TxFailedStore } from './l1_tx_failed_store/index.js';
|
|
5
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wdWJsaXNoZXIvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLGtCQUFrQixFQUFFLE1BQU0sMEJBQTBCLENBQUM7QUFDOUQsT0FBTyxFQUFFLHlCQUF5QixFQUFFLE1BQU0sa0NBQWtDLENBQUM7QUFHN0UsT0FBTyxFQUFFLHlCQUF5QixFQUFFLE1BQU0sa0NBQWtDLENBQUM7QUFHN0UsT0FBTyxFQUFFLEtBQUssVUFBVSxFQUFFLEtBQUssYUFBYSxFQUFFLEtBQUssZUFBZSxFQUFFLE1BQU0sK0JBQStCLENBQUMifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/publisher/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAG7E,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/publisher/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAG7E,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAG7E,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,aAAa,EAAE,KAAK,eAAe,EAAE,MAAM,+BAA+B,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { L1ContractAddresses } from '@aztec/ethereum/l1-contract-addresses';
|
|
2
|
+
import type { ExtendedViemWalletClient } from '@aztec/ethereum/types';
|
|
3
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
|
+
/**
|
|
6
|
+
* Sends an L1-to-L2 message via the Inbox contract and returns its hash and global leaf index.
|
|
7
|
+
* Test helper copied from the end-to-end fixtures so this integration test can live in sequencer-client.
|
|
8
|
+
*/
|
|
9
|
+
export declare function sendL1ToL2Message(message: {
|
|
10
|
+
recipient: AztecAddress;
|
|
11
|
+
content: Fr;
|
|
12
|
+
secretHash: Fr;
|
|
13
|
+
}, ctx: {
|
|
14
|
+
l1Client: ExtendedViemWalletClient;
|
|
15
|
+
l1ContractAddresses: Pick<L1ContractAddresses, 'inboxAddress' | 'rollupAddress'>;
|
|
16
|
+
}): Promise<{
|
|
17
|
+
msgHash: Fr;
|
|
18
|
+
globalLeafIndex: Fr;
|
|
19
|
+
txReceipt: import("viem").TransactionReceipt;
|
|
20
|
+
}>;
|
|
21
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibDFfdG9fbDJfbWVzc2FnaW5nLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvcHVibGlzaGVyL2wxX3RvX2wyX21lc3NhZ2luZy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFDQSxPQUFPLEtBQUssRUFBRSxtQkFBbUIsRUFBRSxNQUFNLHVDQUF1QyxDQUFDO0FBQ2pGLE9BQU8sS0FBSyxFQUFFLHdCQUF3QixFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFDdEUsT0FBTyxFQUFFLEVBQUUsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBSXBELE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLDZCQUE2QixDQUFDO0FBSWhFOzs7R0FHRztBQUNILHdCQUFzQixpQkFBaUIsQ0FDckMsT0FBTyxFQUFFO0lBQUUsU0FBUyxFQUFFLFlBQVksQ0FBQztJQUFDLE9BQU8sRUFBRSxFQUFFLENBQUM7SUFBQyxVQUFVLEVBQUUsRUFBRSxDQUFBO0NBQUUsRUFDakUsR0FBRyxFQUFFO0lBQ0gsUUFBUSxFQUFFLHdCQUF3QixDQUFDO0lBQ25DLG1CQUFtQixFQUFFLElBQUksQ0FBQyxtQkFBbUIsRUFBRSxjQUFjLEdBQUcsZUFBZSxDQUFDLENBQUM7Q0FDbEY7Ozs7R0FnRUYifQ==
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"l1_to_l2_messaging.d.ts","sourceRoot":"","sources":["../../src/publisher/l1_to_l2_messaging.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AACjF,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AAIpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAIhE;;;GAGG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE;IAAE,SAAS,EAAE,YAAY,CAAC;IAAC,OAAO,EAAE,EAAE,CAAC;IAAC,UAAU,EAAE,EAAE,CAAA;CAAE,EACjE,GAAG,EAAE;IACH,QAAQ,EAAE,wBAAwB,CAAC;IACnC,mBAAmB,EAAE,IAAI,CAAC,mBAAmB,EAAE,cAAc,GAAG,eAAe,CAAC,CAAC;CAClF;;;;GAgEF"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { RollupContract } from '@aztec/ethereum/contracts';
|
|
2
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
|
+
import { tryJsonStringify } from '@aztec/foundation/json-rpc';
|
|
4
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
5
|
+
import { InboxAbi } from '@aztec/l1-artifacts';
|
|
6
|
+
import { decodeEventLog, getContract } from 'viem';
|
|
7
|
+
/**
|
|
8
|
+
* Sends an L1-to-L2 message via the Inbox contract and returns its hash and global leaf index.
|
|
9
|
+
* Test helper copied from the end-to-end fixtures so this integration test can live in sequencer-client.
|
|
10
|
+
*/ export async function sendL1ToL2Message(message, ctx) {
|
|
11
|
+
const logger = createLogger('sequencer-client:l1_to_l2_messaging');
|
|
12
|
+
const inbox = getContract({
|
|
13
|
+
address: ctx.l1ContractAddresses.inboxAddress.toString(),
|
|
14
|
+
abi: InboxAbi,
|
|
15
|
+
client: ctx.l1Client
|
|
16
|
+
});
|
|
17
|
+
const { recipient, content, secretHash } = message;
|
|
18
|
+
const version = await new RollupContract(ctx.l1Client, ctx.l1ContractAddresses.rollupAddress.toString()).getVersion();
|
|
19
|
+
// We inject the message to Inbox
|
|
20
|
+
const txHash = await inbox.write.sendL2Message([
|
|
21
|
+
{
|
|
22
|
+
actor: recipient.toString(),
|
|
23
|
+
version: BigInt(version)
|
|
24
|
+
},
|
|
25
|
+
content.toString(),
|
|
26
|
+
secretHash.toString()
|
|
27
|
+
], {
|
|
28
|
+
gas: 1_000_000n
|
|
29
|
+
});
|
|
30
|
+
logger.info(`L1 to L2 message sent in tx ${txHash}`);
|
|
31
|
+
// We check that the message was correctly injected by checking the emitted event
|
|
32
|
+
const txReceipt = await ctx.l1Client.waitForTransactionReceipt({
|
|
33
|
+
hash: txHash
|
|
34
|
+
});
|
|
35
|
+
if (txReceipt.status !== 'success') {
|
|
36
|
+
throw new Error(`L1 to L2 message failed to be sent in tx ${txHash}. Status: ${txReceipt.status}`);
|
|
37
|
+
}
|
|
38
|
+
logger.info(`L1 to L2 message receipt retrieved for tx ${txReceipt.transactionHash}`, txReceipt);
|
|
39
|
+
if (txReceipt.transactionHash !== txHash) {
|
|
40
|
+
throw new Error(`Receipt transaction hash mismatch: ${txReceipt.transactionHash} !== ${txHash}`);
|
|
41
|
+
}
|
|
42
|
+
// Filter for MessageSent events from the Inbox contract by trying to decode each log
|
|
43
|
+
const messageSentLogs = txReceipt.logs.filter((log)=>log.address.toLowerCase() === ctx.l1ContractAddresses.inboxAddress.toString().toLowerCase()).map((log)=>{
|
|
44
|
+
try {
|
|
45
|
+
const decoded = decodeEventLog({
|
|
46
|
+
abi: InboxAbi,
|
|
47
|
+
data: log.data,
|
|
48
|
+
topics: log.topics
|
|
49
|
+
});
|
|
50
|
+
return {
|
|
51
|
+
log,
|
|
52
|
+
decoded
|
|
53
|
+
};
|
|
54
|
+
} catch {
|
|
55
|
+
return null; // Not a decodable event from this ABI
|
|
56
|
+
}
|
|
57
|
+
}).filter((item)=>item !== null && item.decoded.eventName === 'MessageSent');
|
|
58
|
+
if (messageSentLogs.length !== 1) {
|
|
59
|
+
throw new Error(`Wrong number of MessageSent logs found in ${txHash} transaction (got ${messageSentLogs.length} expected 1)\n${tryJsonStringify(messageSentLogs.map((item)=>item.log))}`);
|
|
60
|
+
}
|
|
61
|
+
// We already have the decoded event
|
|
62
|
+
const topics = messageSentLogs[0].decoded;
|
|
63
|
+
const receivedMsgHash = topics.args.hash;
|
|
64
|
+
const receivedGlobalLeafIndex = topics.args.index;
|
|
65
|
+
return {
|
|
66
|
+
msgHash: Fr.fromHexString(receivedMsgHash),
|
|
67
|
+
globalLeafIndex: new Fr(receivedGlobalLeafIndex),
|
|
68
|
+
txReceipt
|
|
69
|
+
};
|
|
70
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type Logger } from '@aztec/foundation/log';
|
|
2
|
+
import type { L1TxFailedStore } from './failed_tx_store.js';
|
|
3
|
+
/**
|
|
4
|
+
* Creates an L1TxFailedStore from a config string.
|
|
5
|
+
* Supports any backend that FileStore supports (GCS, S3, R2, local filesystem).
|
|
6
|
+
* @param config - Config string (e.g., 'gs://bucket/path', 's3://bucket/path', 'file:///path'). If undefined, returns undefined.
|
|
7
|
+
* @param logger - Optional logger.
|
|
8
|
+
* @returns The store instance, or undefined if config is not provided.
|
|
9
|
+
*/
|
|
10
|
+
export declare function createL1TxFailedStore(config: string | undefined, logger?: Logger): Promise<L1TxFailedStore | undefined>;
|
|
11
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmFjdG9yeS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3B1Ymxpc2hlci9sMV90eF9mYWlsZWRfc3RvcmUvZmFjdG9yeS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsS0FBSyxNQUFNLEVBQWdCLE1BQU0sdUJBQXVCLENBQUM7QUFHbEUsT0FBTyxLQUFLLEVBQUUsZUFBZSxFQUFFLE1BQU0sc0JBQXNCLENBQUM7QUFHNUQ7Ozs7OztHQU1HO0FBQ0gsd0JBQXNCLHFCQUFxQixDQUN6QyxNQUFNLEVBQUUsTUFBTSxHQUFHLFNBQVMsRUFDMUIsTUFBTSxHQUFFLE1BQXFELEdBQzVELE9BQU8sQ0FBQyxlQUFlLEdBQUcsU0FBUyxDQUFDLENBZXRDIn0=
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/publisher/l1_tx_failed_store/factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAGlE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAG5D;;;;;;GAMG;AACH,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,MAAM,GAAE,MAAqD,GAC5D,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC,CAetC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
2
|
+
import { createFileStore } from '@aztec/stdlib/file-store';
|
|
3
|
+
import { FileStoreL1TxFailedStore } from './file_store_failed_tx_store.js';
|
|
4
|
+
/**
|
|
5
|
+
* Creates an L1TxFailedStore from a config string.
|
|
6
|
+
* Supports any backend that FileStore supports (GCS, S3, R2, local filesystem).
|
|
7
|
+
* @param config - Config string (e.g., 'gs://bucket/path', 's3://bucket/path', 'file:///path'). If undefined, returns undefined.
|
|
8
|
+
* @param logger - Optional logger.
|
|
9
|
+
* @returns The store instance, or undefined if config is not provided.
|
|
10
|
+
*/ export async function createL1TxFailedStore(config, logger = createLogger('sequencer:l1-tx-failed-store')) {
|
|
11
|
+
if (!config) {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
const fileStore = await createFileStore(config, logger);
|
|
15
|
+
if (!fileStore) {
|
|
16
|
+
throw new Error(`Failed to create file store from config: '${config}'. ` + `Supported formats: 'gs://bucket/path', 's3://bucket/path', 'file:///path'.`);
|
|
17
|
+
}
|
|
18
|
+
logger.info(`Created L1 tx failed store`, {
|
|
19
|
+
config
|
|
20
|
+
});
|
|
21
|
+
return new FileStoreL1TxFailedStore(fileStore, logger);
|
|
22
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { Branded } from '@aztec/foundation/branded-types';
|
|
2
|
+
import type { Hex } from 'viem';
|
|
3
|
+
/** URI pointing to a stored failed L1 transaction. */
|
|
4
|
+
export type FailedL1TxUri = Branded<string, 'FailedL1TxUri'>;
|
|
5
|
+
/** A failed L1 transaction captured for debugging and replay. */
|
|
6
|
+
export type FailedL1Tx = {
|
|
7
|
+
/** Tx hash (for reverts) or keccak256(request.data) (for simulation/send failures). */
|
|
8
|
+
id: Hex;
|
|
9
|
+
/** Unix timestamp (ms) when failure occurred. */
|
|
10
|
+
timestamp: number;
|
|
11
|
+
/** Whether the failure was during simulation or after sending. */
|
|
12
|
+
failureType: 'simulation' | 'revert' | 'send-error';
|
|
13
|
+
/** The actual L1 transaction for replay (multicall-encoded for bundled txs). */
|
|
14
|
+
request: {
|
|
15
|
+
to: Hex;
|
|
16
|
+
data: Hex;
|
|
17
|
+
value?: string;
|
|
18
|
+
};
|
|
19
|
+
/** Raw blob data as hex for replay. */
|
|
20
|
+
blobData?: Hex[];
|
|
21
|
+
/** L1 block number at time of failure (simulation target or receipt block). */
|
|
22
|
+
l1BlockNumber: string;
|
|
23
|
+
/** Receipt info (present only for on-chain reverts). */
|
|
24
|
+
receipt?: {
|
|
25
|
+
transactionHash: Hex;
|
|
26
|
+
blockNumber: string;
|
|
27
|
+
gasUsed: string;
|
|
28
|
+
status: 'reverted';
|
|
29
|
+
};
|
|
30
|
+
/** Error information. */
|
|
31
|
+
error: {
|
|
32
|
+
message: string;
|
|
33
|
+
/** Decoded error name (e.g., 'Rollup__InvalidProposer'). */
|
|
34
|
+
name?: string;
|
|
35
|
+
};
|
|
36
|
+
/** Context metadata. */
|
|
37
|
+
context: {
|
|
38
|
+
/** Actions involved (e.g., ['propose', 'governance-signal']). */
|
|
39
|
+
actions: string[];
|
|
40
|
+
/** Individual request data for each action (metadata, not used for replay). */
|
|
41
|
+
requests?: Array<{
|
|
42
|
+
action: string;
|
|
43
|
+
to: Hex;
|
|
44
|
+
data: Hex;
|
|
45
|
+
}>;
|
|
46
|
+
checkpointNumber?: number;
|
|
47
|
+
slot?: number;
|
|
48
|
+
sender: Hex;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
/** Store for failed L1 transactions for debugging purposes. */
|
|
52
|
+
export interface L1TxFailedStore {
|
|
53
|
+
/** Saves a failed transaction and returns its URI. */
|
|
54
|
+
saveFailedTx(tx: FailedL1Tx): Promise<FailedL1TxUri>;
|
|
55
|
+
/** Retrieves a failed transaction by its URI. */
|
|
56
|
+
getFailedTx(uri: FailedL1TxUri): Promise<FailedL1Tx>;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmFpbGVkX3R4X3N0b3JlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvcHVibGlzaGVyL2wxX3R4X2ZhaWxlZF9zdG9yZS9mYWlsZWRfdHhfc3RvcmUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsT0FBTyxFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFFL0QsT0FBTyxLQUFLLEVBQUUsR0FBRyxFQUFFLE1BQU0sTUFBTSxDQUFDO0FBRWhDLHNEQUFzRDtBQUN0RCxNQUFNLE1BQU0sYUFBYSxHQUFHLE9BQU8sQ0FBQyxNQUFNLEVBQUUsZU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;QACV,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,uCAAuC;IACvC,QAAQ,CAAC,EAAE,GAAG,EAAE,CAAC;IACjB,+EAA+E;IAC/E,aAAa,EAAE,MAAM,CAAC;IACtB,wDAAwD;IACxD,OAAO,CAAC,EAAE;QACR,eAAe,EAAE,GAAG,CAAC;QACrB,WAAW,EAAE,MAAM,CAAC;QACpB,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,UAAU,CAAC;KACpB,CAAC;IACF,yBAAyB;IACzB,KAAK,EAAE;QACL,OAAO,EAAE,MAAM,CAAC;QAChB,4DAA4D;QAC5D,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;IACF,wBAAwB;IACxB,OAAO,EAAE;QACP,iEAAiE;QACjE,OAAO,EAAE,MAAM,EAAE,CAAC;QAClB,+EAA+E;QAC/E,QAAQ,CAAC,EAAE,KAAK,CAAC;YAAE,MAAM,EAAE,MAAM,CAAC;YAAC,EAAE,EAAE,GAAG,CAAC;YAAC,IAAI,EAAE,GAAG,CAAA;SAAE,CAAC,CAAC;QACzD,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,GAAG,CAAC;KACb,CAAC;CACH,CAAC;AAEF,+DAA+D;AAC/D,MAAM,WAAW,eAAe;IAC9B,sDAAsD;IACtD,YAAY,CAAC,EAAE,EAAE,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IACrD,iDAAiD;IACjD,WAAW,CAAC,GAAG,EAAE,aAAa,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;CACtD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/** Store for failed L1 transactions for debugging purposes. */ export { };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type Logger } from '@aztec/foundation/log';
|
|
2
|
+
import type { FileStore } from '@aztec/stdlib/file-store';
|
|
3
|
+
import type { FailedL1Tx, FailedL1TxUri, L1TxFailedStore } from './failed_tx_store.js';
|
|
4
|
+
/**
|
|
5
|
+
* L1TxFailedStore implementation using the FileStore abstraction.
|
|
6
|
+
* Supports any backend that FileStore supports (GCS, S3, R2, local filesystem).
|
|
7
|
+
*/
|
|
8
|
+
export declare class FileStoreL1TxFailedStore implements L1TxFailedStore {
|
|
9
|
+
private readonly fileStore;
|
|
10
|
+
private readonly log;
|
|
11
|
+
constructor(fileStore: FileStore, logger?: Logger);
|
|
12
|
+
saveFailedTx(tx: FailedL1Tx): Promise<FailedL1TxUri>;
|
|
13
|
+
getFailedTx(uri: FailedL1TxUri): Promise<FailedL1Tx>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmlsZV9zdG9yZV9mYWlsZWRfdHhfc3RvcmUuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9wdWJsaXNoZXIvbDFfdHhfZmFpbGVkX3N0b3JlL2ZpbGVfc3RvcmVfZmFpbGVkX3R4X3N0b3JlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxLQUFLLE1BQU0sRUFBZ0IsTUFBTSx1QkFBdUIsQ0FBQztBQUNsRSxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSwwQkFBMEIsQ0FBQztBQUUxRCxPQUFPLEtBQUssRUFBRSxVQUFVLEVBQUUsYUFBYSxFQUFFLGVBQWUsRUFBRSxNQUFNLHNCQUFzQixDQUFDO0FBRXZGOzs7R0FHRztBQUNILHFCQUFhLHdCQUF5QixZQUFXLGVBQWU7SUFJNUQsT0FBTyxDQUFDLFFBQVEsQ0FBQyxTQUFTO0lBSDVCLE9BQU8sQ0FBQyxRQUFRLENBQUMsR0FBRyxDQUFTO0lBRTdCLFlBQ21CLFNBQVMsRUFBRSxTQUFTLEVBQ3JDLE1BQU0sQ0FBQyxFQUFFLE1BQU0sRUFHaEI7SUFFWSxZQUFZLENBQUMsRUFBRSxFQUFFLFVBQVUsR0FBRyxPQUFPLENBQUMsYUFBYSxDQUFDLENBb0JoRTtJQUVZLFdBQVcsQ0FBQyxHQUFHLEVBQUUsYUFBYSxHQUFHLE9BQU8sQ0FBQyxVQUFVLENBQUMsQ0FHaEU7Q0FDRiJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file_store_failed_tx_store.d.ts","sourceRoot":"","sources":["../../../src/publisher/l1_tx_failed_store/file_store_failed_tx_store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvF;;;GAGG;AACH,qBAAa,wBAAyB,YAAW,eAAe;IAI5D,OAAO,CAAC,QAAQ,CAAC,SAAS;IAH5B,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAS;IAE7B,YACmB,SAAS,EAAE,SAAS,EACrC,MAAM,CAAC,EAAE,MAAM,EAGhB;IAEY,YAAY,CAAC,EAAE,EAAE,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC,CAoBhE;IAEY,WAAW,CAAC,GAAG,EAAE,aAAa,GAAG,OAAO,CAAC,UAAU,CAAC,CAGhE;CACF"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
2
|
+
/**
|
|
3
|
+
* L1TxFailedStore implementation using the FileStore abstraction.
|
|
4
|
+
* Supports any backend that FileStore supports (GCS, S3, R2, local filesystem).
|
|
5
|
+
*/ export class FileStoreL1TxFailedStore {
|
|
6
|
+
fileStore;
|
|
7
|
+
log;
|
|
8
|
+
constructor(fileStore, logger){
|
|
9
|
+
this.fileStore = fileStore;
|
|
10
|
+
this.log = logger ?? createLogger('sequencer:l1-tx-failed-store');
|
|
11
|
+
}
|
|
12
|
+
async saveFailedTx(tx) {
|
|
13
|
+
const prefix = tx.receipt ? 'tx' : 'data';
|
|
14
|
+
const path = `${tx.failureType}/${prefix}-${tx.id}.json`;
|
|
15
|
+
const json = JSON.stringify(tx, null, 2);
|
|
16
|
+
const uri = await this.fileStore.save(path, Buffer.from(json), {
|
|
17
|
+
metadata: {
|
|
18
|
+
'content-type': 'application/json',
|
|
19
|
+
actions: tx.context.actions.join(','),
|
|
20
|
+
'failure-type': tx.failureType
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
this.log.info(`Saved failed L1 tx to ${uri}`, {
|
|
24
|
+
id: tx.id,
|
|
25
|
+
failureType: tx.failureType,
|
|
26
|
+
actions: tx.context.actions.join(',')
|
|
27
|
+
});
|
|
28
|
+
return uri;
|
|
29
|
+
}
|
|
30
|
+
async getFailedTx(uri) {
|
|
31
|
+
const data = await this.fileStore.read(uri);
|
|
32
|
+
return JSON.parse(data.toString());
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { type FailedL1Tx, type FailedL1TxUri, type L1TxFailedStore } from './failed_tx_store.js';
|
|
2
|
+
export { createL1TxFailedStore } from './factory.js';
|
|
3
|
+
export { FileStoreL1TxFailedStore } from './file_store_failed_tx_store.js';
|
|
4
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9wdWJsaXNoZXIvbDFfdHhfZmFpbGVkX3N0b3JlL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxLQUFLLFVBQVUsRUFBRSxLQUFLLGFBQWEsRUFBRSxLQUFLLGVBQWUsRUFBRSxNQUFNLHNCQUFzQixDQUFDO0FBQ2pHLE9BQU8sRUFBRSxxQkFBcUIsRUFBRSxNQUFNLGNBQWMsQ0FBQztBQUNyRCxPQUFPLEVBQUUsd0JBQXdCLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQyJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/publisher/l1_tx_failed_store/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,aAAa,EAAE,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACjG,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import type { EpochCache } from '@aztec/epoch-cache';
|
|
2
|
+
import { type RollupContract } from '@aztec/ethereum/contracts';
|
|
3
|
+
import { type L1TxUtils } from '@aztec/ethereum/l1-tx-utils';
|
|
4
|
+
import type { SlotNumber } from '@aztec/foundation/branded-types';
|
|
5
|
+
import { type Logger } from '@aztec/foundation/log';
|
|
6
|
+
import type { Hex } from 'viem';
|
|
7
|
+
import type { RequestWithExpiry } from './sequencer-publisher.js';
|
|
8
|
+
/** A request that was dropped by bundle simulation, with the decoded revert reason. */
|
|
9
|
+
export type DroppedRequest = {
|
|
10
|
+
request: RequestWithExpiry;
|
|
11
|
+
revertReason: string | undefined;
|
|
12
|
+
returnData: Hex | undefined;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Result of {@link SequencerBundleSimulator.simulate}.
|
|
16
|
+
*
|
|
17
|
+
* - `success`: simulation succeeded. `requests` is the filtered survivor list, `gasLimit` is
|
|
18
|
+
* the bumped gas limit derived from `gasUsed` (plus blob evaluation gas). `droppedRequests`
|
|
19
|
+
* lists the entries that were observed to revert in simulation.
|
|
20
|
+
* - `fallback`: the node does not support eth_simulateV1 (or the simulate call threw). The
|
|
21
|
+
* caller should send `requests` as-is with a safe gas limit (e.g. {@link MAX_L1_TX_LIMIT}).
|
|
22
|
+
* `droppedRequests` carries any entries that the first pass already proved reverted, so the
|
|
23
|
+
* caller does not re-include them when the second pass falls back.
|
|
24
|
+
* - `aborted`: the bundle cannot be sent. `droppedRequests` contains only entries that were
|
|
25
|
+
* actually observed to revert (so they can be reported as simulation failures); it is empty
|
|
26
|
+
* when the abort was caused by an empty input bundle.
|
|
27
|
+
*/
|
|
28
|
+
export type BundleSimulateResult = {
|
|
29
|
+
kind: 'success';
|
|
30
|
+
requests: RequestWithExpiry[];
|
|
31
|
+
gasLimit: bigint;
|
|
32
|
+
droppedRequests: DroppedRequest[];
|
|
33
|
+
} | {
|
|
34
|
+
kind: 'fallback';
|
|
35
|
+
requests: RequestWithExpiry[];
|
|
36
|
+
droppedRequests: DroppedRequest[];
|
|
37
|
+
} | {
|
|
38
|
+
kind: 'aborted';
|
|
39
|
+
reason: AbortReason;
|
|
40
|
+
droppedRequests: DroppedRequest[];
|
|
41
|
+
};
|
|
42
|
+
export type AbortReason = 'empty-bundle' | 'all-reverted' | 'second-pass-reverts';
|
|
43
|
+
/**
|
|
44
|
+
* Bundle-level simulator for the aggregate3 payload that `SequencerPublisher` is about to send.
|
|
45
|
+
*
|
|
46
|
+
* Runs `eth_simulateV1` against `Multicall3.aggregate3`, drops entries that revert, and returns
|
|
47
|
+
* a gasLimit for the survivors. When `eth_simulateV1` is unavailable, signals fallback to the
|
|
48
|
+
* caller so it can send the bundle as-is with a conservative gas limit.
|
|
49
|
+
*/
|
|
50
|
+
export declare class SequencerBundleSimulator {
|
|
51
|
+
private readonly deps;
|
|
52
|
+
private readonly log;
|
|
53
|
+
constructor(deps: {
|
|
54
|
+
getL1TxUtils: () => L1TxUtils;
|
|
55
|
+
rollupContract: RollupContract;
|
|
56
|
+
epochCache: EpochCache;
|
|
57
|
+
log?: Logger;
|
|
58
|
+
});
|
|
59
|
+
/**
|
|
60
|
+
* Simulates the given bundle near the end of the target slot and filters out entries
|
|
61
|
+
* that revert.
|
|
62
|
+
*
|
|
63
|
+
* - If all entries pass on the first pass, returns `success` with the gasLimit.
|
|
64
|
+
* - If some entries revert, re-simulates the survivors. If the second pass is clean, returns
|
|
65
|
+
* `success` with the survivors and dropped entries. If the second pass surfaces any revert,
|
|
66
|
+
* returns `aborted` — we refuse to send a bundle whose composition still has internal
|
|
67
|
+
* reverts after one round of filtering.
|
|
68
|
+
* - If eth_simulateV1 is unavailable, returns `fallback`. The caller is expected to send the
|
|
69
|
+
* bundle as-is with a safe gas limit.
|
|
70
|
+
*
|
|
71
|
+
* The simulation `block.timestamp` is the last L1 slot timestamp inside the target L2 slot.
|
|
72
|
+
* This still maps to the target L2 slot for propose's `validateHeader` and EIP-712 signature
|
|
73
|
+
* checks, while avoiding eth_simulateV1 rejecting a child block whose timestamp is not strictly
|
|
74
|
+
* greater than the current L1 head.
|
|
75
|
+
*
|
|
76
|
+
* Known limitation: on networks where L1 is mining behind cadence (missed L1 slots, anvil with
|
|
77
|
+
* overridden timestamps), the actual `block.timestamp` at send time can land in the prior L2
|
|
78
|
+
* slot. In that case `propose` would revert silently inside the multicall. The simulator does
|
|
79
|
+
* not detect this case because it simulates inside the target slot — the prior implementation
|
|
80
|
+
* used `min(predictedNextL1Ts, targetTimestamp)` to surface this failure mode at simulate time.
|
|
81
|
+
*/
|
|
82
|
+
simulate(validRequests: RequestWithExpiry[], targetSlot: SlotNumber): Promise<BundleSimulateResult>;
|
|
83
|
+
private buildSuccessResult;
|
|
84
|
+
/**
|
|
85
|
+
* `gasLimit = bumpGasLimit(ceil(gasUsed * 64 / 63))`, plus blob evaluation gas if a propose
|
|
86
|
+
* survived, capped at the L1 block gas limit.
|
|
87
|
+
*/
|
|
88
|
+
private computeGasLimit;
|
|
89
|
+
/**
|
|
90
|
+
* eth_simulateV1 cannot carry blob sidecar data, so disable the rollup's on-chain blob check
|
|
91
|
+
* when a propose is in the bundle.
|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