Skip to content

Commit

Permalink
Add lint for rust binding changes (#5626)
Browse files Browse the repository at this point in the history
* Add lint for rust binding changes

* check in rust binding changes
  • Loading branch information
mat-if authored Nov 6, 2024
1 parent f5271e3 commit d04e25a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ jobs:
- name: Lint
run: yarn lint

- name: Build Rust bindings
run: yarn build

- name: Check for Rust binding changes
run: |
if [[ $(git status | grep index.) ]]; then
echo "Rust bindings have outstanding updates, please run 'yarn build' and check them in."
exit 1
fi
test:
name: Test
runs-on: ubuntu-latest
Expand Down
9 changes: 0 additions & 9 deletions ironfish-rust-nodejs/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,7 @@ export interface BoxedMessage {
}
export declare function boxMessage(plaintext: string, senderSecretKey: Uint8Array, recipientPublicKey: string): BoxedMessage
export declare function unboxMessage(boxedMessage: string, nonce: string, senderPublicKey: string, recipientSecretKey: Uint8Array): string
/**
* # Safety
* This is unsafe, it calls libc functions
*/
export declare function initSignalHandler(): void
/**
* # Safety
* This is unsafe, it intentionally crashes
*/
export declare function triggerSegfault(): void
export const ASSET_ID_LENGTH: number
export const ASSET_METADATA_LENGTH: number
export const ASSET_NAME_LENGTH: number
Expand Down
3 changes: 1 addition & 2 deletions ironfish-rust-nodejs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ if (!nativeBinding) {
throw new Error(`Failed to load native binding`)
}

const { FishHashContext, deserializePublicPackage, deserializeRound2CombinedPublicPackage, KEY_LENGTH, NONCE_LENGTH, BoxKeyPair, randomBytes, boxMessage, unboxMessage, RollingFilter, initSignalHandler, triggerSegfault, ASSET_ID_LENGTH, ASSET_METADATA_LENGTH, ASSET_NAME_LENGTH, ASSET_LENGTH, Asset, NOTE_ENCRYPTION_KEY_LENGTH, MAC_LENGTH, ENCRYPTED_NOTE_PLAINTEXT_LENGTH, ENCRYPTED_NOTE_LENGTH, NoteEncrypted, PUBLIC_ADDRESS_LENGTH, RANDOMNESS_LENGTH, MEMO_LENGTH, AMOUNT_VALUE_LENGTH, DECRYPTED_NOTE_LENGTH, Note, PROOF_LENGTH, TRANSACTION_SIGNATURE_LENGTH, TRANSACTION_PUBLIC_KEY_RANDOMNESS_LENGTH, TRANSACTION_EXPIRATION_LENGTH, TRANSACTION_FEE_LENGTH, LATEST_TRANSACTION_VERSION, TransactionPosted, Transaction, verifyTransactions, UnsignedTransaction, LanguageCode, generateKey, spendingKeyToWords, wordsToSpendingKey, generatePublicAddressFromIncomingViewKey, generateKeyFromPrivateKey, initializeSapling, FoundBlockResult, ThreadPoolHandler, isValidPublicAddress, CpuCount, getCpuCount, generateRandomizedPublicKey, multisig, xchacha20poly1305 } = nativeBinding
const { FishHashContext, deserializePublicPackage, deserializeRound2CombinedPublicPackage, KEY_LENGTH, NONCE_LENGTH, BoxKeyPair, randomBytes, boxMessage, unboxMessage, RollingFilter, initSignalHandler, ASSET_ID_LENGTH, ASSET_METADATA_LENGTH, ASSET_NAME_LENGTH, ASSET_LENGTH, Asset, NOTE_ENCRYPTION_KEY_LENGTH, MAC_LENGTH, ENCRYPTED_NOTE_PLAINTEXT_LENGTH, ENCRYPTED_NOTE_LENGTH, NoteEncrypted, PUBLIC_ADDRESS_LENGTH, RANDOMNESS_LENGTH, MEMO_LENGTH, AMOUNT_VALUE_LENGTH, DECRYPTED_NOTE_LENGTH, Note, PROOF_LENGTH, TRANSACTION_SIGNATURE_LENGTH, TRANSACTION_PUBLIC_KEY_RANDOMNESS_LENGTH, TRANSACTION_EXPIRATION_LENGTH, TRANSACTION_FEE_LENGTH, LATEST_TRANSACTION_VERSION, TransactionPosted, Transaction, verifyTransactions, UnsignedTransaction, LanguageCode, generateKey, spendingKeyToWords, wordsToSpendingKey, generatePublicAddressFromIncomingViewKey, generateKeyFromPrivateKey, initializeSapling, FoundBlockResult, ThreadPoolHandler, isValidPublicAddress, CpuCount, getCpuCount, generateRandomizedPublicKey, multisig, xchacha20poly1305 } = nativeBinding

module.exports.FishHashContext = FishHashContext
module.exports.deserializePublicPackage = deserializePublicPackage
Expand All @@ -265,7 +265,6 @@ module.exports.boxMessage = boxMessage
module.exports.unboxMessage = unboxMessage
module.exports.RollingFilter = RollingFilter
module.exports.initSignalHandler = initSignalHandler
module.exports.triggerSegfault = triggerSegfault
module.exports.ASSET_ID_LENGTH = ASSET_ID_LENGTH
module.exports.ASSET_METADATA_LENGTH = ASSET_METADATA_LENGTH
module.exports.ASSET_NAME_LENGTH = ASSET_NAME_LENGTH
Expand Down

0 comments on commit d04e25a

Please sign in to comment.