-
Notifications
You must be signed in to change notification settings - Fork 699
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
P-chain - Memo field zeroed post Durango #2607
Changes from 5 commits
d01b7ee
3181e9a
5bbe14c
46de238
6854972
80332a3
9b5ac0a
c0ce5ad
53e9a44
b8df184
1fdf681
1b01c22
3d33013
dcf5591
1e10b39
557bfb9
99e56de
6009d83
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,13 +54,20 @@ func (e *StandardTxExecutor) CreateChainTx(tx *txs.CreateChainTx) error { | |
return err | ||
} | ||
|
||
var ( | ||
timestamp = e.State.GetTimestamp() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
isDurangoActive = e.Config.IsDurangoActivated(timestamp) | ||
) | ||
if err := avax.VerifyMemoFieldLength(tx.Memo, isDurangoActive); err != nil { | ||
return err | ||
} | ||
|
||
baseTxCreds, err := verifyPoASubnetAuthorization(e.Backend, e.State, e.Tx, tx.SubnetID, tx.SubnetAuth) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
// Verify the flowcheck | ||
timestamp := e.State.GetTimestamp() | ||
createBlockchainTxFee := e.Config.GetCreateBlockchainTxFee(timestamp) | ||
if err := e.FlowChecker.VerifySpend( | ||
tx, | ||
|
@@ -98,8 +105,15 @@ func (e *StandardTxExecutor) CreateSubnetTx(tx *txs.CreateSubnetTx) error { | |
return err | ||
} | ||
|
||
var ( | ||
timestamp = e.State.GetTimestamp() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
isDurangoActive = e.Config.IsDurangoActivated(timestamp) | ||
) | ||
if err := avax.VerifyMemoFieldLength(tx.Memo, isDurangoActive); err != nil { | ||
return err | ||
} | ||
|
||
// Verify the flowcheck | ||
timestamp := e.State.GetTimestamp() | ||
createSubnetTxFee := e.Config.GetCreateSubnetTxFee(timestamp) | ||
if err := e.FlowChecker.VerifySpend( | ||
tx, | ||
|
@@ -131,6 +145,14 @@ func (e *StandardTxExecutor) ImportTx(tx *txs.ImportTx) error { | |
return err | ||
} | ||
|
||
var ( | ||
currentTimestamp = e.State.GetTimestamp() | ||
isDurangoActive = e.Config.IsDurangoActivated(currentTimestamp) | ||
) | ||
if err := avax.VerifyMemoFieldLength(tx.Memo, isDurangoActive); err != nil { | ||
return err | ||
} | ||
|
||
e.Inputs = set.NewSet[ids.ID](len(tx.ImportedInputs)) | ||
utxoIDs := make([][]byte, len(tx.ImportedInputs)) | ||
for i, in := range tx.ImportedInputs { | ||
|
@@ -209,6 +231,14 @@ func (e *StandardTxExecutor) ExportTx(tx *txs.ExportTx) error { | |
return err | ||
} | ||
|
||
var ( | ||
currentTimestamp = e.State.GetTimestamp() | ||
isDurangoActive = e.Config.IsDurangoActivated(currentTimestamp) | ||
) | ||
if err := avax.VerifyMemoFieldLength(tx.Memo, isDurangoActive); err != nil { | ||
return err | ||
} | ||
|
||
outs := make([]*avax.TransferableOutput, len(tx.Outs)+len(tx.ExportedOutputs)) | ||
copy(outs, tx.Outs) | ||
copy(outs[len(tx.Outs):], tx.ExportedOutputs) | ||
|
@@ -386,6 +416,14 @@ func (e *StandardTxExecutor) TransformSubnetTx(tx *txs.TransformSubnetTx) error | |
return err | ||
} | ||
|
||
var ( | ||
currentTimestamp = e.State.GetTimestamp() | ||
isDurangoActive = e.Config.IsDurangoActivated(currentTimestamp) | ||
) | ||
if err := avax.VerifyMemoFieldLength(tx.Memo, isDurangoActive); err != nil { | ||
return err | ||
} | ||
|
||
// Note: math.MaxInt32 * time.Second < math.MaxInt64 - so this can never | ||
// overflow. | ||
if time.Duration(tx.MaxStakeDuration)*time.Second > e.Backend.Config.MaxStakeDuration { | ||
|
@@ -512,6 +550,14 @@ func (e *StandardTxExecutor) BaseTx(tx *txs.BaseTx) error { | |
return err | ||
} | ||
|
||
var ( | ||
currentTimestamp = e.State.GetTimestamp() | ||
isDurangoActive = e.Config.IsDurangoActivated(currentTimestamp) | ||
) | ||
if err := avax.VerifyMemoFieldLength(tx.Memo, isDurangoActive); err != nil { | ||
StephenButtolph marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return err | ||
} | ||
|
||
// Verify the flowcheck | ||
if err := e.FlowChecker.VerifySpend( | ||
tx, | ||
|
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.
I added a different method rather than extending
SyntacticVerify
with config and chainTIme. We can revisit this choice down the line, in case other syntactic checks will depend on the specific fork used