Skip to content

Commit

Permalink
Add BaseTx support to platformvm (#2232)
Browse files Browse the repository at this point in the history
Signed-off-by: Dhruba Basu <7675102+dhrubabasu@users.noreply.github.com>
  • Loading branch information
dhrubabasu committed Oct 31, 2023
1 parent 1f9df8f commit 047d493
Show file tree
Hide file tree
Showing 16 changed files with 641 additions and 38 deletions.
9 changes: 8 additions & 1 deletion vms/platformvm/metrics/tx_metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ type txMetrics struct {
numTransformSubnetTxs,
numAddPermissionlessValidatorTxs,
numAddPermissionlessDelegatorTxs,
numTransferSubnetOwnershipTxs prometheus.Counter
numTransferSubnetOwnershipTxs,
numBaseTxs prometheus.Counter
}

func newTxMetrics(
Expand All @@ -51,6 +52,7 @@ func newTxMetrics(
numAddPermissionlessValidatorTxs: newTxMetric(namespace, "add_permissionless_validator", registerer, &errs),
numAddPermissionlessDelegatorTxs: newTxMetric(namespace, "add_permissionless_delegator", registerer, &errs),
numTransferSubnetOwnershipTxs: newTxMetric(namespace, "transfer_subnet_ownership", registerer, &errs),
numBaseTxs: newTxMetric(namespace, "base", registerer, &errs),
}
return m, errs.Err
}
Expand Down Expand Up @@ -139,3 +141,8 @@ func (m *txMetrics) TransferSubnetOwnershipTx(*txs.TransferSubnetOwnershipTx) er
m.numTransferSubnetOwnershipTxs.Inc()
return nil
}

func (m *txMetrics) BaseTx(*txs.BaseTx) error {
m.numBaseTxs.Inc()
return nil
}
6 changes: 6 additions & 0 deletions vms/platformvm/txs/base_tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import (
)

var (
_ UnsignedTx = (*BaseTx)(nil)

ErrNilTx = errors.New("tx is nil")

errOutputsNotSorted = errors.New("outputs not sorted")
Expand Down Expand Up @@ -96,3 +98,7 @@ func (tx *BaseTx) SyntacticVerify(ctx *snow.Context) error {
return nil
}
}

func (tx *BaseTx) Visit(visitor Visitor) error {
return visitor.BaseTx(tx)
}

0 comments on commit 047d493

Please sign in to comment.