encointer / encointer-wallet-flutter

Encointer mobile wallet flutter implementation

Home Page:https://encointer.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

faucet claim didn't work for reputable

brenzi opened this issue · comments

NYT bootstrapper EPrZ1Lu6fHW7Fk7mYHxpoiXCLCJKqXR8w2EnyqMJLczrm4R failed to claim

there was an extrinsic error "insufficientBalance"

@clangenb it possible that the faucet claim implementation in the app doesn't recognize NYT to use as fee payment when sending the faucet claim extrinsic (or it uses the wrong token leading to insufficient balance)?
current balances of the mentioned account:

u0qj944rhWE: 8.9592480648918493148 LEU
kygch5kVGq7: 11.90345849166083718775 NYT
19336095210 (19mKSM)

just to verify the obvious: The faucet does still have enough balance:

> nctr-k list-faucets -v
address: 5FhzmY7D6G1yWDj8TRZdmsRUbn351WhHbpBugZybvmVzpMJu
name: PioneerPot
creator: 5ETuxZmGvrVhf1nzubeDBwHxAkshW4EfTbrGX27G1eXx99QD
balance: 7300000000000
drip amount: 100000000000
whitelist: None
> nctr-k balance 5FhzmY7D6G1yWDj8TRZdmsRUbn351WhHbpBugZybvmVzpMJu --all
7300000000000

So, there are 7.3 KSM left in the faucet and the whitelist is null, so any community can drip

Hmm, I can't explain this:

CommunityIdentifier? getTxPaymentAsset(CommunityIdentifier? preferredCid) {
if (preferredCid != null && communityBalance != null && communityBalance! > 0.013) {
return preferredCid;
}
try {
final fallbackCidFmt = account!.balanceEntries.entries.firstWhere((e) => applyDemurrage(e.value)! > 0.013).key;
return CommunityIdentifier.fromFmtString(fallbackCidFmt);
} catch (e, s) {
Log.e(
'${account!.address} does not have sufficient funds in any community. Returning null to pay tx in native token',
'EncointerStore',
s,
);
return null;
}
}

The function is a bit flawed if preferredCid is not equal chosenCid, but we always call it with chosenCid.

So, the observed behaviour is obviously that we try to pay with the native balance (or maybe with an inexistent cid, not sure if this would throw another error). So I think we try to pay in the native currency, which can only happen if:

  • account! throws a null exception
  • .firstWhere((e) => applyDemurrage(e.value)! > 0.13) throws an exception, which can be due to:
    • applyDemurrage is null, but it is initialized upon ap startup and hence non-zero.
    • there is no cid with amount < 0.13 after demurrage, but based on your balance reports, I would be surprised.

Hmm. I have to try to reproduce it.

The only thing that would explain it if this account has never chosen a community before on that network, which can only happen if the account was initialized with another network.

Yes the account may actually have been initialized on gesell

I have found the culprit: insufficient funds is an error we infer from the RPC error. The actual error is bad signature:

[log] [DEBUG]  ==> : [TxPaymentAsset]: Enough funds in preferred cid {"principal":"22.933469182418623","lastUpdate":3523116} to pay tx fee. 
[log] [PRINT]  ==> : Header: {parentHash: 0x76f3a9e72ef612cdf9cb36809ed70d564af2dc0c7ced81233a6009322da99576, number: 0x35c241, stateRoot: 0x6830e926b9ef9ce724dfd5c4921ec62b4ba481a2d1c1a360ee9a0f93b1eea97b, extrinsicsRoot: 0x663a432f50d3550aff46ed67a0941dd53523c160d4d6b73833b3be5bfb3c124b, digest: {logs: [0x066175726120051c7a0800000000, 0x0452505352901022c2625cdf284f807599a6fc4eb30ced1457e21a125fd4b4a580dc29be075ba6d82302, 0x05617572610101549f339edea95271d4e21238bb1a00efffcffcfcbbe19418284c6d023433e731d8be0708cdc0a131d4c7afb9849e20e272062767dc8af1fc3c7d59fbcd34e781]}} 
[log] [PRINT]  ==> : [subscribeNewHeads] Got header: {number: 3523137} 
[log] [PRINT]  ==> : [getBlockHash] params: [3523137] 
[log] [PRINT]  ==> : [getBlockHash] hash: 0x3742f72e93adfb297cb8db5918915dc212db4677042fdaebae29a5c07a54cfa9 
[log] [DEBUG] EncointerApi ==> : api: Getting pendingIssuance for 5Dkgw1dQHWUuaYPjh8tPoayxkQSS67PM3FXh6QGf48zXChBd 
[log] [DEBUG] Api ==> : Dart Rpc Api is connected: true 
[log] [DEBUG] Api ==> : Provider is connected: true 
[log] [ERROR]  ==> : Caught RPC error while sending extrinsics: Exception: {code: 1010, message: Invalid Transaction, data: Transaction has a bad signature} 

This can happen due to a nonce error for instance, but why, I don't know yet.

I will close the issue as this was before the major revamp where we got rid of JS.