ava-labs/subnet-evm

local network with 0.5.9 takes much longer time to stop than local network with 0.5.5

felipemadero opened this issue · 0 comments

A 5 node local network with a subnet evm blockchain takes about 30 seconds to stop with subnet-evm 0.5.9 (avago 1.10.15) but 2 seconds to stop with subnet-evm 0.5.5 (avago 1.10.12).
That is a pretty good difference for users doing local dev iterations.

Which is the reason? A change in the avago/vm termination protocol? Can the 0.5.9 time be safely reduced to the previous 2 seconds one using some mechanism?

To reproduce it

Have an avalanchego binary for version 1.10.12 on path $AVAGOPATH1.
Have an avalanchego binary for version 1.10.15 on path $AVAGOPATH2.
Create a subnet-evm binary for version 0.5.5, name it srEXiWaHuhNyPZVr84qZMmfsfu58wmhm4rJHW6DNW1iNoAW99. Save it on plugins dir for 1.10.12 $PLUGINDIR1
Create a subnet-evm binary for version 0.5.9, name it srEXiWaHuhNyPhLWSK4Kk8pta7hem71jmez2ZzGscuJFwg2kk. Save it on plugins dir for 1.10.15 $PLUGINDIR2
Have a genesis.json file at $GENESISPATH with some default contents. eg:

{
    "config": {
        "byzantiumBlock": 0,
        "chainId": 1,
        "constantinopleBlock": 0,
        "eip150Block": 0,
        "eip150Hash": "0x2086799aeebeae135c246c65021c82b4e15a2c451340993aacfd2751886514f0",
        "eip155Block": 0,
        "eip158Block": 0,
        "feeConfig": {
            "gasLimit": 8000000,
            "targetBlockRate": 2,
            "minBaseFee": 25000000000,
            "targetGas": 15000000,
            "baseFeeChangeDenominator": 36,
            "minBlockGasCost": 0,
            "maxBlockGasCost": 1000000,
            "blockGasCostStep": 200000
        },
        "homesteadBlock": 0,
        "istanbulBlock": 0,
        "muirGlacierBlock": 0,
        "petersburgBlock": 0,
        "subnetEVMTimestamp": 0
    },
    "nonce": "0x0",
    "timestamp": "0x0",
    "extraData": "0x",
    "gasLimit": "0x7a1200",
    "difficulty": "0x0",
    "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "coinbase": "0x0000000000000000000000000000000000000000",
    "alloc": {
        "8db97c7cece249c2b98bdc0226cc4c2a57bf52fc": {
            "balance": "0xd3c21bcecceda1000000"
        }
    },
    "airdropHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "airdropAmount": null,
    "number": "0x0",
    "gasUsed": "0x0",
    "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "baseFeePerGas": null
}

On a avalanche-network-runner local repo at main branch, start the server:

go run main.go server 

On another console, same avalanche-network-runner local repo at main branch, create a network with subnet-evm 0.5.5 blockchain:

go run main.go control start --avalanchego-path $AVAGOPATH1 --plugin-dir $PLUGINDIR1 --blockchain-specs '[{"vm_name": "subnetevm1", "genesis": "'$GENESISPATH'"}]'

Time stopping it:

time go run main.go control stop

Now create a network with subnet-evm 0.5.9 blockchain:

go run main.go control start --avalanchego-path $AVAGOPATH2 --plugin-dir $PLUGINDIR2 --blockchain-specs '[{"vm_name": "subnetevm2", "genesis": "'$GENESISPATH'"}]'

Time stopping it:

time go run main.go control stop

By the way, it also seems that the local network is slower to start on 0.5.9: 60 secs against 45 secs on 0.5.5
But the stop consideration has more impact on CLI usage, start time is saved by using anr snapshots.