Documentation
¶
Index ¶
- Constants
- Variables
- func NewCreateProofSetTransaction(t testing.TB) *types.Transaction
- func NewMockContractClient(ctrl *gomock.Controller) (*mocks2.MockPDP, *mocks2.MockPDPVerifier, *mocks2.MockPDPProvingSchedule)
- func NewSuccessfulReceipt(height int64) *types.Receipt
- func Ptr[T any](v T) *T
- func RandomBytes(t testing.TB, size int) []byte
- func RandomCID(t testing.TB) cid.Cid
- type FakeChainClient
- func (c *FakeChainClient) AdvanceByHeight(epochs int64) abi.ChainEpoch
- func (c *FakeChainClient) AdvanceChain() abi.ChainEpoch
- func (c *FakeChainClient) ChainHead(ctx context.Context) (*types.TipSet, error)
- func (c *FakeChainClient) ChainNotify(ctx context.Context) (<-chan []*api.HeadChange, error)
- func (c *FakeChainClient) CurrentHeight() abi.ChainEpoch
- func (c *FakeChainClient) StateGetRandomnessDigestFromBeacon(ctx context.Context, randEpoch abi.ChainEpoch, tsk types.TipSetKey) (abi.Randomness, error)
- type Harness
- func (h *Harness) CreateProofSet(ctx context.Context, svc *service.PDPService, ...) *models.PDPProofSet
- func (h *Harness) Require_MessageSendsEth_SendSuccess(reason string, signedTx common.Hash)
- func (h *Harness) SendCreateProofSet(proofSetID uint64)
- func (h *Harness) UploadPiece(ctx context.Context, svc *service.PDPService, piece []byte, notify string) *service.PiecePrepareResponse
- func (h *Harness) WaitFor_MessageWaitsEth_TxSuccess(signedTx common.Hash)
- func (h *Harness) WaitFor_PDPProofsetCreate_OK(signedTx common.Hash)
- func (h *Harness) WaitFor_PDPProofsetCreate_ProofsetCreated(signedTx common.Hash)
- type MockContractBackendWrapper
- type MockEthClient
Constants ¶
const SQLiteDBConfig = "pdp.db"
Variables ¶
var ListenerAddress = common.HexToAddress("0x6170dE2b09b404776197485F3dc6c968Ef948506")
this address also doesn't matter
var RecordKeepAddress = common.HexToAddress("0x6170dE2b09b404776197485F3dc6c968Ef948505")
NB: this address is never sent to during testing so it's value is insignificant. picked a valid address anyways, but can be whatever we want.
Functions ¶
func NewCreateProofSetTransaction ¶
func NewCreateProofSetTransaction(t testing.TB) *types.Transaction
func NewMockContractClient ¶
func NewMockContractClient(ctrl *gomock.Controller) (*mocks2.MockPDP, *mocks2.MockPDPVerifier, *mocks2.MockPDPProvingSchedule)
func NewSuccessfulReceipt ¶
Types ¶
type FakeChainClient ¶
type FakeChainClient struct {
// contains filtered or unexported fields
}
func NewFakeChainClient ¶
func NewFakeChainClient(t testing.TB) *FakeChainClient
func (*FakeChainClient) AdvanceByHeight ¶
func (c *FakeChainClient) AdvanceByHeight(epochs int64) abi.ChainEpoch
AdvanceHeight advances the chain by the specified number of epochs
func (*FakeChainClient) AdvanceChain ¶
func (c *FakeChainClient) AdvanceChain() abi.ChainEpoch
func (*FakeChainClient) ChainNotify ¶
func (c *FakeChainClient) ChainNotify(ctx context.Context) (<-chan []*api.HeadChange, error)
func (*FakeChainClient) CurrentHeight ¶
func (c *FakeChainClient) CurrentHeight() abi.ChainEpoch
func (*FakeChainClient) StateGetRandomnessDigestFromBeacon ¶
func (c *FakeChainClient) StateGetRandomnessDigestFromBeacon(ctx context.Context, randEpoch abi.ChainEpoch, tsk types.TipSetKey) (abi.Randomness, error)
type Harness ¶
type Harness struct {
T testing.TB
Chain *FakeChainClient
EthClient *MockEthClient
Contract *mocks.MockPDP
Verifier *mocks.MockPDPVerifier
Schedule *mocks.MockPDPProvingSchedule
DB *gorm.DB
ClientAddr common.Address
// contains filtered or unexported fields
}
func SetupTestDeps ¶
func SetupTestDeps(t testing.TB, ctx context.Context, ctrl *gomock.Controller) (*Harness, *service.PDPService)
func (*Harness) CreateProofSet ¶
func (h *Harness) CreateProofSet(ctx context.Context, svc *service.PDPService, id, challengeWindow, provingPeriod uint64) *models.PDPProofSet
func (*Harness) Require_MessageSendsEth_SendSuccess ¶
Require_MessageSendsEth_SendSuccess asserts a message in MessageSendsEth was sent successfully given a reason and signedTx hash.
func (*Harness) SendCreateProofSet ¶
func (*Harness) UploadPiece ¶
func (h *Harness) UploadPiece(ctx context.Context, svc *service.PDPService, piece []byte, notify string) *service.PiecePrepareResponse
func (*Harness) WaitFor_MessageWaitsEth_TxSuccess ¶
func (*Harness) WaitFor_PDPProofsetCreate_OK ¶
func (*Harness) WaitFor_PDPProofsetCreate_ProofsetCreated ¶
type MockContractBackendWrapper ¶
type MockContractBackendWrapper struct {
*mocks.MockContractBackend
}
MockContractBackendWrapper wraps MockContractBackend but excludes the conflicting method
type MockEthClient ¶
type MockEthClient struct {
*mocks.MockSenderETHClient
*mocks.MockMessageWatcherEthClient
*MockContractBackendWrapper
}
MockEthClient combines all mock interfaces for EthClient
func NewMockEthClient ¶
func NewMockEthClient(ctrl *gomock.Controller) *MockEthClient
NewMockEthClient creates a new mock instance that implements all required interfaces
func (*MockEthClient) SuggestGasTipCap ¶
SuggestGasTipCap delegates to MockSenderETHClient's implementation This overrides the method from MockContractBackend to avoid the conflict