@aztec/entrypoints 0.0.1-commit.f2ce05ee → 0.0.1-commit.f504929
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/encoding.d.ts +3 -3
- package/dest/encoding.d.ts.map +1 -1
- package/dest/encoding.js +6 -6
- package/package.json +5 -5
- package/src/encoding.ts +4 -4
package/dest/encoding.d.ts
CHANGED
|
@@ -37,7 +37,7 @@ export declare class EncodedAppEntrypointCalls implements EncodedCalls {
|
|
|
37
37
|
/** The hashed args for the call, ready to be injected in the execution cache */
|
|
38
38
|
hashedArguments: HashedValues[];
|
|
39
39
|
/** The index of the generator to use for hashing */
|
|
40
|
-
|
|
40
|
+
domainSeparator: number;
|
|
41
41
|
/**
|
|
42
42
|
* A nonce to inject into the payload of the transaction. When used with cancellable=true, this nonce will be
|
|
43
43
|
* used to compute a nullifier that allows cancelling this transaction by submitting a new one with the same nonce
|
|
@@ -50,7 +50,7 @@ export declare class EncodedAppEntrypointCalls implements EncodedCalls {
|
|
|
50
50
|
/** The hashed args for the call, ready to be injected in the execution cache */
|
|
51
51
|
hashedArguments: HashedValues[],
|
|
52
52
|
/** The index of the generator to use for hashing */
|
|
53
|
-
|
|
53
|
+
domainSeparator: number,
|
|
54
54
|
/**
|
|
55
55
|
* A nonce to inject into the payload of the transaction. When used with cancellable=true, this nonce will be
|
|
56
56
|
* used to compute a nullifier that allows cancelling this transaction by submitting a new one with the same nonce
|
|
@@ -85,4 +85,4 @@ export declare class EncodedAppEntrypointCalls implements EncodedCalls {
|
|
|
85
85
|
}
|
|
86
86
|
/** Encodes FunctionCalls for execution, following Noir's convention */
|
|
87
87
|
export declare function encode(calls: FunctionCall[]): Promise<EncodedCalls>;
|
|
88
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
88
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW5jb2RpbmcuZC50cyIsInNvdXJjZVJvb3QiO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OAAO,CAAC,YAAY,CAAC,CAwBzE"}
|
package/dest/encoding.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DomainSeparator } from '@aztec/constants';
|
|
2
2
|
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
3
3
|
import { poseidon2HashWithSeparator } from '@aztec/foundation/crypto/poseidon';
|
|
4
4
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
@@ -14,9 +14,9 @@ export const APP_MAX_CALLS = 5;
|
|
|
14
14
|
* */ export class EncodedAppEntrypointCalls {
|
|
15
15
|
encodedFunctionCalls;
|
|
16
16
|
hashedArguments;
|
|
17
|
-
|
|
17
|
+
domainSeparator;
|
|
18
18
|
tx_nonce;
|
|
19
|
-
constructor(/** Function calls in the expected format (Noir's convention) */ encodedFunctionCalls, /** The hashed args for the call, ready to be injected in the execution cache */ hashedArguments, /** The index of the generator to use for hashing */
|
|
19
|
+
constructor(/** Function calls in the expected format (Noir's convention) */ encodedFunctionCalls, /** The hashed args for the call, ready to be injected in the execution cache */ hashedArguments, /** The index of the generator to use for hashing */ domainSeparator, /**
|
|
20
20
|
* A nonce to inject into the payload of the transaction. When used with cancellable=true, this nonce will be
|
|
21
21
|
* used to compute a nullifier that allows cancelling this transaction by submitting a new one with the same nonce
|
|
22
22
|
* but higher fee. The nullifier ensures only one transaction can succeed.
|
|
@@ -24,7 +24,7 @@ export const APP_MAX_CALLS = 5;
|
|
|
24
24
|
tx_nonce){
|
|
25
25
|
this.encodedFunctionCalls = encodedFunctionCalls;
|
|
26
26
|
this.hashedArguments = hashedArguments;
|
|
27
|
-
this.
|
|
27
|
+
this.domainSeparator = domainSeparator;
|
|
28
28
|
this.tx_nonce = tx_nonce;
|
|
29
29
|
}
|
|
30
30
|
/* eslint-disable camelcase */ /**
|
|
@@ -46,7 +46,7 @@ export const APP_MAX_CALLS = 5;
|
|
|
46
46
|
* Hashes the payload
|
|
47
47
|
* @returns The hash of the payload
|
|
48
48
|
*/ hash() {
|
|
49
|
-
return poseidon2HashWithSeparator(this.toFields(), this.
|
|
49
|
+
return poseidon2HashWithSeparator(this.toFields(), this.domainSeparator);
|
|
50
50
|
}
|
|
51
51
|
/** Serializes the function calls to an array of fields. */ functionCallsToFields() {
|
|
52
52
|
return this.encodedFunctionCalls.flatMap((call)=>[
|
|
@@ -70,7 +70,7 @@ export const APP_MAX_CALLS = 5;
|
|
|
70
70
|
}
|
|
71
71
|
const paddedCalls = padArrayEnd(functionCalls, FunctionCall.empty(), APP_MAX_CALLS);
|
|
72
72
|
const encoded = await encode(paddedCalls);
|
|
73
|
-
return new EncodedAppEntrypointCalls(encoded.encodedFunctionCalls, encoded.hashedArguments,
|
|
73
|
+
return new EncodedAppEntrypointCalls(encoded.encodedFunctionCalls, encoded.hashedArguments, DomainSeparator.SIGNATURE_PAYLOAD, txNonce);
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
/** Encodes FunctionCalls for execution, following Noir's convention */ export async function encode(calls) {
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@aztec/entrypoints",
|
|
3
3
|
"homepage": "https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/entrypoints",
|
|
4
4
|
"description": "Implementation of sample contract entrypoints for the Aztec Network",
|
|
5
|
-
"version": "0.0.1-commit.
|
|
5
|
+
"version": "0.0.1-commit.f504929",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
8
8
|
"./account": "./dest/account_entrypoint.js",
|
|
@@ -67,10 +67,10 @@
|
|
|
67
67
|
]
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@aztec/constants": "0.0.1-commit.
|
|
71
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
72
|
-
"@aztec/protocol-contracts": "0.0.1-commit.
|
|
73
|
-
"@aztec/stdlib": "0.0.1-commit.
|
|
70
|
+
"@aztec/constants": "0.0.1-commit.f504929",
|
|
71
|
+
"@aztec/foundation": "0.0.1-commit.f504929",
|
|
72
|
+
"@aztec/protocol-contracts": "0.0.1-commit.f504929",
|
|
73
|
+
"@aztec/stdlib": "0.0.1-commit.f504929",
|
|
74
74
|
"tslib": "^2.4.0",
|
|
75
75
|
"zod": "^3.23.8"
|
|
76
76
|
},
|
package/src/encoding.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DomainSeparator } from '@aztec/constants';
|
|
2
2
|
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
3
3
|
import { poseidon2HashWithSeparator } from '@aztec/foundation/crypto/poseidon';
|
|
4
4
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
@@ -47,7 +47,7 @@ export class EncodedAppEntrypointCalls implements EncodedCalls {
|
|
|
47
47
|
/** The hashed args for the call, ready to be injected in the execution cache */
|
|
48
48
|
public hashedArguments: HashedValues[],
|
|
49
49
|
/** The index of the generator to use for hashing */
|
|
50
|
-
public
|
|
50
|
+
public domainSeparator: number,
|
|
51
51
|
/**
|
|
52
52
|
* A nonce to inject into the payload of the transaction. When used with cancellable=true, this nonce will be
|
|
53
53
|
* used to compute a nullifier that allows cancelling this transaction by submitting a new one with the same nonce
|
|
@@ -80,7 +80,7 @@ export class EncodedAppEntrypointCalls implements EncodedCalls {
|
|
|
80
80
|
* @returns The hash of the payload
|
|
81
81
|
*/
|
|
82
82
|
hash() {
|
|
83
|
-
return poseidon2HashWithSeparator(this.toFields(), this.
|
|
83
|
+
return poseidon2HashWithSeparator(this.toFields(), this.domainSeparator);
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
/** Serializes the function calls to an array of fields. */
|
|
@@ -114,7 +114,7 @@ export class EncodedAppEntrypointCalls implements EncodedCalls {
|
|
|
114
114
|
return new EncodedAppEntrypointCalls(
|
|
115
115
|
encoded.encodedFunctionCalls,
|
|
116
116
|
encoded.hashedArguments,
|
|
117
|
-
|
|
117
|
+
DomainSeparator.SIGNATURE_PAYLOAD,
|
|
118
118
|
txNonce,
|
|
119
119
|
);
|
|
120
120
|
}
|