Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions build/devenv/cciptestinterfaces/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,12 @@ type ChainLaneProfile struct {
DefaultInboundCCVs []datastore.AddressRef
DefaultOutboundCCVs []datastore.AddressRef

// TokenReceiverAllowed controls whether the OnRamp on the source chain allows a
// non-empty tokenReceiver in extraArgs for messages destined to this chain.
// Required for SVM destinations where tokenReceiver is always present in SVMExtraArgsV1.
// When nil, the existing on-chain value is preserved (defaults to false on fresh deployments).
TokenReceiverAllowed *bool

GasForVerification uint32
}

Expand Down
38 changes: 38 additions & 0 deletions build/devenv/evm/impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,44 @@
return extraArgs
}

func serializeExtraArgsSVMV1(opts cciptestinterfaces.MessageOptions) []byte {

Check failure on line 869 in build/devenv/evm/impl.go

View workflow job for this annotation

GitHub Actions / lint

func serializeExtraArgsSVMV1 is unused (unused)
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))
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Can we not panic here? I don't see a clear path to adding test, asserting valid/intended errors from upstream caller

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is supposed to be running in devenv test via a call with SendMessage. And that's the pattern with all other serialize functions

}

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: uint32(opts.ExecutionGasLimit), //nolint:gosec

Check failure on line 892 in build/devenv/evm/impl.go

View workflow job for this annotation

GitHub Actions / lint

unnecessary conversion (unconvert)
AccountIsWritableBitmap: 0,
AllowOutOfOrderExecution: opts.OutOfOrderExecution,
TokenReceiver: [32]byte{},
Accounts: [][32]byte{},
Comment thread
huangzhen1997 marked this conversation as resolved.
})
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...)
}
Comment thread
huangzhen1997 marked this conversation as resolved.

func (m *CCIP17EVM) ExposeMetrics(
ctx context.Context,
source, dest uint64,
Expand Down
1 change: 1 addition & 0 deletions build/devenv/implcommon.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ func buildPartialChainConfig(
ExecutorDestChainConfig: local.ExecutorDestChainConfig,
AddressBytesLength: remote.AddressBytesLength,
BaseExecutionGasCost: remote.BaseExecutionGasCost,
TokenReceiverAllowed: remote.TokenReceiverAllowed,
}
}

Expand Down
Loading