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] Minimize duration of tx acceptance for e2e testing #3685

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -1132,7 +1132,7 @@ func getDefaultSubnetConfig(v *viper.Viper) subnets.Config {
return subnets.Config{
ConsensusParameters: getConsensusConfig(v),
ValidatorOnly: false,
ProposerMinBlockDelay: proposervm.DefaultMinBlockDelay,
ProposerMinBlockDelay: v.GetDuration(ProposerMinBlockDelayKey),
ProposerNumHistoricalBlocks: proposervm.DefaultNumHistoricalBlocks,
}
}
Expand Down
4 changes: 4 additions & 0 deletions config/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"github.com/ava-labs/avalanchego/utils/ulimit"
"github.com/ava-labs/avalanchego/utils/units"
"github.com/ava-labs/avalanchego/vms/components/gas"
"github.com/ava-labs/avalanchego/vms/proposervm"
)

const (
Expand Down Expand Up @@ -321,6 +322,9 @@ func addNodeFlags(fs *pflag.FlagSet) {
fs.Int(SnowMaxProcessingKey, snowball.DefaultParameters.MaxOutstandingItems, "Maximum number of processing items to be considered healthy")
fs.Duration(SnowMaxTimeProcessingKey, snowball.DefaultParameters.MaxItemProcessingTime, "Maximum amount of time an item should be processing and still be healthy")

// Primary Network Config
fs.Duration(ProposerMinBlockDelayKey, proposervm.DefaultMinBlockDelay, "Minimum delay to enforce when building a snowman++ block for the primary network chains")

// ProposerVM
fs.Bool(ProposerVMUseCurrentHeightKey, false, "Have the ProposerVM always report the last accepted P-chain block height")

Expand Down
1 change: 1 addition & 0 deletions config/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,4 +208,5 @@ const (
TracingExporterTypeKey = "tracing-exporter-type"
TracingHeadersKey = "tracing-headers"
ProcessContextFileKey = "process-context-file"
ProposerMinBlockDelayKey = "proposer-min-block-delay"
)
1 change: 0 additions & 1 deletion tests/e2e/x/transfer/virtuous.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,6 @@ var _ = e2e.DescribeXChainSerial("[Virtuous Transfer Tx AVAX]", func() {

for i := 0; i < totalRounds; i++ {
runFunc(i)
time.Sleep(time.Second)
}

_ = e2e.CheckBootstrapIsPossible(tc, env.GetNetwork())
Expand Down
2 changes: 2 additions & 0 deletions tests/fixture/e2e/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ func NewWallet(tc tests.TestContext, keychain *secp256k1fx.Keychain, nodeURI tmp
)
},
),
// Reducing the default from 100ms speeds up detection of tx acceptance
common.WithPollFrequency(10*time.Millisecond),
)
OutputWalletBalances(tc, wallet)
return wallet
Expand Down
10 changes: 10 additions & 0 deletions tests/fixture/tmpnet/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ func DefaultTmpnetFlags() FlagsMap {
// Specific to e2e testing
config.MinStakeDurationKey: DefaultMinStakeDuration.String(),
config.ProposerVMUseCurrentHeightKey: true,
// Reducing this from the 1s default speeds up tx acceptance
config.ProposerMinBlockDelayKey: "0s",
}
flags.SetDefaults(DefaultTestFlags())
return flags
Expand All @@ -76,3 +78,11 @@ func DefaultChainConfigs() map[string]FlagsMap {
},
}
}

// A set of subnet configuration appropriate for testing.
func DefaultSubnetConfig() FlagsMap {
Copy link
Contributor

Choose a reason for hiding this comment

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

since this is only used in this package, can we unexport it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

tmpnet is used by other repos - including subnet-evm and hypersdk - and the intention is for reuse.

return FlagsMap{
// Reducing this from the 1s default speeds up tx acceptance
"proposerMinBlockDelay": 0, // Needs to be a number to be valid in subnet configuration
}
}
6 changes: 6 additions & 0 deletions tests/fixture/tmpnet/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,12 @@ func (n *Network) CreateSubnets(ctx context.Context, log logging.Logger, apiURI
zap.String("name", subnet.Name),
)

// Apply tmpnet defaults
if subnet.Config == nil {
subnet.Config = FlagsMap{}
}
subnet.Config.SetDefaults(DefaultSubnetConfig())

if subnet.OwningKey == nil {
// Allocate a pre-funded key and remove it from the network so it won't be used for
// other purposes
Expand Down
Loading