Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Accept number equal to 1 or 0 while checking data type of bool. #629

Merged
merged 1 commit into from
Dec 11, 2019

Conversation

jlamarr22
Copy link
Contributor

Change Description

Change:
For the validation of data type of bool during serialization, additionally accept number which equal to 1 or 0. Closing #624 in favor of this PR due to adding tests and switching base branch to develop.

Reason of the change:
You could see there is a buffer.push(data ? 1 : 0); just below the changed line. It converts all boolean value to 1 or 0.
Hence, if we fetch the payload in an action which is pushed by eosjs before, all boolean fields would become 1 or 0. If we repeat the same payload with the field using value of 1 or 0, it will be invalidated during the check because the check only accept boolean as the data type.

In our latest eosio-explorer required feature, there is a repeat push action feature which depends on the last fetched payload and it will be blocked by the check ( not accepting 1 or 0 ). We need this change in eosjs for us to finish the feature.

API Changes

  • API Changes

Documentation Additions

  • Documentation Additions

@tbfleming
Copy link
Contributor

Note that the "Reason of the change", copied from #624 is nonsensical. The real reason is nodeos's abi_serializer produces 1 and 0 for booleans.

@jlamarr22 jlamarr22 merged commit e2c667e into develop Dec 11, 2019
@jlamarr22 jlamarr22 deleted the accept-1-and-0 branch December 11, 2019 18:02
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants