Skip to content

Commit

Permalink
fix(transactions)!: malleability for multiple signatures
Browse files Browse the repository at this point in the history
  • Loading branch information
sdbondi committed Dec 26, 2024
1 parent 973f8a1 commit cb9ccdd
Show file tree
Hide file tree
Showing 47 changed files with 974 additions and 266 deletions.
3 changes: 3 additions & 0 deletions bindings/dist/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,16 @@ export * from "./types/TransactionPoolStage";
export * from "./types/TransactionReceipt";
export * from "./types/TransactionReceiptAddress";
export * from "./types/TransactionResult";
export * from "./types/TransactionSealSignature";
export * from "./types/TransactionSignature";
export * from "./types/TransactionStatus";
export * from "./types/TransactionV1";
export * from "./types/Type";
export * from "./types/UnclaimedConfidentialOutput";
export * from "./types/UnclaimedConfidentialOutputAddress";
export * from "./types/UnsealedTransactionV1";
export * from "./types/UnsignedTransaction";
export * from "./types/UnsignedTransactionV1";
export * from "./types/ValidatorSignature";
export * from "./types/Vault";
export * from "./types/VaultId";
Expand Down
3 changes: 3 additions & 0 deletions bindings/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,16 @@ export * from "./types/TransactionPoolStage";
export * from "./types/TransactionReceipt";
export * from "./types/TransactionReceiptAddress";
export * from "./types/TransactionResult";
export * from "./types/TransactionSealSignature";
export * from "./types/TransactionSignature";
export * from "./types/TransactionStatus";
export * from "./types/TransactionV1";
export * from "./types/Type";
export * from "./types/UnclaimedConfidentialOutput";
export * from "./types/UnclaimedConfidentialOutputAddress";
export * from "./types/UnsealedTransactionV1";
export * from "./types/UnsignedTransaction";
export * from "./types/UnsignedTransactionV1";
export * from "./types/ValidatorSignature";
export * from "./types/Vault";
export * from "./types/VaultId";
Expand Down
7 changes: 7 additions & 0 deletions bindings/dist/types/TransactionSealSignature.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export interface TransactionSealSignature {
public_key: string;
signature: {
public_nonce: string;
signature: string;
};
}
2 changes: 2 additions & 0 deletions bindings/dist/types/TransactionSealSignature.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export {};
5 changes: 4 additions & 1 deletion bindings/dist/types/TransactionSignature.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
export interface TransactionSignature {
public_key: string;
signature: string;
signature: {
public_nonce: string;
signature: string;
};
}
14 changes: 4 additions & 10 deletions bindings/dist/types/TransactionV1.d.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
import type { Epoch } from "./Epoch";
import type { Instruction } from "./Instruction";
import type { SubstateRequirement } from "./SubstateRequirement";
import type { TransactionSignature } from "./TransactionSignature";
import type { TransactionSealSignature } from "./TransactionSealSignature";
import type { UnsealedTransactionV1 } from "./UnsealedTransactionV1";
import type { VersionedSubstateId } from "./VersionedSubstateId";
export interface TransactionV1 {
id: string;
fee_instructions: Array<Instruction>;
instructions: Array<Instruction>;
inputs: Array<SubstateRequirement>;
min_epoch: Epoch | null;
max_epoch: Epoch | null;
signatures: Array<TransactionSignature>;
body: UnsealedTransactionV1;
seal_signature: TransactionSealSignature;
filled_inputs: Array<VersionedSubstateId>;
}
6 changes: 6 additions & 0 deletions bindings/dist/types/UnsealedTransactionV1.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import type { TransactionSignature } from "./TransactionSignature";
import type { UnsignedTransactionV1 } from "./UnsignedTransactionV1";
export interface UnsealedTransactionV1 {
transaction: UnsignedTransactionV1;
signatures: Array<TransactionSignature>;
}
1 change: 1 addition & 0 deletions bindings/dist/types/UnsealedTransactionV1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
14 changes: 4 additions & 10 deletions bindings/dist/types/UnsignedTransaction.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
import type { Epoch } from "./Epoch";
import type { Instruction } from "./Instruction";
import type { SubstateRequirement } from "./SubstateRequirement";
export interface UnsignedTransaction {
fee_instructions: Array<Instruction>;
instructions: Array<Instruction>;
inputs: Array<SubstateRequirement>;
min_epoch: Epoch | null;
max_epoch: Epoch | null;
}
import type { UnsignedTransactionV1 } from "./UnsignedTransactionV1";
export type UnsignedTransaction = {
V1: UnsignedTransactionV1;
};
12 changes: 12 additions & 0 deletions bindings/dist/types/UnsignedTransactionV1.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import type { Epoch } from "./Epoch";
import type { Instruction } from "./Instruction";
import type { SubstateRequirement } from "./SubstateRequirement";
export interface UnsignedTransactionV1 {
network: number;
fee_instructions: Array<Instruction>;
instructions: Array<Instruction>;
inputs: Array<SubstateRequirement>;
min_epoch: Epoch | null;
max_epoch: Epoch | null;
is_seal_signer_authorized: boolean;
}
1 change: 1 addition & 0 deletions bindings/dist/types/UnsignedTransactionV1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import type { ComponentAddressOrName } from "./ComponentAddressOrName";
export interface PublishTemplateRequest {
binary: string;
fee_account: ComponentAddressOrName | null;
max_fee: number;
detect_inputs: boolean;
dry_run: boolean;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import type { Amount } from "../Amount";
export interface PublishTemplateResponse {
transaction_id: string;
dry_run_fee: Amount | null;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import type { ComponentAddressOrName } from "./ComponentAddressOrName";
export interface PublishTransactionRequest {
binary: Array<number>;
fee_account: ComponentAddressOrName;
max_fee: number;
detect_inputs: boolean;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export interface PublishTransactionResponse {
transaction_id: string;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export {};
4 changes: 4 additions & 0 deletions bindings/dist/wallet-daemon-client.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export * from "./types/wallet-daemon-client/SubstatesGetRequest";
export * from "./types/wallet-daemon-client/ProofsFinalizeResponse";
export * from "./types/wallet-daemon-client/AuthRevokeTokenRequest";
export * from "./types/wallet-daemon-client/TransactionWaitResultRequest";
export * from "./types/wallet-daemon-client/PublishTemplateResponse";
export * from "./types/wallet-daemon-client/TransactionSubmitResponse";
export * from "./types/wallet-daemon-client/AccountsCreateRequest";
export * from "./types/wallet-daemon-client/CallInstructionRequest";
Expand Down Expand Up @@ -58,6 +59,7 @@ export * from "./types/wallet-daemon-client/AccountsInvokeResponse";
export * from "./types/wallet-daemon-client/AccountsListRequest";
export * from "./types/wallet-daemon-client/AuthLoginAcceptResponse";
export * from "./types/wallet-daemon-client/TransactionSubmitDryRunResponse";
export * from "./types/wallet-daemon-client/PublishTransactionResponse";
export * from "./types/wallet-daemon-client/ConfidentialCreateOutputProofResponse";
export * from "./types/wallet-daemon-client/TemplatesGetRequest";
export * from "./types/wallet-daemon-client/ConfidentialViewVaultBalanceResponse";
Expand All @@ -69,11 +71,13 @@ export * from "./types/wallet-daemon-client/ClaimValidatorFeesResponse";
export * from "./types/wallet-daemon-client/ConfidentialTransferResponse";
export * from "./types/wallet-daemon-client/TemplatesGetResponse";
export * from "./types/wallet-daemon-client/AccountsTransferRequest";
export * from "./types/wallet-daemon-client/PublishTransactionRequest";
export * from "./types/wallet-daemon-client/AuthLoginRequest";
export * from "./types/wallet-daemon-client/AuthGetAllJwtResponse";
export * from "./types/wallet-daemon-client/AccountsCreateFreeTestCoinsRequest";
export * from "./types/wallet-daemon-client/ConfidentialTransferRequest";
export * from "./types/wallet-daemon-client/SettingsSetResponse";
export * from "./types/wallet-daemon-client/PublishTemplateRequest";
export * from "./types/wallet-daemon-client/AccountsCreateFreeTestCoinsResponse";
export * from "./types/wallet-daemon-client/AccountGetRequest";
export * from "./types/wallet-daemon-client/KeysCreateRequest";
Expand Down
4 changes: 4 additions & 0 deletions bindings/dist/wallet-daemon-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export * from "./types/wallet-daemon-client/SubstatesGetRequest";
export * from "./types/wallet-daemon-client/ProofsFinalizeResponse";
export * from "./types/wallet-daemon-client/AuthRevokeTokenRequest";
export * from "./types/wallet-daemon-client/TransactionWaitResultRequest";
export * from "./types/wallet-daemon-client/PublishTemplateResponse";
export * from "./types/wallet-daemon-client/TransactionSubmitResponse";
export * from "./types/wallet-daemon-client/AccountsCreateRequest";
export * from "./types/wallet-daemon-client/CallInstructionRequest";
Expand Down Expand Up @@ -60,6 +61,7 @@ export * from "./types/wallet-daemon-client/AccountsInvokeResponse";
export * from "./types/wallet-daemon-client/AccountsListRequest";
export * from "./types/wallet-daemon-client/AuthLoginAcceptResponse";
export * from "./types/wallet-daemon-client/TransactionSubmitDryRunResponse";
export * from "./types/wallet-daemon-client/PublishTransactionResponse";
export * from "./types/wallet-daemon-client/ConfidentialCreateOutputProofResponse";
export * from "./types/wallet-daemon-client/TemplatesGetRequest";
export * from "./types/wallet-daemon-client/ConfidentialViewVaultBalanceResponse";
Expand All @@ -71,11 +73,13 @@ export * from "./types/wallet-daemon-client/ClaimValidatorFeesResponse";
export * from "./types/wallet-daemon-client/ConfidentialTransferResponse";
export * from "./types/wallet-daemon-client/TemplatesGetResponse";
export * from "./types/wallet-daemon-client/AccountsTransferRequest";
export * from "./types/wallet-daemon-client/PublishTransactionRequest";
export * from "./types/wallet-daemon-client/AuthLoginRequest";
export * from "./types/wallet-daemon-client/AuthGetAllJwtResponse";
export * from "./types/wallet-daemon-client/AccountsCreateFreeTestCoinsRequest";
export * from "./types/wallet-daemon-client/ConfidentialTransferRequest";
export * from "./types/wallet-daemon-client/SettingsSetResponse";
export * from "./types/wallet-daemon-client/PublishTemplateRequest";
export * from "./types/wallet-daemon-client/AccountsCreateFreeTestCoinsResponse";
export * from "./types/wallet-daemon-client/AccountGetRequest";
export * from "./types/wallet-daemon-client/KeysCreateRequest";
Expand Down
4 changes: 2 additions & 2 deletions bindings/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bindings/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tari-project/typescript-bindings",
"version": "1.2.0",
"version": "1.3.0",
"description": "",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down
3 changes: 3 additions & 0 deletions bindings/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,16 @@ export * from "./types/TransactionPoolStage";
export * from "./types/TransactionReceipt";
export * from "./types/TransactionReceiptAddress";
export * from "./types/TransactionResult";
export * from "./types/TransactionSealSignature";
export * from "./types/TransactionSignature";
export * from "./types/TransactionStatus";
export * from "./types/TransactionV1";
export * from "./types/Type";
export * from "./types/UnclaimedConfidentialOutput";
export * from "./types/UnclaimedConfidentialOutputAddress";
export * from "./types/UnsealedTransactionV1";
export * from "./types/UnsignedTransaction";
export * from "./types/UnsignedTransactionV1";
export * from "./types/ValidatorSignature";
export * from "./types/Vault";
export * from "./types/VaultId";
Expand Down
6 changes: 6 additions & 0 deletions bindings/src/types/TransactionSealSignature.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.

export interface TransactionSealSignature {
public_key: string;
signature: { public_nonce: string; signature: string };
}
2 changes: 1 addition & 1 deletion bindings/src/types/TransactionSignature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

export interface TransactionSignature {
public_key: string;
signature: string;
signature: { public_nonce: string; signature: string };
}
14 changes: 4 additions & 10 deletions bindings/src/types/TransactionV1.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { Epoch } from "./Epoch";
import type { Instruction } from "./Instruction";
import type { SubstateRequirement } from "./SubstateRequirement";
import type { TransactionSignature } from "./TransactionSignature";
import type { TransactionSealSignature } from "./TransactionSealSignature";
import type { UnsealedTransactionV1 } from "./UnsealedTransactionV1";
import type { VersionedSubstateId } from "./VersionedSubstateId";

export interface TransactionV1 {
id: string;
fee_instructions: Array<Instruction>;
instructions: Array<Instruction>;
inputs: Array<SubstateRequirement>;
min_epoch: Epoch | null;
max_epoch: Epoch | null;
signatures: Array<TransactionSignature>;
body: UnsealedTransactionV1;
seal_signature: TransactionSealSignature;
filled_inputs: Array<VersionedSubstateId>;
}
8 changes: 8 additions & 0 deletions bindings/src/types/UnsealedTransactionV1.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { TransactionSignature } from "./TransactionSignature";
import type { UnsignedTransactionV1 } from "./UnsignedTransactionV1";

export interface UnsealedTransactionV1 {
transaction: UnsignedTransactionV1;
signatures: Array<TransactionSignature>;
}
12 changes: 2 additions & 10 deletions bindings/src/types/UnsignedTransaction.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { Epoch } from "./Epoch";
import type { Instruction } from "./Instruction";
import type { SubstateRequirement } from "./SubstateRequirement";
import type { UnsignedTransactionV1 } from "./UnsignedTransactionV1";

export interface UnsignedTransaction {
fee_instructions: Array<Instruction>;
instructions: Array<Instruction>;
inputs: Array<SubstateRequirement>;
min_epoch: Epoch | null;
max_epoch: Epoch | null;
}
export type UnsignedTransaction = { V1: UnsignedTransactionV1 };
14 changes: 14 additions & 0 deletions bindings/src/types/UnsignedTransactionV1.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { Epoch } from "./Epoch";
import type { Instruction } from "./Instruction";
import type { SubstateRequirement } from "./SubstateRequirement";

export interface UnsignedTransactionV1 {
network: number;
fee_instructions: Array<Instruction>;
instructions: Array<Instruction>;
inputs: Array<SubstateRequirement>;
min_epoch: Epoch | null;
max_epoch: Epoch | null;
is_seal_signer_authorized: boolean;
}
10 changes: 10 additions & 0 deletions bindings/src/types/wallet-daemon-client/PublishTemplateRequest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { ComponentAddressOrName } from "./ComponentAddressOrName";

export interface PublishTemplateRequest {
binary: string;
fee_account: ComponentAddressOrName | null;
max_fee: number;
detect_inputs: boolean;
dry_run: boolean;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { Amount } from "../Amount";

export interface PublishTemplateResponse {
transaction_id: string;
dry_run_fee: Amount | null;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { ComponentAddressOrName } from "./ComponentAddressOrName";

export interface PublishTransactionRequest {
binary: Array<number>;
fee_account: ComponentAddressOrName;
max_fee: number;
detect_inputs: boolean;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.

export interface PublishTransactionResponse {
transaction_id: string;
}
4 changes: 4 additions & 0 deletions bindings/src/wallet-daemon-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export * from "./types/wallet-daemon-client/SubstatesGetRequest";
export * from "./types/wallet-daemon-client/ProofsFinalizeResponse";
export * from "./types/wallet-daemon-client/AuthRevokeTokenRequest";
export * from "./types/wallet-daemon-client/TransactionWaitResultRequest";
export * from "./types/wallet-daemon-client/PublishTemplateResponse";
export * from "./types/wallet-daemon-client/TransactionSubmitResponse";
export * from "./types/wallet-daemon-client/AccountsCreateRequest";
export * from "./types/wallet-daemon-client/CallInstructionRequest";
Expand Down Expand Up @@ -61,6 +62,7 @@ export * from "./types/wallet-daemon-client/AccountsInvokeResponse";
export * from "./types/wallet-daemon-client/AccountsListRequest";
export * from "./types/wallet-daemon-client/AuthLoginAcceptResponse";
export * from "./types/wallet-daemon-client/TransactionSubmitDryRunResponse";
export * from "./types/wallet-daemon-client/PublishTransactionResponse";
export * from "./types/wallet-daemon-client/ConfidentialCreateOutputProofResponse";
export * from "./types/wallet-daemon-client/TemplatesGetRequest";
export * from "./types/wallet-daemon-client/ConfidentialViewVaultBalanceResponse";
Expand All @@ -72,11 +74,13 @@ export * from "./types/wallet-daemon-client/ClaimValidatorFeesResponse";
export * from "./types/wallet-daemon-client/ConfidentialTransferResponse";
export * from "./types/wallet-daemon-client/TemplatesGetResponse";
export * from "./types/wallet-daemon-client/AccountsTransferRequest";
export * from "./types/wallet-daemon-client/PublishTransactionRequest";
export * from "./types/wallet-daemon-client/AuthLoginRequest";
export * from "./types/wallet-daemon-client/AuthGetAllJwtResponse";
export * from "./types/wallet-daemon-client/AccountsCreateFreeTestCoinsRequest";
export * from "./types/wallet-daemon-client/ConfidentialTransferRequest";
export * from "./types/wallet-daemon-client/SettingsSetResponse";
export * from "./types/wallet-daemon-client/PublishTemplateRequest";
export * from "./types/wallet-daemon-client/AccountsCreateFreeTestCoinsResponse";
export * from "./types/wallet-daemon-client/AccountGetRequest";
export * from "./types/wallet-daemon-client/KeysCreateRequest";
Expand Down
3 changes: 2 additions & 1 deletion dan_layer/tari_bor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ where
}

pub fn encode<T: Serialize + ?Sized>(val: &T) -> Result<Vec<u8>, BorError> {
let mut buf = Vec::with_capacity(512);
let len = encoded_len(val)?;
let mut buf = Vec::with_capacity(len);
encode_into_writer(val, &mut buf).map_err(|e| BorError::new(format!("{:?}", e)))?;
Ok(buf)
}
Expand Down
Loading

0 comments on commit cb9ccdd

Please sign in to comment.