Skip to content
Open
Show file tree
Hide file tree
Changes from all 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

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bindings/generated/latest/ccip/core/core.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bindings/generated/latest/ccip/executor/executor.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bindings/generated/latest/ccip/factory/factory.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bindings/generated/latest/ccip/receiver/receiver.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bindings/generated/latest/ccip/sender/sender.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bindings/generated/latest/mcms/api/api.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bindings/generated/latest/mcms/core/core.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions bindings/generated/latest/mcms/mcmstest/mcmstest.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified contracts/dars/current/ccip-burn-mint-token-pool-current.dar
Binary file not shown.
Binary file modified contracts/dars/current/ccip-committee-verifier-current.dar
Binary file not shown.
Binary file modified contracts/dars/current/ccip-core-current.dar
Binary file not shown.
Binary file modified contracts/dars/current/ccip-executor-current.dar
Binary file not shown.
Binary file modified contracts/dars/current/ccip-extension-api-current.dar
Binary file not shown.
Binary file modified contracts/dars/current/ccip-factory-current.dar
Binary file not shown.
Binary file modified contracts/dars/current/ccip-lock-release-token-pool-current.dar
Binary file not shown.
Binary file modified contracts/dars/current/ccip-receiver-current.dar
Binary file not shown.
Binary file modified contracts/dars/current/ccip-runtime-current.dar
Binary file not shown.
Binary file modified contracts/dars/current/ccip-sender-current.dar
Binary file not shown.
Binary file modified contracts/dars/current/ccip-test-current.dar
Binary file not shown.
Binary file modified contracts/dars/current/globalconfig-current.dar
Binary file not shown.
Binary file modified contracts/dars/current/mcms-api-current.dar
Binary file not shown.
Binary file modified contracts/dars/current/mcms-core-current.dar
Binary file not shown.
Binary file modified contracts/dars/current/mcms-test-current.dar
Binary file not shown.
14 changes: 12 additions & 2 deletions contracts/mcms/api/daml/MCMS/Crypto.daml
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,10 @@ hashMetadataLeafNative meta =
-- TIMELOCK HASH FUNCTIONS
-- ===========================================================================

-- opId = keccak256(abi.encode(calls, predecessor, salt))
-- Uses length-prefixed encoding to prevent collision attacks
-- opId = keccak256(calls, predecessor, salt)
-- Every variable-length field is length-prefixed (not raw-concatenated), so the
-- encoding is injective and immune to predecessor/salt boundary-shift collisions.
-- predecessor and salt are additionally enforced to be 32 bytes at the call sites.
hashTimelockOpId : [TimelockCall] -> BytesHex -> BytesHex -> BytesHex
hashTimelockOpId calls predecessor salt =
let
Expand Down Expand Up @@ -226,6 +228,14 @@ assertValidHex fieldName hex =
assertMsg (fieldName <> ": invalid hex (must be even-length, 0-9a-fA-F only): " <> hex)
(isValidHex hex)

-- | Validate that a field is a well-formed 32-byte value (hex-encoded).
-- Used for timelock predecessor and salt
assertValidBytes32 : Text -> BytesHex -> Update ()
assertValidBytes32 fieldName hex = do
assertValidHex fieldName hex
assertMsg ("mcms: " <> fieldName <> " must be 32 bytes, got " <> show (byteCount hex)) $
byteCount hex == 32

-- ===========================================================================
-- MERKLE PROOF VERIFICATION
-- ===========================================================================
Expand Down
10 changes: 7 additions & 3 deletions contracts/mcms/core/daml/MCMS/Main.daml
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,8 @@ template MCMS
controller submitter
do
-- 0. Validate BytesHex inputs
assertValidHex "predecessor" predecessor
assertValidHex "salt" salt
assertValidBytes32 "predecessor" predecessor
assertValidBytes32 "salt" salt
forA_ calls $ \call -> assertValidHex "call.operationData" call.operationData

now <- getTime
Expand Down Expand Up @@ -696,6 +696,8 @@ executeSelfDispatch mcms call =
forA_ params.calls $ \c ->
assertMsg ("mcms: function blocked: " <> c.targetInstanceAddress <> ":" <> c.functionName) $
BlockedFunction c.targetInstanceAddress c.functionName `notElem` mcms.blockedFunctions
assertValidBytes32 "predecessor" params.predecessor
assertValidBytes32 "salt" params.salt
let opId = hashTimelockOpId params.calls params.predecessor params.salt
assertMsg "mcms: operation already scheduled" $
not $ Map.member opId mcms.timelockTimestamps
Expand Down Expand Up @@ -757,7 +759,9 @@ scheduleBatchInternal now mcms rs calls predecessor salt delay = do
assertMsg ("mcms: function blocked: " <> call.targetInstanceAddress <> ":" <> call.functionName) $
BlockedFunction call.targetInstanceAddress call.functionName `notElem` mcms.blockedFunctions

-- 3. Compute opId
-- 3. Validate predecessor and salt are 32-byte values, then compute opId
assertValidBytes32 "predecessor" predecessor
assertValidBytes32 "salt" salt
let opId = hashTimelockOpId calls predecessor salt

-- 4. Check not already scheduled (on-chain duplicate prevention)
Expand Down
16 changes: 8 additions & 8 deletions contracts/mcms/test/daml/MCMS/ExternalTargetTest.daml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ externalScheduleOp = Op
, nonce = 0
, targetInstanceAddress = "mcms-daml-test@ccip_owner-9cefe94d"
, functionName = "ScheduleBatch"
, operationData = "011b636f756e74657240636369705f6f776e65722d396365666539346409496e6372656d656e74000000200000000000000000000000000000000000000000000000000000000000000000000f65787465726e616c2d73616c742d310000000000000000"
, operationData = "011b636f756e74657240636369705f6f776e65722d396365666539346409496e6372656d656e740000002000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000065787465726e616c2d73616c742d310000000000000000"
}

externalScheduleMetadata : RootMetadata
Expand All @@ -121,11 +121,11 @@ externalScheduleMetadata = RootMetadata
}

externalScheduleRoot : Text
externalScheduleRoot = "4f91344c80e695656fef97b4c58382b66ce1b984c3bcf7d94efcb0daafa4772c"
externalScheduleRoot = "a5de111064a236613fc3434e6832f8bc0d0e12a912d412705bc1730cb72b108c"

externalScheduleMetadataProof : [Text]
externalScheduleMetadataProof =
[ "e0a871ad97f2400815079772600b3e09b04d0487822918cf15db61344bc396f4"
[ "5ac687c6c469d00fca89f3a6b2909416ddd500456cff668dd94bca2d621a1ccf"
]

externalScheduleOpProof : [Text]
Expand All @@ -138,18 +138,18 @@ externalScheduleSignatures : [RawSignature]
externalScheduleSignatures =
[ RawSignature
{ publicKey = "04c170cfd2dfedf29d6dc68f57205d5b2a182dfbf0ae5fc4f6d9cb3382e6ab194e5e236469efad820ecceb3c474be2657747ea6d947fd79cb73f1834b45911cc2e"
, r = "12b1795146cdb8c6c2ddd50aff263094a206f589e6667e2f5ea2af34f194d505"
, s = "123ddca05b3ad0a94e1bbd48b9f6b801a18e9b5dd0788480af496d2c63cfc0a0"
, r = "365ad57001ca8a19812e13f58cf6dbdc48856860c6d4e18727e758d703179751"
, s = "24b35648bbb1917913b589a91317e44ebd61287156e815f4fb1de43e5e38358f"
}
, RawSignature
{ publicKey = "04be6d6382ad269cab52671739bb27d4b3ac087c46c7956324810dee6fa311ef8eb1065e376017fe4a8d3d5ee0e86f837f9bb69f22331c1828e5521765f2cdee31"
, r = "c8f3b29c9185437668a2cdca62792c7285caaec86e39f3edb8cd6b9beacdd4b8"
, s = "4d6fdde4f1d737a933dfe760d59a45d644633a4c7dc61ded9d4c1ecc2306e969"
, r = "cf4c3ae13e7d37a905b35519209b24e05cbf4ac8597f7b9f7fd18f6466ba2720"
, s = "227a13c64283758057023e7f3ed30a4518b818b4ebba224ceaf3373e8c9fc692"
}
]

externalScheduleSalt : Text
externalScheduleSalt = "65787465726e616c2d73616c742d31"
externalScheduleSalt = "000000000000000000000000000000000065787465726e616c2d73616c742d31"

-- ===========================================================================
-- BYPASSER EXTERNAL CALL TESTS
Expand Down
Loading
Loading