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

Move wallet test to wallet.test.ts #4638

Merged
merged 1 commit into from
Jan 30, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -37,68 +37,6 @@
}
}
],
"Transaction throw error if account is not fully synced when creating transaction": [
{
"version": 2,
"id": "d283dbe7-a71c-4924-a565-24cf056a6b24",
"name": "testA",
"spendingKey": "84596b1a609345a27a5f9a3146157361e7fa419d77a6126460327eda18aafc2a",
"viewKey": "f2b58c13a6d8e27de575a37f04dcae3ed612d129b9e139e8630bc276c099e3e147be6b0e67742864ed1481fdd0792acb45334351fbac2129c0522fd1092fa60d",
"incomingViewKey": "c1c7d58affbea89aea6cd493788e75c2b0c4722ee9514345c39508f3450d1e03",
"outgoingViewKey": "79c00a26cbdbac6cf1eb3348830f1e868dc08700ae1f9454909e9b097a26e9c6",
"publicAddress": "11de04f3699b77a994045aaf26fcf1c1e0402a27d5f02bf44b81b683226cc7f0",
"createdAt": {
"hash": {
"type": "Buffer",
"data": "base64:R5HXrp+X3xAO8VWOhHctagm0N2I4goP3XG8goyqIqoY="
},
"sequence": 1
}
},
{
"version": 2,
"id": "51c4cff5-d48c-48d2-bfbf-46aa8e7f4346",
"name": "testB",
"spendingKey": "92d415945ed382e16dc67bcf40c15a60e6b614dde41ad3737ddcc52c92d9b263",
"viewKey": "fb92691173d3c88bbb1e41bfd1cd341b5668b6b492f783f9948cc02c62174e3b3fcec997366022c2698bb7d82b020b999aa14702858bf819d99af955b1c66bb7",
"incomingViewKey": "e55f21def38f409991d28480b050c43e6ac59cb1c63e6e216517521f55ed9e05",
"outgoingViewKey": "138224cf5bdc50eef098cff1b23ea1d3bf1fb542e0717c4a583f3f8dd1ae9087",
"publicAddress": "fa28629adfbf0a24ea976859a4abb2d8be178776d716422cb491274b54349dd8",
"createdAt": {
"hash": {
"type": "Buffer",
"data": "base64:R5HXrp+X3xAO8VWOhHctagm0N2I4goP3XG8goyqIqoY="
},
"sequence": 1
}
},
{
"header": {
"sequence": 2,
"previousBlockHash": "4791D7AE9F97DF100EF1558E84772D6A09B43762388283F75C6F20A32A88AA86",
"noteCommitment": {
"type": "Buffer",
"data": "base64:XMcV9o/QRLNpCLaiKyGwEKmGMNeDdroq+y+h9jD+RlM="
},
"transactionCommitment": {
"type": "Buffer",
"data": "base64:neA9YMRbFYjfrzgJ3nubn9QoyYhl6q4q1lEtI7yGVG8="
},
"target": "9282972777491357380673661573939192202192629606981189395159182914949423",
"randomness": "0",
"timestamp": 1695140654832,
"graffiti": "0000000000000000000000000000000000000000000000000000000000000000",
"noteSize": 4,
"work": "0"
},
"transactions": [
{
"type": "Buffer",
"data": "base64:AgAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGzKiP////8AAAAAUFzRRKUUw8Vbc1ZusHhJrYDmEmGXE0NVlMfxjv4jmpCid7pHJuJymNR8DmAh0mytk21WGoVJU0UWdUcfkNmGJ2bb2qRGsKJ3AWtVqoMR14ugxE6WgucauybLvRvmIWTXXc40Xq9S67C/UeCkpqsgoTkfib6b0P/4sRUWc5UVJtQMPiMzZJGsjP1WVvEKLzil8xX0l0j2CeyNh9BOmyJNYpfMQEDWPn4e3nK6WKEXtvi1FvT/k/PP9sIs/LDt1up4wFSovbGyHyJN+ER6AoF3H1Lwx2XX33i30dMOotVYqg7JPXOzbjK6ycd21cY8v1AVAHDXYHghdHr4wvN0y3X0OexPSKhs3ZzC5H4115U+2CLxYEpzyChcdZm0D1aDxsNuX7P/14q5LNih4/rmxDNZi88GXgrszsIAW6/23TTFlFt9BhQVckU1+R/BpGSzfY13UMj5WHiPGZ7cPADViqcF/1Nb8nEe0ONik6GzoPBFFmpLAtTO6POA6x5T+eNo8Fv4aCZWpGcaMET0zzvySKErXpdN/WtOJufuIe5K3rOYAvY/N6xA6nz0Tb3XTUfrmayd7XfDKwgkYf8vzXlStpJfTU+oq+xLwWopUHWvPCe64u7uyts+Y5jsh0lyb24gRmlzaCBub3RlIGVuY3J5cHRpb24gbWluZXIga2V5MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwvEQbyBC7GVPG1CZLVctTeKm7gfThTdQN9Bly+pdx/uk6bGoAlBcRTCMCGubOr4cxSV6BkyPOHtROKKEeR/m0Bw=="
}
]
}
],
"Transaction check if a transaction is not a miners fee": [
{
"version": 2,
Expand Down Expand Up @@ -244,4 +182,4 @@
"data": "base64:AgIAAAAAAAAAAwAAAAAAAAABAAAAAAAAAAEAAAAAAAAABQAAAAAAAAAKAAAAC3mTTnexuv8GM+i6b/3C1et6tqEStAg/74Ul4by+WMGiaipmlaGCoAHaytSiGvg8ogpXZabo8YaAmfvp8satdeP3IoZ8XUmpPMk4JutaR7qX4teywYW1mVHaX0xKM7EcROEgU3Kdq3zt/S9CqkeFR8QuDxGKaR0tGtZdjVyKNiILAQ8pVVRq+Z1paBIHmxGqo1k4zFhNd1bPOBMQyhwFb+t41ZQMhcmJkMD5PlxDXNGVqG7pey/BCqoWiJEqG33daV9CrXXY69dRAdra0FA8RIELu/+6E7HAlEkE888G0yXhYes2LeOV7Kt394Bk42Sft8ZlXVpJeTR9acckMNDNhLDlSwydmg21DUarHeHJhAWKe1TZnq4x7ZCibK4Lmj8sBgAAABVOGuOBz7eXK7KdmP/1cnboY+jNnjiRlx8ID/wdUAW+5ahnzy7LdFy+XQRjoHvT0eMbhzw7fb2bRw/6M58Q/UqnZA31lbukS4IGCjC/TYSNl1Z7MYatC1ni5cCbxVVgCZE9yK0YQ4ZqcbjHCUkgm+wjQNET5fo8y8YJ2ZCzRDjNNeX2yE5bFb5H+CqAI/2v9LTdKXG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P9LNLg4v/rgLxaFBw=="
}
]
}
}
34 changes: 0 additions & 34 deletions ironfish/src/primitives/transaction.test.slow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
import { Asset } from '@ironfish/rust-nodejs'
import { Assert } from '../assert'
import {
createNodeTest,
useAccountFixture,
Expand Down Expand Up @@ -55,39 +54,6 @@ describe('Transaction', () => {
expect(transactionB.isMinersFee()).toBe(true)
})

it('throw error if account is not fully synced when creating transaction', async () => {
const nodeA = nodeTest.node

// Create an account A
const accountA = await useAccountFixture(nodeA.wallet, 'testA')
const accountB = await useAccountFixture(nodeA.wallet, 'testB')

// Create a block with a miner's fee
const block1 = await useMinerBlockFixture(nodeA.chain, 2, accountA)
await nodeA.chain.addBlock(block1)
await nodeA.wallet.updateHead()
const headhash = await nodeA.wallet.getLatestHeadHash()
Assert.isNotNull(headhash)
// Modify the headhash
headhash[0] = 0
await accountA.updateHead({ hash: headhash, sequence: 2 })

const response = nodeA.wallet.createTransaction({
account: accountA,
outputs: [
{
publicAddress: accountB.publicAddress,
amount: BigInt(1),
memo: '',
assetId: Asset.nativeId(),
},
],
fee: 1n,
expiration: 0,
})
await expect(response).rejects.toThrow(Error)
})

it('check if a transaction is not a miners fee', async () => {
const nodeA = nodeTest.node

Expand Down
105 changes: 105 additions & 0 deletions ironfish/src/wallet/__fixtures__/wallet.test.ts.fixture
Original file line number Diff line number Diff line change
Expand Up @@ -6739,5 +6739,110 @@
"sequence": 3
}
}
],
"Wallet createTransaction throw error if account is not fully synced when creating transaction": [
{
"version": 3,
"id": "b59eda2d-904e-4da3-9512-a0b25611b6a3",
"name": "testA",
"spendingKey": "b99e7690ee81d4f4d612c97d084a86de0c429f8f93a88e3cfea555beb3c422a9",
"viewKey": "ffa9c00e7ec0eb9f011064c3604086437c73e03bf5080d75542e24681c8c0ab910fa16526bc6e8fe3981b4aabe38124db9c05ee9155749df24fd13390b50444b",
"incomingViewKey": "1c1860afd44df75687543f5849bac6989ddba81f44cce9a6722cfba26a2b2703",
"outgoingViewKey": "13199aff517e7ce766b37e5e47b7cc821f5f406727b4ea95d9a808009d27013e",
"publicAddress": "4d443ee12dddd05b5545e37fa81f08610eeb80936e22f9b9f941827636944dac",
"createdAt": {
"hash": {
"type": "Buffer",
"data": "base64:R5HXrp+X3xAO8VWOhHctagm0N2I4goP3XG8goyqIqoY="
},
"sequence": 1
}
},
{
"version": 3,
"id": "3a8c3bd8-e2c5-4192-85d1-83496e6a84e4",
"name": "testB",
"spendingKey": "9826fc36e963313f936f589e7768f819ca171b2c341aa225cd5e40d425c15d96",
"viewKey": "78e7afe54130d3bc2361f4355a35fa5d78f596ea9a288f7eb040ae454fd96aad8a584f8ba43cbc74e18aa0c97ec9a0bd4199a9b3005307c952f4a893864f8213",
"incomingViewKey": "85493e842b596100eb396ca5a725822c2359f01f3074ca67ced32a8754272802",
"outgoingViewKey": "877b98e0a1c99423a7d0f4786be0dcf8df6a61b773d759aaee2e706f67bae7fd",
"publicAddress": "4267eb0d90c2dc6552fd350c23fe006654e170ec480b53e7b5716f433eee6ec9",
"createdAt": {
"hash": {
"type": "Buffer",
"data": "base64:R5HXrp+X3xAO8VWOhHctagm0N2I4goP3XG8goyqIqoY="
},
"sequence": 1
}
},
{
"header": {
"sequence": 2,
"previousBlockHash": "4791D7AE9F97DF100EF1558E84772D6A09B43762388283F75C6F20A32A88AA86",
"noteCommitment": {
"type": "Buffer",
"data": "base64:VwABPj6VtUEEtRbrxY8KypD/vIv1uJuozXMg6fgdOQ8="
},
"transactionCommitment": {
"type": "Buffer",
"data": "base64:WaQM4GYX0tgnsONIw/fa7yH7FtEh+x4TIymLW7fQX6I="
},
"target": "9282972777491357380673661573939192202192629606981189395159182914949423",
"randomness": "0",
"timestamp": 1706643093240,
"graffiti": "0000000000000000000000000000000000000000000000000000000000000000",
"noteSize": 4,
"work": "0"
},
"transactions": [
{
"type": "Buffer",
"data": "base64:AgAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGzKiP////8AAAAAuZYKZJtTsS/3upu+uR8DVKer039byVNm+2mu5OLC5N2vIS+XIdDiTVjI2oSMlwfj8h+pMCdhr2hWlBWdPkLBGHl/czlT6mfJnJz7CEepv2iAyyVpFaW6kTSAF8CxHH9LzgtYOz5J4yAx5tnH48t3dSBtgftW8GXl77IKulty3B4BR7UCswtRK1m8xlhmRFc94uH3fN//sWrNBIhBV/CKbBJo2dCzvb9+0esCOnH3VRC0Y7JCKo5YCKe5F3Iyvi1ie4rfYbAM2XJ6Z6iwHUsHklUBrSb3DQ3XjQ+IQUoCASAKKv6d45E0Mg5Zh6pl7m3UzPeoiIqLpVWf9pMN33bb01Ka0Myw2nxSpuUJTxgJiW1+kMq8aWXGEMiIy/XnNbkWHJ+PwhPExp03T8xqNXsrPUUX4+reysoP1F/SRkActw9xr4WbM4E960eVwwJIx4cGqi4gVi+bl/q+yQF5ODy+ClXuLw0r7YfqM76vsEBSByYBZ7OtVd5SAc+oVny102SD9rXpDDysoT4pN1IROafTALhfh2o8xRdhR3s4QLxPiyshluMtVOrcE/31sl8jNY5X6ktgvO4TB3oRfgF27Oj4sTOK423/NiPe0c9F5MK4BupQBS6XRs/NZElyb24gRmlzaCBub3RlIGVuY3J5cHRpb24gbWluZXIga2V5MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwFMk9fpsDi3bFGFxF32GvemKn51q1cPrsY72fDBrgNx5PGGk2UkbfoI92LnyEWmNqv8bWxd1j/pdCxweM+2p5DQ=="
}
]
},
{
"version": 3,
"id": "d93bfbd3-a04a-4d93-a108-8e0ba35fff1d",
"name": "test",
"spendingKey": "29967705d77d0af5d965ec9f9ebf1e2bc44e2b8930ca752f36cd7d20fbddfa9f",
"viewKey": "cf863e32b2b8dd6b9486a8b01c12583a9c496be87a939f29ee889cd0dd7aafefca1d61d3282857ddb4f4ac238f41066b5af5a3dc3c0af1f4e303ccd0228263a4",
"incomingViewKey": "e9e4826ebdc483056e1974fdb404147d7bc82762cbe4272c6452037dc5c17203",
"outgoingViewKey": "96071b7f56a836372832ba504ae3e6205a2492403f4a290cc584fe70d570b9f5",
"publicAddress": "203ff42455fa235012dedc7ed32432fccff046f7d30377c77bd18d74da77b098",
"createdAt": {
"hash": {
"type": "Buffer",
"data": "base64:R5HXrp+X3xAO8VWOhHctagm0N2I4goP3XG8goyqIqoY="
},
"sequence": 1
}
},
{
"header": {
"sequence": 2,
"previousBlockHash": "4791D7AE9F97DF100EF1558E84772D6A09B43762388283F75C6F20A32A88AA86",
"noteCommitment": {
"type": "Buffer",
"data": "base64:0u/eq8yWgI/gqhzY9uC1NyHoixNTXEqBUDi6xZxI8F4="
},
"transactionCommitment": {
"type": "Buffer",
"data": "base64:7lu9oNB6rV0EZQ0BANOD3P/dAeFVGTZ+33Tzpl7y3L0="
},
"target": "9282972777491357380673661573939192202192629606981189395159182914949423",
"randomness": "0",
"timestamp": 1706643093807,
"graffiti": "0000000000000000000000000000000000000000000000000000000000000000",
"noteSize": 4,
"work": "0"
},
"transactions": [
{
"type": "Buffer",
"data": "base64:AQAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGzKiP////8AAAAAuJ7/6S1e5kfsCaMlroYuJjGoy9gNrftRzAe8lEwoPd6iwHFshCHEOW3ec3md2f+WrblSkMz5bb77TE1IJHz+v2eTRNsxN1Lg3JXJ6ql+wSqtxW+Uz5l5do1WVOkoT0+Utr99viJiUFJPcoLBLGNu9Ld7z7t8GlMXwQepMLQRwAYSMfxpCyUEzsxFF11tswDfSRX7/xnMOTXYyhurfMYb4sqSEqsWJ78qlbY3hNfribmMGHZOKPcnZQi9sGW6t3LGiVdNxX7Sdja1OpMUe+kWWQyNho6BLK93BT+aWNNMJDQIZcsnretyK32qcLFL92r6B7UscVcXr7WLCM1QiPZ4iIyiOct61p+d0Uo3Ov6yqEj5jg4o0u97LvwrHvYWtY5y0xK8l77n36oMGDl7MNyiGmb4f0Y21xr0wjeh7yniV9L0ceuU1KEN3U/sd9AGP6gY+8b8L/48fZ+Aa7BseW9rrVIszIvOl8m5owfyUbnv3NZ3z/KPQhytSVeTucumnT1vCySLT4wDXQ4ZFRmhOuWjxTYQv5iIUl0gISpuEE9jgfFpEPwyaUOzGVGW6YTCUQL3GO/OVNlJO4hVeoqUMwo+znedJwqwOwuP3naEZebh9j8ZQuJf7dGu2Ulyb24gRmlzaCBub3RlIGVuY3J5cHRpb24gbWluZXIga2V5MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwjStaOt2a+kxPBxlPm0nJnBvZm5HHBrwg+QpCX6SHJhGy4p1ru/INeO+XLfO2HAS9OikzxI+rEwVtGbFq0K0WDA=="
}
]
}
]
}
35 changes: 35 additions & 0 deletions ironfish/src/wallet/wallet.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1218,6 +1218,41 @@ describe('Wallet', () => {
expect(reorgVerification.valid).toBe(true)
})

it('throw error if account is not fully synced when creating transaction', async () => {
// Create an account A
const accountA = await useAccountFixture(nodeTest.wallet, 'testA')
const accountB = await useAccountFixture(nodeTest.wallet, 'testB')

// Create a block with a miner's fee
const block = await useMinerBlockFixture(nodeTest.node.chain, 2, accountA)
await nodeTest.chain.addBlock(block)
await nodeTest.wallet.updateHead()

// Modify the headhash
const headhash = await nodeTest.wallet.getLatestHeadHash()
Assert.isNotNull(headhash)
headhash[0] = 0
await accountA.updateHead({ hash: headhash, sequence: 2 })

const response = nodeTest.wallet.createTransaction({
account: accountA,
outputs: [
{
publicAddress: accountB.publicAddress,
amount: BigInt(1),
memo: '',
assetId: Asset.nativeId(),
},
],
fee: 1n,
expiration: 0,
})

await expect(response).rejects.toThrow(
'Your account must finish scanning before sending a transaction.',
)
})

describe('should create transactions with the correct version', () => {
const preservedNodeTest = createNodeTest(true)
let chain: Blockchain
Expand Down
Loading