-
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
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
This PR integrates the changes added in #1867.
The overall change separates implementing the AvalancheGo
block.VM
andsnowman.Block
interfaces to fulfill DynamicStateSync into a separate, independently tested package.This splits up the VM into individual pieces that can be overridden and creates a new
Chain
interface that can define three concrete block typesAdditionally,
Chain
implementsInitialize
andSetConsensusIndex
to take in all of the necessary parameters supplied by AvalancheGo and to set the required subscriptions or hooks needed to operate ie. accepted/verified/rejected block subscriptions, notifications when the VM transitions toNormalOp
, etc.After integrating, this PR adds new integration action/auth agnostic integration tests for the updated VM package. This replaces the test coverage previously added through MorpheusVM and cuts down the MorpheusVM integration tests to only the tests written to run against
workload.TestNetwork
.