Skip to content

Aptos: add shared capability payload conversion helpers#1923

Draft
cawthorne wants to merge 2 commits intomainfrom
feature/add-aptos-shared-protos-conversion-helper
Draft

Aptos: add shared capability payload conversion helpers#1923
cawthorne wants to merge 2 commits intomainfrom
feature/add-aptos-shared-protos-conversion-helper

Conversation

@cawthorne
Copy link
Contributor

Summary

  • add shared Aptos capability-to-domain payload conversion helpers in pkg/chains/aptos
  • move the Aptos capability payload/type-tag conversion tests into chainlink-common

Why

  • keeps Aptos proto/domain conversion logic in the same place as the other chain proto helpers
  • unblocks the follow-up cleanup in capabilities without duplicating conversion code

@github-actions
Copy link

github-actions bot commented Mar 24, 2026

⚠️ API Diff Results - github.com/smartcontractkit/chainlink-common

⚠️ Breaking Changes (34)

pkg/capabilities/actions/vault.(*CreateSecretsRequest) (2)
  • GetOrgId — 🗑️ Removed

  • GetWorkflowOwner — 🗑️ Removed

pkg/capabilities/actions/vault.(*DeleteSecretsRequest) (2)
  • GetOrgId — 🗑️ Removed

  • GetWorkflowOwner — 🗑️ Removed

pkg/capabilities/actions/vault.(*GetSecretsRequest) (2)
  • GetOrgId — 🗑️ Removed

  • GetWorkflowOwner — 🗑️ Removed

pkg/capabilities/actions/vault.(*ListSecretIdentifiersRequest) (2)
  • GetOrgId — 🗑️ Removed

  • GetWorkflowOwner — 🗑️ Removed

pkg/capabilities/actions/vault.(*UpdateSecretsRequest) (2)
  • GetOrgId — 🗑️ Removed

  • GetWorkflowOwner — 🗑️ Removed

pkg/capabilities/actions/vault.CreateSecretsRequest (2)
  • OrgId — 🗑️ Removed

  • WorkflowOwner — 🗑️ Removed

pkg/capabilities/actions/vault.DeleteSecretsRequest (2)
  • OrgId — 🗑️ Removed

  • WorkflowOwner — 🗑️ Removed

pkg/capabilities/actions/vault.GetSecretsRequest (2)
  • OrgId — 🗑️ Removed

  • WorkflowOwner — 🗑️ Removed

pkg/capabilities/actions/vault.ListSecretIdentifiersRequest (2)
  • OrgId — 🗑️ Removed

  • WorkflowOwner — 🗑️ Removed

pkg/capabilities/actions/vault.UpdateSecretsRequest (2)
  • OrgId — 🗑️ Removed

  • WorkflowOwner — 🗑️ Removed

pkg/capabilities/v2/chain-capabilities/aptos (5)
  • ReceiverContractExecutionStatus — 🗑️ Removed

  • ReceiverContractExecutionStatus_name — 🗑️ Removed

  • ReceiverContractExecutionStatus_RECEIVER_CONTRACT_EXECUTION_STATUS_REVERTED — 🗑️ Removed

  • ReceiverContractExecutionStatus_RECEIVER_CONTRACT_EXECUTION_STATUS_SUCCESS — 🗑️ Removed

  • ReceiverContractExecutionStatus_value — 🗑️ Removed

pkg/capabilities/v2/chain-capabilities/aptos.(*WriteReportReply) (1)
  • GetReceiverContractExecutionStatus — 🗑️ Removed
pkg/capabilities/v2/chain-capabilities/aptos.WriteReportReply (1)
  • ReceiverContractExecutionStatus — 🗑️ Removed
pkg/services/servicetest (2)
  • Mock — 🗑️ Removed

  • SetupNoOpMock — 🗑️ Removed

pkg/settings/cresettings.Schema (2)
  • VaultJWTAuthEnabled — 🗑️ Removed

  • VaultOrgIdAsSecretOwnerEnabled — 🗑️ Removed

pkg/settings/cresettings.chainWrite (2)
  • Aptos — 🗑️ Removed

  • Solana — 🗑️ Removed

pkg/settings/cresettings.evmChainWrite (1)
  • ReportSizeLimit — 🗑️ Removed

✅ Compatible Changes (2)

pkg/chains/aptos (2)
  • ConvertCapabilityTypeTagFromProto — ➕ Added

  • ConvertCapabilityViewPayloadFromProto — ➕ Added


📄 View full apidiff report

if payload == nil {
return nil, fmt.Errorf("viewRequest.Payload is required")
}
if payload.Module == nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should module name be validated as well?

if payload.Function == "" {
return nil, fmt.Errorf("viewRequest.Payload.Function is required")
}
if len(payload.Module.Address) > typeaptos.AccountAddressLength {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't the validation check exact size?

}
elementType, err := ConvertCapabilityTypeTagFromProto(vector.ElementType)
if err != nil {
return nil, err
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe wrap this error to add additional context

Comment on lines +92 to +97
if len(structTag.Address) > typeaptos.AccountAddressLength {
return nil, fmt.Errorf("struct address too long: %d", len(structTag.Address))
}

var structAddress typeaptos.AccountAddress
copy(structAddress[typeaptos.AccountAddressLength-len(structTag.Address):], structTag.Address)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks a bit confusing and is duplicated, lets just extract this logic similar to evm

func ConvertAddressFromProto(protoAddress []byte) (evmtypes.Address, error) {
	if err := ValidateAddressBytes(protoAddress); err != nil {
		return evmtypes.Address{}, err
	}

	return evmtypes.Address(protoAddress), nil
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants