Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: fetch addresses from registry #12000

Merged
merged 1 commit into from
Feb 26, 2025

Conversation

just-mitch
Copy link
Collaborator

@just-mitch just-mitch commented Feb 14, 2025

Key changes:

  • Makes slash factory address optional in L1ContractAddresses interface
  • Adds new RegisterNewRollupVersionPayload contract for registering new rollup versions
  • Adds new Registry contract with methods for managing rollup versions
  • Extracts rollup deployment logic into separate deployRollupAndPeriphery function
  • Adds collectAddresses and collectAddressesSafe methods to Registry for fetching contract addresses
  • Transfers fee asset ownership to coin issuer during deployment

Copy link
Collaborator Author

just-mitch commented Feb 14, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@just-mitch just-mitch force-pushed the 02-13-feat_fetch_addresses_from_registry branch from 50eaaf6 to 3dbe043 Compare February 14, 2025 00:09
@just-mitch just-mitch marked this pull request as ready for review February 14, 2025 00:12
@just-mitch just-mitch force-pushed the 02-13-feat_fetch_addresses_from_registry branch 8 times, most recently from 0093784 to c64b04d Compare February 19, 2025 01:13
@spalladino
Copy link
Collaborator

You may want to update ethereum/src/queries.ts#getL1ContractsAddresses to use this!

Copy link
Collaborator Author

+1. Will stack!

@just-mitch just-mitch mentioned this pull request Feb 20, 2025
@just-mitch just-mitch force-pushed the 02-13-feat_fetch_addresses_from_registry branch 2 times, most recently from c9994ec to ab4338d Compare February 25, 2025 00:40
Copy link
Contributor

@LHerskind LHerskind left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer not having the slash-factory as part of the rollup, as it:

  1. is essentially decided off-chain by sequencers
  2. is not fixed, and putting it in there give it the feel that it don't change

Really the rollup don't need to know about its existence, so I would prefer it not knowing. It is one of those things that make more sense to me that we either provide, or have provided as part of the slasher_client being used.

@just-mitch just-mitch force-pushed the 02-13-feat_fetch_addresses_from_registry branch 6 times, most recently from 379759b to 35ab869 Compare February 25, 2025 20:38
@just-mitch just-mitch requested a review from LHerskind February 25, 2025 21:12
@just-mitch just-mitch force-pushed the 02-13-feat_fetch_addresses_from_registry branch 2 times, most recently from 8bddbcb to c1a2bd1 Compare February 26, 2025 02:59
const governanceAddresses = await registry.getGovernanceAddresses();
const rollupAddress = await registry.getRollupAddress(rollupVersion);

if (rollupAddress === undefined) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

else is un needed

};
}

public static async collectAddressesSafe(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The difference between these two is that one does not throw? im not sure why we need to duplicate the whole method for this

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The safe name as written feels like a footgun that the return type will have undefined items in it on top of not throwing

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PTSD thinking of "safeTransfer" in ERC721
Post Traumatic Stress Disorder Reaction GIF

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was going for https://zod.dev/?id=safeparse

But we only use this in the test, so I will remove.

);
const newVersionSalt = originalVersionSalt + 1;

const { rollup: newRollup, payloadAddress } = await deployRollupAndPeriphery(
Copy link
Member

@Maddiaa0 Maddiaa0 Feb 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

periphery is vague,

its not clear to me that its deploying a governance payload and slash factory

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reasong that it is not just doing the "usual" deployment, and then deploying the extra components separate? Is it also to be used in the cli. Otherwise it seems like a bit of an overkill to ingrain it all the way in there.

Beyond that, package wise, should we be pulling in all the deployment stuff for using contracts as well? I mean things like deploying the contracts etc is not needed for the sequencer or any of the others nodes but won't they end up loading some of it anyway.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little confused on the first point- we do a usual deployment in the beforeAll? Or are you saying "usual" here just for deploying the rollup contract and then have separate functions for deploying the rollup's slash factory and upgrade proposal? If so, then yes this function is a convenience wrapper over some utilities that do just that.

For the second one, I agree, but since the deploy stuff is already in @aztec/ethereum alongside these contract utility classes, the sequencer is already pulling all of it in.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But also, yes, this is used in the CLI as part of #12127

Copy link
Contributor

@LHerskind LHerskind left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the changes more this way, but not sure about how deep we should have the deployments that are mainly testing inside the ethereum package - but this is hypocritical as we already throw it all the way in.

Added few comments, some not related to changes here but just observations.

@@ -247,6 +255,144 @@ export function createL1Clients(
return { walletClient, publicClient } as L1Clients;
}

export const deployRollupAndPeriphery = async (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As @Maddiaa0 mentioned earlier this one can be a bit confusing to follow, as it is not clear what periphery is here. For example, the registry could be seen as periphery to the contracts as well. Also it seems like primarily something you would be using for a test here, so less clear to me why it would be lal the way in here? (Guess this is true all the deployments though 🤷🤔)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah agreed, it's not a great name. Will stack to update, since it does more stuff in one of the higher PRs.

return payloadAddress;
};

export const deployRollup = async (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More of a comment related to actual production usage of some of this, but right now the owner would be the deployer, and not end up being the governance.


const txHashes: Hex[] = [];

if (args.initialValidators && args.initialValidators.length > 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think I would prefer if we could pull this into its own function and make it very clear that it is a big cheat. If already moving it around might as well make the cheating clear.


const registryAddress = await govDeployer.deploy(l1Artifacts.registry, [account.address.toString()]);
const registryAddress = await deployer.deploy(l1Artifacts.registry, [account.address.toString()]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of the things down here seems like stuff that would be simple to batch together into a bigger contract deploying it such that there is not all the fiddling in here. Not needed in this flow, just a comment as related really.

// Transaction hashes to await
const txHashes: Hex[] = [];

{
if (!(await feeAsset.read.freeForAll())) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the if here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For idempotency. If we re-run, and try to transfer again, it reverts because we are not the owner.

};
}

public static async collectAddressesSafe(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PTSD thinking of "safeTransfer" in ERC721
Post Traumatic Stress Disorder Reaction GIF


const snapshot = await this.registry.read.getSnapshot([version]);
const address = EthAddress.fromString(snapshot.rollup);
return address.equals(EthAddress.ZERO) ? undefined : address;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I would prefer either returning what the function actually returned, or throwing.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll throw.

public async getCanonicalAddress(): Promise<EthAddress | undefined> {
const snapshot = await this.registry.read.getCurrentSnapshot();
const address = EthAddress.fromString(snapshot.rollup);
return address.equals(EthAddress.ZERO) ? undefined : address;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

);
const newVersionSalt = originalVersionSalt + 1;

const { rollup: newRollup, payloadAddress } = await deployRollupAndPeriphery(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reasong that it is not just doing the "usual" deployment, and then deploying the extra components separate? Is it also to be used in the cli. Otherwise it seems like a bit of an overkill to ingrain it all the way in there.

Beyond that, package wise, should we be pulling in all the deployment stuff for using contracts as well? I mean things like deploying the contracts etc is not needed for the sequencer or any of the others nodes but won't they end up loading some of it anyway.

client: publicClient,
});

const lockAmount = 10000n * 10n ** 18n;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If configs are changed this would likely be breaking. Also, if they are the same value, we could reduce the number of magic numbers and not have them both be defined with a constant like this 🫡

@just-mitch just-mitch force-pushed the 02-13-feat_fetch_addresses_from_registry branch from c1a2bd1 to cd46471 Compare February 26, 2025 16:47
@just-mitch just-mitch merged commit a90f08e into master Feb 26, 2025
10 checks passed
@just-mitch just-mitch deleted the 02-13-feat_fetch_addresses_from_registry branch February 26, 2025 17:34
TomAFrench added a commit that referenced this pull request Feb 26, 2025
* master: (31 commits)
  feat: Slack message to ci channel tagging owners on flakes. (#12284)
  fix: slack notify was broken by quoted commit titles
  revert: "chore: Fix and reenable fees-settings test (#12302)"
  fix: run arm64 on master (#12307)
  yolo fix
  chore: Fix and reenable fees-settings test (#12302)
  feat!: rename compute_nullifier_without_context (#12308)
  chore: Lazy loading artifacts everywhere (#12285)
  chore: Reenable dapp subscription test (#12304)
  chore: Run prover test with fake proofs when requested (#12305)
  chore: Do not set CI_FULL outside CI (#12300)
  chore: new mnemonic deployments on sepolia (#12076)
  chore!: enable multiple L1 nodes to be used (#11945)
  chore: remove no longer supported extension from vscode/extension.json (#12303)
  fix(e2e): p2p_reqresp (#12297)
  feat: Sync from noir (#12298)
  chore: enabling `e2e_contract_updates` in CI + nuking irrelevant test (#12293)
  feat: prepend based merge (#12093)
  feat: fetch addresses from registry (#12000)
  feat: live logs (#12271)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat(sequencer,prover): use rollup version to get contract addresses from registry
4 participants