local

package
v1.8.2 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2022 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RandomSigningGroup added in v1.5.0

func RandomSigningGroup(size int) []common.Address

RandomSigningGroup randmly chooses `size` signers to be a new signing group

Types

type Chain

type Chain interface {
	chain.Handle
	OperatorAddress() common.Address
	OpenKeep(
		keepAddress common.Address,
		ownerAddress common.Address,
		members []common.Address,
	) chain.BondedECDSAKeepHandle
	CloseKeep(keepAddress common.Address) error
	TerminateKeep(keepAddress common.Address) error
	RequestSignature(keepAddress common.Address, digest [32]byte) error
	AuthorizeOperator(operatorAddress common.Address)
}

Chain is an extention of eth.Handle interface which exposes additional functions useful for testing.

func Connect

func Connect(ctx context.Context) Chain

Connect performs initialization for the local chain, wrapped in the provided context.

type ChainLogger added in v1.8.0

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

ChainLogger writes log messages relevant to the local chain

func (*ChainLogger) IncreaseRedemptionFeeCalls added in v1.8.0

func (cl *ChainLogger) IncreaseRedemptionFeeCalls() int

IncreaseRedemptionFeeCalls returns the number of times we've increased the redemption fees

func (*ChainLogger) KeepAddressCalls added in v1.8.0

func (cl *ChainLogger) KeepAddressCalls() int

KeepAddressCalls returns the number of times we've attempted to retrieve the keep address

func (*ChainLogger) ProvideRedemptionSignatureCalls added in v1.8.0

func (cl *ChainLogger) ProvideRedemptionSignatureCalls() int

ProvideRedemptionSignatureCalls returns the number of times we've tried to provide the redemption signature

func (*ChainLogger) RetrieveSignerPubkeyCalls added in v1.8.0

func (cl *ChainLogger) RetrieveSignerPubkeyCalls() int

RetrieveSignerPubkeyCalls returns the number of times we've tried to retrieve the signer public key

type Signature added in v1.5.0

type Signature struct {
	V uint8
	R [32]uint8
	S [32]uint8
}

Signature represents an ecdsa signature

type TBTCLocalChain added in v1.5.0

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

TBTCLocalChain represents variables and state relative to the TBTC chain

func NewTBTCLocalChain added in v1.5.0

func NewTBTCLocalChain(ctx context.Context) *TBTCLocalChain

NewTBTCLocalChain creates a new TBTCLocalChain

func (TBTCLocalChain) AuthorizeOperator added in v1.5.0

func (lc TBTCLocalChain) AuthorizeOperator(operator common.Address)

func (TBTCLocalChain) BlockCounter added in v1.5.0

func (lc TBTCLocalChain) BlockCounter() corechain.BlockCounter

func (TBTCLocalChain) BlockTimestamp added in v1.5.0

func (lc TBTCLocalChain) BlockTimestamp(blockNumber *big.Int) (uint64, error)

func (TBTCLocalChain) CloseKeep added in v1.5.0

func (lc TBTCLocalChain) CloseKeep(keepAddress common.Address) error

func (*TBTCLocalChain) CreateDeposit added in v1.5.0

func (tlc *TBTCLocalChain) CreateDeposit(
	depositAddress string,
	signers []common.Address,
)

CreateDeposit creates a new deposit by mutating the local TBTC chain

func (*TBTCLocalChain) CurrentState added in v1.5.0

func (tlc *TBTCLocalChain) CurrentState(
	depositAddress string,
) (chain.DepositState, error)

CurrentState returns the state of a particular deposit

func (*TBTCLocalChain) DepositPubkey added in v1.5.0

func (tlc *TBTCLocalChain) DepositPubkey(
	depositAddress string,
) ([]byte, error)

DepositPubkey returns the public key of a particular deposit

func (*TBTCLocalChain) DepositRedemptionFee added in v1.5.0

func (tlc *TBTCLocalChain) DepositRedemptionFee(
	depositAddress string,
) (*big.Int, error)

DepositRedemptionFee returns the redemption fee of a particular deposit

func (*TBTCLocalChain) DepositRedemptionProof added in v1.5.0

func (tlc *TBTCLocalChain) DepositRedemptionProof(
	depositAddress string,
) (*TxProof, error)

DepositRedemptionProof returns the redemption proof of a particular deposit

func (*TBTCLocalChain) DepositRedemptionSignature added in v1.5.0

func (tlc *TBTCLocalChain) DepositRedemptionSignature(
	depositAddress string,
) (*Signature, error)

DepositRedemptionSignature returns the redemption signature of a particular deposit

func (*TBTCLocalChain) FundDeposit added in v1.8.0

func (tlc *TBTCLocalChain) FundDeposit(depositAddress string)

FundDeposit sets funding info for the deposit. It simulates result of providing a funding proof for the deposit.

func (*TBTCLocalChain) FundingInfo added in v1.8.0

func (tlc *TBTCLocalChain) FundingInfo(
	depositAddress string,
) (*chain.FundingInfo, error)

FundingInfo retrieves the funding info for a particular deposit address

func (TBTCLocalChain) GetKeepAtIndex added in v1.5.0

func (lc TBTCLocalChain) GetKeepAtIndex(
	keepIndex *big.Int,
) (chain.BondedECDSAKeepHandle, error)

func (TBTCLocalChain) GetKeepCount added in v1.5.0

func (lc TBTCLocalChain) GetKeepCount() (*big.Int, error)

func (TBTCLocalChain) GetKeepWithID added in v1.8.0

func (lc TBTCLocalChain) GetKeepWithID(
	keepID chain.ID,
) (chain.BondedECDSAKeepHandle, error)

func (*TBTCLocalChain) ID added in v1.8.0

func (tlc *TBTCLocalChain) ID() chain.ID

ID implements the ID method in the chain.TBTCHandle interface.

func (*TBTCLocalChain) IncreaseRedemptionFee added in v1.5.0

func (tlc *TBTCLocalChain) IncreaseRedemptionFee(
	depositAddress string,
	previousOutputValueBytes [8]uint8,
	newOutputValueBytes [8]uint8,
) error

IncreaseRedemptionFee sets the remeption fee to `newOutputValueBytes` and uses `previousOutputValueBytes` for validation.

func (*TBTCLocalChain) IsEligibleForApplication added in v1.5.0

func (tlc *TBTCLocalChain) IsEligibleForApplication() (bool, error)

IsEligibleForApplication implements the IsEligibleForApplication method in the chain.TBTCHandle interface.

func (TBTCLocalChain) IsOperatorAuthorized added in v1.5.0

func (lc TBTCLocalChain) IsOperatorAuthorized(operator chain.ID) (bool, error)

func (*TBTCLocalChain) IsRegisteredForApplication added in v1.5.0

func (tlc *TBTCLocalChain) IsRegisteredForApplication() (bool, error)

IsRegisteredForApplication implements the IsRegisteredForApplication method in the chain.TBTCHandle interface.

func (TBTCLocalChain) IsStatusUpToDateForApplication added in v1.5.0

func (lc TBTCLocalChain) IsStatusUpToDateForApplication() (bool, error)

IsStatusUpToDateForApplication implements the IsStatusUpToDateForApplication method in the chain.TBTCHandle interface.

func (*TBTCLocalChain) Keep added in v1.8.0

func (tlc *TBTCLocalChain) Keep(depositAddress string) (chain.BondedECDSAKeepHandle, error)

Keep returns the keep for a particular deposit

func (*TBTCLocalChain) Logger added in v1.5.0

func (tlc *TBTCLocalChain) Logger() *ChainLogger

Logger surfaces the chain's logger

func (TBTCLocalChain) Name added in v1.8.0

func (lc TBTCLocalChain) Name() string

func (TBTCLocalChain) OnBondedECDSAKeepCreated added in v1.5.0

func (lc TBTCLocalChain) OnBondedECDSAKeepCreated(
	handler func(event *chain.BondedECDSAKeepCreatedEvent),
) subscription.EventSubscription

OnBondedECDSAKeepCreated is a callback that is invoked when an on-chain notification of a new ECDSA keep creation is seen.

func (*TBTCLocalChain) OnDepositCreated added in v1.5.0

func (tlc *TBTCLocalChain) OnDepositCreated(
	handler func(depositAddress string),
) subscription.EventSubscription

OnDepositCreated installs a callback that is invoked when a local-chain notification of a new deposit creation is seen.

func (*TBTCLocalChain) OnDepositGotRedemptionSignature added in v1.5.0

func (tlc *TBTCLocalChain) OnDepositGotRedemptionSignature(
	handler func(depositAddress string),
) subscription.EventSubscription

OnDepositGotRedemptionSignature installs a callback that is invoked when the signers sign off on a redemption

func (*TBTCLocalChain) OnDepositRedeemed added in v1.5.0

func (tlc *TBTCLocalChain) OnDepositRedeemed(
	handler func(depositAddress string),
) subscription.EventSubscription

OnDepositRedeemed installs a callback that is invoked when the redemption process is successful

func (*TBTCLocalChain) OnDepositRedemptionRequested added in v1.5.0

func (tlc *TBTCLocalChain) OnDepositRedemptionRequested(
	handler func(depositAddress string),
) subscription.EventSubscription

OnDepositRedemptionRequested installs a callback that is invoked when a redemption is requested.

func (*TBTCLocalChain) OnDepositRegisteredPubkey added in v1.5.0

func (tlc *TBTCLocalChain) OnDepositRegisteredPubkey(
	handler func(depositAddress string),
) subscription.EventSubscription

OnDepositRegisteredPubkey installs a callback that is invoked when a local-chain notification of a deposit registration is seen.

func (TBTCLocalChain) OpenKeep added in v1.5.0

func (lc TBTCLocalChain) OpenKeep(
	keepAddress common.Address,
	ownerAddress common.Address,
	members []common.Address,
) chain.BondedECDSAKeepHandle

func (TBTCLocalChain) OperatorAddress added in v1.8.0

func (lc TBTCLocalChain) OperatorAddress() common.Address

func (TBTCLocalChain) OperatorID added in v1.8.0

func (lc TBTCLocalChain) OperatorID() chain.ID

func (*TBTCLocalChain) PastDepositRedemptionRequestedEvents added in v1.5.0

func (tlc *TBTCLocalChain) PastDepositRedemptionRequestedEvents(
	startBlock uint64,
	depositAddress string,
) ([]*chain.DepositRedemptionRequestedEvent, error)

PastDepositRedemptionRequestedEvents the redemption requested events relevant to a particular deposit

func (*TBTCLocalChain) ProvideRedemptionProof added in v1.5.0

func (tlc *TBTCLocalChain) ProvideRedemptionProof(
	depositAddress string,
	txVersion [4]uint8,
	txInputVector []uint8,
	txOutputVector []uint8,
	txLocktime [4]uint8,
	merkleProof []uint8,
	txIndexInBlock *big.Int,
	bitcoinHeaders []uint8,
) error

ProvideRedemptionProof sets the redemption proof on a deposit and updates the state to Redeemed

func (*TBTCLocalChain) ProvideRedemptionSignature added in v1.5.0

func (tlc *TBTCLocalChain) ProvideRedemptionSignature(
	depositAddress string,
	v uint8,
	r [32]uint8,
	s [32]uint8,
) error

ProvideRedemptionSignature enriches the deposit with a redemption signature and moves the state to AwaitingWithdrawalProof

func (TBTCLocalChain) PublicKeyToOperatorID added in v1.8.0

func (lc TBTCLocalChain) PublicKeyToOperatorID(publicKey *cecdsa.PublicKey) chain.ID

func (*TBTCLocalChain) RedeemDeposit added in v1.5.0

func (tlc *TBTCLocalChain) RedeemDeposit(depositAddress string) error

RedeemDeposit initiates the redemption process which involves trading the system back the minted TBTC in exhange for the underlying BTC.

func (*TBTCLocalChain) RegisterAsMemberCandidate added in v1.5.0

func (tlc *TBTCLocalChain) RegisterAsMemberCandidate() error

RegisterAsMemberCandidate registers client as a candidate to be selected to a keep.

func (TBTCLocalChain) RequestSignature added in v1.7.0

func (lc TBTCLocalChain) RequestSignature(keepAddress common.Address, digest [32]byte) error

func (*TBTCLocalChain) RetrieveSignerPubkey added in v1.5.0

func (tlc *TBTCLocalChain) RetrieveSignerPubkey(depositAddress string) error

RetrieveSignerPubkey enriches the referenced deposit with the signer public key and moves the state to AwaitingBtcFundingProof

func (*TBTCLocalChain) SetAlwaysFailingTransactions added in v1.5.0

func (tlc *TBTCLocalChain) SetAlwaysFailingTransactions(transactions ...string)

SetAlwaysFailingTransactions adds the supplied transactions to collection of always failing transactions

func (TBTCLocalChain) Signing added in v1.6.0

func (lc TBTCLocalChain) Signing() corechain.Signing

func (TBTCLocalChain) StakeMonitor added in v1.5.0

func (lc TBTCLocalChain) StakeMonitor() (corechain.StakeMonitor, error)

func (TBTCLocalChain) TBTCApplicationHandle added in v1.8.0

func (lc TBTCLocalChain) TBTCApplicationHandle() (chain.TBTCHandle, error)

func (TBTCLocalChain) TerminateKeep added in v1.5.0

func (lc TBTCLocalChain) TerminateKeep(keepAddress common.Address) error

func (TBTCLocalChain) UnmarshalID added in v1.8.0

func (lc TBTCLocalChain) UnmarshalID(idString string) (chain.ID, error)

func (*TBTCLocalChain) UpdateStatusForApplication added in v1.5.0

func (tlc *TBTCLocalChain) UpdateStatusForApplication() error

UpdateStatusForApplication implements the UpdateStatusForApplication method in the chain.TBTCHandle interface.

type TxProof added in v1.5.0

type TxProof struct{}

TxProof represents where a transaction proof has been provided or not (nil if not)

Jump to

Keyboard shortcuts

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