Code Monkey home page Code Monkey logo

Comments (9)

cedriking avatar cedriking commented on May 22, 2024 2

Hey @Retamogordo , what @fuadop did here is to set the fee at the default from mainnet. Which will give the same fee calculation for 0 bytes.

On mainnet, after a couple of bytes, the fees are completely dynamic, based on many factors that we cannot recreate on arlocal since there's no competition while mining, limits of txs per blocks, etc.

Hope this helps answer why it's different. The fee should be calculated from the arlocal endpoint /price/:bytes.

from arlocal.

fuadop avatar fuadop commented on May 22, 2024 1

Sure !, A PR has been raised on #127. I'll be sure to notify you when npm gets updated with this change.

from arlocal.

fuadop avatar fuadop commented on May 22, 2024

Hey @Retamogordo 👋
This is currently outdated, the latest arlocal version uses calculation based on https://arweavefees.com

from arlocal.

Retamogordo avatar Retamogordo commented on May 22, 2024

Hi, thanks.
I'm still confused. This code is still there, I can see it on the latest version of transactions.ts.
And another thing (possibly not related to the former one) is that price requests return different values depending on what provider is queried, e.g.:
https://arweave.dev/price/400 => returns 65595508 (plain format)
http://localhost:1984/price/400 => returns 26238203 (json)

from arlocal.

Retamogordo avatar Retamogordo commented on May 22, 2024

At first glance (I forked the repo today):
in app.ts:
quering price uses this:
this.router.get('/price/:bytes/:addy?', async (ctx) => (ctx.body = (+ctx.params.bytes / 1000) * 65595508));

while post transaction code uses another formula to check if balance is sufficient:
async function txPostRoute(ctx: Router.RouterContext) { .... const calculatedReward = +(data.data_size || '0') * 1965132; if (!wallet || wallet.balance < calculatedReward) { ctx.status = 410; ctx.body = { code: 410, msg: "You don't have enough tokens" }; return; }

So my tx fails due to insufficient balance, despite I airdrop winston according to price query.

}

from arlocal.

fuadop avatar fuadop commented on May 22, 2024

I see @Retamogordo
This is a bug! Thank you very much for noticing this. A fix would be made for this soon!🙏

from arlocal.

Retamogordo avatar Retamogordo commented on May 22, 2024

Ouch..
So could you somehow inform me as soon as it is fixed ? I mean when it is ready for install at npm.
Thanks a lot.

from arlocal.

Retamogordo avatar Retamogordo commented on May 22, 2024

Hi, it's me again,
I see that the fix is merged, so query results must be consistent.
There is one thing I still do not catch, though.
On https://arweavefees.com/ I notice that they use a kind of step function for fee calculations,
namely I get the same results for data sizes of, let us say: 400 bytes and 1000 bytes or 4000 bytes, which is 64958659 winston.
Contrary to that ArLocal uses a linear function on data size for fee calc, so for 400 bytes I get 28402855 winston.
So I still observe a certain inconsistency of the two approaches.

from arlocal.

Retamogordo avatar Retamogordo commented on May 22, 2024

Cool, thank you.

from arlocal.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.