-
Notifications
You must be signed in to change notification settings - Fork 236
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add batched signerless contract calls
- Loading branch information
Showing
33 changed files
with
261 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
noir-projects/noir-contracts/contracts/multi_call_entrypoint_contract/Nargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[package] | ||
name = "multi_call_entrypoint_contract" | ||
authors = [""] | ||
compiler_version = ">=0.18.0" | ||
type = "contract" | ||
|
||
[dependencies] | ||
aztec = { path = "../../../aztec-nr/aztec" } | ||
authwit = { path = "../../../aztec-nr/authwit" } |
13 changes: 13 additions & 0 deletions
13
noir-projects/noir-contracts/contracts/multi_call_entrypoint_contract/src/main.nr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// An entrypoint contract that allows everything to go through. Only used for testing | ||
// Pair this with SignerlessWallet to perform multiple actions before any account contracts are deployed (and without authentication) | ||
contract MultiCallEntrypoint { | ||
use dep::std; | ||
|
||
use dep::aztec::prelude::AztecAddress; | ||
use dep::authwit::entrypoint::app::AppPayload; | ||
|
||
#[aztec(private)] | ||
fn entrypoint(app_payload: pub AppPayload) { | ||
app_payload.execute_calls(&mut context); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from '../entrypoint/entrypoint.js'; |
2 changes: 1 addition & 1 deletion
2
yarn-project/aztec.js/src/contract/base_contract_interaction.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
yarn-project/aztec.js/src/entrypoint/default_entrypoint.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { FunctionCall, PackedArguments, TxExecutionRequest } from '@aztec/circuit-types'; | ||
import { TxContext } from '@aztec/circuits.js'; | ||
|
||
import { EntrypointInterface } from './entrypoint.js'; | ||
|
||
/** | ||
* Default implementation of the entrypoint interface. It calls a function on a contract directly | ||
*/ | ||
export class DefaultEntrypoint implements EntrypointInterface { | ||
constructor(private chainId: number, private protocolVersion: number) {} | ||
|
||
createTxExecutionRequest(executions: FunctionCall[]): Promise<TxExecutionRequest> { | ||
const [execution] = executions; | ||
const packedArguments = PackedArguments.fromArgs(execution.args); | ||
const txContext = TxContext.empty(this.chainId, this.protocolVersion); | ||
return Promise.resolve( | ||
new TxExecutionRequest( | ||
execution.to, | ||
execution.functionData, | ||
packedArguments.hash, | ||
txContext, | ||
[packedArguments], | ||
[], | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { FunctionCall, TxExecutionRequest } from '@aztec/circuit-types'; | ||
import { Fr } from '@aztec/foundation/fields'; | ||
|
||
import { FeePaymentMethod } from '../fee/fee_payment_method.js'; | ||
|
||
/** | ||
* Fee payment options for a transaction. | ||
*/ | ||
export type FeeOptions = { | ||
/** The fee payment method to use */ | ||
paymentMethod: FeePaymentMethod; | ||
/** The fee limit to pay */ | ||
maxFee: bigint | number | Fr; | ||
}; | ||
|
||
/** Creates transaction execution requests out of a set of function calls. */ | ||
export interface EntrypointInterface { | ||
/** | ||
* Generates an execution request out of set of function calls. | ||
* @param executions - The execution intents to be run. | ||
* @param feeOpts - The fee to be paid for the transaction. | ||
* @returns The authenticated transaction execution request. | ||
*/ | ||
createTxExecutionRequest(executions: FunctionCall[], feeOpts?: FeeOptions): Promise<TxExecutionRequest>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,9 @@ | |
{ | ||
"path": "../circuits.js" | ||
}, | ||
{ | ||
"path": "../entrypoints" | ||
}, | ||
{ | ||
"path": "../ethereum" | ||
}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.