Skip to content

Commit

Permalink
Merge branch 'master' into readme-tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
bethaitman-da committed Apr 4, 2019
2 parents 57e81a7 + c9147ed commit 940e5b2
Show file tree
Hide file tree
Showing 30 changed files with 444 additions and 58 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ them on [StackOverflow using the `daml` tag](https://stackoverflow.com/tags/daml
We warmly welcome [contributions](./CONTRIBUTING.md).

### 1. Clone this repository
`git clone git@github.com:DACH-NY/daml.git`.

`git clone git@github.com:digital-asset/daml.git`.

### 2. Set up the DA Development Environment ("`dev-env`")

Expand Down Expand Up @@ -56,7 +57,7 @@ To just run the tests, run `bazel test //...`
### 4. Contribute!

If you are looking for ideas on how to contribute, please browse our
[issues](https://github.com/DACH-NY/daml/issues).
[issues](https://github.com/digital-asset/daml/issues).

### Caching: build speed and disk space considerations

Expand Down
2 changes: 1 addition & 1 deletion build-scripts/monitoring/open_ports.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
set -u

# options
PORT_RANGES=${PORT_RANGES:-"8000:8100 9000:9100 20000:20100 7600:7601"}
PORT_RANGES=${PORT_RANGES:-"8000:8100 9000:9100 20000:20100 6865:6866"}
SHOULD_FAIL_BUILD=${SHOULD_FAIL_BUILD:-true}
SHOULD_KILL_PROCESSES=${SHOULD_KILL_PROCESSES:-false}

Expand Down
7 changes: 5 additions & 2 deletions ci/build-dev-env.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ def log_cmd(cmd):
# doesn't exist.
def get_secret(workdir, key):
value = os.environ.pop(key, None)
if value is None:
log("%s is empty, skipping uploads" % key)
if value is None or value is ("$(%s)" % key):
log("%s is unset, skipping uploads" % key)
sys.exit()

filepath = os.path.join(workdir, key)
Expand Down Expand Up @@ -94,6 +94,9 @@ def main():

workdir = make_workdir()

# FIXME(zimbatm): figure out secret handling with forks
return

nix_secret_key = get_secret(workdir, "NIX_SECRET_KEY_CONTENT")
google_creds = get_secret(workdir, "GOOGLE_APPLICATION_CREDENTIALS_CONTENT")

Expand Down
3 changes: 2 additions & 1 deletion ci/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ eval "$(dev-env/bin/dade assist)"

step "configuring bazel"

# FIXME(zimbatm): handle secrets on forks
# If GOOGLE_APPLICATION_CREDENTIALS were provided, access the bucket directly and upload
if [[ -e "${GOOGLE_APPLICATION_CREDENTIALS_CONTENT:-}" ]];then
if false; then # [[ -n "${GOOGLE_APPLICATION_CREDENTIALS_CONTENT:-}" ]]; then
GOOGLE_APPLICATION_CREDENTIALS=$(mktemp)
echo "$GOOGLE_APPLICATION_CREDENTIALS_CONTENT" > "$GOOGLE_APPLICATION_CREDENTIALS"
unset GOOGLE_APPLICATION_CREDENTIALS_CONTENT
Expand Down
10 changes: 5 additions & 5 deletions da-assistant/DA/Sdk/Cli/Job.hs
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,8 @@ projectJobs proj = do
P.renderPlain $ NavConf.navigatorConfig (fmap NavConf.partyToUser (projectParties proj))
confFile = projectPath proj </> ".navigator.conf"
mbNewNavPort <- liftIO $ findFreePort 20 7500
mbSandboxPort <- liftIO $ findFreePort 20 7600
sandboxPort <- liftIO $ maybe (throwIO $ NoFreePortFound 7600 20) return (runningSandboxPort <|> mbSandboxPort)
mbSandboxPort <- liftIO $ findFreePort 20 6865
sandboxPort <- liftIO $ maybe (throwIO $ NoFreePortFound 6865 20) return (runningSandboxPort <|> mbSandboxPort)
navPort <- liftIO $ maybe (throwIO $ NoFreePortFound 7500 20) return (runningNavPort <|> mbNewNavPort)
let useNewApiComponents = isSDKVersionEligibleForNewApiUsage proj
navigatorApiUrl = if useNewApiComponents then NewApiUrlAndPort "localhost" sandboxPort else OldApiUrlWithPort ("http://localhost:" <> (T.pack $ show sandboxPort) <> "/v0")
Expand All @@ -272,8 +272,8 @@ projectSandbox = do
Just p -> do
mbPort <- getProjectSandboxPort p
damlEntryFile <- getDAMLEntryFile p
mbNewSandboxPort <- liftIO $ findFreePort 20 7600
sandboxPort <- liftIO $ maybe (throwIO $ NoFreePortFound 7600 20) return (mbPort <|> mbNewSandboxPort)
mbNewSandboxPort <- liftIO $ findFreePort 20 6865
sandboxPort <- liftIO $ maybe (throwIO $ NoFreePortFound 6865 20) return (mbPort <|> mbNewSandboxPort)
let useJavaSandbox = isSDKVersionEligibleForNewApiUsage p
return [JobSandbox $ Sandbox useJavaSandbox (projectProjectName p) (pathToText $ projectPath p)
(pathToText damlEntryFile) (map pathToText $ projectDarDependencies p)
Expand Down Expand Up @@ -311,7 +311,7 @@ runJob job = do
[ Env.Javac Env.requiredMinJdkVersion
]
navigatorJarPath <- findPath "navigator" Command.Types.PPQExecutable
-- java -jar navigator server localhost 8080
-- java -jar navigator server localhost 6865
let args =
[ "java", "-jar", pathToText navigatorJarPath
, "server"
Expand Down
6 changes: 3 additions & 3 deletions docs/source/app-dev/bindings-js/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ The second one introduces a dependency that is going to be later used to generat
let [, , host, port] = process.argv;
host = host || 'localhost';
port = port || 7600;
port = port || 6865;
These lines read the command-line arguments and provide some sensible defaults.

Expand Down Expand Up @@ -196,7 +196,7 @@ Read those from the command line by editing the part where the arguments are rea
let [, , sender, receiver, host, port] = process.argv;
host = host || 'localhost';
port = port || 7600;
port = port || 6865;
if (!sender || !receiver) {
console.log('Missing sender and/or receiver arguments, exiting.');
process.exit(-1);
Expand Down Expand Up @@ -763,7 +763,7 @@ Note that the transaction filter was factored out as it can be shared. The final
let [, , sender, receiver, host, port] = process.argv;
host = host || 'localhost';
port = port || 7600;
port = port || 6865;
if (!sender || !receiver) {
console.log('Missing sender and/or receiver arguments, exiting.');
process.exit(-1);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The following example opens a transaction tree stream for Bob::

grpcurl -import-path . -proto com/digitalasset/ledger/api/v1/transaction_service.proto -plaintext -d '{"ledgerId" : "sandbox-0ed644f5-9451-4bb4-bd4f-f8900cd74df5", "filter": {"filtersByParty":{"Bob":{}}}, "begin": {"boundary":0 } }' localhost:8080 com.digitalasset.ledger.api.v1.TransactionService.GetTransactionTrees
grpcurl -import-path . -proto com/digitalasset/ledger/api/v1/transaction_service.proto -plaintext -d '{"ledgerId" : "sandbox-0ed644f5-9451-4bb4-bd4f-f8900cd74df5", "filter": {"filtersByParty":{"Bob":{}}}, "begin": {"boundary":0 } }' localhost:6865 com.digitalasset.ledger.api.v1.TransactionService.GetTransactionTrees
{
"transactions": [
{
Expand Down
28 changes: 14 additions & 14 deletions docs/source/getting-started/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ In this section, you will run the quickstart application and get introduced to t
.. _quickstart-sandbox:

#. To run the :doc:`sandbox </tools/sandbox>` (a lightweight local version of the ledger), run ``da run sandbox -- --port 7600 --scenario Main:setup target/daml/*``
#. To run the :doc:`sandbox </tools/sandbox>` (a lightweight local version of the ledger), run ``da run sandbox -- --port 6865 --scenario Main:setup target/daml/*``

The output should look like this:

Expand All @@ -140,13 +140,13 @@ In this section, you will run the quickstart application and get introduced to t
_\ \/ _ `/ _ \/ _ / _ \/ _ \\ \ /
/___/\_,_/_//_/\_,_/_.__/\___/_\_\
Initialized sandbox version 3.0.3 with ledger-id = sandbox-bb4a19ee-c0f8-444e-825a-1eb3c1ecd401, port = 7600, dar file = DamlPackageContainer(List(target/daml/qs.dar)), time mode = Static, daml-engine = {}
Initialized sandbox version 3.0.3 with ledger-id = sandbox-bb4a19ee-c0f8-444e-825a-1eb3c1ecd401, port = 6865, dar file = DamlPackageContainer(List(target/daml/qs.dar)), time mode = Static, daml-engine = {}
Initialized Static time provider, starting from 1970-01-01T00:00:00Z
DAML LF Engine supports LF versions: 1.0, 0; Transaction versions: 1; Value versions: 1
Starting plainText server
listening on localhost:7600
listening on localhost:6865
The sandbox is now running, and you can access its :ref:`ledger API <ledger-api-introduction>` on port ``7600``.
The sandbox is now running, and you can access its :ref:`ledger API <ledger-api-introduction>` on port ``6865``.

.. note::

Expand All @@ -155,7 +155,7 @@ In this section, you will run the quickstart application and get introduced to t
.. _quickstart-navigator:

#. Open a new terminal window and navigate to your project directory.
#. Start the :doc:`Navigator </tools/navigator/index>`, a browser-based leger front-end, by running ``da run navigator -- server localhost 7600 --port 7500``
#. Start the :doc:`Navigator </tools/navigator/index>`, a browser-based leger front-end, by running ``da run navigator -- server localhost 6865 --port 7500``

The Navigator automatically connects the sandbox. You can access it on port ``7500``.

Expand Down Expand Up @@ -490,7 +490,7 @@ To build automations and integrations around the ledger, the SDK has :doc:`langu

To start the Java integration in the quickstart application, run ``mvn compile exec:java@run-quickstart``

The application provides REST services on port ``8080`` to perform basic operations on behalf on ``Alice``.
The application provides REST services on port ``6865`` to perform basic operations on behalf on ``Alice``.

.. note::

Expand All @@ -500,24 +500,24 @@ The application provides REST services on port ``8080`` to perform basic operati

The following REST services are included:

- ``GET`` on ``http://localhost:8080/iou`` lists all active Ious, and their Ids.
- ``GET`` on ``http://localhost:6865/iou`` lists all active Ious, and their Ids.

Note that the Ids exposed by the REST API are not the ledger contract Ids, but integers. You can open the address in your browser or run ``curl -X GET http://localhost:8080/iou``.
- ``GET`` on ``http://localhost:8080/iou/ID`` returns the Iou with Id ``ID``.
Note that the Ids exposed by the REST API are not the ledger contract Ids, but integers. You can open the address in your browser or run ``curl -X GET http://localhost:6865/iou``.
- ``GET`` on ``http://localhost:6865/iou/ID`` returns the Iou with Id ``ID``.

For example, to get the content of the Iou with Id 0, run:

``curl -X GET http://localhost:8080/iou/0``
- ``PUT`` on ``http://localhost:8080/iou`` creates a new Iou on the ledger.
``curl -X GET http://localhost:6865/iou/0``
- ``PUT`` on ``http://localhost:6865/iou`` creates a new Iou on the ledger.

To create another *AliceCoin*, run:

``curl -X PUT -d '{"issuer":"Alice","owner":"Alice","currency":"AliceCoin","amount":1.0,"observers":[]}' http://localhost:8080/iou``
- ``POST`` on ``http://localhost:8080/iou/ID/transfer`` transfers the Iou with Id ``ID``.
``curl -X PUT -d '{"issuer":"Alice","owner":"Alice","currency":"AliceCoin","amount":1.0,"observers":[]}' http://localhost:6865/iou``
- ``POST`` on ``http://localhost:6865/iou/ID/transfer`` transfers the Iou with Id ``ID``.

Find out the Id of your new *AliceCoin* using step 1. and then run:

``curl -X POST -d '{ "newOwner":"Bob" }' http://localhost:8080/iou/ID/transfer``
``curl -X POST -d '{ "newOwner":"Bob" }' http://localhost:6865/iou/ID/transfer``

to transfer it to Bob.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<maven.compiler.target>1.8</maven.compiler.target>
<daml-codegen-java.output>${project.build.directory}/generated-sources/iou</daml-codegen-java.output>
<ledgerhost>localhost</ledgerhost>
<ledgerport>7600</ledgerport>
<ledgerport>6865</ledgerport>
<party>Alice</party>
<restport>8080</restport>
</properties>
Expand Down
6 changes: 3 additions & 3 deletions docs/source/tools/extractor.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ This example extracts:

- all contract data from the beginning of the ledger to the current latest transaction
- for the party ``Scrooge_McDuck``
- from a Ledger node or Sandbox running on host ``192.168.1.12`` on port ``7600``
- from a Ledger node or Sandbox running on host ``192.168.1.12`` on port ``6865``
- to PostgreSQL instance running on localhost
- identified by the user ``postgres`` without a password set
- into a database called ``daml_export``

.. code-block:: none
$ da run extractor -- postgresql --user postgres --connecturl jdbc:postgresql:daml_export --party Scrooge_McDuck -h 192.168.1.12 -p 7600 --to head
$ da run extractor -- postgresql --user postgres --connecturl jdbc:postgresql:daml_export --party Scrooge_McDuck -h 192.168.1.12 -p 6865 --to head
This terminates after reaching the transaction which was the latest at the time the Extractor started streaming.

Expand All @@ -66,7 +66,7 @@ For what options to use, see the next sections.
Connecting the Extractor to a ledger
************************************

To connect to the Sandbox, provide separate address and port parameters. For example, ``--host 10.1.1.10 --port 7600``, or in short form ``-h 10.1.1.168 -p 7600``.
To connect to the Sandbox, provide separate address and port parameters. For example, ``--host 10.1.1.10 --port 6865``, or in short form ``-h 10.1.1.168 -p 6865``.

The default host is ``localhost`` and the default port is ``6865``, so you don’t need to pass those.

Expand Down
2 changes: 1 addition & 1 deletion docs/source/tools/navigator/console.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Try out the Navigator Console on the Quickstart

With the sandbox running the :doc:`quickstart application </getting-started/quickstart>`

#. To start the shell, run ``da run navigator -- console localhost 7600``
#. To start the shell, run ``da run navigator -- console localhost 6865``

This connects Navigator Console to the sandbox, which is still running.

Expand Down
6 changes: 3 additions & 3 deletions docs/source/tools/sandbox.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ Sandbox can also be run manually as in this example::
/ __/__ ____ ___/ / / ___ __ __
_\ \/ _ `/ _ \/ _ / _ \/ _ \\ \ /
/___/\_,_/_//_/\_,_/_.__/\___/_\_\
initialized sandbox with ledger-id = sandbox-16ae201c-b2fd-45e0-af04-c61abe13fed7, port = 8080, dar file = DAR files at List(/Users/donkeykong/temp/da-sdk/test/Main.dar), time mode = Static, daml-engine = {}
initialized sandbox with ledger-id = sandbox-16ae201c-b2fd-45e0-af04-c61abe13fed7, port = 6865, dar file = DAR files at List(/Users/donkeykong/temp/da-sdk/test/Main.dar), time mode = Static, daml-engine = {}
Initialized Static time provider, starting from 1970-01-01T00:00:00Z
listening on localhost:8080
listening on localhost:6865

Here, ``da run sandbox --`` tells the SDK Assistant to run ``sandbox`` from the active SDK release and pass it any arguments that follow. The example passes the DAR file to load (``Main.dar``) and the optional ``--scenario`` flag tells Sandbox to run the ``Main:example`` scenario on startup. The scenario must be fully qualified; here ``Main`` is the module and ``example`` is the name of the scenario, separated by a ``:``. The scenario is used for testing and development; it is not run in production.

Expand All @@ -32,7 +32,7 @@ Command-line reference
Sandbox requires the names of the input ``.dar`` or ``.dalf`` files as arguments to start.
The available command line options are listed here::

-p, --port <value> Sandbox service port. Defaults to 8080.
-p, --port <value> Sandbox service port. Defaults to 6865.
-a, --address <value> Sandbox service host. Defaults to binding on all addresses.
--dalf This argument is present for backwards compatibility. DALF and DAR archives are now identified by their extensions.
--static-time Use static time, configured with TimeService through gRPC.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public void close() throws Exception {
}

public static void main(String[] args) throws SSLException {
DamlLedgerClient ledgerClient = DamlLedgerClient.forHostWithLedgerIdDiscovery("localhost", 8080, Optional.empty());
DamlLedgerClient ledgerClient = DamlLedgerClient.forHostWithLedgerIdDiscovery("localhost", 6865, Optional.empty());
ledgerClient.connect();
String ledgerId = ledgerClient.ledgerIdentityClient.getLedgerIdentity().blockingGet();
System.out.println("expectedLedgerId = " + ledgerId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ object EventFilter {
specificSubscriptions
.groupBy(_._1)
.map { // Intentionally not using .mapValues to fully materialize the map
case (templateId, pairs) => {
case (templateId, pairs) =>
val setOfParties: Set[Party] = pairs.map(_._2)(breakOut)
templateId -> (setOfParties union globalSubscriptions)
}
}
.withDefaultValue(globalSubscriptions)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import com.digitalasset.daml.lf.engine.testing.SemanticTester
import com.digitalasset.daml.lf.lfpackage.{Ast, Decode}
import com.digitalasset.grpc.adapter.AkkaExecutionSequencerPool
import com.digitalasset.platform.apitesting.{LedgerContext, PlatformChannels, RemoteServerResource}
import com.digitalasset.platform.sandbox.config.DamlPackageContainer
import com.digitalasset.platform.sandbox.config.{DamlPackageContainer, SandboxConfig}

import scala.concurrent.{Await, ExecutionContext}
import scala.concurrent.duration._
Expand Down Expand Up @@ -84,7 +84,7 @@ object StandaloneSemanticTestRunner {

private val defaultConfig = Config(
host = "localhost",
port = 6865,
port = SandboxConfig.DefaultPort,
packageContainer = DamlPackageContainer(),
performReset = false,
)
Expand All @@ -93,7 +93,7 @@ object StandaloneSemanticTestRunner {
head("Semantic test runner")
opt[Int]('p', "port")
.action((x, c) => c.copy(port = x))
.text("Ledger API server port. Defaults to 6865.")
.text(s"Ledger API server port. Defaults to ${SandboxConfig.DefaultPort}.")

opt[String]('h', "host")
.action((x, c) => c.copy(host = x))
Expand Down
Loading

0 comments on commit 940e5b2

Please sign in to comment.