Skip to content

Commit

Permalink
node: fix function comments
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsaigle committed May 6, 2024
1 parent 2e192f8 commit 8ae3b11
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion node/pkg/governor/flow_cancel_tokens.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package governor

// FlowCancelTokenList Returns a list of `tokenConfigEntry`s representing tokens that can 'Flow Cancel'. This means that incoming transfers
// FlowCancelTokenList returns a list of `tokenConfigEntry`s representing tokens that can 'Flow Cancel'. This means that incoming transfers
// that use these tokens can reduce the 'daily usage' of the Governor configured for the destination chain.
// The list of tokens was generated by grepping the file `generated_mainnet_tokens.go` for "USDC", "USDT", and "DAI".
//
Expand Down
8 changes: 4 additions & 4 deletions node/pkg/governor/governor.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ type (
}
)

// newTransferFromDbTransfer function  Perform a bounds check on dbTransfer.Value to ensure it can fit into int64.
// newTransferFromDbTransfer performs a bounds check on dbTransfer.Value to ensure it can fit into int64.
// This should always be the case for normal operation as dbTransfer.Value represents the USD value of a transfer.
func newTransferFromDbTransfer(dbTransfer *db.Transfer) (tx transfer, err error) {
if dbTransfer.Value > math.MaxInt64 {
Expand All @@ -126,7 +126,7 @@ func newTransferFromDbTransfer(dbTransfer *db.Transfer) (tx transfer, err error)
return transfer{dbTransfer, int64(dbTransfer.Value)}, nil
}

// addFlowCancelTransfer method  Appends a transfer to a ChainEntry's transfers property.
// addFlowCancelTransfer appends a transfer to a ChainEntry's transfers property.
// SECURITY: The calling code is responsible for ensuring that the asset within the transfer is a flow-cancelling asset.
// SECURITY: This method performs validation to ensure that the Flow Cancel transfer is valid. This is important to
// ensure that the Governor usage cannot be lowered due to malicious or invalid transfers.
Expand All @@ -153,7 +153,7 @@ func (ce *chainEntry) addFlowCancelTransfer(transfer transfer) error {
return nil
}

// addFlowCancelTransferFromDbTransfer method  Helper method to convert a dbTransfer to a transfer and add it to the
// addFlowCancelTransferFromDbTransfer converts a dbTransfer to a transfer and adds it to the
// Chain Entry.
// Validation of transfer data is performed by other methods: see addFlowCancelTransfer, newTransferFromDbTransfer.
func (ce *chainEntry) addFlowCancelTransferFromDbTransfer(dbTransfer *db.Transfer) error {
Expand All @@ -168,7 +168,7 @@ func (ce *chainEntry) addFlowCancelTransferFromDbTransfer(dbTransfer *db.Transfe
return nil
}

// inverse method Takes a transfer and returns a copy of that transfer with the
// inverse takes a transfer and returns a copy of that transfer with the
// additive inverse of its Value property (i.e. flip the sign).
func (t *transfer) inverse() transfer {
return transfer{t.dbTransfer, -t.value}
Expand Down
2 changes: 1 addition & 1 deletion node/pkg/governor/governor_monitoring.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ func (gov *ChainGovernor) resetReleaseTimerForTime(vaaId string, now time.Time)
return "", fmt.Errorf("vaa not found in the pending list")
}

// sumValue function  Sums the value of all `transfers`. See also `TrimAndSumValue`.
// sumValue function sums the value of all `transfers`. See also `TrimAndSumValue`.
func sumValue(transfers []transfer, startTime time.Time) uint64 {
if len(transfers) == 0 {
return 0
Expand Down
2 changes: 1 addition & 1 deletion node/pkg/governor/governor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func (gov *ChainGovernor) setTokenForTesting(
return nil
}

// getStatsForAllChains method  Sums the number of transfers, value of all transfers, number of pending transfers,
// getStatsForAllChains sums the number of transfers, value of all transfers, number of pending transfers,
// and the value of the pending transfers.
// Note that 'flow cancel transfers' are not included and therefore the values returned by this function may not
// match the Governor usage.
Expand Down

0 comments on commit 8ae3b11

Please sign in to comment.