trufflesuite / truffle

:warning: The Truffle Suite is being sunset. For information on ongoing support, migration options and FAQs, visit the Consensys blog. Thank you for all the support over the years.
https://consensys.io/blog/consensys-announces-the-sunset-of-truffle-and-ganache-and-new-hardhat?utm_source=github&utm_medium=referral&utm_campaign=2023_Sep_truffle-sunset-2023_announcement_
MIT License
14.02k stars 2.32k forks source link

Tezos truffle-contract returns BigNumber instead of BN #2802

Open tcoulter opened 4 years ago

tcoulter commented 4 years ago

In the alphaTez branch, I noticed today that the Tezos version of truffle-contract returns BigNumber objects instead of BN. As a matter of standardizing our output, we should move to BN.

Steps to reproduce:

  1. Get the alphaTez branch and yarn, yarn bootstrap, etc. (referred to as truffle below)
  2. Create a new project using the truffle unbox tezos-example box. Make sure you have all the Tezos requirements (e.g., Docker) installed before continuing.
  3. In the project, fire up truffle console, then run deploy. After that, follow the commands below. You'll see that when reading data from .storage(), we get BigNumber output for integers.
truffle(development)> let instance = await SimpleStorage.deployed()
truffle(development)> await instance.storage()
BigNumber { s: 1, e: 0, c: [ 2 ] }
gnidan commented 4 years ago

@haltman-at asks: do we even use the numberFormat mechanism for Tezos right now?

gnidan commented 4 years ago

These are my take on requirements:

CruzMolina commented 4 years ago

Since Tezos does not currently support views, Tezos contract instances are not hooked up to appropriately utilize the numberFormat mechanism.

Furthermore, the current formatter expects an ABI (methodABI.outputs) and LIGO does not currently provide a ready-made ABI for contracts.

The good(?) news is that because the only "view" we need to handle currently is a storage call, it might not be too difficult to write a michelson json storage number formatter to specifically handle this.

There may be another alternative down the road where Taquito eventually allows us to set their encoder to format numbers as BNs.

haltman-at commented 4 years ago

Ugh, the current formatter expects an ABI? Ugh, I hadn't realized... what a mess. With any luck I'll redo all this before too long, but who knows how long that'll take...

One thing worth noting, we currently support three values for numberFormat: BN, BigNumber, and string.

dvkam commented 2 years ago

Also here, Tezos does support views now.

BearCooder commented 1 year ago

Hello @haltman-at & @fainashalts can you please make a statement as to why Tezos support is not a priority anymore? To be honest it leaves a bad taste after the big announcement od Tezos support in Truffle (Twitter and Blogpost) over two years ago. The funny thing is the support didnt last long, less than a year later Truffle started to ghost all issues and update requests on github or stated to do it later.. why the sudden change back then?

At least make either make it official and announce that you are not supporting Tezos anymore or at least update Tezos Truffle to current protocol standard. I dont know maybe its a failure on the communication side, maybe Truffle @tcoulter and Tezos Foundation @drchrispinnock need to talk but the current state is unfortunate.