Skip to content

Commit

Permalink
populating fee addrs in aztec node
Browse files Browse the repository at this point in the history
  • Loading branch information
benesjan committed Feb 7, 2024
1 parent dfad8c0 commit 61d7839
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 9 deletions.
7 changes: 4 additions & 3 deletions yarn-project/aztec-node/src/aztec-node/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -552,9 +552,10 @@ export class AztecNodeService implements AztecNode {
this.log.info(`Simulating tx ${await tx.getTxHash()}`);
const blockNumber = (await this.blockSource.getBlockNumber()) + 1;

// TODO(benesjan): populate these values from config.
const coinbase = EthAddress.ZERO;
const feeRecipient = AztecAddress.ZERO;
// If sequencer is not initialized, we just set these values to zero for simulation.
const coinbase = this.sequencer?.coinbase || EthAddress.ZERO;
const feeRecipient = this.sequencer?.feeRecipient || AztecAddress.ZERO;

const newGlobalVariables = await this.globalVariableBuilder.buildGlobalVariables(
new Fr(blockNumber),
coinbase,
Expand Down
8 changes: 8 additions & 0 deletions yarn-project/sequencer-client/src/client/sequencer-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,12 @@ export class SequencerClient {
public restart() {
this.sequencer.restart();
}

get coinbase() {
return this.sequencer.coinbase;
}

get feeRecipient() {
return this.sequencer.feeRecipient;
}
}
20 changes: 14 additions & 6 deletions yarn-project/sequencer-client/src/sequencer/sequencer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ export class Sequencer {
private maxTxsPerBlock = 32;
private minTxsPerBLock = 1;
// TODO: zero values should not be allowed for the following 2 values in PROD
private coinbase = EthAddress.ZERO;
private feeRecipient = AztecAddress.ZERO;
private _coinbase = EthAddress.ZERO;
private _feeRecipient = AztecAddress.ZERO;
private lastPublishedBlock = 0;
private state = SequencerState.STOPPED;

Expand Down Expand Up @@ -68,10 +68,10 @@ export class Sequencer {
this.minTxsPerBLock = config.minTxsPerBlock;
}
if (config.coinbase) {
this.coinbase = config.coinbase;
this._coinbase = config.coinbase;
}
if (config.feeRecipient) {
this.feeRecipient = config.feeRecipient;
this._feeRecipient = config.feeRecipient;
}
}

Expand Down Expand Up @@ -166,8 +166,8 @@ export class Sequencer {

const newGlobalVariables = await this.globalsBuilder.buildGlobalVariables(
new Fr(newBlockNumber),
this.coinbase,
this.feeRecipient,
this._coinbase,
this._feeRecipient,
);

// Filter out invalid txs
Expand Down Expand Up @@ -421,6 +421,14 @@ export class Sequencer {
}
return false;
}

get coinbase(): EthAddress {
return this._coinbase;
}

get feeRecipient(): AztecAddress {
return this._feeRecipient;
}
}

/**
Expand Down

0 comments on commit 61d7839

Please sign in to comment.