-
Notifications
You must be signed in to change notification settings - Fork 205
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix authorization in try contexts (#9823)
wildcard pattern matches bite once again. We clearly do not want to use the committers here. I tried to move most of the logic to PartialTransaction but unfortunately moving the submitters to PartialTransaction doesn’t quite work since as usual scenarios make things difficult because submitters change at weird places and we reset the partial transaction in weird places. changelog_begin changelog_end
- Loading branch information
1 parent
cb06fb3
commit 269237e
Showing
4 changed files
with
97 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
transactions: | ||
TX #0 1970-01-01T00:00:00Z [Test:42] version: dev | ||
#0:0 version: dev | ||
│ referenced by #1:0, #2:0 | ||
│ known to (since): a (#0), b (#0) | ||
└─> create Test:Tester@XXXXXXXX | ||
with: { a = 'a', b = 'b' } | ||
|
||
TX #1 1970-01-01T00:00:00Z [Test:44] version: dev | ||
#1:0 version: dev | ||
│ known to (since): a (#1), b (#1) | ||
└─> b exercises CreateInTry:Test:Tester@XXXXXXXX on 009877e9c7e647b905ba9185add7af1b24e664508899260672b7e21c59ad9168d1 | ||
with { } | ||
children: | ||
#1:1 no-version | ||
│ known to (since): a (#1), b (#1) | ||
└─> rollback: | ||
#1:2 version: dev | ||
│ known to (since): a (#1), b (#1) | ||
└─> create Test:T@XXXXXXXX | ||
with: { ps = ['a', 'b'] } | ||
|
||
TX #2 1970-01-01T00:00:00Z [Test:47] version: dev | ||
#2:0 version: dev | ||
│ known to (since): a (#2), b (#2) | ||
└─> b exercises CreateInNestedTry:Test:Tester@XXXXXXXX on 009877e9c7e647b905ba9185add7af1b24e664508899260672b7e21c59ad9168d1 | ||
with { } | ||
children: | ||
#2:1 no-version | ||
│ known to (since): a (#2), b (#2) | ||
└─> rollback: | ||
#2:2 version: dev | ||
│ known to (since): a (#2), b (#2) | ||
└─> create Test:T@XXXXXXXX | ||
with: { ps = ['a', 'b'] } | ||
|
||
active contracts: | ||
009877e9c7e647b905ba9185add7af1b24e664508899260672b7e21c59ad9168d1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
-- Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. | ||
-- SPDX-License-Identifier: Apache-2.0 | ||
|
||
|
||
module Test where | ||
|
||
import DA.Exception | ||
|
||
template T | ||
with | ||
ps : [Party] | ||
where | ||
signatory ps | ||
|
||
template Tester | ||
with | ||
a : Party | ||
b : Party | ||
where | ||
signatory a | ||
observer b | ||
nonconsuming choice CreateInTry : () | ||
controller b | ||
do try do | ||
create (T [a, b]) | ||
abort "" | ||
catch | ||
GeneralError _ -> pure () | ||
|
||
nonconsuming choice CreateInNestedTry : () | ||
controller b | ||
do try try do create (T [a, b]) | ||
abort "" | ||
catch | ||
GeneralError _ -> pure () | ||
catch | ||
GeneralError _ -> pure () | ||
|
||
run = scenario do | ||
a <- getParty "a" | ||
b <- getParty "b" | ||
cid <- submit a $ create (Tester a b) | ||
-- Tests that we have the authorization from the parent exercise. | ||
submit b $ exercise cid CreateInTry | ||
-- Tests that we have the authorization from the parent exercise | ||
-- even if there is another rollback in between. | ||
submit b $ exercise cid CreateInNestedTry |