Skip to content

Commit

Permalink
fix: remove special case for epoch 0 (#8549)
Browse files Browse the repository at this point in the history
  • Loading branch information
LHerskind authored Sep 16, 2024
1 parent 5a6aaeb commit b035d01
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 12 deletions.
2 changes: 1 addition & 1 deletion l1-contracts/src/core/Rollup.sol
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ contract Rollup is Leonidas, IRollup, ITestRollup {

function computeTxsEffectsHash(bytes calldata _body)
external
view
pure
override(IRollup)
returns (bytes32)
{
Expand Down
2 changes: 1 addition & 1 deletion l1-contracts/src/core/interfaces/IRollup.sol
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,5 @@ interface IRollup {

function archive() external view returns (bytes32);
function archiveAt(uint256 _blockNumber) external view returns (bytes32);
function computeTxsEffectsHash(bytes calldata _body) external view returns (bytes32);
function computeTxsEffectsHash(bytes calldata _body) external pure returns (bytes32);
}
3 changes: 0 additions & 3 deletions l1-contracts/src/core/sequencer_selection/Leonidas.sol
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,6 @@ contract Leonidas is Ownable, ILeonidas {
function getProposerAt(uint256 _ts) public view override(ILeonidas) returns (address) {
uint256 epochNumber = getEpochAt(_ts);
uint256 slot = getSlotAt(_ts);
if (epochNumber == 0) {
return address(0);
}

Epoch storage epoch = epochs[epochNumber];

Expand Down
3 changes: 3 additions & 0 deletions l1-contracts/test/sparta/Sparta.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ contract SpartaTest is DecoderBase {
assertFalse(_seenCommittee[committee[i]]);
_seenCommittee[committee[i]] = true;
}

address proposer = rollup.getCurrentProposer();
assertTrue(_seenCommittee[proposer]);
}

function testProposerForNonSetupEpoch(uint8 _epochsToJump) public setup(4) {
Expand Down
7 changes: 3 additions & 4 deletions yarn-project/end-to-end/src/fixtures/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,9 @@ export async function setup(
config.publisherPrivateKey = `0x${publisherPrivKey!.toString('hex')}`;
}

// Made as separate values such that keys can change, but for test they will be the same.
config.validatorPrivateKey = config.publisherPrivateKey;

if (PXE_URL) {
// we are setting up against a remote environment, l1 contracts are assumed to already be deployed
return await setupWithRemoteEnvironment(publisherHdAccount!, config, logger, numberOfAccounts, enableGas);
Expand All @@ -408,10 +411,6 @@ export async function setup(

await watcher.start();

// Run the test with validators enabled
const validatorPrivKey = getPrivateKeyFromIndex(1);
config.validatorPrivateKey = `0x${validatorPrivKey!.toString('hex')}`;

logger.verbose('Creating and synching an aztec node...');

const acvmConfig = await getACVMConfig(logger);
Expand Down
4 changes: 1 addition & 3 deletions yarn-project/sequencer-client/src/publisher/l1-publisher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -405,14 +405,12 @@ export class L1Publisher {
}),
});

const min = (a: bigint, b: bigint) => (a > b ? b : a);

// @note We perform this guesstimate instead of the usual `gasEstimate` since
// viem will use the current state to simulate against, which means that
// we will fail estimation in the case where we are simulating for the
// first ethereum block within our slot (as current time is not in the
// slot yet).
const gasGuesstimate = min(computeTxsEffectsHashGas + L1Publisher.PROPOSE_GAS_GUESS, 15_000_000n);
const gasGuesstimate = computeTxsEffectsHashGas + L1Publisher.PROPOSE_GAS_GUESS;

const attestations = encodedData.attestations
? encodedData.attestations.map(attest => attest.toViemSignature())
Expand Down

0 comments on commit b035d01

Please sign in to comment.