Skip to content

Commit

Permalink
api: include Oasis-style encryption envelope info
Browse files Browse the repository at this point in the history
  • Loading branch information
pro-wh committed Aug 30, 2024
1 parent ab3411a commit f06312e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
6 changes: 6 additions & 0 deletions api/spec/v1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2855,6 +2855,12 @@ components:
type: integer
format: int32
description: The total byte size of the transaction.
oasis_encryption_envelope:
allOf: [$ref: '#/components/schemas/RuntimeTransactionEncryptionEnvelope']
description: |
The data relevant to the Oasis-style encrypted transaction.
Note: The term "envelope" in this context refers to the [Oasis-style encryption envelopes](https://github.com/oasisprotocol/oasis-sdk/blob/c36a7ee194abf4ca28fdac0edbefe3843b39bf69/runtime-sdk/src/types/callformat.rs)
which differ slightly from [digital envelopes](hhttps://en.wikipedia.org/wiki/Hybrid_cryptosystem#Envelope_encryption).
method:
type: string
description: |
Expand Down
12 changes: 12 additions & 0 deletions storage/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -1480,6 +1480,8 @@ func (c *StorageClient) RuntimeTransactions(ctx context.Context, p apiTypes.GetR
t := RuntimeTransaction{
Error: &TxError{},
}
var oasisEncryptionEnvelope RuntimeTransactionEncryptionEnvelope
var oasisEncryptionEnvelopeFormat *common.CallFormat
var evmEncryptionEnvelope RuntimeTransactionEncryptionEnvelope
var evmEncryptionEnvelopeFormat *common.CallFormat
var sender0PreimageContextIdentifier *string
Expand Down Expand Up @@ -1507,6 +1509,12 @@ func (c *StorageClient) RuntimeTransactions(ctx context.Context, p apiTypes.GetR
&t.GasUsed,
&t.ChargedFee,
&t.Size,
&oasisEncryptionEnvelopeFormat,
&oasisEncryptionEnvelope.PublicKey,
&oasisEncryptionEnvelope.DataNonce,
&oasisEncryptionEnvelope.Data,
&oasisEncryptionEnvelope.ResultNonce,
&oasisEncryptionEnvelope.Result,
&t.Method,
&t.Body,
&t.To,
Expand Down Expand Up @@ -1534,6 +1542,10 @@ func (c *StorageClient) RuntimeTransactions(ctx context.Context, p apiTypes.GetR
if t.Success == nil || *t.Success {
t.Error = nil
}
if oasisEncryptionEnvelopeFormat != nil { // a rudimentary check to determine if the tx was encrypted
oasisEncryptionEnvelope.Format = *oasisEncryptionEnvelopeFormat
t.OasisEncryptionEnvelope = &oasisEncryptionEnvelope
}
if evmEncryptionEnvelopeFormat != nil { // a rudimentary check to determine if the tx was encrypted
evmEncryptionEnvelope.Format = *evmEncryptionEnvelopeFormat
t.EncryptionEnvelope = &evmEncryptionEnvelope
Expand Down
6 changes: 6 additions & 0 deletions storage/client/queries/queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,12 @@ const (
ELSE COALESCE(FLOOR(txs.fee / NULLIF(txs.gas_limit, 0)) * txs.gas_used, 0) -- charged_fee=gas_price * gas_used for EVM txs
END AS charged_fee,
txs.size,
txs.oasis_encrypted_format,
txs.oasis_encrypted_public_key,
txs.oasis_encrypted_data_nonce,
txs.oasis_encrypted_data_data,
txs.oasis_encrypted_result_nonce,
txs.oasis_encrypted_result_data,
txs.method,
txs.body,
txs.to,
Expand Down

0 comments on commit f06312e

Please sign in to comment.