@aztec/stdlib 2.0.3-rc.9 → 2.1.0-rc.1
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/dest/block/in_block.d.ts +5 -5
- package/dest/block/in_block.d.ts.map +1 -1
- package/dest/block/proposal/attestations_and_signers.d.ts +48 -0
- package/dest/block/proposal/attestations_and_signers.d.ts.map +1 -0
- package/dest/block/proposal/attestations_and_signers.js +99 -0
- package/dest/block/proposal/committee_attestation.d.ts +1 -0
- package/dest/block/proposal/committee_attestation.d.ts.map +1 -1
- package/dest/block/proposal/committee_attestation.js +3 -0
- package/dest/block/proposal/index.d.ts +1 -0
- package/dest/block/proposal/index.d.ts.map +1 -1
- package/dest/block/proposal/index.js +1 -0
- package/dest/contract/interfaces/contract_class.d.ts +3 -3
- package/dest/interfaces/aztec-node-admin.d.ts +13 -7
- package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
- package/dest/interfaces/block-builder.d.ts +1 -0
- package/dest/interfaces/block-builder.d.ts.map +1 -1
- package/dest/interfaces/proving-job.d.ts +6 -6
- package/dest/interfaces/slasher.d.ts +4 -0
- package/dest/interfaces/slasher.d.ts.map +1 -1
- package/dest/interfaces/slasher.js +1 -0
- package/dest/interfaces/validator.d.ts +9 -2
- package/dest/interfaces/validator.d.ts.map +1 -1
- package/dest/interfaces/validator.js +2 -1
- package/dest/p2p/consensus_payload.d.ts +27 -0
- package/dest/p2p/consensus_payload.d.ts.map +1 -1
- package/dest/p2p/consensus_payload.js +10 -0
- package/dest/p2p/signature_utils.d.ts +2 -1
- package/dest/p2p/signature_utils.d.ts.map +1 -1
- package/dest/p2p/signature_utils.js +1 -0
- package/dest/slashing/types.d.ts +1 -0
- package/dest/slashing/types.d.ts.map +1 -1
- package/dest/slashing/types.js +22 -0
- package/dest/tests/mocks.d.ts +2 -0
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +4 -0
- package/dest/tx/indexed_tx_effect.d.ts +3 -3
- package/dest/tx/proposed_block_header.d.ts +1 -0
- package/dest/tx/proposed_block_header.d.ts.map +1 -1
- package/dest/tx/proposed_block_header.js +3 -0
- package/dest/tx/state_reference.js +1 -1
- package/dest/tx/tx.d.ts +0 -7
- package/dest/tx/tx.d.ts.map +1 -1
- package/dest/tx/tx.js +0 -8
- package/package.json +9 -9
- package/src/block/proposal/attestations_and_signers.ts +121 -0
- package/src/block/proposal/committee_attestation.ts +4 -0
- package/src/block/proposal/index.ts +1 -0
- package/src/interfaces/block-builder.ts +1 -0
- package/src/interfaces/slasher.ts +2 -0
- package/src/interfaces/validator.ts +12 -2
- package/src/p2p/consensus_payload.ts +16 -0
- package/src/p2p/signature_utils.ts +1 -0
- package/src/slashing/types.ts +23 -0
- package/src/tests/mocks.ts +12 -0
- package/src/tx/proposed_block_header.ts +13 -0
- package/src/tx/state_reference.ts +1 -1
- package/src/tx/tx.ts +0 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signature_utils.d.ts","sourceRoot":"","sources":["../../src/p2p/signature_utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGpD,oBAAY,wBAAwB;IAClC,aAAa,IAAI;IACjB,gBAAgB,IAAI;
|
|
1
|
+
{"version":3,"file":"signature_utils.d.ts","sourceRoot":"","sources":["../../src/p2p/signature_utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGpD,oBAAY,wBAAwB;IAClC,aAAa,IAAI;IACjB,gBAAgB,IAAI;IACpB,sBAAsB,IAAI;CAC3B;AAED,MAAM,WAAW,QAAQ;IACvB,gBAAgB,CAAC,eAAe,EAAE,wBAAwB,GAAG,MAAM,CAAC;CACrE;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,EAAE,QAAQ,EAAE,eAAe,EAAE,wBAAwB,GAAG,QAAQ,CAE1G;AAED;;;;GAIG;AACH,wBAAgB,yCAAyC,CACvD,CAAC,EAAE,QAAQ,EACX,eAAe,EAAE,wBAAwB,GACxC,QAAQ,CAGV"}
|
|
@@ -3,6 +3,7 @@ import { keccak256, makeEthSignDigest } from '@aztec/foundation/crypto';
|
|
|
3
3
|
export var SignatureDomainSeparator = /*#__PURE__*/ function(SignatureDomainSeparator) {
|
|
4
4
|
SignatureDomainSeparator[SignatureDomainSeparator["blockProposal"] = 0] = "blockProposal";
|
|
5
5
|
SignatureDomainSeparator[SignatureDomainSeparator["blockAttestation"] = 1] = "blockAttestation";
|
|
6
|
+
SignatureDomainSeparator[SignatureDomainSeparator["attestationsAndSigners"] = 2] = "attestationsAndSigners";
|
|
6
7
|
return SignatureDomainSeparator;
|
|
7
8
|
}({});
|
|
8
9
|
/**
|
package/dest/slashing/types.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export declare enum OffenseType {
|
|
|
18
18
|
/** A committee member attested to a block that was built as a descendent of an invalid block (as in a block with invalid attestations) */
|
|
19
19
|
ATTESTED_DESCENDANT_OF_INVALID = 7
|
|
20
20
|
}
|
|
21
|
+
export declare function getOffenseTypeName(offense: OffenseType): "unknown" | "data_withholding" | "valid_epoch_pruned" | "inactivity" | "broadcasted_invalid_block_proposal" | "proposed_insufficient_attestations" | "proposed_incorrect_attestations" | "attested_descendant_of_invalid";
|
|
21
22
|
export declare const OffenseTypeSchema: z.ZodNativeEnum<typeof OffenseType>;
|
|
22
23
|
export declare const OffenseToBigInt: Record<OffenseType, bigint>;
|
|
23
24
|
export declare function bigIntToOffense(offense: bigint): OffenseType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/slashing/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,KAAK,MAAM,EAAW,MAAM,qBAA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AC;AAEF,sEAAsE;AACtE,MAAM,MAAM,iBAAiB,GAAG,YAAY,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEhF,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAYE,CAAC;AAEvC,kEAAkE;AAClE,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAExC,MAAM,MAAM,mBAAmB;AAC7B,mEAAmE;AACjE;IAAE,IAAI,EAAE,uBAAuB,CAAC;IAAC,IAAI,EAAE,cAAc,EAAE,CAAA;CAAE;AAC3D,oEAAoE;GAClE;IAAE,IAAI,EAAE,qBAAqB,CAAC;IAAC,OAAO,EAAE,UAAU,CAAA;CAAE;AACtD,mEAAmE;GACjE;IAAE,IAAI,EAAE,wBAAwB,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE;AACnD,yDAAyD;GACvD;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,KAAK,EAAE,kBAAkB,EAAE,CAAC;IAAC,UAAU,EAAE,UAAU,EAAE,EAAE,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE;AACnG,gEAAgE;GAC9D;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,UAAU,EAAE,UAAU,EAAE,EAAE,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEzE,MAAM,MAAM,uBAAuB,GAAG,mBAAmB,CAAC,MAAM,CAAC,CAAC"}
|
package/dest/slashing/types.js
CHANGED
|
@@ -11,6 +11,28 @@ export var OffenseType = /*#__PURE__*/ function(OffenseType) {
|
|
|
11
11
|
/** A committee member attested to a block that was built as a descendent of an invalid block (as in a block with invalid attestations) */ OffenseType[OffenseType["ATTESTED_DESCENDANT_OF_INVALID"] = 7] = "ATTESTED_DESCENDANT_OF_INVALID";
|
|
12
12
|
return OffenseType;
|
|
13
13
|
}({});
|
|
14
|
+
export function getOffenseTypeName(offense) {
|
|
15
|
+
switch(offense){
|
|
16
|
+
case 0:
|
|
17
|
+
return 'unknown';
|
|
18
|
+
case 1:
|
|
19
|
+
return 'data_withholding';
|
|
20
|
+
case 2:
|
|
21
|
+
return 'valid_epoch_pruned';
|
|
22
|
+
case 3:
|
|
23
|
+
return 'inactivity';
|
|
24
|
+
case 4:
|
|
25
|
+
return 'broadcasted_invalid_block_proposal';
|
|
26
|
+
case 5:
|
|
27
|
+
return 'proposed_insufficient_attestations';
|
|
28
|
+
case 6:
|
|
29
|
+
return 'proposed_incorrect_attestations';
|
|
30
|
+
case 7:
|
|
31
|
+
return 'attested_descendant_of_invalid';
|
|
32
|
+
default:
|
|
33
|
+
throw new Error(`Unknown offense type: ${offense}`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
14
36
|
export const OffenseTypeSchema = z.nativeEnum(OffenseType);
|
|
15
37
|
export const OffenseToBigInt = {
|
|
16
38
|
[0]: 0n,
|
package/dest/tests/mocks.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { Fr } from '@aztec/foundation/fields';
|
|
|
3
3
|
import type { ContractArtifact } from '../abi/abi.js';
|
|
4
4
|
import { AztecAddress } from '../aztec-address/index.js';
|
|
5
5
|
import { L2Block } from '../block/l2_block.js';
|
|
6
|
+
import type { CommitteeAttestationsAndSigners } from '../block/proposal/attestations_and_signers.js';
|
|
6
7
|
import { PublishedL2Block } from '../block/published_l2_block.js';
|
|
7
8
|
import type { ContractInstanceWithAddress } from '../contract/index.js';
|
|
8
9
|
import { GasFees } from '../gas/gas_fees.js';
|
|
@@ -48,6 +49,7 @@ export interface MakeConsensusPayloadOptions {
|
|
|
48
49
|
txHashes?: TxHash[];
|
|
49
50
|
txs?: Tx[];
|
|
50
51
|
}
|
|
52
|
+
export declare const makeAndSignCommitteeAttestationsAndSigners: (attestationsAndSigners: CommitteeAttestationsAndSigners, signer?: Secp256k1Signer) => import("../block/index.js").Signature;
|
|
51
53
|
export declare const makeBlockProposal: (options?: MakeConsensusPayloadOptions) => BlockProposal;
|
|
52
54
|
export declare const makeBlockAttestation: (options?: MakeConsensusPayloadOptions) => BlockAttestation;
|
|
53
55
|
export declare const makeBlockAttestationFromBlock: (block: L2Block, signer?: Secp256k1Signer) => BlockAttestation;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mocks.d.ts","sourceRoot":"","sources":["../../src/tests/mocks.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAe,MAAM,0BAA0B,CAAC;AACxE,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAE9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAIlE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAS7C,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAGzD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EACL,WAAW,EAIX,cAAc,EACd,EAAE,EACH,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,kBAAkB,EAAiC,MAAM,uBAAuB,CAAC;AAE1F,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAG1C,eAAO,MAAM,YAAY,QAAO,MAAyB,CAAC;AAE1D,eAAO,MAAM,kBAAkB,GAAU,6DAMtC,OAAO,CAAC,YAAY,CAA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;AAEF,eAAO,MAAM,sBAAsB;;;EAIlC,CAAC;AAEF,MAAM,WAAW,2BAA2B;IAC1C,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,OAAO,CAAC,EAAE,EAAE,CAAC;IACb,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC;CACZ;AAqBD,eAAO,MAAM,0CAA0C,GACrD,wBAAwB,+BAA+B,EACvD,SAAQ,eAA0C,0CAOnD,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,UAAU,2BAA2B,KAAG,aAOzE,CAAC;AAGF,eAAO,MAAM,oBAAoB,GAAI,UAAU,2BAA2B,KAAG,gBAM5E,CAAC;AAEF,eAAO,MAAM,6BAA6B,GAAI,OAAO,OAAO,EAAE,SAAS,eAAe,KAAG,gBAQxF,CAAC;AAEF,wBAAsB,sBAAsB,CAC1C,aAAa,EAAE,MAAM,EACrB,IAAI,GAAE;IAAE,OAAO,CAAC,EAAE,eAAe,EAAE,CAAA;CAAO,GACzC,OAAO,CAAC,gBAAgB,CAAC,CAc3B"}
|
package/dest/tests/mocks.js
CHANGED
|
@@ -148,6 +148,10 @@ const makeAndSignConsensusPayload = (domainSeparator, options)=>{
|
|
|
148
148
|
signature
|
|
149
149
|
};
|
|
150
150
|
};
|
|
151
|
+
export const makeAndSignCommitteeAttestationsAndSigners = (attestationsAndSigners, signer = Secp256k1Signer.random())=>{
|
|
152
|
+
const hash = getHashedSignaturePayloadEthSignedMessage(attestationsAndSigners, SignatureDomainSeparator.attestationsAndSigners);
|
|
153
|
+
return signer.sign(hash);
|
|
154
|
+
};
|
|
151
155
|
export const makeBlockProposal = (options)=>{
|
|
152
156
|
const { blockNumber, payload, signature } = makeAndSignConsensusPayload(SignatureDomainSeparator.blockProposal, options);
|
|
153
157
|
const txHashes = options?.txHashes ?? [
|
|
@@ -4,13 +4,13 @@ import { TxEffect } from './tx_effect.js';
|
|
|
4
4
|
export type IndexedTxEffect = InBlock<TxEffect> & {
|
|
5
5
|
txIndexInBlock: number;
|
|
6
6
|
};
|
|
7
|
-
export declare function indexedTxSchema(): import("zod").ZodObject<
|
|
7
|
+
export declare function indexedTxSchema(): import("zod").ZodObject<{
|
|
8
8
|
data: import("@aztec/foundation/schemas").ZodFor<TxEffect>;
|
|
9
9
|
l2BlockNumber: import("zod").ZodPipeline<import("zod").ZodUnion<[import("zod").ZodBigInt, import("zod").ZodNumber, import("zod").ZodString]>, import("zod").ZodNumber>;
|
|
10
10
|
l2BlockHash: import("zod").ZodEffects<import("zod").ZodEffects<import("zod").ZodEffects<import("zod").ZodEffects<import("zod").ZodString, string, string>, string, string>, Buffer<ArrayBuffer>, string>, L2BlockHash, string>;
|
|
11
|
-
}
|
|
11
|
+
} & {
|
|
12
12
|
txIndexInBlock: import("zod").ZodPipeline<import("zod").ZodUnion<[import("zod").ZodBigInt, import("zod").ZodNumber, import("zod").ZodString]>, import("zod").ZodNumber>;
|
|
13
|
-
}
|
|
13
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
14
14
|
data: TxEffect;
|
|
15
15
|
l2BlockNumber: number;
|
|
16
16
|
l2BlockHash: L2BlockHash;
|
|
@@ -48,6 +48,7 @@ export declare class ProposedBlockHeader {
|
|
|
48
48
|
static getFields(fields: FieldsOf<ProposedBlockHeader>): readonly [Fr, ContentCommitment, Fr, bigint, EthAddress, AztecAddress, GasFees, Fr];
|
|
49
49
|
static from(fields: FieldsOf<ProposedBlockHeader>): ProposedBlockHeader;
|
|
50
50
|
static fromBuffer(buffer: Buffer | BufferReader): ProposedBlockHeader;
|
|
51
|
+
equals(other: ProposedBlockHeader): boolean;
|
|
51
52
|
toBuffer(): Buffer<ArrayBufferLike>;
|
|
52
53
|
hash(): Fr;
|
|
53
54
|
static empty(fields?: Partial<FieldsOf<ProposedBlockHeader>>): ProposedBlockHeader;
|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U,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,GAAG,mBAAmB;IAerE,MAAM,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO;IAa3C,QAAQ;IAcR,IAAI,IAAI,EAAE;IAIV,MAAM,CAAC,KAAK,CAAC,MAAM,GAAE,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAM,GAAG,mBAAmB;IActF,MAAM,CAAC,MAAM,IAAI,mBAAmB;IAapC,OAAO,IAAI,OAAO;IAalB;;;OAGG;IACI,QAAQ;IAIf,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,mBAAmB;IAInD,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,UAAU;IAalC,MAAM,IAAI,UAAU;IAgBpB,SAAS;;;;;;;;;;;;;;;;;IAaT,CAAC,OAAO,CAAC,MAAM,CAAC;CAajB"}
|
|
@@ -59,6 +59,9 @@ import { ContentCommitment } from './content_commitment.js';
|
|
|
59
59
|
const reader = BufferReader.asReader(buffer);
|
|
60
60
|
return new ProposedBlockHeader(reader.readObject(Fr), reader.readObject(ContentCommitment), Fr.fromBuffer(reader), reader.readUInt64(), reader.readObject(EthAddress), reader.readObject(AztecAddress), reader.readObject(GasFees), reader.readObject(Fr));
|
|
61
61
|
}
|
|
62
|
+
equals(other) {
|
|
63
|
+
return this.lastArchiveRoot.equals(other.lastArchiveRoot) && this.contentCommitment.equals(other.contentCommitment) && this.slotNumber.equals(other.slotNumber) && this.timestamp === other.timestamp && this.coinbase.equals(other.coinbase) && this.feeRecipient.equals(other.feeRecipient) && this.gasFees.equals(other.gasFees) && this.totalManaUsed.equals(other.totalManaUsed);
|
|
64
|
+
}
|
|
62
65
|
toBuffer() {
|
|
63
66
|
// Note: The order here must match the order in the ProposedHeaderLib solidity library.
|
|
64
67
|
return serializeToBuffer([
|
|
@@ -102,6 +102,6 @@ import { PartialStateReference } from './partial_state_reference.js';
|
|
|
102
102
|
}`;
|
|
103
103
|
}
|
|
104
104
|
equals(other) {
|
|
105
|
-
return this.l1ToL2MessageTree.
|
|
105
|
+
return this.l1ToL2MessageTree.equals(other.l1ToL2MessageTree) && this.partial.equals(other.partial);
|
|
106
106
|
}
|
|
107
107
|
}
|
package/dest/tx/tx.d.ts
CHANGED
|
@@ -107,13 +107,6 @@ export declare class Tx extends Gossipable {
|
|
|
107
107
|
* @returns The hash of the public inputs of the private kernel tail circuit.
|
|
108
108
|
*/
|
|
109
109
|
getTxHash(): TxHash;
|
|
110
|
-
/**
|
|
111
|
-
* Allows setting the hash of the Tx.
|
|
112
|
-
* Use this when you want to skip computing it from the original data.
|
|
113
|
-
* Don't set a Tx hash received from an untrusted source.
|
|
114
|
-
* @param hash - The hash to set.
|
|
115
|
-
*/
|
|
116
|
-
setTxHash(_hash: TxHash): this;
|
|
117
110
|
getCalldataMap(): Map<string, Fr[]>;
|
|
118
111
|
/** Returns stats about this tx. */
|
|
119
112
|
getStats(): TxStats;
|
package/dest/tx/tx.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tx.d.ts","sourceRoot":"","sources":["../../src/tx/tx.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,YAAY,EAAyD,MAAM,6BAA6B,CAAC;AAClH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAIxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAEpE,OAAO,EAAE,oCAAoC,EAAE,MAAM,wDAAwD,CAAC;AAC9G,OAAO,E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AAM,GAAG,YAAY,GAAG,OAAO;IAWlD,QAAQ,IAAI,MAAM;CAG1B"}
|
package/dest/tx/tx.js
CHANGED
|
@@ -149,14 +149,6 @@ import { TxHash } from './tx_hash.js';
|
|
|
149
149
|
*/ getTxHash() {
|
|
150
150
|
return this.txHash;
|
|
151
151
|
}
|
|
152
|
-
/**
|
|
153
|
-
* Allows setting the hash of the Tx.
|
|
154
|
-
* Use this when you want to skip computing it from the original data.
|
|
155
|
-
* Don't set a Tx hash received from an untrusted source.
|
|
156
|
-
* @param hash - The hash to set.
|
|
157
|
-
*/ setTxHash(_hash) {
|
|
158
|
-
return this;
|
|
159
|
-
}
|
|
160
152
|
getCalldataMap() {
|
|
161
153
|
if (!this.calldataMap) {
|
|
162
154
|
const calldataMap = new Map();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/stdlib",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0-rc.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"inherits": [
|
|
6
6
|
"../package.common.json",
|
|
@@ -69,15 +69,15 @@
|
|
|
69
69
|
"test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}"
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@aztec/bb.js": "2.0
|
|
73
|
-
"@aztec/blob-lib": "2.0
|
|
74
|
-
"@aztec/constants": "2.0
|
|
75
|
-
"@aztec/ethereum": "2.0
|
|
76
|
-
"@aztec/foundation": "2.0
|
|
77
|
-
"@aztec/l1-artifacts": "2.0
|
|
78
|
-
"@aztec/noir-noirc_abi": "2.0
|
|
72
|
+
"@aztec/bb.js": "2.1.0-rc.1",
|
|
73
|
+
"@aztec/blob-lib": "2.1.0-rc.1",
|
|
74
|
+
"@aztec/constants": "2.1.0-rc.1",
|
|
75
|
+
"@aztec/ethereum": "2.1.0-rc.1",
|
|
76
|
+
"@aztec/foundation": "2.1.0-rc.1",
|
|
77
|
+
"@aztec/l1-artifacts": "2.1.0-rc.1",
|
|
78
|
+
"@aztec/noir-noirc_abi": "2.1.0-rc.1",
|
|
79
79
|
"@google-cloud/storage": "^7.15.0",
|
|
80
|
-
"axios": "^1.
|
|
80
|
+
"axios": "^1.12.0",
|
|
81
81
|
"json-stringify-deterministic": "1.0.12",
|
|
82
82
|
"lodash.chunk": "^4.2.0",
|
|
83
83
|
"lodash.isequal": "^4.5.0",
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import type { ViemCommitteeAttestations } from '@aztec/ethereum';
|
|
2
|
+
import { hexToBuffer } from '@aztec/foundation/string';
|
|
3
|
+
|
|
4
|
+
import { encodeAbiParameters, parseAbiParameters } from 'viem';
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
|
|
7
|
+
import type { Signable, SignatureDomainSeparator } from '../../p2p/signature_utils.js';
|
|
8
|
+
import { CommitteeAttestation } from './committee_attestation.js';
|
|
9
|
+
|
|
10
|
+
export class CommitteeAttestationsAndSigners implements Signable {
|
|
11
|
+
constructor(public attestations: CommitteeAttestation[]) {}
|
|
12
|
+
|
|
13
|
+
static get schema() {
|
|
14
|
+
return z
|
|
15
|
+
.object({
|
|
16
|
+
attestations: CommitteeAttestation.schema.array(),
|
|
17
|
+
})
|
|
18
|
+
.transform(obj => new CommitteeAttestationsAndSigners(obj.attestations));
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
getPayloadToSign(domainSeparator: SignatureDomainSeparator): Buffer {
|
|
22
|
+
const abi = parseAbiParameters('uint8,(bytes,bytes),address[]');
|
|
23
|
+
const packed = this.getPackedAttestations();
|
|
24
|
+
|
|
25
|
+
const encodedData = encodeAbiParameters(abi, [
|
|
26
|
+
domainSeparator,
|
|
27
|
+
[packed.signatureIndices, packed.signaturesOrAddresses],
|
|
28
|
+
this.getSigners().map(s => s.toString()),
|
|
29
|
+
]);
|
|
30
|
+
|
|
31
|
+
return hexToBuffer(encodedData);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
static empty(): CommitteeAttestationsAndSigners {
|
|
35
|
+
return new CommitteeAttestationsAndSigners([]);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
toString() {
|
|
39
|
+
return `CommitteeAttestationsAndSigners(${this.attestations.map(a => a.toString()).join(',')})`;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
getSigners() {
|
|
43
|
+
return this.attestations.filter(a => !a.signature.isEmpty()).map(a => a.address);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
getSignedAttestations() {
|
|
47
|
+
return this.attestations.filter(a => !a.signature.isEmpty());
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Packs an array of committee attestations into the format expected by the Solidity contract
|
|
52
|
+
*
|
|
53
|
+
* @param attestations - Array of committee attestations with addresses and signatures
|
|
54
|
+
* @returns Packed attestations with bitmap and tightly packed signature/address data
|
|
55
|
+
*/
|
|
56
|
+
getPackedAttestations(): ViemCommitteeAttestations {
|
|
57
|
+
const length = this.attestations.length;
|
|
58
|
+
const attestations = this.attestations.map(a => a.toViem());
|
|
59
|
+
|
|
60
|
+
// Calculate bitmap size (1 bit per attestation, rounded up to nearest byte)
|
|
61
|
+
const bitmapSize = Math.ceil(length / 8);
|
|
62
|
+
const signatureIndices = new Uint8Array(bitmapSize);
|
|
63
|
+
|
|
64
|
+
// Calculate total data size needed
|
|
65
|
+
let totalDataSize = 0;
|
|
66
|
+
for (let i = 0; i < length; i++) {
|
|
67
|
+
const signature = attestations[i].signature;
|
|
68
|
+
// Check if signature is empty (v = 0)
|
|
69
|
+
const isEmpty = signature.v === 0;
|
|
70
|
+
|
|
71
|
+
if (!isEmpty) {
|
|
72
|
+
totalDataSize += 65; // v (1) + r (32) + s (32)
|
|
73
|
+
} else {
|
|
74
|
+
totalDataSize += 20; // address only
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const signaturesOrAddresses = new Uint8Array(totalDataSize);
|
|
79
|
+
let dataIndex = 0;
|
|
80
|
+
|
|
81
|
+
// Pack the data
|
|
82
|
+
for (let i = 0; i < length; i++) {
|
|
83
|
+
const attestation = attestations[i];
|
|
84
|
+
const signature = attestation.signature;
|
|
85
|
+
|
|
86
|
+
// Check if signature is empty
|
|
87
|
+
const isEmpty = signature.v === 0;
|
|
88
|
+
|
|
89
|
+
if (!isEmpty) {
|
|
90
|
+
// Set bit in bitmap (bit 7-0 in each byte, left to right)
|
|
91
|
+
const byteIndex = Math.floor(i / 8);
|
|
92
|
+
const bitIndex = 7 - (i % 8);
|
|
93
|
+
signatureIndices[byteIndex] |= 1 << bitIndex;
|
|
94
|
+
|
|
95
|
+
// Pack signature: v + r + s
|
|
96
|
+
signaturesOrAddresses[dataIndex] = signature.v;
|
|
97
|
+
dataIndex++;
|
|
98
|
+
|
|
99
|
+
// Pack r (32 bytes)
|
|
100
|
+
const rBytes = Buffer.from(signature.r.slice(2), 'hex');
|
|
101
|
+
signaturesOrAddresses.set(rBytes, dataIndex);
|
|
102
|
+
dataIndex += 32;
|
|
103
|
+
|
|
104
|
+
// Pack s (32 bytes)
|
|
105
|
+
const sBytes = Buffer.from(signature.s.slice(2), 'hex');
|
|
106
|
+
signaturesOrAddresses.set(sBytes, dataIndex);
|
|
107
|
+
dataIndex += 32;
|
|
108
|
+
} else {
|
|
109
|
+
// Pack address only (20 bytes)
|
|
110
|
+
const addrBytes = Buffer.from(attestation.addr.slice(2), 'hex');
|
|
111
|
+
signaturesOrAddresses.set(addrBytes, dataIndex);
|
|
112
|
+
dataIndex += 20;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return {
|
|
117
|
+
signatureIndices: `0x${Buffer.from(signatureIndices).toString('hex')}`,
|
|
118
|
+
signaturesOrAddresses: `0x${Buffer.from(signaturesOrAddresses).toString('hex')}`,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
}
|
|
@@ -111,6 +111,10 @@ export class CommitteeAttestation {
|
|
|
111
111
|
return this.address.equals(other.address) && this.signature.equals(other.signature);
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
+
toString(): string {
|
|
115
|
+
return `CommitteeAttestation(${this.address.toString()}, ${this.signature.toString()})`;
|
|
116
|
+
}
|
|
117
|
+
|
|
114
118
|
toViem(): ViemCommitteeAttestation {
|
|
115
119
|
return {
|
|
116
120
|
addr: this.address.toString(),
|
|
@@ -24,6 +24,7 @@ export interface SlasherConfig {
|
|
|
24
24
|
slashOffenseExpirationRounds: number; // Number of rounds after which pending offenses expire
|
|
25
25
|
slashMaxPayloadSize: number; // Maximum number of offenses to include in a single slash payload
|
|
26
26
|
slashGracePeriodL2Slots: number; // Number of L2 slots to wait after genesis before slashing for most offenses
|
|
27
|
+
slashExecuteRoundsLookBack: number; // How many rounds to look back when searching for a round to execute
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
export const SlasherConfigSchema = z.object({
|
|
@@ -44,5 +45,6 @@ export const SlasherConfigSchema = z.object({
|
|
|
44
45
|
slashMaxPayloadSize: z.number(),
|
|
45
46
|
slashGracePeriodL2Slots: z.number(),
|
|
46
47
|
slashBroadcastedInvalidBlockPenalty: schemas.BigInt,
|
|
48
|
+
slashExecuteRoundsLookBack: z.number(),
|
|
47
49
|
slashSelfAllowed: z.boolean().optional(),
|
|
48
50
|
}) satisfies ZodFor<SlasherConfig>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { SecretValue } from '@aztec/foundation/config';
|
|
2
2
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
|
+
import type { Signature } from '@aztec/foundation/eth-signature';
|
|
3
4
|
import { Fr } from '@aztec/foundation/fields';
|
|
4
5
|
import { type ZodFor, schemas } from '@aztec/foundation/schemas';
|
|
5
6
|
import type { SequencerConfig, SlasherConfig } from '@aztec/stdlib/interfaces/server';
|
|
@@ -9,6 +10,8 @@ import type { ProposedBlockHeader, StateReference, Tx } from '@aztec/stdlib/tx';
|
|
|
9
10
|
import type { PeerId } from '@libp2p/interface';
|
|
10
11
|
import { z } from 'zod';
|
|
11
12
|
|
|
13
|
+
import type { CommitteeAttestationsAndSigners } from '../block/index.js';
|
|
14
|
+
|
|
12
15
|
/**
|
|
13
16
|
* Validator client configuration
|
|
14
17
|
*/
|
|
@@ -28,11 +31,14 @@ export interface ValidatorClientConfig {
|
|
|
28
31
|
/** Interval between polling for new attestations from peers */
|
|
29
32
|
attestationPollingIntervalMs: number;
|
|
30
33
|
|
|
31
|
-
/**
|
|
34
|
+
/** Whether to re-execute transactions in a block proposal before attesting */
|
|
32
35
|
validatorReexecute: boolean;
|
|
33
36
|
|
|
34
37
|
/** Will re-execute until this many milliseconds are left in the slot */
|
|
35
38
|
validatorReexecuteDeadlineMs: number;
|
|
39
|
+
|
|
40
|
+
/** Whether to always reexecute block proposals, even for non-validator nodes or when out of the currnet committee */
|
|
41
|
+
alwaysReexecuteBlockProposals?: boolean;
|
|
36
42
|
}
|
|
37
43
|
|
|
38
44
|
export type ValidatorClientFullConfig = ValidatorClientConfig &
|
|
@@ -46,11 +52,11 @@ export const ValidatorClientConfigSchema = z.object({
|
|
|
46
52
|
attestationPollingIntervalMs: z.number().min(0),
|
|
47
53
|
validatorReexecute: z.boolean(),
|
|
48
54
|
validatorReexecuteDeadlineMs: z.number().min(0),
|
|
55
|
+
alwaysReexecuteBlockProposals: z.boolean().optional(),
|
|
49
56
|
}) satisfies ZodFor<Omit<ValidatorClientConfig, 'validatorPrivateKeys'>>;
|
|
50
57
|
|
|
51
58
|
export interface Validator {
|
|
52
59
|
start(): Promise<void>;
|
|
53
|
-
registerBlockProposalHandler(): void;
|
|
54
60
|
updateConfig(config: Partial<ValidatorClientFullConfig>): void;
|
|
55
61
|
|
|
56
62
|
// Block validation responsibilities
|
|
@@ -67,4 +73,8 @@ export interface Validator {
|
|
|
67
73
|
|
|
68
74
|
broadcastBlockProposal(proposal: BlockProposal): Promise<void>;
|
|
69
75
|
collectAttestations(proposal: BlockProposal, required: number, deadline: Date): Promise<BlockAttestation[]>;
|
|
76
|
+
signAttestationsAndSigners(
|
|
77
|
+
attestationsAndSigners: CommitteeAttestationsAndSigners,
|
|
78
|
+
proposer: EthAddress,
|
|
79
|
+
): Promise<Signature>;
|
|
70
80
|
}
|
|
@@ -63,6 +63,14 @@ export class ConsensusPayload implements Signable {
|
|
|
63
63
|
return serializeToBuffer([this.header, this.archive, this.stateReference]);
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
+
public equals(other: ConsensusPayload): boolean {
|
|
67
|
+
return (
|
|
68
|
+
this.header.equals(other.header) &&
|
|
69
|
+
this.archive.equals(other.archive) &&
|
|
70
|
+
this.stateReference.equals(other.stateReference)
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
66
74
|
static fromBuffer(buf: Buffer | BufferReader): ConsensusPayload {
|
|
67
75
|
const reader = BufferReader.asReader(buf);
|
|
68
76
|
const payload = new ConsensusPayload(
|
|
@@ -102,6 +110,14 @@ export class ConsensusPayload implements Signable {
|
|
|
102
110
|
return this.size;
|
|
103
111
|
}
|
|
104
112
|
|
|
113
|
+
toInspect() {
|
|
114
|
+
return {
|
|
115
|
+
header: this.header.toInspect(),
|
|
116
|
+
archive: this.archive.toString(),
|
|
117
|
+
stateReference: this.stateReference.toInspect(),
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
|
|
105
121
|
toString() {
|
|
106
122
|
return `header: ${this.header.toString()}, archive: ${this.archive.toString()}, stateReference: ${this.stateReference.l1ToL2MessageTree.root.toString()}`;
|
|
107
123
|
}
|
package/src/slashing/types.ts
CHANGED
|
@@ -22,6 +22,29 @@ export enum OffenseType {
|
|
|
22
22
|
ATTESTED_DESCENDANT_OF_INVALID = 7,
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
export function getOffenseTypeName(offense: OffenseType) {
|
|
26
|
+
switch (offense) {
|
|
27
|
+
case OffenseType.UNKNOWN:
|
|
28
|
+
return 'unknown';
|
|
29
|
+
case OffenseType.DATA_WITHHOLDING:
|
|
30
|
+
return 'data_withholding';
|
|
31
|
+
case OffenseType.VALID_EPOCH_PRUNED:
|
|
32
|
+
return 'valid_epoch_pruned';
|
|
33
|
+
case OffenseType.INACTIVITY:
|
|
34
|
+
return 'inactivity';
|
|
35
|
+
case OffenseType.BROADCASTED_INVALID_BLOCK_PROPOSAL:
|
|
36
|
+
return 'broadcasted_invalid_block_proposal';
|
|
37
|
+
case OffenseType.PROPOSED_INSUFFICIENT_ATTESTATIONS:
|
|
38
|
+
return 'proposed_insufficient_attestations';
|
|
39
|
+
case OffenseType.PROPOSED_INCORRECT_ATTESTATIONS:
|
|
40
|
+
return 'proposed_incorrect_attestations';
|
|
41
|
+
case OffenseType.ATTESTED_DESCENDANT_OF_INVALID:
|
|
42
|
+
return 'attested_descendant_of_invalid';
|
|
43
|
+
default:
|
|
44
|
+
throw new Error(`Unknown offense type: ${offense}`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
25
48
|
export const OffenseTypeSchema = z.nativeEnum(OffenseType);
|
|
26
49
|
|
|
27
50
|
export const OffenseToBigInt: Record<OffenseType, bigint> = {
|
package/src/tests/mocks.ts
CHANGED
|
@@ -8,6 +8,7 @@ import type { ContractArtifact } from '../abi/abi.js';
|
|
|
8
8
|
import { AztecAddress } from '../aztec-address/index.js';
|
|
9
9
|
import { CommitteeAttestation, L1PublishedData } from '../block/index.js';
|
|
10
10
|
import { L2Block } from '../block/l2_block.js';
|
|
11
|
+
import type { CommitteeAttestationsAndSigners } from '../block/proposal/attestations_and_signers.js';
|
|
11
12
|
import { PublishedL2Block } from '../block/published_l2_block.js';
|
|
12
13
|
import { computeContractAddressFromInstance } from '../contract/contract_address.js';
|
|
13
14
|
import { getContractClassFromArtifact } from '../contract/contract_class.js';
|
|
@@ -273,6 +274,17 @@ const makeAndSignConsensusPayload = (
|
|
|
273
274
|
return { blockNumber: header.globalVariables.blockNumber, payload, signature };
|
|
274
275
|
};
|
|
275
276
|
|
|
277
|
+
export const makeAndSignCommitteeAttestationsAndSigners = (
|
|
278
|
+
attestationsAndSigners: CommitteeAttestationsAndSigners,
|
|
279
|
+
signer: Secp256k1Signer = Secp256k1Signer.random(),
|
|
280
|
+
) => {
|
|
281
|
+
const hash = getHashedSignaturePayloadEthSignedMessage(
|
|
282
|
+
attestationsAndSigners,
|
|
283
|
+
SignatureDomainSeparator.attestationsAndSigners,
|
|
284
|
+
);
|
|
285
|
+
return signer.sign(hash);
|
|
286
|
+
};
|
|
287
|
+
|
|
276
288
|
export const makeBlockProposal = (options?: MakeConsensusPayloadOptions): BlockProposal => {
|
|
277
289
|
const { blockNumber, payload, signature } = makeAndSignConsensusPayload(
|
|
278
290
|
SignatureDomainSeparator.blockProposal,
|
|
@@ -84,6 +84,19 @@ export class ProposedBlockHeader {
|
|
|
84
84
|
);
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
+
equals(other: ProposedBlockHeader): boolean {
|
|
88
|
+
return (
|
|
89
|
+
this.lastArchiveRoot.equals(other.lastArchiveRoot) &&
|
|
90
|
+
this.contentCommitment.equals(other.contentCommitment) &&
|
|
91
|
+
this.slotNumber.equals(other.slotNumber) &&
|
|
92
|
+
this.timestamp === other.timestamp &&
|
|
93
|
+
this.coinbase.equals(other.coinbase) &&
|
|
94
|
+
this.feeRecipient.equals(other.feeRecipient) &&
|
|
95
|
+
this.gasFees.equals(other.gasFees) &&
|
|
96
|
+
this.totalManaUsed.equals(other.totalManaUsed)
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
|
|
87
100
|
toBuffer() {
|
|
88
101
|
// Note: The order here must match the order in the ProposedHeaderLib solidity library.
|
|
89
102
|
return serializeToBuffer([
|
|
@@ -137,6 +137,6 @@ export class StateReference {
|
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
public equals(other: this): boolean {
|
|
140
|
-
return this.l1ToL2MessageTree.
|
|
140
|
+
return this.l1ToL2MessageTree.equals(other.l1ToL2MessageTree) && this.partial.equals(other.partial);
|
|
141
141
|
}
|
|
142
142
|
}
|
package/src/tx/tx.ts
CHANGED
|
@@ -207,16 +207,6 @@ export class Tx extends Gossipable {
|
|
|
207
207
|
return this.txHash;
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
-
/**
|
|
211
|
-
* Allows setting the hash of the Tx.
|
|
212
|
-
* Use this when you want to skip computing it from the original data.
|
|
213
|
-
* Don't set a Tx hash received from an untrusted source.
|
|
214
|
-
* @param hash - The hash to set.
|
|
215
|
-
*/
|
|
216
|
-
setTxHash(_hash: TxHash) {
|
|
217
|
-
return this;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
210
|
getCalldataMap(): Map<string, Fr[]> {
|
|
221
211
|
if (!this.calldataMap) {
|
|
222
212
|
const calldataMap = new Map();
|