Comments (6)
problem
unable to complete cross contract call tutorial due to upper limit on size of number that can be passed to a smart contract function call via nearlib
detail
recently @evgenykuzyakov submitted to Slack #general
(see line 72
in main.js
) an example of increasing the amount of gas submitted to 9.9 NEAR when invoking a function call. This seems to work find as a passthrough value since no checks are made in nearlib
on the size of the number, it goes directly to nearcore
. The example works fine.
But since we're using BN.js
in nearlib
we're limited by this assertion:
assert(number < 0x20000000000000); // 2 ^ 53 (unsafe)
This line limits us to
9007199254740991
, which is much smaller than
99000000000000000000
suggested by the working example linked above.
Transaction 6fci1ciicWLM7JFcdZVDWaDXtJpzMScvvA6GmEuLPTZc failed. Exceeded the prepaid gas
reproduction
-
run the test
-
note error Transaction failed. Exceeded the prepaid gas.
-
edit the value in
src/test.js
line36
by incrementing the gas passed as an argument tocontract.calculate()
from
9007199254740991 to
9007199254740992 -
run the test
-
note error
Error: Assertion failed
coming from the assertion on this line in BN.js (one of ournearlib
dependencies, line3204
)
Error: Assertion failed
at assert (https://cdn.jsdelivr.net/npm/[email protected]/dist/nearlib.js:3082:21)
at BN._initNumber (https://cdn.jsdelivr.net/npm/[email protected]/dist/nearlib.js:3204:7)
from near-api-js.
@bowenwang1996 Is the max amount of gas allowed for function calls a constant?
from near-api-js.
yes
from near-api-js.
But since we're using BN.js in nearlib we're limited by this assertion:
assert(number < 0x20000000000000); // 2 ^ 53 (unsafe)
we aren't, just need to pass number as decimal string, i.e. new BN("99000000000000000000")
from near-api-js.
we aren't, just need to pass number as decimal string, i.e.
new BN("99000000000000000000")
@vgrichina oh jeez π€¦ββ
from near-api-js.
@vgrichina -- just thinking about this again now. BN
is available in a JS context but this number is being passed to ContractPromise.create
in an AssemblyScript context. unfortunately i'll have to revisit this more carefully after retracing my steps since I couldn't easily reproduce the problem I experienced before
from near-api-js.
Related Issues (20)
- Get result of an execution plan
- Rework 'accounts' package tests due to removal of top-level account creation functionality
- functionCall arguments formated in Json only HOT 28
- The `wallet.requestSignIn` stopped working on v3.0.0 HOT 2
- Replace crypto-browserify with another library
- Error: Length of buffer does not match length of ASN.1 sequence HOT 31
- Error: Unable to resolve module http from ./node_modules/@near-js/providers/lib/fetch.js http could not be found within the project HOT 2
- Get correct publicKey from biometric getKeys using indexer HOT 1
- Support nearcore 1.37 HOT 1
- [Error] createAccount don't work on testnet. HOT 8
- How to get the account balance based on a particular block or date HOT 4
- SignedDelegate is not working
- Biometric createKey failing with Bitwarden password manager "expected βidβ or βrawIdβ field" HOT 6
- Passkeys/webauthn popup not triggering in Chrome HOT 11
- Account.sendMoney transaction execution level
- Updating RPC error schema HOT 2
- yarn + latest wallet selector + latest near-api-js == error HOT 6
- Error sending signed transaction with v4.0.3 HOT 5
- `provider.sendTransaction(signedTx)` always fails for FailoverRpcProvider HOT 1
- decodedTransaction.publicKey.toString() returns [object Object] HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from near-api-js.