Skip to content

Commit

Permalink
stub legacy second sig check
Browse files Browse the repository at this point in the history
  • Loading branch information
oXtxNt9U committed Dec 10, 2024
1 parent 0885a7f commit f859cfa
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/contracts/source/contracts/crypto/transactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export interface TransactionData {
timestamp: number;

signature?: string;
secondSignature?: string;

sequence?: number;
gasUsed?: number;
Expand Down
4 changes: 4 additions & 0 deletions packages/contracts/source/contracts/state/wallets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ export interface Wallet {
setNonce(nonce: BigNumber): void;
increaseNonce(): void;
decreaseNonce(): void;

// legacy
hasLegacySecondPublicKey(): boolean;
legacySecondPublicKey(): string;
}

export interface ValidatorWallet {
Expand Down
10 changes: 10 additions & 0 deletions packages/state/source/wallets/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,14 @@ export class Wallet implements Contracts.State.Wallet {
public decreaseNonce(): void {
this.setNonce(this.getNonce().minus(BigNumber.ONE));
}

// Legacy
public hasLegacySecondPublicKey(): boolean {
return !!this.legacyAttributes.secondPublicKey;
}

public legacySecondPublicKey(): string {
Utils.assert.defined(this.legacyAttributes.secondPublicKey);
return this.legacyAttributes.secondPublicKey;
}
}
7 changes: 7 additions & 0 deletions packages/transactions/source/handlers/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ export abstract class TransactionHandler implements Contracts.Transactions.Trans
) {
throw new Exceptions.InsufficientBalanceError();
}

if (sender.hasLegacySecondPublicKey()) {
// TODO: enable
// if (!(await this.verifier.verifyHash(transaction.data, sender.legacySecondPublicKey()))) {
// throw new Exceptions.InvalidSignatureError();
// }
}
}

public emitEvents(transaction: Contracts.Crypto.Transaction): void {}
Expand Down

0 comments on commit f859cfa

Please sign in to comment.