guard

package
v0.0.105 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 22, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package guard signs attestations and posts to attestation collector and destination.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AttestationCollectorAttestationScanner

type AttestationCollectorAttestationScanner struct {
	// contains filtered or unexported fields
}

AttestationCollectorAttestationScanner fetches attestations for particular origin-destination pair. TODO: this needs to become an interface.

func NewAttestationCollectorAttestationScanner

func NewAttestationCollectorAttestationScanner(domain domains.DomainClient, originID, destinationID uint32, db db.SynapseDB, signer signer.Signer, interval time.Duration) AttestationCollectorAttestationScanner

NewAttestationCollectorAttestationScanner creates a new attestation collector attestation scanner.

func (AttestationCollectorAttestationScanner) FindNewestGuardAttestationInInitialState added in v0.0.96

func (a AttestationCollectorAttestationScanner) FindNewestGuardAttestationInInitialState(ctx context.Context) (types.InProgressAttestation, error)

FindNewestGuardAttestationInInitialState fetches the newest attestation that was suggested from origin.

func (AttestationCollectorAttestationScanner) Start

Start starts the AttestationCollectorAttestationScanner.

type AttestationGuardCollectorSubmitter added in v0.0.73

type AttestationGuardCollectorSubmitter struct {
	// contains filtered or unexported fields
}

AttestationGuardCollectorSubmitter submits the signed attestation (by both notary and guard) to the Attestation Collector. TODO: this needs to become an interface.

func NewAttestationGuardCollectorSubmitter added in v0.0.73

func NewAttestationGuardCollectorSubmitter(
	originDomain domains.DomainClient,
	attestationDomain domains.DomainClient,
	destinationDomain domains.DomainClient,
	db db.SynapseDB,
	bondedSigner signer.Signer,
	unbondedSigner signer.Signer,
	interval time.Duration) AttestationGuardCollectorSubmitter

NewAttestationGuardCollectorSubmitter creates a new attestation guard collector submitter.

func (AttestationGuardCollectorSubmitter) FindNewestGuardUnsubmittedSignedInProgressAttestation added in v0.0.96

func (a AttestationGuardCollectorSubmitter) FindNewestGuardUnsubmittedSignedInProgressAttestation(ctx context.Context) (types.InProgressAttestation, error)

FindNewestGuardUnsubmittedSignedInProgressAttestation fetches the newest signed attestation (by both notary and guard) that has not yet been submitted to the Attestation Collector.

func (AttestationGuardCollectorSubmitter) Start added in v0.0.73

Start starts the AttestationGuardCollectorSubmitter.

type AttestationGuardCollectorVerifier added in v0.0.74

type AttestationGuardCollectorVerifier struct {
	// contains filtered or unexported fields
}

AttestationGuardCollectorVerifier verifies the signed attestation (by both notary and guard) is posted successfully on the Attestation Collector. TODO: this needs to become an interface.

func NewAttestationGuardCollectorVerifier added in v0.0.74

func NewAttestationGuardCollectorVerifier(
	originDomain domains.DomainClient,
	attestationDomain domains.DomainClient,
	destinationDomain domains.DomainClient,
	db db.SynapseDB,
	bondedSigner signer.Signer,
	unbondedSigner signer.Signer,
	interval time.Duration) AttestationGuardCollectorVerifier

NewAttestationGuardCollectorVerifier creates a new attestation guard collector verifier.

func (AttestationGuardCollectorVerifier) FindNewestGuardSubmittedToCollectorInProgressAttestation added in v0.0.96

func (a AttestationGuardCollectorVerifier) FindNewestGuardSubmittedToCollectorInProgressAttestation(ctx context.Context) (types.InProgressAttestation, error)

FindNewestGuardSubmittedToCollectorInProgressAttestation fetches the newest signed attestation (by both notary and guard) that has been submitted to the Attestation Collector.

func (AttestationGuardCollectorVerifier) Start added in v0.0.74

Start starts the AttestationGuardCollectorVerifier.

type AttestationGuardDestinationSubmitter added in v0.0.75

type AttestationGuardDestinationSubmitter struct {
	// contains filtered or unexported fields
}

AttestationGuardDestinationSubmitter submits the signed attestation (by both notary and guard) to the Destination. TODO: this needs to become an interface.

func NewAttestationGuardDestinationSubmitter added in v0.0.75

func NewAttestationGuardDestinationSubmitter(
	originDomain domains.DomainClient,
	attestationDomain domains.DomainClient,
	destinationDomain domains.DomainClient,
	db db.SynapseDB,
	bondedSigner signer.Signer,
	unbondedSigner signer.Signer,
	interval time.Duration) AttestationGuardDestinationSubmitter

NewAttestationGuardDestinationSubmitter creates a new attestation guard destination submitter.

func (AttestationGuardDestinationSubmitter) FindNewestGuardConfirmedOnCollector added in v0.0.96

func (a AttestationGuardDestinationSubmitter) FindNewestGuardConfirmedOnCollector(ctx context.Context) (types.InProgressAttestation, error)

FindNewestGuardConfirmedOnCollector fetches the newest signed attestation (by both notary and guard) that has been submitted to and confirmed on the Attestation Collector.

func (AttestationGuardDestinationSubmitter) Start added in v0.0.75

Start starts the AttestationGuardDestinationSubmitter.

type AttestationGuardDestinationVerifier added in v0.0.76

type AttestationGuardDestinationVerifier struct {
	// contains filtered or unexported fields
}

AttestationGuardDestinationVerifier verifies the signed attestation (by both notary and guard) is posted successfully on the Destination. TODO: this needs to become an interface.

func NewAttestationGuardDestinationVerifier added in v0.0.76

func NewAttestationGuardDestinationVerifier(
	originDomain domains.DomainClient,
	attestationDomain domains.DomainClient,
	destinationDomain domains.DomainClient,
	db db.SynapseDB,
	bondedSigner signer.Signer,
	unbondedSigner signer.Signer,
	interval time.Duration) AttestationGuardDestinationVerifier

NewAttestationGuardDestinationVerifier creates a new attestation guard destination verifier.

func (AttestationGuardDestinationVerifier) FindNewestSubmittedToDestinationInProgressAttestation added in v0.0.96

func (a AttestationGuardDestinationVerifier) FindNewestSubmittedToDestinationInProgressAttestation(ctx context.Context) (types.InProgressAttestation, error)

FindNewestSubmittedToDestinationInProgressAttestation fetches the newest signed attestation (by both notary and guard) that has been submitted to the Destination.

func (AttestationGuardDestinationVerifier) Start added in v0.0.76

Start starts the AttestationGuardDestinationVerifier.

type AttestationGuardSigner added in v0.0.72

type AttestationGuardSigner struct {
	// contains filtered or unexported fields
}

AttestationGuardSigner signs the attestation after it has been verified on origin. TODO: this needs to become an interface.

func NewAttestationGuardSigner added in v0.0.72

func NewAttestationGuardSigner(
	originDomain domains.DomainClient,
	attestationDomain domains.DomainClient,
	destinationDomain domains.DomainClient,
	db db.SynapseDB,
	bondedSigner signer.Signer,
	unbondedSigner signer.Signer,
	interval time.Duration) AttestationGuardSigner

NewAttestationGuardSigner creates a new attestation guard signer.

func (AttestationGuardSigner) FindNewestGuardUnsignedAndVerifiedAttestation added in v0.0.96

func (a AttestationGuardSigner) FindNewestGuardUnsignedAndVerifiedAttestation(ctx context.Context) (types.InProgressAttestation, error)

FindNewestGuardUnsignedAndVerifiedAttestation fetches the newest attestation that still needs to be signed by the guard but has been verified on origin.

func (AttestationGuardSigner) Start added in v0.0.72

Start starts the AttestationGuardSigner.

type Guard

type Guard struct {
	// contains filtered or unexported fields
}

Guard in the current version scans the attestation collector for notary signed attestations, signs them, and posts to destination chains. TODO: Note right now, I have threads for each origin-destination pair and do no batching at all.

func NewGuard

func NewGuard(ctx context.Context, cfg config.GuardConfig) (_ Guard, err error)

NewGuard creates a new guard.

func (Guard) Start

func (u Guard) Start(ctx context.Context) error

Start starts the guard.

type OriginGuardAttestationScanner added in v0.0.96

type OriginGuardAttestationScanner struct {
	// contains filtered or unexported fields
}

OriginGuardAttestationScanner fetches merkle roots for particular origin-destination pair. TODO: this needs to become an interface.

func NewOriginGuardAttestationScanner added in v0.0.96

func NewOriginGuardAttestationScanner(
	originDomain domains.DomainClient,
	attestationDomain domains.DomainClient,
	destinationDomain domains.DomainClient,
	db db.SynapseDB,
	bondedSigner signer.Signer,
	unbondedSigner signer.Signer,
	interval time.Duration) OriginGuardAttestationScanner

NewOriginGuardAttestationScanner creates a new origin guard attestation scanner.

func (OriginGuardAttestationScanner) FindLatestNonce added in v0.0.96

func (a OriginGuardAttestationScanner) FindLatestNonce(ctx context.Context) (nonce uint32, err error)

FindLatestNonce fetches the latest nonce for a given chain.

func (OriginGuardAttestationScanner) Start added in v0.0.96

Start starts the OriginGuardAttestationScanner.

Directories

Path Synopsis
Package api contains the API for the guard.
Package api contains the API for the guard.
Package cmd provides the command line interface for the guard.
Package cmd provides the command line interface for the guard.
Package main provides the main function for the Guard.
Package main provides the main function for the Guard.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL