guard

package
v0.0.72 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2023 License: MIT Imports: 14 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) FindLatestNonce

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

FindLatestNonce fetches the latest cached nonce for a given chain. TODO (joe): there was a bug in this code not covered by current tests. Make sure to add a test that covers when latestNonce is not zero.

func (AttestationCollectorAttestationScanner) Start

Start starts the AttestationCollectorAttestationScanner.

type AttestationDoubleCheckOnOriginVerifier added in v0.0.70

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

AttestationDoubleCheckOnOriginVerifier double checks attestations on origin. TODO: this needs to become an interface.

func NewAttestationDoubleCheckOnOriginVerifier added in v0.0.70

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

NewAttestationDoubleCheckOnOriginVerifier creates a new attestation double-check-on-origin verifier.

func (AttestationDoubleCheckOnOriginVerifier) FindOldestGuardUnsignedAndUnverifiedAttestation added in v0.0.70

func (a AttestationDoubleCheckOnOriginVerifier) FindOldestGuardUnsignedAndUnverifiedAttestation(ctx context.Context) (types.InProgressAttestation, error)

FindOldestGuardUnsignedAndUnverifiedAttestation fetches the oldest attestation that still needs to be signed by the guard and needs to be verified.

func (AttestationDoubleCheckOnOriginVerifier) Start added in v0.0.70

Start starts the OriginAttestationScanner.

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) FindOldestGuardUnsignedAndVerifiedAttestation added in v0.0.72

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

FindOldestGuardUnsignedAndVerifiedAttestation fetches the oldest 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.

Jump to

Keyboard shortcuts

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