diff --git a/build/devenv/cciptestinterfaces/interface.go b/build/devenv/cciptestinterfaces/interface.go index 691d4548d..c2fcb162d 100644 --- a/build/devenv/cciptestinterfaces/interface.go +++ b/build/devenv/cciptestinterfaces/interface.go @@ -254,6 +254,7 @@ type ChainLaneProfile struct { DefaultExecutorQualifier string DefaultInboundCCVs []datastore.AddressRef DefaultOutboundCCVs []datastore.AddressRef + TokenReceiverAllowed *bool GasForVerification *uint32 AllowedFinalityConfig *finality.Config } diff --git a/build/devenv/evm/impl.go b/build/devenv/evm/impl.go index 87012be17..dbdc5b302 100644 --- a/build/devenv/evm/impl.go +++ b/build/devenv/evm/impl.go @@ -123,6 +123,7 @@ func init() { // provides backward compatibility with the previous FamilyEVM/FamilyCanton // combined switch case. cciptestinterfaces.RegisterExtraArgsSerializer(chainsel.FamilyCanton, SerializeEVMExtraArgs) + cciptestinterfaces.RegisterExtraArgsSerializer(chainsel.FamilySolana, SerializeSVMExtraArgs) } type CCIP17EVMConfig struct { @@ -691,6 +692,16 @@ func SerializeEVMExtraArgs(opts cciptestinterfaces.MessageOptions) []byte { } } +// SerializeSVMExtraArgs is the Solana family's ExtraArgsSerializer, handling versions 1. +func SerializeSVMExtraArgs(opts cciptestinterfaces.MessageOptions) []byte { + switch opts.Version { + case 1: + return serializeExtraArgsSVMV1(opts) + default: + panic(fmt.Sprintf("unsupported EVM message extra args version: %d", opts.Version)) + } +} + func serializeExtraArgsV1(opts cciptestinterfaces.MessageOptions) []byte { evmExtraArgsV1Type, err := abi.NewType("tuple", "EVMExtraArgsV1", []abi.ArgumentMarshaling{ {Name: "gasLimit", Type: "uint256"}, @@ -767,6 +778,44 @@ func serializeExtraArgsV3(opts cciptestinterfaces.MessageOptions) []byte { return extraArgs } +func serializeExtraArgsSVMV1(opts cciptestinterfaces.MessageOptions) []byte { + svmExtraArgsV1Type, err := abi.NewType("tuple", "SVMExtraArgsV1", []abi.ArgumentMarshaling{ + {Name: "computeUnits", Type: "uint32"}, + {Name: "accountIsWritableBitmap", Type: "uint64"}, + {Name: "allowOutOfOrderExecution", Type: "bool"}, + {Name: "tokenReceiver", Type: "bytes32"}, + {Name: "accounts", Type: "bytes32[]"}, + }) + if err != nil { + panic(fmt.Sprintf("failed to create SVMExtraArgsV1 tuple type: %v", err)) + } + + arguments := abi.Arguments{{Type: svmExtraArgsV1Type, Name: "extraArgs"}} + + type SVMExtraArgsV1 struct { + ComputeUnits uint32 + AccountIsWritableBitmap uint64 + AllowOutOfOrderExecution bool + TokenReceiver [32]byte + Accounts [][32]byte + } + + packed, err := arguments.Pack(SVMExtraArgsV1{ + ComputeUnits: opts.ExecutionGasLimit, + AccountIsWritableBitmap: 0, + AllowOutOfOrderExecution: opts.OutOfOrderExecution, + TokenReceiver: [32]byte{}, + Accounts: [][32]byte{}, + }) + if err != nil { + panic(fmt.Sprintf("failed to pack SVMExtraArgsV1: %v", err)) + } + + // bytes4 public constant SVM_EXTRA_ARGS_V1_TAG = 0x1f3b3aba; + tag, _ := hexutil.Decode("0x1f3b3aba") + return append(tag, packed...) +} + func (m *CCIP17EVM) ExposeMetrics( ctx context.Context, source, dest uint64, diff --git a/build/devenv/implcommon.go b/build/devenv/implcommon.go index c84e6f616..aa8db87ba 100644 --- a/build/devenv/implcommon.go +++ b/build/devenv/implcommon.go @@ -259,6 +259,7 @@ func buildPartialChainConfig( FeeQuoterDestChainConfig: remote.FeeQuoterDestChainConfig, ExecutorDestChainConfig: local.ExecutorDestChainConfig, BaseExecutionGasCost: remote.BaseExecutionGasCost, + TokenReceiverAllowed: remote.TokenReceiverAllowed, } } diff --git a/build/devenv/services/chainconfig/evm.go b/build/devenv/services/chainconfig/evm.go index e9bfc458c..e8e47e77a 100644 --- a/build/devenv/services/chainconfig/evm.go +++ b/build/devenv/services/chainconfig/evm.go @@ -14,6 +14,9 @@ import ( func EVMChainConfigLoader(outputs []*ctfblockchain.Output) (map[string]any, error) { infos := make(map[string]any) for _, output := range outputs { + if output.Family != chainsel.FamilyEVM { + continue + } info := &evm.Info{ ChainID: output.ChainID, Type: output.Type,