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 on Local Networks #2576

Open
wants to merge 61 commits into
base: main
Choose a base branch
from
Open

TmpNet on Local Networks #2576

wants to merge 61 commits into from

Conversation

felipemadero
Copy link
Collaborator

@felipemadero felipemadero commented Jan 26, 2025

Why this should be merged

Closes #2509 #2510 #2511

Replaces ANR with TmpNet for implementation of local network deploys.

How this works

How this was tested

How is this documented

@felipemadero felipemadero requested a review from a team as a code owner January 26, 2025 03:53
@felipemadero felipemadero marked this pull request as draft January 26, 2025 03:53
@felipemadero felipemadero marked this pull request as ready for review January 31, 2025 15:17
@meaghanfitzgerald
Copy link
Collaborator

✅ Deployed a Subnet (--sovereign=false)
✅ Deployed a PoA L1
✅ Added a validator to an existing node cluster using my local machine

Will do additional code review, but functionally tmpnet seems to be working, and feels a bit faster than ANR

Copy link
Collaborator

@meaghanfitzgerald meaghanfitzgerald left a comment

Choose a reason for hiding this comment

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

this is a massive PR, definitely would help to get a review of the tmpnet implementation from @maru-ava if you're willing 🙏

Comment on lines 15 to 21

"github.com/ava-labs/avalanche-cli/pkg/interchain"
"github.com/ava-labs/avalanche-cli/pkg/localnet"
"github.com/ava-labs/avalanche-cli/pkg/models"
"github.com/ava-labs/avalanche-cli/pkg/networkoptions"
"github.com/ava-labs/avalanche-cli/pkg/node"
"github.com/ava-labs/avalanche-cli/pkg/subnet"
"github.com/ava-labs/avalanche-cli/pkg/utils"

Copy link
Collaborator

Choose a reason for hiding this comment

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

why the added spaces on 15 and 21?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

cmd/networkcmd/start.go Outdated Show resolved Hide resolved
felipemadero and others added 2 commits February 5, 2025 11:55
Co-authored-by: Meaghan FitzGerald <[email protected]>
Signed-off-by: felipemadero <[email protected]>
@sukantoraymond
Copy link
Collaborator

Currently on main, if i deploy a subnet in local network (ANR, sovereign=false), and then create another subnet and deploy in local network again, it works fine.

On tmpnet, if i deploy a subnet in local network (tmpnet, sovereign=false), and then create another subnet and deploy in local network again:

AVL-7H2W7V:avalanche-cli raymondsukanto$ ./bin/avalanche blockchain deploy tmpnet7 
✔ Local Network
Deploying [tmpnet7] to Local Network

AvalancheGo path: /Users/raymondsukanto/.avalanche-cli/bin/avalanchego/avalanchego-v1.12.2/avalanchego

Booting Network. Wait until healthy...
Error: failed to start local node: failed to load process context for node "NodeID-7Xhw2mDxuDS44j42TCB6U5579esbSt3Lg": [02-07|12:16:29.709] FATAL app/app.go:77 failed to initialize node {"error": "couldn't initialize API server: listen tcp 127.0.0.1:9650: bind: address already in use"}

@sukantoraymond
Copy link
Collaborator

sukantoraymond commented Feb 7, 2025

running network clean after, and try deploying again:

AVL-7H2W7V:avalanche-cli raymondsukanto$ ./bin/avalanche blockchain deploy tmpnet7 
✔ Local Network
Deploying [tmpnet7] to Local Network

AvalancheGo path: /Users/raymondsukanto/.avalanche-cli/bin/avalanchego/avalanchego-v1.12.2/avalanchego

Booting Network. Wait until healthy...
Error: failed to start local node: failed to load process context for node "NodeID-7Xhw2mDxuDS44j42TCB6U5579esbSt3Lg": [02-07|12:19:35.986] FATAL app/app.go:77 failed to initialize node {"error": "couldn't initialize API server: listen tcp 127.0.0.1:9650: bind: address already in use"}

and then running network stop:

AVL-7H2W7V:avalanche-cli raymondsukanto$ ./bin/avalanche network stop
Error: network is not bootstrapped

app.Log.Warn("failed killing server process", zap.Error(err))
} else {
ux.Logger.PrintToUser("Process terminated.")
if err := localnet.LocalNetworkStop(app); err != nil && !errors.Is(err, localnet.ErrNetworkNotBootstrapped) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Currently on main, if network clean is successful it prints out

Process terminated.

We should print out something if clean is successful.

binutils.WithDialTimeout(constants.FastGRPCDialTimeout),
)
// Returns true if all local network nodes are alive
func LocalNetworkIsBootstrapped(app *application.Avalanche) (bool, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

can differentiate between the names LocalNetworkIsBootstrapped and IsLocalNetworkBlockchainBootstrapped

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Review 👀
Development

Successfully merging this pull request may close these issues.

Create TMPNET package/service within CLI
3 participants