@aztec/entrypoints 0.69.1 → 0.71.0
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EntrypointPayload, computeCombinedPayloadHash, } from '@aztec/aztec.js/entrypoint';
|
|
2
|
-
import {
|
|
2
|
+
import { HashedValues, TxExecutionRequest } from '@aztec/circuit-types';
|
|
3
3
|
import { TxContext } from '@aztec/circuits.js';
|
|
4
4
|
import { FunctionSelector, encodeArguments } from '@aztec/foundation/abi';
|
|
5
5
|
import { DEFAULT_CHAIN_ID, DEFAULT_VERSION } from './constants.js';
|
|
@@ -19,14 +19,14 @@ export class DefaultAccountEntrypoint {
|
|
|
19
19
|
const appPayload = EntrypointPayload.fromAppExecution(calls, nonce);
|
|
20
20
|
const feePayload = await EntrypointPayload.fromFeeOptions(this.address, fee);
|
|
21
21
|
const abi = this.getEntrypointAbi();
|
|
22
|
-
const
|
|
22
|
+
const entrypointHashedArgs = HashedValues.fromValues(encodeArguments(abi, [appPayload, feePayload, !!cancellable]));
|
|
23
23
|
const combinedPayloadAuthWitness = await this.auth.createAuthWit(computeCombinedPayloadHash(appPayload, feePayload));
|
|
24
24
|
const txRequest = TxExecutionRequest.from({
|
|
25
|
-
firstCallArgsHash:
|
|
25
|
+
firstCallArgsHash: entrypointHashedArgs.hash,
|
|
26
26
|
origin: this.address,
|
|
27
27
|
functionSelector: FunctionSelector.fromNameAndParameters(abi.name, abi.parameters),
|
|
28
28
|
txContext: new TxContext(this.chainId, this.version, fee.gasSettings),
|
|
29
|
-
argsOfCalls: [...appPayload.
|
|
29
|
+
argsOfCalls: [...appPayload.hashedArguments, ...feePayload.hashedArguments, entrypointHashedArgs],
|
|
30
30
|
authWitnesses: [combinedPayloadAuthWitness],
|
|
31
31
|
});
|
|
32
32
|
return txRequest;
|
package/dest/dapp_entrypoint.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { computeAuthWitMessageHash, computeInnerAuthWitHash } from '@aztec/aztec.js';
|
|
2
2
|
import { EntrypointPayload } from '@aztec/aztec.js/entrypoint';
|
|
3
|
-
import {
|
|
3
|
+
import { HashedValues, TxExecutionRequest } from '@aztec/circuit-types';
|
|
4
4
|
import { Fr, TxContext } from '@aztec/circuits.js';
|
|
5
5
|
import { FunctionSelector, encodeArguments } from '@aztec/foundation/abi';
|
|
6
6
|
import { DEFAULT_CHAIN_ID, DEFAULT_VERSION } from './constants.js';
|
|
@@ -23,22 +23,22 @@ export class DefaultDappEntrypoint {
|
|
|
23
23
|
}
|
|
24
24
|
const payload = EntrypointPayload.fromFunctionCalls(calls);
|
|
25
25
|
const abi = this.getEntrypointAbi();
|
|
26
|
-
const
|
|
26
|
+
const entrypointHashedArgs = HashedValues.fromValues(encodeArguments(abi, [payload, this.userAddress]));
|
|
27
27
|
const functionSelector = FunctionSelector.fromNameAndParameters(abi.name, abi.parameters);
|
|
28
28
|
// Default msg_sender for entrypoints is now Fr.max_value rather than 0 addr (see #7190 & #7404)
|
|
29
29
|
const innerHash = computeInnerAuthWitHash([
|
|
30
30
|
Fr.MAX_FIELD_VALUE,
|
|
31
31
|
functionSelector.toField(),
|
|
32
|
-
|
|
32
|
+
entrypointHashedArgs.hash,
|
|
33
33
|
]);
|
|
34
34
|
const outerHash = computeAuthWitMessageHash({ consumer: this.dappEntrypointAddress, innerHash }, { chainId: new Fr(this.chainId), version: new Fr(this.version) });
|
|
35
35
|
const authWitness = await this.userAuthWitnessProvider.createAuthWit(outerHash);
|
|
36
36
|
const txRequest = TxExecutionRequest.from({
|
|
37
|
-
firstCallArgsHash:
|
|
37
|
+
firstCallArgsHash: entrypointHashedArgs.hash,
|
|
38
38
|
origin: this.dappEntrypointAddress,
|
|
39
39
|
functionSelector,
|
|
40
40
|
txContext: new TxContext(this.chainId, this.version, fee.gasSettings),
|
|
41
|
-
argsOfCalls: [...payload.
|
|
41
|
+
argsOfCalls: [...payload.hashedArguments, entrypointHashedArgs],
|
|
42
42
|
authWitnesses: [authWitness],
|
|
43
43
|
});
|
|
44
44
|
return txRequest;
|
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.
|
|
5
|
+
"version": "0.71.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
8
8
|
"./dapp": "./dest/dapp_entrypoint.js",
|
|
@@ -61,11 +61,11 @@
|
|
|
61
61
|
]
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@aztec/aztec.js": "0.
|
|
65
|
-
"@aztec/circuit-types": "0.
|
|
66
|
-
"@aztec/circuits.js": "0.
|
|
67
|
-
"@aztec/foundation": "0.
|
|
68
|
-
"@aztec/protocol-contracts": "0.
|
|
64
|
+
"@aztec/aztec.js": "0.71.0",
|
|
65
|
+
"@aztec/circuit-types": "0.71.0",
|
|
66
|
+
"@aztec/circuits.js": "0.71.0",
|
|
67
|
+
"@aztec/foundation": "0.71.0",
|
|
68
|
+
"@aztec/protocol-contracts": "0.71.0",
|
|
69
69
|
"tslib": "^2.4.0"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
type ExecutionRequestInit,
|
|
6
6
|
computeCombinedPayloadHash,
|
|
7
7
|
} from '@aztec/aztec.js/entrypoint';
|
|
8
|
-
import {
|
|
8
|
+
import { HashedValues, TxExecutionRequest } from '@aztec/circuit-types';
|
|
9
9
|
import { type AztecAddress, TxContext } from '@aztec/circuits.js';
|
|
10
10
|
import { type FunctionAbi, FunctionSelector, encodeArguments } from '@aztec/foundation/abi';
|
|
11
11
|
|
|
@@ -29,18 +29,18 @@ export class DefaultAccountEntrypoint implements EntrypointInterface {
|
|
|
29
29
|
const feePayload = await EntrypointPayload.fromFeeOptions(this.address, fee);
|
|
30
30
|
|
|
31
31
|
const abi = this.getEntrypointAbi();
|
|
32
|
-
const
|
|
32
|
+
const entrypointHashedArgs = HashedValues.fromValues(encodeArguments(abi, [appPayload, feePayload, !!cancellable]));
|
|
33
33
|
|
|
34
34
|
const combinedPayloadAuthWitness = await this.auth.createAuthWit(
|
|
35
35
|
computeCombinedPayloadHash(appPayload, feePayload),
|
|
36
36
|
);
|
|
37
37
|
|
|
38
38
|
const txRequest = TxExecutionRequest.from({
|
|
39
|
-
firstCallArgsHash:
|
|
39
|
+
firstCallArgsHash: entrypointHashedArgs.hash,
|
|
40
40
|
origin: this.address,
|
|
41
41
|
functionSelector: FunctionSelector.fromNameAndParameters(abi.name, abi.parameters),
|
|
42
42
|
txContext: new TxContext(this.chainId, this.version, fee.gasSettings),
|
|
43
|
-
argsOfCalls: [...appPayload.
|
|
43
|
+
argsOfCalls: [...appPayload.hashedArguments, ...feePayload.hashedArguments, entrypointHashedArgs],
|
|
44
44
|
authWitnesses: [combinedPayloadAuthWitness],
|
|
45
45
|
});
|
|
46
46
|
|
package/src/dapp_entrypoint.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { computeAuthWitMessageHash, computeInnerAuthWitHash } from '@aztec/aztec.js';
|
|
2
2
|
import { type AuthWitnessProvider } from '@aztec/aztec.js/account';
|
|
3
3
|
import { type EntrypointInterface, EntrypointPayload, type ExecutionRequestInit } from '@aztec/aztec.js/entrypoint';
|
|
4
|
-
import {
|
|
4
|
+
import { HashedValues, TxExecutionRequest } from '@aztec/circuit-types';
|
|
5
5
|
import { type AztecAddress, Fr, TxContext } from '@aztec/circuits.js';
|
|
6
6
|
import { type FunctionAbi, FunctionSelector, encodeArguments } from '@aztec/foundation/abi';
|
|
7
7
|
|
|
@@ -29,13 +29,13 @@ export class DefaultDappEntrypoint implements EntrypointInterface {
|
|
|
29
29
|
const payload = EntrypointPayload.fromFunctionCalls(calls);
|
|
30
30
|
|
|
31
31
|
const abi = this.getEntrypointAbi();
|
|
32
|
-
const
|
|
32
|
+
const entrypointHashedArgs = HashedValues.fromValues(encodeArguments(abi, [payload, this.userAddress]));
|
|
33
33
|
const functionSelector = FunctionSelector.fromNameAndParameters(abi.name, abi.parameters);
|
|
34
34
|
// Default msg_sender for entrypoints is now Fr.max_value rather than 0 addr (see #7190 & #7404)
|
|
35
35
|
const innerHash = computeInnerAuthWitHash([
|
|
36
36
|
Fr.MAX_FIELD_VALUE,
|
|
37
37
|
functionSelector.toField(),
|
|
38
|
-
|
|
38
|
+
entrypointHashedArgs.hash,
|
|
39
39
|
]);
|
|
40
40
|
const outerHash = computeAuthWitMessageHash(
|
|
41
41
|
{ consumer: this.dappEntrypointAddress, innerHash },
|
|
@@ -45,11 +45,11 @@ export class DefaultDappEntrypoint implements EntrypointInterface {
|
|
|
45
45
|
const authWitness = await this.userAuthWitnessProvider.createAuthWit(outerHash);
|
|
46
46
|
|
|
47
47
|
const txRequest = TxExecutionRequest.from({
|
|
48
|
-
firstCallArgsHash:
|
|
48
|
+
firstCallArgsHash: entrypointHashedArgs.hash,
|
|
49
49
|
origin: this.dappEntrypointAddress,
|
|
50
50
|
functionSelector,
|
|
51
51
|
txContext: new TxContext(this.chainId, this.version, fee.gasSettings),
|
|
52
|
-
argsOfCalls: [...payload.
|
|
52
|
+
argsOfCalls: [...payload.hashedArguments, entrypointHashedArgs],
|
|
53
53
|
authWitnesses: [authWitness],
|
|
54
54
|
});
|
|
55
55
|
|