Skip to content

Commit d04e25a

Browse files
authored
Add lint for rust binding changes (#5626)
* Add lint for rust binding changes * check in rust binding changes
1 parent f5271e3 commit d04e25a

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,16 @@ jobs:
3939
- name: Lint
4040
run: yarn lint
4141

42+
- name: Build Rust bindings
43+
run: yarn build
44+
45+
- name: Check for Rust binding changes
46+
run: |
47+
if [[ $(git status | grep index.) ]]; then
48+
echo "Rust bindings have outstanding updates, please run 'yarn build' and check them in."
49+
exit 1
50+
fi
51+
4252
test:
4353
name: Test
4454
runs-on: ubuntu-latest

ironfish-rust-nodejs/index.d.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,7 @@ export interface BoxedMessage {
2929
}
3030
export declare function boxMessage(plaintext: string, senderSecretKey: Uint8Array, recipientPublicKey: string): BoxedMessage
3131
export declare function unboxMessage(boxedMessage: string, nonce: string, senderPublicKey: string, recipientSecretKey: Uint8Array): string
32-
/**
33-
* # Safety
34-
* This is unsafe, it calls libc functions
35-
*/
3632
export declare function initSignalHandler(): void
37-
/**
38-
* # Safety
39-
* This is unsafe, it intentionally crashes
40-
*/
41-
export declare function triggerSegfault(): void
4233
export const ASSET_ID_LENGTH: number
4334
export const ASSET_METADATA_LENGTH: number
4435
export const ASSET_NAME_LENGTH: number

ironfish-rust-nodejs/index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ if (!nativeBinding) {
252252
throw new Error(`Failed to load native binding`)
253253
}
254254

255-
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
255+
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
256256

257257
module.exports.FishHashContext = FishHashContext
258258
module.exports.deserializePublicPackage = deserializePublicPackage
@@ -265,7 +265,6 @@ module.exports.boxMessage = boxMessage
265265
module.exports.unboxMessage = unboxMessage
266266
module.exports.RollingFilter = RollingFilter
267267
module.exports.initSignalHandler = initSignalHandler
268-
module.exports.triggerSegfault = triggerSegfault
269268
module.exports.ASSET_ID_LENGTH = ASSET_ID_LENGTH
270269
module.exports.ASSET_METADATA_LENGTH = ASSET_METADATA_LENGTH
271270
module.exports.ASSET_NAME_LENGTH = ASSET_NAME_LENGTH

0 commit comments

Comments
 (0)