Documentation
¶
Index ¶
- Variables
- func CheckBalance[S signerP.Signer](ctx context.Context, signer S, rewardS signerP.RewardSigner, threshold float64, ...)
- func CorrectEpochSwitch(prevEpoch, newEpoch *types.EpochInfo) bool
- func FetchEpochAndAttestInfoWithRetry[Signer signerP.Signer](ctx context.Context, signer Signer, logger log.Logger, ...) (types.EpochInfo, types.AttestInfo, error)
- func MockRPCServer(t *testing.T, mock MockRPC) *httptest.Server
- func NewProvider(ctx context.Context, providerURL string, logger log.Logger) (*rpc.Provider, error)
- func ProcessBlockHeaders[Account signerP.Signer](ctx context.Context, headersFeed chan *rpc.BlockHeader, account Account, ...) error
- func RunBlockHeaderWatcher[S signerP.Signer](ctx context.Context, wsProviderURL string, logger log.Logger, signer S, ...) error
- func SepoliaValidationContracts(t *testing.T) *types.ValidationContracts
- func SetTargetBlockHashIfExists[Account signerP.Signer](ctx context.Context, account Account, logger log.Logger, ...)
- func SubscribeToBlockHeaders(ctx context.Context, wsProviderURL string, logger log.Logger) (*rpc.WsProvider, chan *rpc.BlockHeader, *client.ClientSubscription, error)
- type AttestStatus
- type AttestTracker
- type AttestTransaction
- func (t *AttestTransaction) Build(ctx context.Context, signer signerP.Signer, blockHash *types.BlockHash) error
- func (t *AttestTransaction) Invoke(ctx context.Context, signer signerP.Signer) (rpc.AddInvokeTransactionResponse, error)
- func (t *AttestTransaction) UpdateNonce(ctx context.Context, signer signerP.Signer) error
- func (t *AttestTransaction) Valid() bool
- type EnvVariable
- type EventDispatcher
- type Method
- type MockRPC
- type Validator
Constants ¶
This section is empty.
Variables ¶
var ErrTransient = errors.New("transient error")
var ErrTxnHashNotFound = rpc.ErrHashNotFound
var Sleep = time.Sleep
Created a function variable for mocking purposes in tests
var Version string = "dev"
The current version of the validator tool. This is set at build time
Functions ¶
func CheckBalance ¶ added in v0.2.7
func CheckBalance[S signerP.Signer]( ctx context.Context, signer S, rewardS signerP.RewardSigner, threshold float64, logger log.Logger, tracer metrics.Tracer, )
Checks the STRK balance of the signer account and, if [rewardS] is not nil and its address differs from the signer one, of the reward account as well. Each balance is recorded and a warning is given if it is below the threshold
func CorrectEpochSwitch ¶ added in v0.2.0
func FetchEpochAndAttestInfoWithRetry ¶
func FetchEpochAndAttestInfoWithRetry[Signer signerP.Signer]( ctx context.Context, signer Signer, logger log.Logger, prevEpoch *types.EpochInfo, isEpochSwitchCorrect func(prevEpoch *types.EpochInfo, newEpoch *types.EpochInfo) bool, maxRetries types.Retries, newEpochID string, tracer metrics.Tracer, ) (types.EpochInfo, types.AttestInfo, error)
func MockRPCServer ¶ added in v0.2.0
Starts a JSON-RPC server answering with the results configured in `mock`, closed on test cleanup. Any other request gets a JSON-RPC error instead of failing the test, since requests from background goroutines can arrive after it ends.
func NewProvider ¶
func NewProvider( ctx context.Context, providerURL string, logger log.Logger, ) (*rpc.Provider, error)
Returns a new Starknet.Go RPC Provider
func ProcessBlockHeaders ¶
func RunBlockHeaderWatcher ¶ added in v0.1.2
func SepoliaValidationContracts ¶ added in v0.2.0
func SepoliaValidationContracts(t *testing.T) *types.ValidationContracts
func SubscribeToBlockHeaders ¶ added in v0.1.2
func SubscribeToBlockHeaders( ctx context.Context, wsProviderURL string, logger log.Logger, ) ( *rpc.WsProvider, chan *rpc.BlockHeader, *client.ClientSubscription, error, )
Returns a Go channel where BlockHeaders are received
Types ¶
type AttestStatus ¶
type AttestStatus uint8
const ( Iddle AttestStatus = iota Ongoing Successful Failed )
type AttestTracker ¶ added in v0.1.1
type AttestTracker struct {
Transaction AttestTransaction
Hash felt.Felt
Status AttestStatus
// contains filtered or unexported fields
}
func NewAttestTracker ¶ added in v0.1.1
func NewAttestTracker() AttestTracker
func (*AttestTracker) UpdateStatus ¶ added in v0.2.4
type AttestTransaction ¶ added in v0.2.4
type AttestTransaction struct {
// contains filtered or unexported fields
}
func (*AttestTransaction) Invoke ¶ added in v0.2.4
func (t *AttestTransaction) Invoke(ctx context.Context, signer signerP.Signer) ( rpc.AddInvokeTransactionResponse, error, )
func (*AttestTransaction) UpdateNonce ¶ added in v0.2.4
func (*AttestTransaction) Valid ¶ added in v0.2.4
func (t *AttestTransaction) Valid() bool
I want to name this built or smth like that
type EnvVariable ¶ added in v0.2.0
type EventDispatcher ¶
type EventDispatcher[S signerP.Signer] struct { // Event channels DoAttest chan types.DoAttest PrepareAttest chan types.PrepareAttest EndOfWindow chan struct{} // Current epoch attest-related fields CurrentAttest AttestTracker // contains filtered or unexported fields }
func NewEventDispatcher ¶
func NewEventDispatcher[S signerP.Signer]() EventDispatcher[S]
type MockRPC ¶ added in v0.4.0
type MockRPC struct {
// Results by method name. `starknet_specVersion` and `starknet_chainId` (Sepolia)
// are answered by default, since creating an `rpc.Provider` requires them
Results map[string]string
// `starknet_call` results by entry point selector name
CallResults map[string]string
Errors map[string]string
CallErrors map[string]string
// Called on a websocket upgrade request, which is always refused
OnWSUpgrade func()
OnRequest func(method string, params []json.RawMessage)
}
Configures the responses of the server started by `MockRPCServer`. Every result is a raw JSON value.
type Validator ¶ added in v0.2.0
type Validator struct {
// contains filtered or unexported fields
}