Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removes unused wallet method shouldDecryptForAccount #5707

Merged
merged 1 commit into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
224 changes: 0 additions & 224 deletions ironfish/src/wallet/__fixtures__/wallet.test.ts.fixture
Original file line number Diff line number Diff line change
Expand Up @@ -5203,230 +5203,6 @@
]
}
],
"Wallet shouldDecryptForAccount should return true for an account with null createdAt": [
{
"value": {
"version": 4,
"id": "ab5b44be-38b3-4c52-8872-8f93b269b817",
"name": "test",
"spendingKey": "ba906d52efbd927f0be11d429358919ea1c87fbb7a4498f8e2ecd046a2793a71",
"viewKey": "fa278f55c53812b3bca2ddd7c0878050b6522f9f87288c3d03250fba9a5bf236fc5e71eac8694878b8c810d96d5c5721b9f1b3507a86eba039e893d09092e89e",
"incomingViewKey": "74d4b2b2c1cc39f4097b90c8b50a3bae0c85c04a3e588e922a18742b70b53304",
"outgoingViewKey": "7f7a01e7efdb53e7b4a12ca4664c0277429205c6b21e5532965f6add9967f36d",
"publicAddress": "74f189128d5f91e129af0bd86d986b948f21ab00561e7b47285000968b8df845",
"createdAt": {
"hash": {
"type": "Buffer",
"data": "base64:R5HXrp+X3xAO8VWOhHctagm0N2I4goP3XG8goyqIqoY="
},
"sequence": 1
},
"scanningEnabled": true,
"proofAuthorizingKey": "d4da17a97007808a389d636669d59efcae825d66cced3bb52c813e5dbf9b8e08"
},
"head": {
"hash": {
"type": "Buffer",
"data": "base64:R5HXrp+X3xAO8VWOhHctagm0N2I4goP3XG8goyqIqoY="
},
"sequence": 1
}
},
{
"header": {
"sequence": 2,
"previousBlockHash": "4791D7AE9F97DF100EF1558E84772D6A09B43762388283F75C6F20A32A88AA86",
"noteCommitment": {
"type": "Buffer",
"data": "base64:Ye223RdSL5Fj+ilufxi5m1pJ2cQEP04YtZP40xumgT0="
},
"transactionCommitment": {
"type": "Buffer",
"data": "base64:VuyFBIxcZoBgF75z/D7ExBC3xFJKkzk0ASQhfIm5fdo="
},
"target": "9282972777491357380673661573939192202192629606981189395159182914949423",
"randomness": "0",
"timestamp": 1717538998177,
"graffiti": "0000000000000000000000000000000000000000000000000000000000000000",
"noteSize": 4,
"work": "0"
},
"transactions": [
{
"type": "Buffer",
"data": "base64:AQAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGzKiP////8AAAAAtaBpU33iI5phDHMDr379VGMo9mtOeclLnyNPE/Gk5DWD5XURR1gDcbaRZ6brJn/o63t1yIvzMq+mFjGuFOksTn4Vc3VUMFbNJcRAI4x4iBm1EqQTd5sA8eaSeb9lz0bMpT/fXduflL5uKiSHJ5WIlZ5zeaG3DVvH5eirAN9kJ2USZ9YJUA9SsDK/wJPlqVm7BL0/ph0kJ/UXL6pQawgLiHy7w0lu+wWEtX39Fc4nnB6ZsY6VSb77x5Jg4CTrX2AK3unixfUmZFKutH5d3DkGYKLwfIoIMQmTx3sqlbHHeHhCzAJhoLhYP9V3FE7rwc/KOjMitlzx3tfWF/loGkfrz7nWbaS7hEC1n60pu6SWwxQa1ntzfbFCpDfghO1CCWkrB1UDDbAZruUIuCLu1gqGGD+NLZMLed1KvcYTlcoGH6BHKmP576imyeZbSQHLkUWBBQ4pIAa+gfejAcE5asKsUt5MMjVa/LZsbt32mW707oF/ZLJgPOmMoFufLww9EB220o52pYQG1bGshC4agxJik2t936biKrUn+cSFDx7ODmpo18U4DyfykcxwCLbrcYkMoHX8HmyiTzhc7NIh0P95WpvuyUwg/UasBxNbxb6mHgzjck1zZQ8MIUlyb24gRmlzaCBub3RlIGVuY3J5cHRpb24gbWluZXIga2V5MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwVBoeIcfVogURg03ma8kl1MPPqMaSumSYTJLxHHmyK+f4idC1ofgBJ5PJsOd8NFqNgWb4t4NFwv0xkcV9jdloBQ=="
}
]
}
],
"Wallet shouldDecryptForAccount should return true for an account with createdAt earlier than the header": [
{
"value": {
"version": 4,
"id": "e4e8e6e1-2e12-4718-9113-80c11fee565f",
"name": "test",
"spendingKey": "8803cd390dc21e390155bcdb76703829be72bdd0d34883e9767b3e9a7ecaca3c",
"viewKey": "911c59f20fe23ea928efe890c6a3fafbc026008bc2efd219c61b76a2515049038b81f13675c60d7a7dcc024027dee03d3680e79c39a5067814f90fc9dfac5b41",
"incomingViewKey": "ee7d2844f24f69e6b7ac13b9016cdf6ebfd3281ce832bf9aae209485bfc02004",
"outgoingViewKey": "494d3e951b10776159af788756fc79169babd1c44674fd36abcfade121882735",
"publicAddress": "71fb7ef377bbe2d80361b858ab2d8cd2dc526bd5e1591f794e7d213f890d1644",
"createdAt": {
"hash": {
"type": "Buffer",
"data": "base64:R5HXrp+X3xAO8VWOhHctagm0N2I4goP3XG8goyqIqoY="
},
"sequence": 1
},
"scanningEnabled": true,
"proofAuthorizingKey": "b8510ed4d78dab26b05034300b9192410c0f91ebf109c60f9d3261835d5f960d"
},
"head": {
"hash": {
"type": "Buffer",
"data": "base64:R5HXrp+X3xAO8VWOhHctagm0N2I4goP3XG8goyqIqoY="
},
"sequence": 1
}
},
{
"header": {
"sequence": 2,
"previousBlockHash": "4791D7AE9F97DF100EF1558E84772D6A09B43762388283F75C6F20A32A88AA86",
"noteCommitment": {
"type": "Buffer",
"data": "base64:CrdKzR6+2LH4Vt+MAuJNoo7NDeOEBXMeHt9dh/7/zhE="
},
"transactionCommitment": {
"type": "Buffer",
"data": "base64:6anoi2aMrsOrpvlT148T0G5FALnPyYATB1ycah0mQx4="
},
"target": "9282972777491357380673661573939192202192629606981189395159182914949423",
"randomness": "0",
"timestamp": 1717539000204,
"graffiti": "0000000000000000000000000000000000000000000000000000000000000000",
"noteSize": 4,
"work": "0"
},
"transactions": [
{
"type": "Buffer",
"data": "base64:AQAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGzKiP////8AAAAAXW00UnSpuO8qpo2Jyg3B/tpZdqG4VCXnE21y1dO3szKRW1IX+QU5tTiRscWoIIrLesCowNl+UW+H9Yh9c2f45nHsQ/UJMXrWQuHBc9B+SJ6luZht+E60UMdqZ4AiBwKyWpW8qcPo4W1huZaRjjgYcGA+0Hg0dPCOeEFKyc94wXoZz8eED57unrjvPC76XQJP8MX/15TOEHpxWEpvuprzT6W4lkHbFlDS59bzvWH/ENCnikKBV496LqMVOhiLvxPYChvccj4fOOgSYRLCIhYMS+n5S5XXC4xSI1JlVIuQDOcwsO8orzhg91Lo5Usyygox91+tBlHT5nUutTvPohwJ7xJ/1PnOrxgooYr9izO2BPGLCCdgeshE6k6nOhFoYsULxum0KMGo/tpWqRsKwQPglpenbW/M6IqBQQ2ZdOVoS8l647TznNHsmY6qGgThHkLS2yFqg1F3DDbTvSWXeUlA1pAAMF+TzD96lPWWJxh/UrYytkUjZyW//tKmh+OacfIaXQvCQ4bqO3a1jpQVS3vpe9O5Y+2DDBpdANSt17LPTG0/vuj/aH4E6EIDXjbMl6EWWEySd9l0M+H90qZ5yJq8OxeJj/ckuwkp+H+Qi2YbtMH6zgllwp3k80lyb24gRmlzaCBub3RlIGVuY3J5cHRpb24gbWluZXIga2V5MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwsDGvyh14nM+TXNBMGdVKsRDxztaXSWvmYF5o2hMV46DtRKUv3XCBNq0mybrGxc8eC3YxvrX3YhCRaIVV/n2/CA=="
}
]
}
],
"Wallet shouldDecryptForAccount should return false for an account created after the header": [
{
"value": {
"version": 4,
"id": "11033864-5f47-41eb-b7b5-91b713a63239",
"name": "test",
"spendingKey": "a86f0e2bcca2fabd80d36b0fc5095523f3161e03d179634f2b8a8b0aba30edab",
"viewKey": "117029994f58adefc5f0ec01657d85e6eecbf6171186c493d16454b47d7f132d19992c4b5b8ba70905516f365b9907cfa483649fff11272f6600df2af631c1d3",
"incomingViewKey": "d64cc966ecd93fea10610e78803648f34b2e9d084ea9dd909e4a06b8a126ba07",
"outgoingViewKey": "851ee2cb193f56a66e242c5d2ba4ace7a653fb1d6b11476cc78d98e1e0d3525b",
"publicAddress": "132e02ec40e55f3f0b5e53721f41539e2559c3da3435a4128e2de74cc6ec9bad",
"createdAt": {
"hash": {
"type": "Buffer",
"data": "base64:R5HXrp+X3xAO8VWOhHctagm0N2I4goP3XG8goyqIqoY="
},
"sequence": 1
},
"scanningEnabled": true,
"proofAuthorizingKey": "18813dfc16bf034f84e3213c1e7d10d2f5b86da87d0520e2e063b9c899095409"
},
"head": {
"hash": {
"type": "Buffer",
"data": "base64:R5HXrp+X3xAO8VWOhHctagm0N2I4goP3XG8goyqIqoY="
},
"sequence": 1
}
},
{
"header": {
"sequence": 2,
"previousBlockHash": "4791D7AE9F97DF100EF1558E84772D6A09B43762388283F75C6F20A32A88AA86",
"noteCommitment": {
"type": "Buffer",
"data": "base64:oL6ChZ4Ly5JPu2d4tRTaerDeczEoWTNMR8BPSdlyC18="
},
"transactionCommitment": {
"type": "Buffer",
"data": "base64:7pYycxMVG5LSCil+Dr0/ffdPvPBzSKAsJ0BS7vt6xTc="
},
"target": "9282972777491357380673661573939192202192629606981189395159182914949423",
"randomness": "0",
"timestamp": 1717539002251,
"graffiti": "0000000000000000000000000000000000000000000000000000000000000000",
"noteSize": 4,
"work": "0"
},
"transactions": [
{
"type": "Buffer",
"data": "base64:AQAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGzKiP////8AAAAAQWhZPSMc2rjX9x3Tf9wVm6W3XpdQNa9FrLxztLw4ONG1M+OLlAZ5n0ZrAZnbgrN+/RA+wisQNxN1gmrHoTO9GVFCyCCI0+mPEHK2PfdKhP+o65UGd70/+DCVBgr/b4rLGcKI5lUECt7nulxLkadWfuIjgRxOPUwunu5Z0KK72/oFDtDef3eUguxBTaQWwO4Z5tLhSwHD8ky+btDYX/4nahaXmataGge/xfnc858XyMKkVHE1KMssIWqATqHVz7rjjdNP4ViotOGY+0Y+6evAr9GvA6QYpa+cZ+NyJO0n/7qtx8mYb/+B/kKWggXOQdkv5YSemxqRXCwV+NYJ4LW4YflHA6iH2c1psJWW+p26lYhHPQXwd7XpRT9g2okgsaFZNr1QlrfNx/qG7pRBYYAIvoq1Tj+rWQ+3q8ElHbXDcxLaSLJgRk13O0deztI5l8tN/134hG7ZkXM0fVKfyfZ6ausW1CB4z6Ql+vTrD9k9IFIUv9qHMK2xfZzhSV3ar9cajxK4nqOPJ/73vnJm/knl1bfW5iSZu4cJDq6hbU2bLNx6f2vA4LODEyWUak55wgFel/aJ1BQreaqYK/hmRPsvDz9CCERiKnqIS3zBsMafmjmtvjgyb4OzRElyb24gRmlzaCBub3RlIGVuY3J5cHRpb24gbWluZXIga2V5MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwnmC0egssnuPLB4XCtvfHNXGqdw/xPf3kURrN9kQeTSV3UQJ5XhZnQs79BcZ8FbaF4GhfxspKbm1mAmxC0ku7Ag=="
}
]
}
],
"Wallet shouldDecryptForAccount should return true for an account created at the header": [
{
"value": {
"version": 4,
"id": "22ad26f8-6324-4047-94f6-6320745e7664",
"name": "test",
"spendingKey": "5f65a8c9dc83cafa7c62a9831653e5c14131dae0c217cdc7409835145ceaae3b",
"viewKey": "666f5d9dcadaf6c5395eb11cdea1650879e36783dca34683635e33e6bfc543ce4413114f480e2abcbd0e0910d2fcc37a6b042129458d282dcc3477620c24eb01",
"incomingViewKey": "31b3d71788afbcccdf4e8b1aafaee039bfc41bc768c6d9dc04c1774f671e1106",
"outgoingViewKey": "2f1b93b172f76c3cd8db1e33fbdb4d09ad2f56e53b8756496201f8e69f94cc20",
"publicAddress": "3c0e7e7752ece79518668342353f58c0e2ded73c5f8ff59bab2dc934a650dc5d",
"createdAt": {
"hash": {
"type": "Buffer",
"data": "base64:R5HXrp+X3xAO8VWOhHctagm0N2I4goP3XG8goyqIqoY="
},
"sequence": 1
},
"scanningEnabled": true,
"proofAuthorizingKey": "a09f3fc03ef8e59fc4b7f4e5c90f920ca113ccb6572761da439cbb0bbf6cce0d"
},
"head": {
"hash": {
"type": "Buffer",
"data": "base64:R5HXrp+X3xAO8VWOhHctagm0N2I4goP3XG8goyqIqoY="
},
"sequence": 1
}
},
{
"header": {
"sequence": 2,
"previousBlockHash": "4791D7AE9F97DF100EF1558E84772D6A09B43762388283F75C6F20A32A88AA86",
"noteCommitment": {
"type": "Buffer",
"data": "base64:neId5as8nWnh1dkeNwfT60oMa8Eimkjep3sqjDz35Ew="
},
"transactionCommitment": {
"type": "Buffer",
"data": "base64:xfYXQYm39V4hSkYFeMAWOI25Kw5iUTCY3bRCmb+6D88="
},
"target": "9282972777491357380673661573939192202192629606981189395159182914949423",
"randomness": "0",
"timestamp": 1717539004596,
"graffiti": "0000000000000000000000000000000000000000000000000000000000000000",
"noteSize": 4,
"work": "0"
},
"transactions": [
{
"type": "Buffer",
"data": "base64:AQAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGzKiP////8AAAAAQAvre+kQkIaCW7kQ1/ZTGhm1BlX0yfJDob4ZNUEVx7OYjqwI9S9DEnnPsw4Ui6sbYbhQ7UK96yCy7MrcLvTogCAVEcpAxvhwSh6KN9aHglavTbp2dovF3LzFHVKjwM6W54QY1/guZlg9jsf9vJq2to2F6KIj0iupDgtVWZL5ZykMv1/4c5IhCAbFgxCbbmfwn0VHec7qsvoID+NTnxbozPPgDQuB7ymZrAafEj0zHLOuSpk6bIHUYHoTyINvdI82QcfNpGVI4j3bwyQoiHYoOWNjBsnUa4Fzv3L7uFAQ1djs8Z1eH8W1056B/xMzTf8MZUbA8s2DjrXdM4CSRubuihtUBdtzNyUXhCVDbEprbHLiehM4RAwbjqo2B8WcLPxxRsezfH54n+iIo60PEnjm1/eynKLAB2cBzJwUTnb3uzfSIb2M/lJ3S6RTXWKdIlZgKqdgTcEFTil9l8/5CV+kuLnKiUvvd0tzf3UxXIdgsyEsat27IRfRTRYAbhI0fWbIRUvy8x7dpWO2sfCEHIJrITqsk+bdztvywVrEeLkhewdJ6PrX+6j5M8Vr9Vu8iS5lLbSRUCqDwNTaTnRkASmqeTUcPzGiVQbMmt5UhSE+O/ail/Uh7rDqpklyb24gRmlzaCBub3RlIGVuY3J5cHRpb24gbWluZXIga2V5MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwyocN2WaEeJlxznepvq5LKiCOcApaZIhLhZNlyTGgi4TQZpRqPbpTMB8/aTS7bD7ES+29kxkULU4fhbyekZinDA=="
}
]
}
],
"Wallet scan should scan until the chain head": [
{
"value": {
Expand Down
50 changes: 0 additions & 50 deletions ironfish/src/wallet/wallet.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2689,56 +2689,6 @@ describe('Wallet', () => {
})
})

describe('shouldDecryptForAccount', () => {
it('should return true for an account with null createdAt', async () => {
const { node } = nodeTest

const account = await useAccountFixture(node.wallet)

await account.updateCreatedAt(null)

const block = await useMinerBlockFixture(node.chain, 2)

expect(node.wallet.shouldDecryptForAccount(block.header, account)).toBe(true)
})

it('should return true for an account with createdAt earlier than the header', async () => {
const { node } = nodeTest

const account = await useAccountFixture(node.wallet)

await account.updateCreatedAt({ hash: Buffer.alloc(32), sequence: 1 })

const block = await useMinerBlockFixture(node.chain, 2)

expect(node.wallet.shouldDecryptForAccount(block.header, account)).toBe(true)
})

it('should return false for an account created after the header', async () => {
const { node } = nodeTest

const account = await useAccountFixture(node.wallet)

await account.updateCreatedAt({ hash: Buffer.alloc(32), sequence: 3 })

const block = await useMinerBlockFixture(node.chain, 2)

expect(node.wallet.shouldDecryptForAccount(block.header, account)).toBe(false)
})

it('should return true for an account created at the header', async () => {
const { node } = nodeTest

const account = await useAccountFixture(node.wallet)

const block = await useMinerBlockFixture(node.chain, 2)

await account.updateCreatedAt(block.header)

expect(node.wallet.shouldDecryptForAccount(block.header, account)).toBe(true)
})
})

describe('encrypt', () => {
it('saves encrypted blobs to disk and updates the wallet account fields', async () => {
const { node } = nodeTest
Expand Down
12 changes: 0 additions & 12 deletions ironfish/src/wallet/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -508,18 +508,6 @@ export class Wallet {
})
}

shouldDecryptForAccount(blockHeader: BlockHeader, account: Account): boolean {
if (account.createdAt === null) {
return true
}

if (account.createdAt.sequence > blockHeader.sequence) {
return false
}

return true
}

private async connectBlockTransactions(
blockHeader: BlockHeader,
transactions: Array<{ transaction: Transaction; decryptedNotes: Array<DecryptedNote> }>,
Expand Down