-
Notifications
You must be signed in to change notification settings - Fork 205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LF: V1 Contract ID check in Preprocessor #10687
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,9 +35,8 @@ final case class EngineConfig( | |
stackTraceMode: Boolean = false, | ||
profileDir: Option[Path] = None, | ||
contractKeyUniqueness: ContractKeyUniquenessMode = ContractKeyUniquenessMode.On, | ||
// TODO: https://github.com/digital-asset/daml/issues/10504 | ||
// switch the default to true | ||
requireSuffixedGlobalCids: Boolean = false, | ||
requireV1ContractId: Boolean = false, | ||
requireSuffixedGlobalContractId: Boolean = false, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. did you drop the todo intentionally? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. After our discussion last week where you told me you are not concern about misusage of the flags (because we have only 3 actively maintain ledgers) I just thought the default behavior does not really matter. |
||
) { | ||
|
||
private[lf] def getCompilerConfig: speedy.Compiler.Config = | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -100,14 +100,14 @@ object Error { | |
override val message: String, | ||
) extends Error | ||
|
||
final case class ValueNesting(value: Value[Value.ContractId]) extends Error { | ||
final case class ValueNesting(culprit: Value[Value.ContractId]) extends Error { | ||
override def message: String = | ||
s"Provided value exceeds maximum nesting level of ${Value.MAXIMUM_NESTING}" | ||
} | ||
|
||
final case class NonSuffixedCid(cid: Value.ContractId.V1) extends Error { | ||
final case class IllegalContractId(cid: Value.ContractId) extends Error { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should we include the reason here and tell users that it failed because of lack of suffix or because they used v0? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I did not feel it was necessary, in the sens that if it's happen it means the user try to feed to the ledger ID that it has cooked himself. If the user want to shoot himself in a foot, I do not see why I shoot tell him which foot is it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fair enough, I tend to lean on the side of including too much information rather than too little in case we need it later but I don’t feel all that strongly about this one. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
override def message: String = | ||
s"Provided Contract ID ${cid.coid} is not suffixed" | ||
s"""Illegal Contract ID "${cid.coid}"""" | ||
} | ||
|
||
final case class RootNode(nodeId: NodeId, override val message: String) extends Error | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe forbidV0 would be more future proof if we ever add v2?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok so in canton, I would rename use use of
requireV1ContractId
toforbidV0ContractId
.And no need to use
requireV1ContractIdSuffix
, right, @remyhaemmerle-da ?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@oliverse-da you should use both:
forbidV0ContractId
to make sure you never get a global v0 cid.requireV1ContractIdSuffix
to make sure that all global v1 cids have a suffix.