-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
chore: add full abi coder tests #3349
base: master
Are you sure you want to change the base?
Conversation
…m/FuelLabs/fuels-ts into ps/chore/add-full-abi-coder-tests
…m/FuelLabs/fuels-ts into ps/chore/add-full-abi-coder-tests
const EXPECTED_ENUM = EnumWithNative::Pending; | ||
const EXPECTED: StructWithEnumArray = StructWithEnumArray { | ||
a: [EXPECTED_ENUM, EXPECTED_ENUM, EXPECTED_ENUM], | ||
}; | ||
|
||
EXPECTED | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There’s something odd happening here. The types_struct_with_array_of_enums
function is clearly returning a struct containing an array of three EnumWithNative::Pending
values:
const EXPECTED_ENUM = EnumWithNative::Pending;
const EXPECTED: StructWithEnumArray = StructWithEnumArray {
a: [EXPECTED_ENUM, EXPECTED_ENUM, EXPECTED_ENUM],
};
EXPECTED
Based on this, after decoding, we should see the following result:
{ a: ['Pending', 'Pending', 'Pending'] }
However, when the TS SDK decodes the data, the result is:
{ a: ['Pending', 'Checked', 'Pending'] }
At first, this seems like a decoding issue in the TS SDK. But after inspecting the raw receipt ReturnData
, I am under the impression that the data returned itself is inconsistent:
// raw receipt
{
id: '0xa52541ced4559cf68e923e81ffc900d6855994bfabad4dd9f24c4dfea8e4f183',
pc: '44544',
is: '11712',
ptr: '67107840',
digest: '0x639809bc6d63798b4571d10a078c77219a7191b65eb30d8b08415d8631c1dbd9',
len: '24',
receiptType: 'RETURN_DATA',
data: '0x000000000000000100000000000000000000000000000001',
}
At a first glance, it appears to me that the data should be something like:
0x000000000000000100000000000000010000000000000001
Since the 3 enum values being returned are exactly the same.
@nedsalk @petertonysmith94 Do you guys know what is happening here?
@petertonysmith94 I was able to fix and validate many cases here except the following 3:
|
Summary
abi-contract
) that taking in fixed inputs, and returns an expected value.@fuel-ts/abi-coder
.Interface
for our new refactored package with absolute certainty of no regression.toEqualBn
to make it easier to check returned BN values.Couple issues
// @ts-expect-error: Custom matcher 'toEqualBn'
) for now.Checklist