From 52ec77ce579074db00cc2d85a858f88db831f810 Mon Sep 17 00:00:00 2001 From: Sofia Faro Date: Thu, 13 Jan 2022 12:57:26 +0000 Subject: [PATCH] Rename daml sandbox to daml sandbox-kv Also drop the default sandbox on `daml start` Part of #11831 changelog_begin changelog_end --- .../bazel_tools/create-daml-app/index.test.ts | 2 +- .../bazel_tools/daml_script/daml_script.bzl | 2 +- .../bazel_tools/daml_trigger/daml_trigger.bzl | 2 +- compatibility/bazel_tools/testing.bzl | 2 +- .../daml-helper/src/DA/Daml/Helper/Main.hs | 5 +---- .../daml-helper/src/DA/Daml/Helper/Start.hs | 2 +- .../scala/com/digitalasset/daml/sdk/SdkMain.scala | 4 ++-- daml-assistant/daml-sdk/validate.sh | 4 ++-- .../src/DA/Daml/Assistant/IntegrationTests.hs | 6 +++--- release/RELEASE.md | 2 +- release/sdk-config.yaml.tmpl | 13 +++++++------ .../create-daml-app-test-resources/index.test.ts | 1 + 12 files changed, 22 insertions(+), 23 deletions(-) diff --git a/compatibility/bazel_tools/create-daml-app/index.test.ts b/compatibility/bazel_tools/create-daml-app/index.test.ts index 1d7d8dc5c732..0f50dcb02e63 100644 --- a/compatibility/bazel_tools/create-daml-app/index.test.ts +++ b/compatibility/bazel_tools/create-daml-app/index.test.ts @@ -125,7 +125,7 @@ beforeAll(async () => { await removeFile(`../${SANDBOX_PORT_FILE_NAME}`); await removeFile(`../${JSON_API_PORT_FILE_NAME}`); const sandboxOptions = [ - "sandbox", + "sandbox-kv", `--ledgerid=${SANDBOX_LEDGER_ID}`, `--port=0`, `--port-file=${SANDBOX_PORT_FILE_NAME}`, diff --git a/compatibility/bazel_tools/daml_script/daml_script.bzl b/compatibility/bazel_tools/daml_script/daml_script.bzl index ac5312179ab2..4a89ab3fe34e 100644 --- a/compatibility/bazel_tools/daml_script/daml_script.bzl +++ b/compatibility/bazel_tools/daml_script/daml_script.bzl @@ -83,7 +83,7 @@ def daml_script_test(compiler_version, runner_version): runner = "//bazel_tools/client_server:runner", runner_args = ["6865"], server = daml_runner, - server_args = ["sandbox"], + server_args = ["sandbox-kv"], server_files = [ "$(rootpath {})".format(compiled_dar), ], diff --git a/compatibility/bazel_tools/daml_trigger/daml_trigger.bzl b/compatibility/bazel_tools/daml_trigger/daml_trigger.bzl index 8cd8b8700f24..c34a740691d2 100644 --- a/compatibility/bazel_tools/daml_trigger/daml_trigger.bzl +++ b/compatibility/bazel_tools/daml_trigger/daml_trigger.bzl @@ -191,7 +191,7 @@ chmod +x $(OUTS) runner = "//bazel_tools/client_server:runner", runner_args = ["6865"], server = daml_runner, - server_args = ["sandbox"], + server_args = ["sandbox-kv"], server_files = [ "$(rootpath {})".format(compiled_dar), ], diff --git a/compatibility/bazel_tools/testing.bzl b/compatibility/bazel_tools/testing.bzl index 6e4111080cc4..55b8e12ebd48 100644 --- a/compatibility/bazel_tools/testing.bzl +++ b/compatibility/bazel_tools/testing.bzl @@ -906,7 +906,7 @@ def sdk_platform_test(sdk_version, platform_version): # We need to use weak seeding to avoid our tests timing out # if the CI machine does not have enough entropy. - sandbox_args = ["sandbox", "--contract-id-seeding=testing-weak"] + sandbox_args = ["sandbox-kv", "--contract-id-seeding=testing-weak"] sandbox_classic_args = ["sandbox-classic", "--contract-id-seeding=testing-weak"] diff --git a/daml-assistant/daml-helper/src/DA/Daml/Helper/Main.hs b/daml-assistant/daml-helper/src/DA/Daml/Helper/Main.hs index 34b4b9cdaa7b..5b7940e269ee 100644 --- a/daml-assistant/daml-helper/src/DA/Daml/Helper/Main.hs +++ b/daml-assistant/daml-helper/src/DA/Daml/Helper/Main.hs @@ -99,7 +99,7 @@ commandParser = subparser $ fold , command "run-platform-jar" (info runPlatformJarCmd forwardOptions) , command "codegen" (info (codegenCmd <**> helper) forwardOptions) , command "packages" (info (packagesCmd <**> helper) packagesCmdInfo) - , command "canton-sandbox" (info (cantonSandboxCmd <**> helper) cantonSandboxCmdInfo) + , command "sandbox-canton" (info (cantonSandboxCmd <**> helper) cantonSandboxCmdInfo) ] where @@ -180,9 +180,6 @@ commandParser = subparser $ fold <|> flag' SandboxKV (long "sandbox-kv" <> help "Deprecated. Run with Sandbox KV.") <|> flag' SandboxCanton (long "sandbox-canton" <> help "Run with Canton Sandbox. The 2.0 default.") <*> sandboxCantonPortSpecOpt - <|> pure SandboxKV -- pre-2.0 default - -- TODO https://github.com/digital-asset/daml/issues/11831 - -- Change default to --sandbox-canton sandboxCantonPortSpecOpt = do adminApiSpec <- sandboxPortOpt "canton-admin-api-port" "Port number for the canton admin API (--sandbox-canton only)" diff --git a/daml-assistant/daml-helper/src/DA/Daml/Helper/Start.hs b/daml-assistant/daml-helper/src/DA/Daml/Helper/Start.hs index c62c1bd66b98..bce1dfe0c4ba 100644 --- a/daml-assistant/daml-helper/src/DA/Daml/Helper/Start.hs +++ b/daml-assistant/daml-helper/src/DA/Daml/Helper/Start.hs @@ -118,7 +118,7 @@ withSandbox :: StartOptions -> FilePath -> [String] -> [String] -> (Process () ( withSandbox StartOptions{..} darPath scenarioArgs sandboxArgs kont = case sandboxChoice of SandboxClassic -> oldSandbox "sandbox-classic" - SandboxKV -> oldSandbox "sandbox" + SandboxKV -> oldSandbox "sandbox-kv" SandboxCanton cantonPortSpec -> cantonSandbox cantonPortSpec where diff --git a/daml-assistant/daml-sdk/src/main/scala/com/digitalasset/daml/sdk/SdkMain.scala b/daml-assistant/daml-sdk/src/main/scala/com/digitalasset/daml/sdk/SdkMain.scala index 8d62cf5af0c7..09d1604ff102 100644 --- a/daml-assistant/daml-sdk/src/main/scala/com/digitalasset/daml/sdk/SdkMain.scala +++ b/daml-assistant/daml-sdk/src/main/scala/com/digitalasset/daml/sdk/SdkMain.scala @@ -11,7 +11,7 @@ import com.daml.auth.middleware.oauth2.{Main => Oauth2Middleware} import com.daml.http.{Main => JsonApi} import com.daml.navigator.{NavigatorBackend => Navigator} import com.daml.platform.sandbox.{SandboxMain => SandboxClassic} -import com.daml.platform.sandboxnext.{Main => Sandbox} +import com.daml.platform.sandboxnext.{Main => SandboxKV} import com.daml.script.export.{Main => Export} object SdkMain { @@ -28,7 +28,7 @@ object SdkMain { case "trigger-service" => TriggerService.main(rest) case "oauth2-middleware" => Oauth2Middleware.main(rest) case "navigator" => Navigator.main(rest) - case "sandbox" => Sandbox.main(rest) + case "sandbox-kv" => SandboxKV.main(rest) case "sandbox-classic" => SandboxClassic.main(rest) case _ => sys.exit(1) } diff --git a/daml-assistant/daml-sdk/validate.sh b/daml-assistant/daml-sdk/validate.sh index 72f2d7eca42b..18c5e767853d 100755 --- a/daml-assistant/daml-sdk/validate.sh +++ b/daml-assistant/daml-sdk/validate.sh @@ -19,7 +19,7 @@ JAVA=$(rlocation "$TEST_WORKSPACE/$1") SDK_CE=$(rlocation "$TEST_WORKSPACE/$2") SDK_EE=$(rlocation "$TEST_WORKSPACE/$3") -for cmd in sandbox sandbox-classic; do +for cmd in sandbox-kv sandbox-classic; do ret=0 $JAVA -jar $SDK_CE $cmd --help | grep -q profile-dir || ret=$? if [[ $ret -eq 0 ]]; then @@ -28,7 +28,7 @@ for cmd in sandbox sandbox-classic; do fi done -for cmd in sandbox sandbox-classic; do +for cmd in sandbox-kv sandbox-classic; do $JAVA -jar $SDK_EE $cmd --help | grep -q profile-dir done diff --git a/daml-assistant/integration-tests/src/DA/Daml/Assistant/IntegrationTests.hs b/daml-assistant/integration-tests/src/DA/Daml/Assistant/IntegrationTests.hs index 5d55b8a678b3..433378834028 100644 --- a/daml-assistant/integration-tests/src/DA/Daml/Assistant/IntegrationTests.hs +++ b/daml-assistant/integration-tests/src/DA/Daml/Assistant/IntegrationTests.hs @@ -197,7 +197,7 @@ quickSandbox projDir = do (shell $ unwords [ "daml" - , "sandbox" + , "sandbox-kv" , "--" , "--port" , show sandboxPort @@ -817,7 +817,7 @@ codegenTests codegenDir = testGroup "daml codegen" ( assertBool "bindings were written" (not $ null contents) cantonTests :: TestTree -cantonTests = testGroup "daml canton-sandbox" +cantonTests = testGroup "daml sandbox-canton" [ testCaseSteps "Can start Canton sandbox and run script" $ \step -> withTempDir $ \dir -> do step "Creating project" callCommandSilentIn dir $ unwords ["daml new", "skeleton", "--template=skeleton"] @@ -830,7 +830,7 @@ cantonTests = testGroup "daml canton-sandbox" domainAdminApiPort <- getFreePort step "Staring Canton sandbox" let portFile = dir "canton-portfile.json" - withDamlServiceIn (dir "skeleton") "canton-sandbox" + withDamlServiceIn (dir "skeleton") "sandbox-canton" [ "--port", show ledgerApiPort , "--admin-api-port", show adminApiPort , "--domain-public-port", show domainPublicApiPort diff --git a/release/RELEASE.md b/release/RELEASE.md index 4f1b071916ea..6166c5d97ed6 100644 --- a/release/RELEASE.md +++ b/release/RELEASE.md @@ -244,7 +244,7 @@ patches we backport to the 1.0 release branch). 1. In 3 separate terminals (since each command blocks), run: - 1. `daml sandbox --wall-clock-time --port 6865 .daml/dist/quickstart-0.0.1.dar` + 1. `daml sandbox-kv --wall-clock-time --port 6865 .daml/dist/quickstart-0.0.1.dar` 1. `daml script --dar .daml/dist/quickstart-0.0.1.dar --script-name Main:initialize --ledger-host localhost --ledger-port 6865 --wall-clock-time && daml navigator server localhost 6865 --port 7500` 1. `daml codegen java && mvn compile exec:java@run-quickstart` diff --git a/release/sdk-config.yaml.tmpl b/release/sdk-config.yaml.tmpl index 4a22dc40f355..786aefbec254 100644 --- a/release/sdk-config.yaml.tmpl +++ b/release/sdk-config.yaml.tmpl @@ -44,10 +44,14 @@ commands: path: damlc/damlc desc: "Run the Daml compiler" completion: true -- name: sandbox +- name: sandbox-canton path: daml-helper/daml-helper - desc: "Launch Sandbox" - args: ["run-platform-jar", "--logback-config=sandbox-logback.xml", "sandbox"] + desc: "Launch Sandbox Canton." + args: ["sandbox-canton"] +- name: sandbox-kv + path: daml-helper/daml-helper + desc: "Deprecated. Launch Sandbox KV (the default Sandbox implementation for SDK < 2.0.0)" + args: ["run-platform-jar", "--logback-config=sandbox-logback.xml", "sandbox-kv"] - name: sandbox-classic path: daml-helper/daml-helper desc: "Deprecated. Launch Sandbox Classic (the default Sandbox implementation for SDK <= 0.13.55)" @@ -107,6 +111,3 @@ commands: path: damlc/damlc args: ["repl"] desc: "Launch the Daml REPL" -- name: canton-sandbox - path: daml-helper/daml-helper - args: ["canton-sandbox"] diff --git a/templates/create-daml-app-test-resources/index.test.ts b/templates/create-daml-app-test-resources/index.test.ts index e4f317b67440..09bf92e09240 100644 --- a/templates/create-daml-app-test-resources/index.test.ts +++ b/templates/create-daml-app-test-resources/index.test.ts @@ -95,6 +95,7 @@ beforeAll(async () => { // Getting Started Guide. const startArgs = [ 'start', + '--sandbox-kv', `--json-api-option=--port-file=${JSON_API_PORT_FILE_NAME}`, ];