Skip to content

Comments

Anchor simulator#195

Closed
Zacholme7 wants to merge 81 commits intosigp:unstablefrom
Zacholme7:simulator
Closed

Anchor simulator#195
Zacholme7 wants to merge 81 commits intosigp:unstablefrom
Zacholme7:simulator

Conversation

@Zacholme7
Copy link
Member

@Zacholme7 Zacholme7 commented Mar 18, 2025

Issue Addressed

N/A

Proposed Changes

This PR extends on the simulator introduced in lighthouse to add support for anchor.

Note

The tests wont currently pass since some of the node functionality still does not work, but once everything is working all the tests should be drop in. There is also an issue where we will stack overflow a tokio worker after running for a bit. This also occurs in the lighthouse simulator. The culprit is the LocalBeaconClient simply growing too large over the course of execution mixed with some deep async calls. This would require a significant refactor to address, so simply configuring the stack size before running is the way to go.

RUST_MIN_STACK=8388608 cargo run --bin integration basic-sim

@Zacholme7
Copy link
Member Author

Do we have a plan to address this duplication?

There is no way to address it without upstreaming anchor support into the lighthouse simulator which we dont want to do.

Isn't it possible to modularize and generalize the LH Simulator and reuse the common parts in Anchor? Similar to what I planned to do with the Peer Manager? @AgeManning

I will look into it and see if there is anything that can be done. The main issue is that the LH simulator revolves around a LocalNetwork that does not include anchor nodes. This is pretty much used everywhere in the simulator so either I add some wrapper around it here or we just duplicate some code in favor of readability.

@diegomrsantos
Copy link
Member

Do we have a plan to address this duplication?

There is no way to address it without upstreaming anchor support into the lighthouse simulator which we dont want to do.

Isn't it possible to modularize and generalize the LH Simulator and reuse the common parts in Anchor? Similar to what I planned to do with the Peer Manager? @AgeManning

I will look into it and see if there is anything that can be done. The main issue is that the LH simulator revolves around a LocalNetwork that does not include anchor nodes. This is pretty much used everywhere in the simulator so either I add some wrapper around it here or we just duplicate some code in favor of readability.

Got it. If you have time, please point me to the more relevant parts in the LH code, and I can try to think about something similar to what I had in mind for the Peer Manager.

@AgeManning
Copy link
Member

Yeah, i think in general we want to avoid code duplication. However the simulator, I think can be quite dependent on the thing its simulating.

As its mainly used for CI and testing, I think its fine to just have duplicate code, I'd personally be more concerned with core components. I.e I still think we merge the new Anchor peer manager into Lighthouse at some point. (Maybe that would help with the simulator also).

@Zacholme7
Copy link
Member Author

Zacholme7 commented Apr 8, 2025

Thought the stack overflow was resolved but just hit it again, looking into it.

Mentioned in summary

@Zacholme7
Copy link
Member Author

Closing for now

@Zacholme7 Zacholme7 closed this May 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge major task ready-for-review This PR is ready to be reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants