Documentation ¶
Index ¶
- Constants
- Variables
- func CheckAnnotatedTag(tag *object.Tag, txDetail *types.TxDetail, _ core.PushKeyGetter) error
- func CheckCommit(commit *object.Commit, txDetail *types.TxDetail, _ core.PushKeyGetter) error
- func CheckCommonPostBody(repo types.LocalRepo, commit types.Commit, isNewRef bool, ...) error
- func CheckEndorsement(end *pptyp.PushEndorsement, logic core.Logic, index int) error
- func CheckEndorsementConsistency(end *pptyp.PushEndorsement, logic core.Logic, noBLSSigCheck bool, index int) error
- func CheckEndorsementConsistencyUsingHost(hosts tickettypes.SelectedTickets, end *pptyp.PushEndorsement, ...) error
- func CheckEndorsementSanity(e *pptyp.PushEndorsement, fromPushTx bool, index int) error
- func CheckIssuePostBody(commit types.Commit, fm map[string]interface{}) error
- func CheckMergeCompliance(repo types.LocalRepo, change *types.ItemChange, ...) error
- func CheckMergeProposalID(id string, index int) error
- func CheckMergeRequestPostBody(keepers core.Keepers, repo types.LocalRepo, commit types.Commit, ...) error
- func CheckMergeRequestPostBodyConsistency(keepers core.Keepers, repo types.LocalRepo, reference string, isNewRef bool, ...) error
- func CheckNote(repo types.LocalRepo, txDetail *types.TxDetail) error
- func CheckPostBody(keepers core.Keepers, repo types.LocalRepo, reference string, ...) error
- func CheckPostCommit(repo types.LocalRepo, commit types.Commit, args *CheckPostCommitArgs) (*plumbing2.PostBody, error)
- func CheckPushNote(note pptyp.PushNote, logic core.Logic) error
- func CheckPushNoteConsistency(note pptyp.PushNote, logic core.Logic) error
- func CheckPushNoteSanity(note pptyp.PushNote) error
- func CheckPushedReferenceConsistency(targetRepo remotetypes.LocalRepo, ref *pptyp.PushedReference, ...) error
- func CheckTxDetail(params *types.TxDetail, keepers core.Keepers, index int) error
- func CheckTxDetailConsistency(txd *types.TxDetail, keepers core.Keepers, index int) error
- func CheckTxDetailSanity(params *types.TxDetail, index int) error
- func GetTxDetailsFromNote(note pptyp.PushNote, targetRefs ...string) (details []*remotetypes.TxDetail)
- func IsBlockedByScope(scopes []string, params *types.TxDetail, namespaceFromParams *state.Namespace) bool
- func ValidateChange(keepers core.Keepers, localRepo types.LocalRepo, oldHash string, ...) error
- func ValidatePostCommit(repo types.LocalRepo, commit types.Commit, args *ValidatePostCommitArg) error
- type ChangeValidatorFunc
- type CheckEndorsementFunc
- type CheckOptions
- type CheckPostCommitArgs
- type CheckPushNoteFunc
- type CommitChecker
- type MergeComplianceCheckFunc
- type PostCommitChecker
- type RefMismatchErr
- type TxDetailChecker
- type ValidatePostCommitArg
Constants ¶
const ErrCodeRefAndLocalStateMismatch = "refAndLocalMismatch"
ErrCodeRefAndLocalStateMismatch is the code describing an error that occurs when a pushed reference old hash does not match its corresponding local reference hash.
const ErrCodeRefAndNetStateMismatch = "refAndNetMismatch"
ErrCodeRefAndNetStateMismatch is the code describing an error that occurs when a pushed reference old hash does not match its corresponding network reference hash.
Variables ¶
var ( MaxIssueContentLen = 1024 * 8 // 8KB MaxIssueTitleLen = 256 ErrCannotWriteToClosedRef = fmt.Errorf("cannot write to a closed reference") )
var (
ErrPushedAndSignedHeadMismatch = fmt.Errorf("pushed object hash differs from signed reference hash")
)
Functions ¶
func CheckAnnotatedTag ¶
CheckAnnotatedTag validates an annotated tag. tag: The target annotated tag txDetail: The pusher transaction detail getPushKey: Getter function for reading push key public key
func CheckCommit ¶
CheckCommit validates a commit repo: The target repo commit: The target commit object txDetail: The push transaction detail getPushKey: Getter function for fetching push public key
func CheckCommonPostBody ¶
func CheckCommonPostBody( repo types.LocalRepo, commit types.Commit, isNewRef bool, fm map[string]interface{}, content []byte) error
CheckCommonPostBody performs sanity checks on common fields of a post body
func CheckEndorsement ¶
CheckEndorsement performs sanity and state consistency checks on the given Endorsement object
func CheckEndorsementConsistency ¶
func CheckEndorsementConsistency(end *pptyp.PushEndorsement, logic core.Logic, noBLSSigCheck bool, index int) error
CheckEndorsementConsistency performs consistency checks on the given Endorsement object against the current state of the network. EXPECT: Sanity check to have been performed using CheckEndorsementSanity
func CheckEndorsementConsistencyUsingHost ¶
func CheckEndorsementConsistencyUsingHost( hosts tickettypes.SelectedTickets, end *pptyp.PushEndorsement, noBLSSigCheck bool, index int) error
CheckEndorsementConsistencyUsingHost performs consistency checks on the given push endorsement object against the current state of the network. EXPECT: Sanity check to have been performed using CheckEndorsementSanity
func CheckEndorsementSanity ¶
func CheckEndorsementSanity(e *pptyp.PushEndorsement, fromPushTx bool, index int) error
CheckEndorsementSanity performs sanity checks on the given Endorsement object. fromPushTx indicates that the endorsement was retrieved from a push transaction. noBLSSigRequiredCheck prevents BLS signature requirement check.
func CheckIssuePostBody ¶
CheckIssuePostBody performs sanity checks on fields of an issue post body
func CheckMergeCompliance ¶
func CheckMergeCompliance( repo types.LocalRepo, change *types.ItemChange, mergeProposalID, pushKeyID string, keepers core.Logic) error
CheckMergeCompliance checks whether the change satisfies the given merge proposal
func CheckMergeProposalID ¶
CheckMergeProposalID performs sanity checks on merge proposal ID
func CheckMergeRequestPostBody ¶
func CheckMergeRequestPostBody( keepers core.Keepers, repo types.LocalRepo, commit types.Commit, reference string, isNewRef bool, body map[string]interface{}) error
CheckMergeRequestPostBody performs sanity and consistency checks on post fields specific to a merge request
func CheckMergeRequestPostBodyConsistency ¶
func CheckMergeRequestPostBodyConsistency( keepers core.Keepers, repo types.LocalRepo, reference string, isNewRef bool, body map[string]interface{}) error
CheckMergeRequestPostBodyConsistency performs consistency checks on fields of a merge request post body against the network state
func CheckNote ¶
CheckNote validates a note. repo: The repo where the tag exists in. txDetail: The pusher transaction detail
func CheckPostBody ¶
func CheckPostBody( keepers core.Keepers, repo types.LocalRepo, reference string, commit types.Commit, isNewRef bool, fm map[string]interface{}, content []byte) error
CheckPostBody checks whether the front matter and content extracted from a post body is ok. keepers: The application state keepers repo: The target repo commit: The commit whose content needs to be checked. isNewRef: indicates that the post reference is new. fm: The front matter data. content: The content from the post commit.
func CheckPostCommit ¶
func CheckPostCommit(repo types.LocalRepo, commit types.Commit, args *CheckPostCommitArgs) (*plumbing2.PostBody, error)
CheckPostCommit validates new commits of a post reference. It returns nil post body and error if validation failed or a post body and nil if validation passed.
func CheckPushNote ¶
CheckPushNote performs validation checks on a push transaction
func CheckPushNoteConsistency ¶
CheckPushNoteConsistency performs consistency checks against the state of the repository as seen by the node. If the target repo object is not set in tx, local reference hash comparison is not performed.
func CheckPushNoteSanity ¶
CheckPushNoteSanity performs syntactic checks on the fields of a push transaction
func CheckPushedReferenceConsistency ¶
func CheckPushedReferenceConsistency(targetRepo remotetypes.LocalRepo, ref *pptyp.PushedReference, repoState *state.Repository) error
CheckPushedReferenceConsistency validates pushed references.
targetRepo is a reference to the local repo. If unset, the pushed reference's old hash will not be compared to the corresponding local and network reference current hash.
ref is the pushed reference.
repoState is the repository's network state.
func CheckTxDetail ¶
CheckTxDetail performs sanity and consistency checks on a transaction's parameters.
func CheckTxDetailConsistency ¶
CheckTxDetailConsistency performs consistency checks on a transaction's parameters.
func CheckTxDetailSanity ¶
CheckTxDetailSanity performs sanity checks on a transaction's parameters. When authScope is true, only fields necessary for authentication are validated.
func GetTxDetailsFromNote ¶
func GetTxDetailsFromNote(note pptyp.PushNote, targetRefs ...string) (details []*remotetypes.TxDetail)
GetTxDetailsFromNote creates a slice of TxDetail objects from a push note. Limit to references specified in targetRefs
func IsBlockedByScope ¶
func IsBlockedByScope(scopes []string, params *types.TxDetail, namespaceFromParams *state.Namespace) bool
IsBlockedByScope checks whether the given tx parameter satisfy a given scope
func ValidateChange ¶
func ValidateChange( keepers core.Keepers, localRepo types.LocalRepo, oldHash string, change *types.ItemChange, detail *types.TxDetail, getPushKey core.PushKeyGetter) error
ValidateChange validates a change to a repository repo: The target repository oldHash: The hash of the old reference change: The change to the reference txDetail: The pusher transaction detail getPushKey: Getter function for reading push key public key
func ValidatePostCommit ¶
func ValidatePostCommit(repo types.LocalRepo, commit types.Commit, args *ValidatePostCommitArg) error
ValidatePostCommit validate a pushed post commit. commit is the recent post commit in the post reference.
Types ¶
type ChangeValidatorFunc ¶
type CheckEndorsementFunc ¶
CheckEndorsementFunc describes a function for validating a push endorsement
type CheckOptions ¶
type CheckOptions struct {
AllowNonceGap bool
}
type CheckPostCommitArgs ¶
CheckPostCommitArgs includes arguments for CheckPostCommit function
type CheckPushNoteFunc ¶
CheckPushNoteFunc describes a function for checking a push note
type CommitChecker ¶
type CommitChecker func(commit *object.Commit, txDetail *types.TxDetail, getPushKey core.PushKeyGetter) error
CommitChecker describes a function for checking a standard commit
type PostCommitChecker ¶
type PostCommitChecker func( repo types.LocalRepo, commit types.Commit, args *CheckPostCommitArgs) (*plumbing2.PostBody, error)
PostCommitChecker describes a function for validating a post commit.
type RefMismatchErr ¶
RefMismatchErr describe a reference mismatch error
type TxDetailChecker ¶
TxDetailChecker describes a function for checking a transaction detail
type ValidatePostCommitArg ¶
type ValidatePostCommitArg struct { Keepers core.Keepers OldHash string Change *types.ItemChange TxDetail *types.TxDetail PushKeyGetter core.PushKeyGetter CheckPostCommit PostCommitChecker CheckCommit CommitChecker }
ValidatePostCommitArg contains arguments for ValidatePostCommit