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

tmpnet: Move tmpnet/local to tmpnet package #2457

Merged
merged 3 commits into from
Dec 15, 2023
Merged

Conversation

marun
Copy link
Contributor

@marun marun commented Dec 10, 2023

Previously the tmpnet code was separated into tmpnet and tmpnet.local packages. The intention was for tmpnet to define common interfaces and configuration, and tmpnet.local to orchestrate process-based temporary networks.

I eventually realized that the previous abstractions were unnecessary. A process- or kube-based network need only differ in its runtime - the code that starts/stops/etc the node. The configuration will be largely similar and can all be stored in the same way. Hence this PR: removing the concept of Local{Node,Network,Config} in favor of Node/Network/Config. Subsequent PRs will introduce the concept of NodeRuntime to support the choice of nodes run as processes or pods.

@marun marun self-assigned this Dec 10, 2023
@marun marun force-pushed the tmpnet-move-local branch 3 times, most recently from 62916a1 to 5bb8d41 Compare December 10, 2023 05:24
@@ -206,6 +197,24 @@ func (nc *NodeConfig) EnsureKeys() error {
return nc.EnsureNodeID()
}

// Derives the nodes proof-of-possession. Requires the node to have a
// BLS signing key.
func (nc *NodeConfig) GetProofOfPosession() (*signer.ProofOfPossession, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

typo: GetProofOfPossession?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Whoops, fixed in parent.

errInvalidKeypair = fmt.Errorf("%q and %q must be provided together or not at all", config.StakingTLSKeyContentKey, config.StakingCertContentKey)
errNoKeysForGenesis = errors.New("failed to generate genesis: no keys to fund")
errInvalidNetworkIDForGenesis = errors.New("network ID can't be mainnet, testnet or local network ID")
errMissingStakersForGenesis = errors.New("no genesis stakers provided")
Copy link
Contributor

Choose a reason for hiding this comment

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

q: do we set in genesis stakers that are not validators?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, I'm assuming that stakers are always validators. Is that a valid assumption?

// Defines the configuration required for a tempoary network
type Network struct {
NetworkConfig
NodeRuntimeConfig
Copy link
Contributor

Choose a reason for hiding this comment

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

q: is is the same runtime config for every node in the network?

Copy link
Contributor Author

@marun marun Dec 10, 2023

Choose a reason for hiding this comment

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

Yes, that is the case. While it was possible to modify the exec path per node (e.g. for the upgrade test) it wasn't persisted. The next PR will enable per-node persistent runtime configuration.

Copy link
Contributor

@abi87 abi87 left a comment

Choose a reason for hiding this comment

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

mostly questions and nits

@marun marun force-pushed the tmpnet-move-local branch from 5bb8d41 to 0e6d8ec Compare December 10, 2023 18:40
@marun marun changed the title tmpnet: Merge tmpnet/local to tmpnet package tmpnet: Move tmpnet/local to tmpnet package Dec 10, 2023
@marun marun changed the base branch from dev to funded-to-prefunded December 10, 2023 18:43
@marun marun force-pushed the tmpnet-move-local branch 2 times, most recently from f9aada9 to 3e42f16 Compare December 10, 2023 21:14
@marun marun added the testing This primarily focuses on testing label Dec 11, 2023
@marun marun force-pushed the funded-to-prefunded branch from 43e53fc to 437bcb6 Compare December 11, 2023 01:57
@marun marun force-pushed the tmpnet-move-local branch from 3e42f16 to 184b8d8 Compare December 11, 2023 03:19
@marun marun changed the title tmpnet: Move tmpnet/local to tmpnet package tmpnet: Move tmpnet/local to tmpnet package Dec 11, 2023
Base automatically changed from funded-to-prefunded to dev December 11, 2023 18:31
@marun marun force-pushed the tmpnet-move-local branch from 184b8d8 to ae08b7e Compare December 11, 2023 18:52
@marun marun marked this pull request as ready for review December 11, 2023 18:53
@marun marun requested a review from gyuho as a code owner December 11, 2023 18:53
@marun marun force-pushed the tmpnet-move-local branch from ae08b7e to 19dca4a Compare December 11, 2023 18:58
Copy link
Collaborator

@aaronbuchwald aaronbuchwald left a comment

Choose a reason for hiding this comment

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

LGTM - one optional nit based on my own preference (NodeID instead of ID)

nodeURI := tmpnet.NodeURI{
NodeID: node.GetID(),
URI: node.GetProcessContext().URI,
ID: node.ID,
Copy link
Collaborator

Choose a reason for hiding this comment

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

optional nit: I think using NodeID is more explicit than ID, which can be confusing at times, so I'd prefer to keep the field name NodeID here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ack, I'll make that change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is your comment just for NodeURI, or should it also apply to tmpnet.Node.ID?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should use the NodeID type for all Node IDs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

marun and others added 3 commits December 14, 2023 18:48
This is the first step in a refactor in support of deploying temporary
networks to kubernetes.
@marun marun force-pushed the tmpnet-move-local branch from 4b22d47 to cb968e8 Compare December 15, 2023 02:49
@StephenButtolph StephenButtolph added this pull request to the merge queue Dec 15, 2023
Merged via the queue into dev with commit 8107f79 Dec 15, 2023
17 checks passed
@StephenButtolph StephenButtolph deleted the tmpnet-move-local branch December 15, 2023 04:27
@marun marun linked an issue Dec 18, 2023 that may be closed by this pull request
6 tasks
marun added a commit that referenced this pull request Dec 20, 2023
marun added a commit that referenced this pull request Dec 21, 2023
marun added a commit that referenced this pull request Dec 22, 2023
marun added a commit that referenced this pull request Dec 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
testing This primarily focuses on testing
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Add subnet support to the tmpnet fixture
5 participants