mirror of
https://github.com/digital-asset/daml.git
synced 2024-09-20 01:07:18 +03:00
CHANGELOG_BEGIN CHANGELOG_END
This commit is contained in:
parent
31d5fb7304
commit
3351dd8963
@ -1370,7 +1370,7 @@ class EngineTest extends WordSpec with Matchers with EitherValues with BazelRunf
|
||||
val fetchedCid = toContractId("#1")
|
||||
val now = Time.Timestamp.now()
|
||||
val submissionSeed = crypto.Hash.hashPrivateKey(
|
||||
"fetching contracts that have keys correctly fills in the transaction structur")
|
||||
"fetching contracts that have keys correctly fills in the transaction structure")
|
||||
val txSeed = crypto.Hash.deriveTransactionSeed(submissionSeed, participant, now)
|
||||
|
||||
"fetched via a fetch" in {
|
||||
|
@ -154,7 +154,7 @@ object ValueGenerators {
|
||||
Gen
|
||||
.containerOfN[Array, Byte](crypto.Hash.underlyingHashLength, arbitrary[Byte]) map crypto.Hash.assertFromByteArray
|
||||
private val genSuffixes: Gen[Bytes] = for {
|
||||
sz <- Gen.chooseNum(0, ContractId.V1.maxSuffixLength)
|
||||
sz <- Gen.chooseNum(0, ContractId.V1.MaxSuffixLength)
|
||||
ab <- Gen.containerOfN[Array, Byte](sz, arbitrary[Byte])
|
||||
} yield Bytes fromByteArray ab
|
||||
|
||||
|
@ -364,15 +364,18 @@ object Value extends CidContainer1[Value] {
|
||||
}
|
||||
|
||||
object V1 {
|
||||
val maxSuffixLength = 94
|
||||
// For more details, please refer to V1 Contract ID allocation scheme
|
||||
// daml-lf/spec/contract-id.rst
|
||||
|
||||
private[lf] val MaxSuffixLength = 94
|
||||
|
||||
def apply(discriminator: Hash): V1 = new V1(discriminator, Bytes.Empty)
|
||||
|
||||
def build(discriminator: crypto.Hash, suffix: Bytes): Either[String, V1] =
|
||||
Either.cond(
|
||||
suffix.length <= maxSuffixLength,
|
||||
suffix.length <= MaxSuffixLength,
|
||||
new V1(discriminator, suffix),
|
||||
s"the suffix is too long, expected at most ${maxSuffixLength} bytes, but got ${suffix.length}"
|
||||
s"the suffix is too long, expected at most $MaxSuffixLength bytes, but got ${suffix.length}"
|
||||
)
|
||||
|
||||
def assertBuild(discriminator: crypto.Hash, suffix: Bytes): V1 =
|
||||
|
Loading…
Reference in New Issue
Block a user