diff --git a/daml-assistant/daml-helper/src/DA/Daml/Helper/Util.hs b/daml-assistant/daml-helper/src/DA/Daml/Helper/Util.hs index 42eb58c4e5c6..81e156542854 100644 --- a/daml-assistant/daml-helper/src/DA/Daml/Helper/Util.hs +++ b/daml-assistant/daml-helper/src/DA/Daml/Helper/Util.hs @@ -312,15 +312,10 @@ cantonConfig CantonOptions{..} = ] , "domains" Aeson..= Aeson.object [ "local" Aeson..= Aeson.object - ( [ storage , "public-api" Aeson..= port cantonDomainPublicApi , "admin-api" Aeson..= port cantonDomainAdminApi - ] <> - [ "domain-parameters" Aeson..= Aeson.object [ "topology-change-delay" Aeson..= ("0 ms" :: T.Text) ] - | StaticTime True <- [cantonStaticTime] ] - ) ] ] ] 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 82ba76917948..04240152da21 100644 --- a/daml-assistant/integration-tests/src/DA/Daml/Assistant/IntegrationTests.hs +++ b/daml-assistant/integration-tests/src/DA/Daml/Assistant/IntegrationTests.hs @@ -594,7 +594,7 @@ damlStartNotSharedTest = testCase "daml start --sandbox-port=0" $ queryResponse <- httpLbs queryRequest manager let body = responseBody queryResponse assertBool ("result is unexpected: " <> show body) $ - ("{\"result\":{\"displayName\":\"Alice\",\"identifier\":\"Alice::" `LBS.isPrefixOf` body) && + ("{\"result\":{\"identifier\":\"Alice::" `LBS.isPrefixOf` body) && ("\",\"isLocal\":true},\"status\":200}" `LBS.isSuffixOf` body) quickstartTests :: FilePath -> FilePath -> IO QuickSandboxResource -> TestTree diff --git a/deps.bzl b/deps.bzl index 13c482fa164c..ae0e512e102a 100644 --- a/deps.bzl +++ b/deps.bzl @@ -356,7 +356,7 @@ java_import( jars = glob(["lib/**/*.jar"]), ) """, - sha256 = "529bcb185b0fec8e74652a7589b37c22f5700d765edd2467375655eb3e656c29", + sha256 = "e72c2ecd613a868ec3eb5654258527cbaed17b15b8c260a0a3de49841355af12", strip_prefix = "canton-community-1.0.0-SNAPSHOT", - urls = ["https://www.canton.io/releases/canton-community-20220202.tar.gz"], + urls = ["https://www.canton.io/releases/canton-community-20220209.tar.gz"], ) diff --git a/ledger/ledger-api-test-tool-on-canton/bootstrap.canton b/ledger/ledger-api-test-tool-on-canton/bootstrap.canton index a9d1e530950d..bd3f060c1aae 100644 --- a/ledger/ledger-api-test-tool-on-canton/bootstrap.canton +++ b/ledger/ledger-api-test-tool-on-canton/bootstrap.canton @@ -1,5 +1,13 @@ +import com.digitalasset.canton.time.NonNegativeFiniteDuration + nodes.local start +test_domain.service.update_dynamic_parameters(_.copy( + ledgerTimeRecordTimeTolerance = NonNegativeFiniteDuration.ofMinutes(3), + mediatorReactionTimeout = NonNegativeFiniteDuration.ofMinutes(1), + participantResponseTimeout = NonNegativeFiniteDuration.ofMinutes(1), +)) + participants.local foreach (_.domains.connect_local(test_domain)) utils.retry_until_true { diff --git a/ledger/ledger-api-test-tool-on-canton/canton.conf b/ledger/ledger-api-test-tool-on-canton/canton.conf index 299e396cefb9..d8c65c7bd8bc 100644 --- a/ledger/ledger-api-test-tool-on-canton/canton.conf +++ b/ledger/ledger-api-test-tool-on-canton/canton.conf @@ -15,9 +15,6 @@ canton { admin-api.port = 4012 domain-parameters { - participant-response-timeout = 1m - ledger-time-record-time-tolerance = 3m - mediator-reaction-timeout = 1m max-rate-per-participant = 10000 } } diff --git a/templates/create-daml-app-test-resources/index.test.ts b/templates/create-daml-app-test-resources/index.test.ts index c088b9558811..0bcfb496d0a6 100644 --- a/templates/create-daml-app-test-resources/index.test.ts +++ b/templates/create-daml-app-test-resources/index.test.ts @@ -8,7 +8,7 @@ import { promises as fs } from 'fs'; import puppeteer, { Browser, Page } from 'puppeteer'; import waitOn from 'wait-on'; -import Ledger from '@daml/ledger'; +import Ledger, { UserRightHelper } from '@daml/ledger'; import { User } from '@daml.js/create-daml-app'; import { authConfig } from './config'; @@ -25,46 +25,31 @@ let uiProc: ChildProcess | undefined = undefined; // Chrome browser that we run in headless mode let browser: Browser | undefined = undefined; -let publicUser: string = ''; -let publicParty: string = ''; +let publicUser: string | undefined; +let publicParty: string | undefined; + +const adminLedger = new Ledger({token: authConfig.makeToken("participant_admin")}); // Function to generate unique party names for us. let nextPartyId = 1; const getParty = async () : [string, string] => { - // TODO For now we use grpcurl to allocate parties and users. - // Once the JSON API exposes party & user management we can switch to that. - const grpcurlPartyArgs = [ - "-plaintext", - "localhost:6865", - "com.daml.ledger.api.v1.admin.PartyManagementService/AllocateParty", - ]; - const allocResult = spawnSync('grpcurl', grpcurlPartyArgs, {"encoding": "utf8"}); - const parsedResult = JSON.parse(allocResult.stdout); + const allocResult = await adminLedger.allocateParty({}); const user = `u${nextPartyId}`; - const party = parsedResult.partyDetails.party; - const createUser = { - "user": { - "id": user, - "primary_party": party, - }, - "rights": [{"can_act_as": {"party": party}}, {"can_read_as": {"party": publicParty}}] - }; - const grpcurlUserArgs = [ - "-plaintext", - "-d", - JSON.stringify(createUser), - "localhost:6865", - "com.daml.ledger.api.v1.admin.UserManagementService/CreateUser", - ]; - const result = spawnSync('grpcurl', grpcurlUserArgs, {"encoding": "utf8"}); + const party = allocResult.identifier; + const rights: UserRight[] = [UserRightHelper.canActAs(party)].concat(publicParty !== undefined ? [UserRightHelper.canReadAs(publicParty)] : []); + await adminLedger.createUser(user, rights, party); nextPartyId++; return [user, party]; }; test('Party names are unique', async () => { - const parties = new Set(await Promise.all(Array(10).fill({}).map(() => getParty()))); + let r = []; + for (let i = 0; i < 10; ++i) { + r = r.concat((await getParty())[1]); + } + const parties = new Set(r); expect(parties.size).toEqual(10); -}); +}, 20_000); const removeFile = async (path: string) => { try { @@ -232,10 +217,7 @@ const follow = async (page: Page, userToFollow: string) => { } // LOGIN_TEST_BEGIN -// FIXME Enable this test once the integration test can be run against a version of Canton that supports the new interface for creating a user -// FIXME The change was introduced as part of https://github.com/digital-asset/daml/pull/12682 -// FIXME The ticket tracking this issue is https://github.com/digital-asset/daml/issues/12808 -test.skip('log in as a new user, log out and log back in', async () => { +test('log in as a new user, log out and log back in', async () => { const [user, party] = await getParty(); // Log in as a new user. @@ -269,10 +251,7 @@ test.skip('log in as a new user, log out and log back in', async () => { // - while the user that is followed is logged out // These are all successful cases. -// FIXME Enable this test once the integration test can be run against a version of Canton that supports the new interface for creating a user -// FIXME The change was introduced as part of https://github.com/digital-asset/daml/pull/12682 -// FIXME The ticket tracking this issue is https://github.com/digital-asset/daml/issues/12808 -test.skip('log in as three different users and start following each other', async () => { +test('log in as three different users and start following each other', async () => { const [user1, party1] = await getParty(); const [user2, party2] = await getParty(); const [user3, party3] = await getParty(); @@ -360,10 +339,7 @@ test.skip('log in as three different users and start following each other', asyn await page3.close(); }, 60_000); -// FIXME Enable this test once the integration test can be run against a version of Canton that supports the new interface for creating a user -// FIXME The change was introduced as part of https://github.com/digital-asset/daml/pull/12682 -// FIXME The ticket tracking this issue is https://github.com/digital-asset/daml/issues/12808 -test.skip('error when following self', async () => { +test('error when following self', async () => { const [user, party] = await getParty(); const page = await newUiPage(); @@ -378,10 +354,7 @@ test.skip('error when following self', async () => { await page.close(); }); -// FIXME Enable this test once the integration test can be run against a version of Canton that supports the new interface for creating a user -// FIXME The change was introduced as part of https://github.com/digital-asset/daml/pull/12682 -// FIXME The ticket tracking this issue is https://github.com/digital-asset/daml/issues/12808 -test.skip('error when adding a user that you are already following', async () => { +test('error when adding a user that you are already following', async () => { const [user1, party1] = await getParty(); const [user2, party2] = await getParty(); const page = await newUiPage(); @@ -432,26 +405,13 @@ test('error on non-existent user id', async () => { const invalidUser = "nonexistent"; const page = await newUiPage(); const error = await failedLogin(page, invalidUser); - expect(error).toMatch(/cannot get user for unknown user \\"nonexistent\\"/); + expect(error).toMatch(/getting user failed for unknown user \\"nonexistent\\"/); await page.close(); }, 40_000); -// FIXME Enable this test once the integration test can be run against a version of Canton that supports the new interface for creating a user -// FIXME The change was introduced as part of https://github.com/digital-asset/daml/pull/12682 -// FIXME The ticket tracking this issue is https://github.com/digital-asset/daml/issues/12808 -test.skip('error on user with no primary party', async () => { +test('error on user with no primary party', async () => { const invalidUser = "noprimary"; - // TODO replace with daml-ledger once it exposes the create user endpoint. - const grpcurlUserArgs = [ - "-plaintext", - "-d", - JSON.stringify({"user": {"id": invalidUser}}), - "localhost:6865", - "com.daml.ledger.api.v1.admin.UserManagementService/CreateUser", - ]; - const result = spawnSync('grpcurl', grpcurlUserArgs, {"encoding": "utf8"}); - console.debug(result.stdout); - console.debug(result.stderr); + await adminLedger.createUser(invalidUser, []); const page = await newUiPage(); const error = await failedLogin(page, invalidUser); expect(error).toMatch(/User 'noprimary' has no primary party/);