Skip to content

Commit

Permalink
Merge pull request #26 from algorandfoundation/refactor-util
Browse files Browse the repository at this point in the history
refactor: reduce test run time, remove extra util methods
  • Loading branch information
boblat authored Jan 3, 2025
2 parents dafba04 + db3c627 commit 9490b44
Show file tree
Hide file tree
Showing 23 changed files with 103 additions and 113 deletions.
5 changes: 2 additions & 3 deletions examples/htlc-logicsig/signature.algo.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { Account, Bytes, Global, LogicSig, op, TransactionType, Txn, Uint64, uint64 } from '@algorandfoundation/algorand-typescript'
import algosdk from 'algosdk'

export default class HashedTimeLockedLogicSig extends LogicSig {
program(): boolean | uint64 {
// Participants
const sellerAddress = Bytes(algosdk.decodeAddress('6ZHGHH5Z5CTPCF5WCESXMGRSVK7QJETR63M3NY5FJCUYDHO57VTCMJOBGY').publicKey)
const buyerAddress = Bytes(algosdk.decodeAddress('7Z5PWO2C6LFNQFGHWKSK5H47IQP5OJW2M3HA2QPXTY3WTNP5NU2MHBW27M').publicKey)
const sellerAddress = Bytes.fromBase32('6ZHGHH5Z5CTPCF5WCESXMGRSVK7QJETR63M3NY5FJCUYDHO57VTC')
const buyerAddress = Bytes.fromBase32('7Z5PWO2C6LFNQFGHWKSK5H47IQP5OJW2M3HA2QPXTY3WTNP5NU2M')
const seller = Account(sellerAddress)
const buyer = Account(buyerAddress)

Expand Down
6 changes: 2 additions & 4 deletions examples/htlc-logicsig/signature.spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { Account, Bytes } from '@algorandfoundation/algorand-typescript'
import { TestExecutionContext } from '@algorandfoundation/algorand-typescript-testing'
import algosdk from 'algosdk'
import { afterEach, describe, expect, it } from 'vitest'
import HashedTimeLockedLogicSig from './signature.algo'

const ZERO_ADDRESS_B32 = 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ'
const ZERO_ADDRESS = Bytes.fromBase32(ZERO_ADDRESS_B32)
const ZERO_ADDRESS = Bytes.fromBase32('AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA')

describe('HTLC LogicSig', () => {
const ctx = new TestExecutionContext()
Expand All @@ -15,7 +13,7 @@ describe('HTLC LogicSig', () => {
})

it('seller receives payment if correct secret is provided', () => {
const receiverAddress = Bytes(algosdk.decodeAddress('6ZHGHH5Z5CTPCF5WCESXMGRSVK7QJETR63M3NY5FJCUYDHO57VTCMJOBGY').publicKey)
const receiverAddress = Bytes.fromBase32('6ZHGHH5Z5CTPCF5WCESXMGRSVK7QJETR63M3NY5FJCUYDHO57VTC')
ctx.txn
.createScope([
ctx.any.txn.payment({
Expand Down
9 changes: 6 additions & 3 deletions examples/rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@ import { puyaTsTransformer } from '../src/test-transformer'

const config: RollupOptions = {
input: [
'examples/auction/contract.algo.ts',
'examples/calculator/contract.algo.ts',
'examples/hello-world-abi/contract.algo.ts',
'examples/hello-world/contract.algo.ts',
'examples/auction/contract.algo.ts',
'examples/voting/contract.algo.ts',
'examples/htlc-logicsig/signature.algo.ts',
'examples/precompiled/contract.algo.ts',
'examples/scratch-storage/contract.algo.ts',
'examples/simple-voting/contract.algo.ts',
'examples/tealscript/example.algo.ts',
'examples/voting/contract.algo.ts',
'examples/zk-whitelist/contract.algo.ts',
'examples/precompiled/contract.algo.ts',
],
output: [
{
Expand Down
3 changes: 1 addition & 2 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ export const DEFAULT_GLOBAL_GENESIS_HASH = Bytes(
)

// algorand encoded address of 32 zero bytes
export const ZERO_ADDRESS_B32 = 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ'
export const ZERO_ADDRESS = Bytes.fromBase32(ZERO_ADDRESS_B32)
export const ZERO_ADDRESS = Bytes.fromBase32('AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA')

/**
"\x09" # pragma version 9
Expand Down
2 changes: 1 addition & 1 deletion src/impl/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,6 @@ export class AccountCls extends BytesBackedCls implements Account {
if (assetOrApp instanceof ApplicationCls) {
return this.data.optedApplications.has(asUint64Cls(assetOrApp.id).asBigInt())
}
throw new internal.errors.InternalError('Invalid argument type. Must be an `algopy.Asset` or `algopy.Application` instance.')
throw new internal.errors.InternalError('Invalid argument type. Must be an `Asset` or `Application` instance.')
}
}
2 changes: 1 addition & 1 deletion src/impl/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const getGlobalData = (): GlobalData => {
}

const getMissingValueErrorMessage = (name: keyof GlobalData) =>
`'algopy.Global' object has no value set for attribute named '${name}'. Use \`context.ledger.patchGlobalData({${name}: your_value})\` to set the value in your test setup."`
`'Global' object has no value set for attribute named '${name}'. Use \`context.ledger.patchGlobalData({${name}: your_value})\` to set the value in your test setup."`

export const Global: internal.opTypes.GlobalType = {
/**
Expand Down
13 changes: 5 additions & 8 deletions src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,18 @@ export const asBigInt = (v: internal.primitives.StubUint64Compat): bigint => asU

export const asNumber = (v: internal.primitives.StubUint64Compat): number => asUint64Cls(v).asNumber()

export function extractGenericTypeArgs(t: string): string[] {
const match = t.match(/<(.*)>/)
if (!match) return []
return match[1].split(',').map((x) => x.trim())
}

export const asUint64Cls = (val: internal.primitives.StubUint64Compat) => internal.primitives.Uint64Cls.fromCompat(val)

export const asBigUintCls = (val: internal.primitives.StubBigUintCompat) => internal.primitives.BigUintCls.fromCompat(val)
export const asBigUintCls = (val: internal.primitives.StubBigUintCompat | Uint8Array) =>
internal.primitives.BigUintCls.fromCompat(
val instanceof Uint8Array ? asBytes(val) : Array.isArray(val) ? asBytes(new Uint8Array(val)) : val,
)

export const asBytesCls = (val: internal.primitives.StubBytesCompat | Uint8Array) => internal.primitives.BytesCls.fromCompat(val)

export const asUint64 = (val: internal.primitives.StubUint64Compat) => asUint64Cls(val).asAlgoTs()

export const asBigUint = (val: internal.primitives.StubBigUintCompat) => asBigUintCls(val).asAlgoTs()
export const asBigUint = (val: internal.primitives.StubBigUintCompat | Uint8Array) => asBigUintCls(val).asAlgoTs()

export const asBytes = (val: internal.primitives.StubBytesCompat | Uint8Array) => asBytesCls(val).asAlgoTs()

Expand Down
3 changes: 1 addition & 2 deletions tests/arc4/address.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import { TestExecutionContext } from '@algorandfoundation/algorand-typescript-te
import { Address, interpretAsArc4 } from '@algorandfoundation/algorand-typescript/arc4'
import { afterEach, describe, expect, test } from 'vitest'
import { ABI_RETURN_VALUE_LOG_PREFIX } from '../../src/constants'
import { encodeAddress } from '../../src/util'
import { asUint8Array } from '../util'
import { asUint8Array, encodeAddress } from '../../src/util'

const abiTypeString = 'address'
const testData = [
Expand Down
2 changes: 1 addition & 1 deletion tests/arc4/bool.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { TestExecutionContext } from '@algorandfoundation/algorand-typescript-te
import { Bool, interpretAsArc4 } from '@algorandfoundation/algorand-typescript/arc4'
import { afterEach, describe, expect, test } from 'vitest'
import { ABI_RETURN_VALUE_LOG_PREFIX } from '../../src/constants'
import { asUint8Array } from '../../src/util'
import appSpecJson from '../artifacts/arc4-primitive-ops/data/Arc4PrimitiveOpsContract.arc32.json'
import { getAlgorandAppClient, getAvmResult } from '../avm-invoker'
import { asUint8Array } from '../util'

describe('arc4.Bool', async () => {
const appClient = await getAlgorandAppClient(appSpecJson as AppSpec)
Expand Down
3 changes: 1 addition & 2 deletions tests/arc4/byte.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ import { Byte, interpretAsArc4 } from '@algorandfoundation/algorand-typescript/a
import { encodingUtil } from '@algorandfoundation/puya-ts'
import { afterEach, describe, expect, it, test } from 'vitest'
import { ABI_RETURN_VALUE_LOG_PREFIX, MAX_UINT64 } from '../../src/constants'
import { asBigUintCls } from '../../src/util'
import { asBigUintCls, asUint8Array } from '../../src/util'
import appSpecJson from '../artifacts/arc4-primitive-ops/data/Arc4PrimitiveOpsContract.arc32.json'
import { getAlgorandAppClient, getAvmResult } from '../avm-invoker'
import { asUint8Array } from '../util'

const invalidBytesLengthError = 'byte string must be 1 byte long'
describe('arc4.Byte', async () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/arc4/str.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { interpretAsArc4, Str } from '@algorandfoundation/algorand-typescript/ar
import { encodingUtil } from '@algorandfoundation/puya-ts'
import { afterEach, describe, expect, test } from 'vitest'
import { ABI_RETURN_VALUE_LOG_PREFIX, MAX_LOG_SIZE } from '../../src/constants'
import { asUint8Array } from '../../src/util'
import appSpecJson from '../artifacts/arc4-primitive-ops/data/Arc4PrimitiveOpsContract.arc32.json'
import { getAlgorandAppClient, getAvmResult } from '../avm-invoker'
import { asUint8Array } from '../util'

describe('arc4.Str', async () => {
const appClient = await getAlgorandAppClient(appSpecJson as AppSpec)
Expand Down
3 changes: 1 addition & 2 deletions tests/arc4/uintn.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ import { BitSize, interpretAsArc4, UintN, UintN16, UintN256, UintN32, UintN64, U
import { encodingUtil } from '@algorandfoundation/puya-ts'
import { afterEach, describe, expect, it, test } from 'vitest'
import { ABI_RETURN_VALUE_LOG_PREFIX, MAX_UINT512, MAX_UINT64 } from '../../src/constants'
import { asBigUintCls } from '../../src/util'
import { asBigUintCls, asUint8Array } from '../../src/util'
import appSpecJson from '../artifacts/arc4-primitive-ops/data/Arc4PrimitiveOpsContract.arc32.json'
import { getAlgorandAppClient, getAvmResult } from '../avm-invoker'
import { asUint8Array } from '../util'

const invalidBytesLengthError = (length: number) => `byte string must correspond to a uint${length}`
describe('arc4.UintN', async () => {
Expand Down
1 change: 0 additions & 1 deletion tests/avm-invoker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ export const generateAVMTestAccount = async (): Promise<ReturnType<algokit.Algor
}

export const generateTestAccount = async (): Promise<Account> => {
// const account = generateAccount()
const account = await generateAVMTestAccount()
return Account(Bytes.fromBase32(account.addr.toString()))
}
Expand Down
4 changes: 2 additions & 2 deletions tests/crypto-op-codes.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import { afterEach, describe, expect, it, Mock, test, vi } from 'vitest'
import { TestExecutionContext } from '../src'
import { LOGIC_DATA_PREFIX, MAX_BYTES_SIZE, PROGRAM_TAG } from '../src/constants'
import * as op from '../src/impl/crypto'
import { conactUint8Arrays, decodePublicKey } from '../src/util'
import { asUint8Array, conactUint8Arrays, decodePublicKey } from '../src/util'
import appSpecJson from './artifacts/crypto-ops/data/CryptoOpsContract.arc32.json'
import { generateAVMTestAccount, getAlgorandAppClientWithApp, getAvmResult } from './avm-invoker'
import { asUint8Array, getPaddedBytes } from './util'
import { getPaddedBytes } from './util'

const MAX_ARG_LEN = 2048
const curveMap = {
Expand Down
2 changes: 1 addition & 1 deletion tests/global-state-arc4-values.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import {
import { Address, ARC4Encoded, BitSize, Bool, Byte, DynamicBytes, Str, UintN } from '@algorandfoundation/algorand-typescript/arc4'
import { afterEach, describe, expect, test } from 'vitest'
import { DeliberateAny, FunctionKeys } from '../src/typescript-helpers'
import { asUint8Array } from '../src/util'
import { GlobalStateContract } from './artifacts/state-ops/contract.algo'
import arc4AppGlobalAppSpecJson from './artifacts/state-ops/data/GlobalStateContract.arc32.json'
import { getAlgorandAppClient, getAvmResult, getLocalNetDefaultAccount } from './avm-invoker'
import { asUint8Array } from './util'

describe('ARC4 AppGlobal values', async () => {
const appClient = await getAlgorandAppClient(arc4AppGlobalAppSpecJson as AppSpec)
Expand Down
3 changes: 1 addition & 2 deletions tests/log.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@ import {
import { afterEach, describe, expect, it } from 'vitest'
import { MAX_UINT512, MAX_UINT64 } from '../src/constants'
import { ApplicationTransaction } from '../src/impl/transactions'
import { asBigUint, asBigUintCls } from '../src/util'
import { asBigUint, asBigUintCls, asUint8Array } from '../src/util'
import { PrimitiveOpsContract } from './artifacts/primitive-ops/contract.algo'
import appSpecJson from './artifacts/primitive-ops/data/PrimitiveOpsContract.arc32.json'
import { getAlgorandAppClient, getAvmResultLog } from './avm-invoker'
import { asUint8Array } from './util'

describe('log', async () => {
const appClient = await getAlgorandAppClient(appSpecJson as AppSpec)
Expand Down
33 changes: 15 additions & 18 deletions tests/primitives/biguint.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@ import type { biguint } from '@algorandfoundation/algorand-typescript'
import { BigUint, Bytes, internal, Uint64 } from '@algorandfoundation/algorand-typescript'
import { describe, expect, it } from 'vitest'
import { BIGUINT_OVERFLOW_UNDERFLOW_MESSAGE, MAX_UINT512, MAX_UINT64 } from '../../src/constants'
import { asUint64 } from '../../src/util'
import { asBigUint, asUint64 } from '../../src/util'
import appSpecJson from '../artifacts/primitive-ops/data/PrimitiveOpsContract.arc32.json'
import { getAlgorandAppClient, getAvmResult, getAvmResultRaw } from '../avm-invoker'
import { abiAsBytes } from '../util'

const asBigUint = (val: bigint | number) => (typeof val === 'bigint' ? BigUint(val) : BigUint(val))

describe('BigUint', async () => {
const appClient = await getAlgorandAppClient(appSpecJson as AppSpec)
Expand Down Expand Up @@ -176,7 +173,7 @@ describe('BigUint', async () => {
const bytesA = internal.encodingUtil.bigIntToUint8Array(bigUintA.valueOf())
const bytesB = internal.encodingUtil.bigIntToUint8Array(bigUintB.valueOf())

const avmResult = BigUint(abiAsBytes(await getAvmResult({ appClient }, 'verify_biguint_add', bytesA, bytesB)))
const avmResult = asBigUint(await getAvmResult<Uint8Array>({ appClient }, 'verify_biguint_add', bytesA, bytesB))

let result = bigUintA + bigUintB
expect(result, `for values: ${a}, ${b}`).toEqual(avmResult)
Expand All @@ -200,7 +197,7 @@ describe('BigUint', async () => {
const bytesA = internal.encodingUtil.bigIntToUint8Array(bigUintA.valueOf())
const bytesB = internal.encodingUtil.bigIntToUint8Array(bigUintB.valueOf())

const avmResult = BigUint(abiAsBytes(await getAvmResult({ appClient }, 'verify_biguint_add', bytesA, bytesB)))
const avmResult = asBigUint(await getAvmResult<Uint8Array>({ appClient }, 'verify_biguint_add', bytesA, bytesB))

let result = bigUintA + bigUintB
expect(result, `for values: ${a}, ${b}`).toEqual(avmResult)
Expand Down Expand Up @@ -254,7 +251,7 @@ describe('BigUint', async () => {
const uint64B = Uint64(b)
const bytesA = internal.encodingUtil.bigIntToUint8Array(bigUintA.valueOf())

const avmResult = BigUint(abiAsBytes(await getAvmResult({ appClient }, 'verify_biguint_add_uint64', bytesA, b)))
const avmResult = asBigUint(await getAvmResult<Uint8Array>({ appClient }, 'verify_biguint_add_uint64', bytesA, b))

let result = bigUintA + BigUint(uint64B)
expect(result, `for values: ${a}, ${b}`).toEqual(avmResult)
Expand Down Expand Up @@ -283,7 +280,7 @@ describe('BigUint', async () => {
const bytesA = internal.encodingUtil.bigIntToUint8Array(bigUintA.valueOf())
const bytesB = internal.encodingUtil.bigIntToUint8Array(bigUintB.valueOf())

const avmResult = BigUint(abiAsBytes(await getAvmResult({ appClient }, 'verify_biguint_sub', bytesA, bytesB)))
const avmResult = asBigUint(await getAvmResult<Uint8Array>({ appClient }, 'verify_biguint_sub', bytesA, bytesB))

let result = bigUintA - bigUintB
expect(result, `for values: ${a}, ${b}`).toEqual(avmResult)
Expand Down Expand Up @@ -353,7 +350,7 @@ describe('BigUint', async () => {
const uint64B = Uint64(b)
const bytesA = internal.encodingUtil.bigIntToUint8Array(bigUintA.valueOf())

const avmResult = BigUint(abiAsBytes(await getAvmResult({ appClient }, 'verify_biguint_sub_uint64', bytesA, b)))
const avmResult = asBigUint(await getAvmResult<Uint8Array>({ appClient }, 'verify_biguint_sub_uint64', bytesA, b))

const result = bigUintA - BigUint(uint64B)
expect(result, `for values: ${a}, ${b}`).toEqual(avmResult)
Expand All @@ -378,7 +375,7 @@ describe('BigUint', async () => {
const bytesA = internal.encodingUtil.bigIntToUint8Array(bigUintA.valueOf())
const bytesB = internal.encodingUtil.bigIntToUint8Array(bigUintB.valueOf())

const avmResult = BigUint(abiAsBytes(await getAvmResult({ appClient }, 'verify_biguint_mul', bytesA, bytesB)))
const avmResult = asBigUint(await getAvmResult<Uint8Array>({ appClient }, 'verify_biguint_mul', bytesA, bytesB))

let result = bigUintA * bigUintB
expect(result, `for values: ${a}, ${b}`).toEqual(avmResult)
Expand Down Expand Up @@ -406,7 +403,7 @@ describe('BigUint', async () => {
const bytesA = internal.encodingUtil.bigIntToUint8Array(bigUintA.valueOf())
const bytesB = internal.encodingUtil.bigIntToUint8Array(bigUintB.valueOf())

const avmResult = BigUint(abiAsBytes(await getAvmResult({ appClient }, 'verify_biguint_mul', bytesA, bytesB)))
const avmResult = asBigUint(await getAvmResult<Uint8Array>({ appClient }, 'verify_biguint_mul', bytesA, bytesB))

let result = bigUintA * bigUintB
expect(result, `for values: ${a}, ${b}`).toEqual(avmResult)
Expand Down Expand Up @@ -461,7 +458,7 @@ describe('BigUint', async () => {
const uint64B = asUint64(b)
const bytesA = internal.encodingUtil.bigIntToUint8Array(bigUintA.valueOf())

const avmResult = BigUint(abiAsBytes(await getAvmResult({ appClient }, 'verify_biguint_mul_uint64', bytesA, b)))
const avmResult = asBigUint(await getAvmResult<Uint8Array>({ appClient }, 'verify_biguint_mul_uint64', bytesA, b))

let result = bigUintA * BigUint(uint64B)
expect(result, `for values: ${a}, ${b}`).toEqual(avmResult)
Expand Down Expand Up @@ -489,7 +486,7 @@ describe('BigUint', async () => {
const bytesA = internal.encodingUtil.bigIntToUint8Array(bigUintA.valueOf())
const bytesB = internal.encodingUtil.bigIntToUint8Array(bigUintB.valueOf())

const avmResult = BigUint(abiAsBytes(await getAvmResult({ appClient }, 'verify_biguint_div', bytesA, bytesB)))
const avmResult = asBigUint(await getAvmResult<Uint8Array>({ appClient }, 'verify_biguint_div', bytesA, bytesB))

let result = bigUintA / bigUintB
expect(result, `for values: ${a}, ${b}`).toEqual(avmResult)
Expand Down Expand Up @@ -562,7 +559,7 @@ describe('BigUint', async () => {
const uint64B = asUint64(b)
const bytesA = internal.encodingUtil.bigIntToUint8Array(bigUintA.valueOf())

const avmResult = BigUint(abiAsBytes(await getAvmResult({ appClient }, 'verify_biguint_div_uint64', bytesA, b)))
const avmResult = asBigUint(await getAvmResult<Uint8Array>({ appClient }, 'verify_biguint_div_uint64', bytesA, b))

const result = bigUintA / BigUint(uint64B)
expect(result, `for values: ${a}, ${b}`).toEqual(avmResult)
Expand All @@ -587,7 +584,7 @@ describe('BigUint', async () => {
const bytesA = internal.encodingUtil.bigIntToUint8Array(bigUintA.valueOf())
const bytesB = internal.encodingUtil.bigIntToUint8Array(bigUintB.valueOf())

const avmResult = BigUint(abiAsBytes(await getAvmResult({ appClient }, 'verify_biguint_mod', bytesA, bytesB)))
const avmResult = asBigUint(await getAvmResult<Uint8Array>({ appClient }, 'verify_biguint_mod', bytesA, bytesB))
let result = bigUintA % bigUintB
expect(result, `for values: ${a}, ${b}`).toEqual(avmResult)

Expand Down Expand Up @@ -659,7 +656,7 @@ describe('BigUint', async () => {
const uint64B = asUint64(b)
const bytesA = internal.encodingUtil.bigIntToUint8Array(bigUintA.valueOf())

const avmResult = BigUint(abiAsBytes(await getAvmResult({ appClient }, 'verify_biguint_mod_uint64', bytesA, b)))
const avmResult = asBigUint(await getAvmResult<Uint8Array>({ appClient }, 'verify_biguint_mod_uint64', bytesA, b))
const result = bigUintA % BigUint(uint64B)
expect(result, `for values: ${a}, ${b}`).toEqual(avmResult)

Expand Down Expand Up @@ -708,7 +705,7 @@ describe('BigUint', async () => {
const bytesB = internal.encodingUtil.bigIntToUint8Array(bigUintB.valueOf())

it(`${a} ${operator} ${b}`, async () => {
const avmResult = BigUint(abiAsBytes(await getAvmResult({ appClient }, `verify_biguint_${op}`, bytesA, bytesB)))
const avmResult = asBigUint(await getAvmResult<Uint8Array>({ appClient }, `verify_biguint_${op}`, bytesA, bytesB))
let result = getStubResult(bigUintA, bigUintB)
expect(result, `for values: ${a}, ${b}`).toEqual(avmResult)

Expand Down Expand Up @@ -736,7 +733,7 @@ describe('BigUint', async () => {
const bytesA = internal.encodingUtil.bigIntToUint8Array(bigUintA.valueOf())

it(`${a} ${operator} ${b}`, async () => {
const avmResult = BigUint(abiAsBytes(await getAvmResult({ appClient }, `verify_biguint_${op}_uint64`, bytesA, b)))
const avmResult = asBigUint(await getAvmResult<Uint8Array>({ appClient }, `verify_biguint_${op}_uint64`, bytesA, b))
const result = getStubResult(bigUintA, BigUint(uint64B))
expect(result, `for values: ${a}, ${b}`).toEqual(avmResult)
})
Expand Down
Loading

0 comments on commit 9490b44

Please sign in to comment.