Skip to content

Commit

Permalink
chore: stop skipping decoding for vectors in Interface.test.ts (#2873)
Browse files Browse the repository at this point in the history
  • Loading branch information
nedsalk authored Aug 1, 2024
1 parent 8b90a28 commit b2e1174
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
4 changes: 4 additions & 0 deletions .changeset/small-lamps-study.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
---

chore: stop skipping decoding for vectors in `Interface.test.ts`
17 changes: 5 additions & 12 deletions packages/abi-coder/test/Interface.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,6 @@ describe('Abi interface', () => {
encodedValue: Uint8Array.from([0, 0, 0, 0, 0, 0, 0, 4, U8_MAX, 0, U8_MAX, U8_MAX]),
},
{
skipDecoding: true,
fn: exhaustiveExamplesInterface.functions.arg_then_vector_u8,
title: '[vector] some arg then u8 vector',
value: [{ a: true, b: U32_MAX }, [U8_MAX, 0, U8_MAX, U8_MAX]],
Expand All @@ -434,7 +433,6 @@ describe('Abi interface', () => {
],
},
{
skipDecoding: true,
fn: exhaustiveExamplesInterface.functions.vector_u8_then_arg,
title: '[vector] Vector u8 and then b256',
value: [[U8_MAX, 0, U8_MAX, U8_MAX], B256_DECODED],
Expand All @@ -444,7 +442,6 @@ describe('Abi interface', () => {
],
},
{
skipDecoding: true,
fn: exhaustiveExamplesInterface.functions.two_u8_vectors,
title: '[vector] two u8 vectors',
value: [
Expand All @@ -457,10 +454,13 @@ describe('Abi interface', () => {
],
},
{
skipDecoding: true,
fn: exhaustiveExamplesInterface.functions.u32_then_three_vectors_u64,
title: '[vector] arg u32 and then three vectors u64',
value: [33, [450, 202, 340], [12, 13, 14], [11, 9]],
decodedTransformer: (decoded: Array<any>) =>
decoded.map((v) =>
Array.isArray(v) ? v.map((bignumber: BN) => bignumber.toNumber()) : v
),
encodedValue: [
Uint8Array.from([0, 0, 0, 33]),
Uint8Array.from([
Expand All @@ -477,7 +477,6 @@ describe('Abi interface', () => {
],
},
{
skipDecoding: true,
fn: exhaustiveExamplesInterface.functions.vector_inside_vector,
title: '[vector] vector inside vector [with offset]',
value: [
Expand Down Expand Up @@ -535,7 +534,6 @@ describe('Abi interface', () => {
offset: 40,
},
{
skipDecoding: true,
fn: exhaustiveExamplesInterface.functions.vector_inside_enum,
title: '[vector] vector inside enum',
value: [
Expand All @@ -555,7 +553,6 @@ describe('Abi interface', () => {
offset: 0,
},
{
skipDecoding: true,
fn: exhaustiveExamplesInterface.functions.vector_inside_struct,
title: '[vector] vector inside struct [with offset]',
value: [
Expand All @@ -579,7 +576,7 @@ describe('Abi interface', () => {
},
])(
'$title: $value',
({ fn, title: _title, value, encodedValue, decodedTransformer, offset, skipDecoding }) => {
({ fn, title: _title, value, encodedValue, decodedTransformer, offset }) => {
const encoded = Array.isArray(value)
? fn.encodeArguments(value)
: fn.encodeArguments([value]);
Expand All @@ -591,10 +588,6 @@ describe('Abi interface', () => {

expect(encoded).toEqual(expectedEncoded);

if (skipDecoding) {
return;
}

let decoded = fn.decodeOutput(expectedEncoded)[0];

if (decodedTransformer) {
Expand Down

0 comments on commit b2e1174

Please sign in to comment.