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

Genesis attachments not loading? #3635

Open
jbencin opened this issue Mar 23, 2023 · 2 comments
Open

Genesis attachments not loading? #3635

jbencin opened this issue Mar 23, 2023 · 2 comments
Assignees
Labels

Comments

@jbencin
Copy link
Contributor

jbencin commented Mar 23, 2023

I noticed a potential issue with Atlas attachments while working on PR #3618. In the function spawn_chains_coordinator() in file testnet/stacks-node/src/run_loop/neon.rs, there is the following code:

        // load up genesis Atlas attachments
        let mut atlas_config = AtlasConfig::default(self.config.is_mainnet());
        let genesis_attachments = GenesisData::new(use_test_genesis_data)
            .read_name_zonefiles()
            .into_iter()
            .map(|z| Attachment::new(z.zonefile_content.as_bytes().to_vec()))
            .collect();
        atlas_config.genesis_attachments = Some(genesis_attachments);

A config for Atlas is instantiated along with the genesis attachments, but these variables are never used after this. See full context here. As far as I can tell, this code does nothing and the genesis attachments are never loaded into the database.

Either this should be modified so that the genesis attachments are not discarded, or if those attachments aren't necessary, this code should be removed because it does nothing.

@jcnelson
Copy link
Member

A config for Atlas is instantiated along with the genesis attachments, but these variables are never used after this.

What should happen is that this data must get passed into moved_atlas_config, instantiated just below the end of this snippet. Then, this will get passed into the chains coordinator thread, where it will be fed into the Atlas database's instantiation logic.

@kantai
Copy link
Member

kantai commented Apr 3, 2023

What should happen is that this data must get passed into moved_atlas_config, instantiated just below the end of this snippet. Then, this will get passed into the chains coordinator thread, where it will be fed into the Atlas database's instantiation logic.

Yeah, I agree that this is what should happen in the codebase, but it doesn't, and looking at the git history, it hasn't maybe ever been used:

https://github.com/stacks-network/stacks-blockchain/blob/2.0.0/testnet/stacks-node/src/run_loop/neon.rs#L165-L171

and then atlas_config is redefined before it ever gets used.

So, I think there's two potential options to resolve this issue:

  1. Alter the code here to actually pass in the genesis attachments.
  2. Delete the genesis attachments from the codebase.

Option 2 would have the advantage of shrinking the stacks-node binary by ~1MB as well as simplifying the codebase.

An argument for doing 2 is that clearly the Atlas network has lived without applying the genesis attachments at bootup, so why should these attachments now get special treatment over other Atlas attachments?

I think @lgalabru and @zone117x may also have some more insights on why this hasn't been a problem in practice, and whether or not we should try to enable the genesis attachments in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Status: 🆕 New
Development

No branches or pull requests

4 participants