Skip to content

Commit

Permalink
chore: TODOs for reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
izyak committed Jul 20, 2023
1 parent d63f79b commit 6a9bd02
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
10 changes: 7 additions & 3 deletions relayer/chains/archway/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ func (pp *ArchwayProviderConfig) Validate() error {
return fmt.Errorf("invalid Timeout: %w", err)
}

// TODO: Valid address for that chain
// Check: COSMOS
if pp.IbcHandlerAddress == "" {
return fmt.Errorf("Ibc handler contract cannot be empty")
}
Expand Down Expand Up @@ -351,7 +353,9 @@ func (ap *ArchwayProvider) Address() (string, error) {
return out, err
}

// TODO: CHECK AGAIN
func (cc *ArchwayProvider) TrustingPeriod(ctx context.Context) (time.Duration, error) {
panic("Archway: Not Implemented")

Check warning on line 358 in relayer/chains/archway/provider.go

View check run for this annotation

Codecov / codecov/patch

relayer/chains/archway/provider.go#L358

Added line #L358 was not covered by tests
// res, err := cc.QueryStakingParams(ctx)

// TODO: check and rewrite
Expand Down Expand Up @@ -403,6 +407,7 @@ func (cc *ArchwayProvider) QueryStatus(ctx context.Context) (*ctypes.ResultStatu

// WaitForNBlocks blocks until the next block on a given chain
func (cc *ArchwayProvider) WaitForNBlocks(ctx context.Context, n int64) error {
panic("Archway: Not implemented")

Check warning on line 410 in relayer/chains/archway/provider.go

View check run for this annotation

Codecov / codecov/patch

relayer/chains/archway/provider.go#L410

Added line #L410 was not covered by tests
// var initial int64
// h, err := cc.RPCClient.Status(ctx)
// if err != nil {
Expand All @@ -427,7 +432,6 @@ func (cc *ArchwayProvider) WaitForNBlocks(ctx context.Context, n int64) error {
// return ctx.Err()
// }
// }
return nil
}

func (ac *ArchwayProvider) BlockTime(ctx context.Context, height int64) (time.Time, error) {
Expand All @@ -452,8 +456,8 @@ func (ap *ArchwayProvider) updateNextAccountSequence(seq uint64) {
}
}

func (app *ArchwayProvider) MsgRegisterCounterpartyPayee(portID, channelID, relayerAddr, counterpartyPayeeAddr string) (provider.RelayerMessage, error) {
return nil, fmt.Errorf("Not implemented for Icon")
func (ap *ArchwayProvider) MsgRegisterCounterpartyPayee(portID, channelID, relayerAddr, counterpartyPayeeAddr string) (provider.RelayerMessage, error) {
return nil, fmt.Errorf("Not implemented for Archway")

Check warning on line 460 in relayer/chains/archway/provider.go

View check run for this annotation

Codecov / codecov/patch

relayer/chains/archway/provider.go#L459-L460

Added lines #L459 - L460 were not covered by tests
}

func (cc *ArchwayProvider) FirstRetryBlockAfter() uint64 {
Expand Down
8 changes: 8 additions & 0 deletions relayer/chains/archway/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ func (ap *ArchwayProvider) QueryTxs(ctx context.Context, page, limit int, events

// parseEventsFromResponseDeliverTx parses the events from a ResponseDeliverTx and builds a slice
// of provider.RelayerEvent's.
// TODO: Comet check needed?
func parseEventsFromResponseDeliverTx(resp abci.ResponseDeliverTx) []provider.RelayerEvent {
var events []provider.RelayerEvent

Expand Down Expand Up @@ -190,6 +191,7 @@ func DefaultPageRequest() *querytypes.PageRequest {

// staking
func (ap *ArchwayProvider) QueryUnbondingPeriod(context.Context) (time.Duration, error) {
// move to provider, panic
return 0, nil
}

Expand All @@ -207,6 +209,7 @@ func (ap *ArchwayProvider) QueryClientState(ctx context.Context, height int64, c
return clientStateExported, nil
}

// TODO: Check revision number

Check warning on line 212 in relayer/chains/archway/query.go

View check run for this annotation

Codecov / codecov/patch

relayer/chains/archway/query.go#L212

Added line #L212 was not covered by tests
func (ap *ArchwayProvider) QueryClientStateResponse(ctx context.Context, height int64, srcClientId string) (*clienttypes.QueryClientStateResponse, error) {

clS, err := ap.QueryClientStateContract(ctx, srcClientId)
Expand Down Expand Up @@ -330,6 +333,7 @@ func (ap *ArchwayProvider) QueryIBCHandlerContractProcessed(ctx context.Context,
return ProcessContractResponse(res)
}

// TODO: Panic for unused functions

Check warning on line 336 in relayer/chains/archway/query.go

View check run for this annotation

Codecov / codecov/patch

relayer/chains/archway/query.go#L336

Added line #L336 was not covered by tests
func (ap *ArchwayProvider) QueryUpgradedClient(ctx context.Context, height int64) (*clienttypes.QueryClientStateResponse, error) {
return nil, fmt.Errorf("Not implemented for Archway")
}
Expand Down Expand Up @@ -534,6 +538,7 @@ func (ap *ArchwayProvider) QueryConnections(ctx context.Context) (conns []*connt
}

// Only return open conenctions
// TODO: Use ENUM

Check warning on line 541 in relayer/chains/archway/query.go

View check run for this annotation

Codecov / codecov/patch

relayer/chains/archway/query.go#L541

Added line #L541 was not covered by tests
if conn.State == 3 {
identifiedConn := conntypes.IdentifiedConnection{
Id: connectionId,
Expand Down Expand Up @@ -653,6 +658,7 @@ func (ap *ArchwayProvider) QueryChannels(ctx context.Context) ([]*chantypes.Iden
}

// check if the channel is open
// TODO: Use enum

Check warning on line 661 in relayer/chains/archway/query.go

View check run for this annotation

Codecov / codecov/patch

relayer/chains/archway/query.go#L661

Added line #L661 was not covered by tests
if channel.State == 3 {
identifiedChannel := chantypes.IdentifiedChannel{
State: channel.State,
Expand All @@ -670,6 +676,8 @@ func (ap *ArchwayProvider) QueryChannels(ctx context.Context) ([]*chantypes.Iden

return channels, nil
}

// TODO: panic or implement

Check warning on line 680 in relayer/chains/archway/query.go

View check run for this annotation

Codecov / codecov/patch

relayer/chains/archway/query.go#L679-L680

Added lines #L679 - L680 were not covered by tests
func (ap *ArchwayProvider) QueryPacketCommitments(ctx context.Context, height uint64, channelid, portid string) (commitments *chantypes.QueryPacketCommitmentsResponse, err error) {
return nil, fmt.Errorf("Not implemented for Archway")
}
Expand Down
5 changes: 5 additions & 0 deletions relayer/chains/archway/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ func (ap *ArchwayProvider) PrepareFactory(txf tx.Factory) (tx.Factory, error) {
}
}

// CHECK : RESON FOR TXN COST 1
if ap.PCfg.MinGasAmount != 0 {
txf = txf.WithGas(ap.PCfg.MinGasAmount)
}
Expand Down Expand Up @@ -164,6 +165,7 @@ func (ap *ArchwayProvider) NewClientState(dstChainID string, dstIBCHeader provid
}, nil
}

// TODO: DELETE
func (ap *ArchwayProvider) NewClientStateMock(dstChainID string, dstIBCHeader provider.IBCHeader, dstTrustingPeriod, dstUbdPeriod time.Duration, allowUpdateAfterExpiry, allowUpdateAfterMisbehaviour bool) (ibcexported.ClientState, error) {

btpHeader := dstIBCHeader.(*iconchain.IconIBCHeader)
Expand Down Expand Up @@ -241,6 +243,7 @@ func (ap *ArchwayProvider) ValidatePacket(msgTransfer provider.PacketInfo, lates
return nil
}

// TODO MOVE TO QUERY
func (ap *ArchwayProvider) PacketCommitment(ctx context.Context, msgTransfer provider.PacketInfo, height uint64) (provider.PacketProof, error) {
packetCommitmentResponse, err := ap.QueryPacketCommitment(
ctx, int64(height), msgTransfer.SourceChannel, msgTransfer.SourcePort, msgTransfer.Sequence,
Expand Down Expand Up @@ -348,6 +351,7 @@ func (ap *ArchwayProvider) MsgTimeoutRequest(msgTransfer provider.PacketInfo, pr
return nil, fmt.Errorf("MsgTimeoutRequest Not implemented for Archway module")
}

// panic
func (ap *ArchwayProvider) MsgTimeoutOnClose(msgTransfer provider.PacketInfo, proofUnreceived provider.PacketProof) (provider.RelayerMessage, error) {
return nil, nil
}
Expand Down Expand Up @@ -1033,6 +1037,7 @@ func (ap *ArchwayProvider) BroadcastTx(
// BroadcastTx attempts to generate, sign and broadcast a transaction with the
// given set of messages. It will also simulate gas requirements if necessary.
// It will return an error upon failure.
// UNUSED: PANIC
func (ap *ArchwayProvider) broadcastTx(
ctx context.Context, // context for tx broadcast
tx []byte, // raw tx to be broadcasted
Expand Down

0 comments on commit 6a9bd02

Please sign in to comment.