Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions spartan/aztec-network/templates/transaction-bot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ spec:
export AZTEC_NODE_URL={{ include "aztec-network.validatorUrl" . }}
{{- end }}
echo "AZTEC_NODE_URL=${AZTEC_NODE_URL}"

export BOT_SENDER_SALT=$(echo $K8S_POD_NAME | awk -F'-' '{print $NF+1}') # +1 so that salt is not 0
node --no-warnings /usr/src/yarn-project/aztec/dest/bin/index.js start --pxe --bot
env:
- name: K8S_POD_UID
Expand Down
9 changes: 9 additions & 0 deletions yarn-project/bot/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ export type BotConfig = {
l1PrivateKey: string | undefined;
/** Signing private key for the sender account. */
senderPrivateKey: Fr | undefined;
/** Optional salt to use to deploy the sender account */
senderSalt: Fr | undefined;
/** Encryption secret for a recipient account. */
recipientEncryptionSecret: Fr;
/** Salt for the token contract deployment. */
Expand Down Expand Up @@ -84,6 +86,7 @@ export const BotConfigSchema = z
l1Mnemonic: z.string().optional(),
l1PrivateKey: z.string().optional(),
senderPrivateKey: schemas.Fr.optional(),
senderSalt: schemas.Fr.optional(),
recipientEncryptionSecret: schemas.Fr,
tokenSalt: schemas.Fr,
txIntervalSeconds: z.number(),
Expand Down Expand Up @@ -111,6 +114,7 @@ export const BotConfigSchema = z
l1Mnemonic: undefined,
l1PrivateKey: undefined,
senderPrivateKey: undefined,
senderSalt: undefined,
l2GasLimit: undefined,
daGasLimit: undefined,
...config,
Expand Down Expand Up @@ -147,6 +151,11 @@ export const botConfigMappings: ConfigMappingsType<BotConfig> = {
description: 'Signing private key for the sender account.',
parseEnv: (val: string) => (val ? Fr.fromHexString(val) : undefined),
},
senderSalt: {
env: 'BOT_ACCOUNT_SALT',
description: 'The salt to use to deploys the sender account.',
parseEnv: (val: string) => (val ? Fr.fromHexString(val) : undefined),
},
recipientEncryptionSecret: {
env: 'BOT_RECIPIENT_ENCRYPTION_SECRET',
description: 'Encryption secret for a recipient account.',
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/bot/src/factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export class BotFactory {
}

private async setupAccountWithPrivateKey(privateKey: Fr) {
const salt = Fr.ONE;
const salt = this.config.senderSalt ?? Fr.ONE;
const signingKey = deriveSigningKey(privateKey);
const account = await getSchnorrAccount(this.pxe, privateKey, signingKey, salt);
const isInit = (await this.pxe.getContractMetadata(account.getAddress())).isContractInitialized;
Expand Down
1 change: 1 addition & 0 deletions yarn-project/foundation/src/config/env_var.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export type EnvVar =
| 'BOT_L1_MNEMONIC'
| 'BOT_L1_PRIVATE_KEY'
| 'BOT_PRIVATE_KEY'
| 'BOT_ACCOUNT_SALT'
| 'BOT_PRIVATE_TRANSFERS_PER_TX'
| 'BOT_PUBLIC_TRANSFERS_PER_TX'
| 'BOT_PXE_URL'
Expand Down