-
Notifications
You must be signed in to change notification settings - Fork 118
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
Snow VM #1831
base: main
Are you sure you want to change the base?
Snow VM #1831
Conversation
Next steps:
Most importantly break this PR up |
res.Errors = make([]string, len(errs)) | ||
for i, err := range errs { | ||
if err != nil { | ||
res.Errors[i] = err.Error() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes a bug discovered in a newly added test. If the error was nil, then the previous code triggered a panic.
return fmt.Errorf("%w: tx timestamp (%d) < block timestamp (%d)", ErrTimestampTooLate, b.Timestamp, timestamp) | ||
case b.Timestamp > timestamp+r.GetValidityWindow(): // tx: 100 block 10 | ||
return ErrTimestampTooEarly | ||
return fmt.Errorf("%w: tx timestamp (%d) > block timestamp (%d) + validity window (%d)", ErrTimestampTooEarly, b.Timestamp, timestamp, r.GetValidityWindow()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added details while debugging newly added tests. These errors are much more helpful with the added information.
@@ -72,10 +71,8 @@ func (p *PreExecutor) PreExecute( | |||
} | |||
|
|||
// Verify auth if not already verified by caller | |||
if verifyAuth { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was never false previously.
// NewTransaction creates a Transaction and initializes the private fields. | ||
func NewTransaction(base *Base, actions Actions, auth Auth) (*Transaction, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need this exported for newly added tests
authFactories := testingNetworkConfig.AuthFactories() | ||
spamKey := authFactories[0] | ||
generator := workload.NewTxGenerator(authFactories[1]) | ||
tc := e2e.NewTestContext() | ||
he2e.SetWorkload(testingNetworkConfig, generator, expectedABI, &spamHelper, firstAuthFactory) | ||
he2e.SetWorkload(testingNetworkConfig, generator, expectedABI, &spamHelper, spamKey) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Throughput and workflow tests should not share the same pre-funded key
type Ready interface { | ||
IsReady() bool | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the need for IsReady
and register the gossip handler when it's ready instead
@@ -8,10 +8,10 @@ import ( | |||
"testing" | |||
|
|||
"github.com/ava-labs/avalanchego/ids" | |||
"github.com/ava-labs/avalanchego/trace" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove need for HyperSDK defined trace package
@@ -1,666 +0,0 @@ | |||
// Copyright (C) 2024, Ava Labs, Inc. All rights reserved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: add integration testing harness for VMs and use for MorpheusVM
This refactor is intended to separate out maintenance of the AvalancheGo specific invariants and initialization from the VM package.
Prior to this PR, the VM package:
snowman.Block
,block.ChainVM
, andblock.StateSyncableVM
interfacesThis PR aims to reduce the responsibilities of the VM package as much as possible. Note: #1744 moved the
StatefulBlock
type out of the chain package and into VM. This continues to remove AvalancheGo specific functionality from the HyperVM specific components.The goal of this refactor is to get to a point where:
snow
package implementssnowman.Block
andblock.ChainVM
and maintains invariants required by consensus enginesnow
package can be tested independently of HyperSDK chain logic that it correctly maintains those invariantssnow
package "decomposes" the AvalancheGo VM interface into components with given defaults and can be overridden by an individual chain (currentlyOptions
, but should be renamed as it doesn't quite fit under this pattern)vm
package tohypervm
vm
package plays the role of initializing all of the required components and implementing a simpler interface that handles the required block state transitionsvm
package that do not need to cover consensus engine edge caseschain.OutputBlock
after accept that can be sent to relevant APIs)