Skip to content

Commit 26f9310

Browse files
committed
Tested TxBuilder.createGcFsTx and it doesn't work for non-present signers (bpi again)
1 parent 8efd769 commit 26f9310

File tree

4 files changed

+36
-11
lines changed

4 files changed

+36
-11
lines changed

coop-pab/app/Coop/Cli/TxBuilderGrpc.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,9 @@ txBuilderService opts = do
9898
( \rawTx ->
9999
return $
100100
defMessage
101-
& success . mintFsTx . cborBase16 .~ rawTx
102101
& info .~ info'
102+
& Proto.TxBuilderService.error . otherErr . msg .~ "wuasapp"
103+
& success . mintFsTx . cborBase16 .~ rawTx
103104
)
104105
mayRawTx
105106
)

coop-pab/aux.sh

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ function generate-keys {
99

1010
function start-cluster {
1111
# As specified in resources/pabConfig.yaml
12-
rm -fr .wallets
13-
rm -fr .local-cluster
14-
mkdir .wallet
12+
rm -fR .wallets
13+
rm -fR .local-cluster
14+
mkdir .wallets
1515
mkdir .local-cluster
1616
mkdir .local-cluster/txs
1717
mkdir .local-cluster/scripts
@@ -95,7 +95,7 @@ function coop-mint-fs {
9595
{
9696
"factStatements": [
9797
{
98-
"fsId": "eW==",
98+
"fsId": "YXNkCg==",
9999
"gcAfter": {
100100
"extended": "NEG_INF"
101101
},
@@ -111,8 +111,26 @@ function coop-mint-fs {
111111
112112
EOF
113113
)
114-
rawTx=$(echo $resp | jq '.mintFsSuccess.mintFsTx | .cborHex = .cborBase16 | del(.cborBase16) | .description = "" | .type = "Tx BabbageEra"')
115-
echo $resp | jq '.mintFsSuccess.alreadyPublished'
114+
rawTx=$(echo $resp | jq '.success.mintFsTx | .cborHex = .cborBase16 | del(.cborBase16) | .description = "" | .type = "Tx BabbageEra"')
115+
echo $resp | jq '.info'
116+
echo $resp | jq '.error'
117+
echo $rawTx > .coop-pab-cli/signed
118+
}
119+
120+
function coop-gc-fs {
121+
make-exports
122+
resp=$(grpcurl -insecure -import-path ../coop-proto -proto ../coop-proto/tx-builder-service.proto -d @ localhost:5081 coop.TxBuilder/createGcFsTx <<EOF
123+
{
124+
"fsIds": ["eW==", "YXNkCg=="],
125+
"submitter": {
126+
"base16": "$SUBMITTER_WALLET"
127+
}
128+
}
129+
130+
EOF
131+
)
132+
rawTx=$(echo $resp | jq '.success.gcFsTx | .cborHex = .cborBase16 | del(.cborBase16) | .description = "" | .type = "Tx BabbageEra"')
133+
echo $resp | jq '.info'
116134
echo $resp | jq '.error'
117135
echo $rawTx > .coop-pab-cli/signed
118136
}

coop-pab/src/Coop/Pab.hs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,8 +519,14 @@ mkPublishingSpec coopDeployment authenticators req = do
519519
authOut <- Map.toList authOuts
520520
return (batch, authOut, authWallet, ivTo . cert'validity . auth'certDatum $ batch)
521521

522+
-- TODO: Security Vulnerability: Sign for me!
523+
-- If the user supplies a Pkh that is either an Authenticator, God, Cert redeemer or Fee
524+
-- BPI will submit successfully as it has all these wallets in its key store.
525+
-- THis is due to how 'just signing' actually works in BPI.
522526
runMintFsTx :: CoopDeployment -> [PaymentPubKeyHash] -> (Value, PaymentPubKeyHash) -> (Bool, Integer) -> CreateMintFsTxReq -> Contract w s Text (Maybe TxId, MintFsInfo)
523527
runMintFsTx coopDeployment authenticators feeSpec (submit, minutes) req = do
528+
self <- PaymentPubKeyHash <$> toCardanoC (req ^. submitter)
529+
when (self `elem` authenticators) (throwError "Must have a Submitter that's not an Authenticator (TODO: Fix systematically)")
524530
(mayPublishingSpec, info) <- mkPublishingSpec coopDeployment authenticators req
525531
maybe
526532
(return (Nothing, info))

coop-proto/tx-builder-service.proto

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ message CreateMintFsTxResp {
2323
Error error = 1;
2424
// Successful Fact Statement Minting message
2525
MintFsSuccess success = 2;
26-
// Information about the processing of the request
27-
MintFsInfo info = 3;
2826
}
27+
// Information about the processing of the request
28+
MintFsInfo info = 3;
2929
}
3030

3131
// Success message associated with CreateMintFsTxResp
@@ -68,9 +68,9 @@ message CreateGcFsTxResp {
6868
Error error = 1;
6969
// Successfull Fact Statement garbage collection message
7070
GcFsSuccess success = 2;
71-
// Request processing information
72-
GcFsInfo info = 3;
7371
}
72+
// Request processing information
73+
GcFsInfo info = 3;
7474
}
7575

7676
// Success message associated with the CreateGcFsTxResp

0 commit comments

Comments
 (0)