NEAR tokens stuck in staking pool - issue with key - how to release? - blockchain

I am currently doing the near stakewars challenge and I have an issue. When I created my staking pool, I guess I used a different key then the key that I had set for my validator key. So my node was kicked off the network. The solution to this problem is supposed to be to update the key, but when I do that I get a permissions error. After trying to figure this out for days I am going to have to just create a new pool and start over. But that kind of sucks because I had 2000 shardnet tokens and what what I would like to do is get them back because the more tokens you have the more likely you are to get a seat.
It seems to me (i could be wrong here) that the issue is the near-cli software does not want to accept a custom key path. I have the private key for the staking pool, so this does not make a lot of sense to me. This is what happens when I try to update the key:
near call luminaryvision.factory.shardnet.near update_staking_key '{"stake_public_key": "ed25519:3EL542RuLDcUDeHXF2dJYfb73nhwAfs9GTXjrknxEqRd"}' --accountId luminaryvision.shardnet.near
"ServerTransactionError: {"index":0,"kind":{"ExecutionError":"Smart contract panicked: panicked at 'assertion failed: `(left == right)`\n left: `AccountId(\"luminaryvision.shardnet.near\")`,\n right: `AccountId(\"luminaryvision\")`: Can only be called by the owner', staking-farm/src/owner.rs:148:9"}}"
Full output here: https://termbin.com/jih0
When I try to unstake, I get a strange error "amount to unstake must be positive". But you can clearly see my staking pool has the near ...
$ near state luminaryvision.factory.shardnet.near
Account luminaryvision.factory.shardnet.near
{
amount: '143620184635167341594709',
block_hash: 'D3spB7dKrRz8tyEsVQFMP1ahqCZ6XGL5cqEKQknVDg66',
block_height: 1932683,
code_hash: 'DD428g9eqLL8fWUxv8QSpVFzyHi1Qd16P8ephYCTmMSZ',
locked: '2048074136681715248000000000',
storage_paid_at: 0,
storage_usage: 346690,
formattedAmount: '0.143620184635167341594709'
}
I tried to give near-cli a custom key path but it still complains about not being able to find the key. The other thought i had was can I just use the key that I used for my stake pool as my validator key so that they match? Someone said i cannot do that, but I don't know why not. Is that an options?
Can anyone help me with this? Would be super appreciated.

Related

AWS Amplify federated google login work properly on browser but dont work on Android

The issues are when I am trying to run federated authentication with the help of amplify auth method on the browser it works fine, but when I try to run it on my mobile.
It throws error No user found when I try to use Auth.currentSession() but the same work on the browser.
tried to search about this type of issue but I found related to ionic-cordova-google-plugin not related to AWS Amplify Federated Login Issue.
Updating the question after closing the question with less debugging information without asking for any information.
This is issues raised in git hub with respect to my problem.
Issue No. 5351 amplify js it's still in open state.
https://github.com/aws-amplify/amplify-js/issues/5351
Another issue 3537 which is still in Open
These two issues has the same scenario like me, I hope its enough debugging information, if more required mention comment instead of closing without notification, it's bullying for a beginner not helping
I fixed the above problem by referring a comment or wrapped around fix.
Link that will take to that comment directly link to comment.
First read the above comment as it will give you overall idea of what exactly the issue is instead of directly jumping to the solution.
Once you read the comment you will be little unclear with respect to implementation as he has use capacitor and not every one are using capacitor.
In my implementation I ignore this part as I am not using capacitor.
App.addListener('appUrlOpen')
Now lets go to main step where we are fixing this issue, I am using deep links to redirect to my application
this.platform.ready().then(() => {
this.deeplinks
.route({
"/success.html": "success",
"/logout.html": "logout",
})
.subscribe(
(match: any) => {
const fragment = JSON.stringify(match).split('"fragment":"')[1];
// this link can be your any link based on your requirement,
// what I am doing it I am passing all the data which I get in my fragments.
// fragments consists of id_token, stage, code,response type.
// These need to be passed to Ionic in order for Amplify to run its magic.
document.location.href = `http://192.168.1.162:8100/#${fragment}`;
},
(nomatch) => {
console.log("Got a deeplink that didn't match", nomatch);
}
);
});
I got this idea by referring the issue in which the developer mentioned of sending code and state along with application deep linking URL.

Different results when making a Corda query via API and inside a flow

I’m getting some strange behaviour. When I update a state with a list of partner ids - other nodes - and and read the state afterwards it seems that via rpcOps.vaultQueryBy I can see the updated - or unconsumed - state with the updated list of partners, but if I do same query via serviceHub.vaultService.queryBy it looks like the state’s parner list hasn’t changed at all.
If I get all states in the flow - also the consumed - it looks like there has not been a change, but via API all updates into partners list are visible. Is this some sort of a bug I have encountered or am I just not understanding something?
We're using Corda 4.0.
Via API
var servicestates = rpcOps.vaultQueryBy<ServiceState>().states.map { it.state.data }
var services = getServices().filter {
it.linearId == UniqueIdentifier.fromString(serviceId)
}.single()
Inside flow
val serviceStateAndRef = serviceHub.vaultService.queryBy<ServiceState>(
QueryCriteria.LinearStateQueryCriteria(linearId = listOf(serviceLinearId))
).states.single()
#Ashutosh Meher You got it near enough. The problem was in a previous flow, where, when creating a new partner state the command call for contract, there was only the caller listed.
So
Command(ServiceContract.Commands.AddPartner(),listOf(ourIdentity.owningKey))
had to be edited to include necessary other parties.
Command(ServiceContract.Commands.AddPartner(),updatedServiceState.participants.map { it.owningKey })
That resulted the other node not to see the change. It was right under my eyes all the time... ;)

The session has been invalidated because the user has changed the password -> no Password was changed

Dear Stackoverflowianers!
Dear Facebook Developers!
I created a Facebook-App couple of weeks ago. In this time it worked perfectly. My PHP-Script checks if the access_token is at least 10 days before expiring (it automatically is set to a long expiration date before) and if so (if >= expiration date - 10) it tries to obtain an new access_token for the same user (which is me, myself and I).
The Problem is that since yesterday it throws me an error:
Fatal error: Uncaught OAuthException: Error validating access token: The session has been invalidated because the user has changed the password.
Now my question is: How can it throw this error as I never changed my password on FB???
Does anybody have any hint for me to the right direction to solve this issue? I'd be very thankful for any help.
Best regards,
AceLine
Actually there's nothing wrong in your flow. It actually throws that error when the token is expired.
We've experience this kind of error before and what we did was we regularly check that the accessToken is still valid if it is not then we generate and save a new one. However, when we set the accessToken that will be used we also extend the life of the token prior to saving it in the local database. See extendedAccessToken
Here's a sample update (This is just a rough code):
// Set the access token and extend it
$facebookClient = new FacebookClient();
$facebookClient->setAccessToken($accessToken);
$facebookClient->setExtendedAccessToken();
// Query your user that will have the updated access token and update it.
$user = User::get($userId);
$user->accessToken = $facebookClient->getAccessToken();
$user->update();

Fallback on geolocation

I'm having trouble with the most basic aspect of geolocation - no matter what I do, I don't seem to be able to get the fallback to trigger. Here's the code:
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position){
var latitude = position.coords.latitude;
var longitude = position.coords.longitude;
var latNum = parseFloat(latitude);
var longNum = parseFloat(longitude);
This is immediately followed by a nested bunch of if...else if statements that trigger different functions based on the user's location within one of a number of defined areas and an else statement to catch the condition where the user is not in any of the defined locations. This part all works fine, including the 'else' condition at the end. Where it falls over is if the user's device does not have geolocation enabled, or the user denies access to location data when prompted.
The code supposed to capture this is simply:
} else {
function10();
}
I have tried this in FF, Safari and Chrome with the same results: if I disable location services or deny access when prompted, the final 'else' function does not trigger.
I've looked at countless examples of this sort of elegant failure on geolocation and can't see why it doesn't work.
I'd be truly grateful for any clues where I went wrong.
OK - problem solved! I'm not sure if I feel just silly or enlightened, but for the benefit of anyone else with the same problem, here's the solution:
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position){
// Do something here if you get position data
},
function() {
// Do something else if you don't get any position data
}
);
}
Where i went wrong, I think, is that I needed to look for a failure of the function(position)rather than the absence of a geolocation enabled agent. The second function within the same if condition provides the action in the event of no position data being returned from the browser, no matter what the reason. The final 'else' statement in the original code (above) would only be triggered on a device with no geolocation capacity.
This all makes sense now, but I have to say the documentation on Google, and many of the tutorial sites was far from clear on this, with frequent references to my initial syntax covering the situation where geolocation capacity was not enabled (as distinct from not present).
Thanks to this answer on SO for pointing me in the right direction.

Failing to fetch CategorizedFacebookType

I have an application which I developed about a year ago and I'm
fetching facebook accounts like this:
facebookClient = new DefaultFacebookClient(access_token);
Connection<CategorizedFacebookType> con = facebookClient.fetchConnection("me/accounts", CategorizedFacebookType.class);
fbAccounts = con.getData();
It worked fine until about a month ago, but now it returns the
fbAccounts list empty. Why is that?
I was hoping moving from restfb-1.6.2.jar to restfb-1.6.9.jar would
help but no luck, it comes up empty on both.
What am I missing?
EDIT, to provide the code for another error I have with this API. The following code used to work:
String id = page.getFbPageID(); // (a valid facebook page id)
FBInsightsDaily daily = new FBInsightsDaily(); // an object holding some insights values
try {
Parameter param = Parameter.with("asdf", "asdf"); // seems like the param is required
JsonObject allValues = facebookClient.executeMultiquery(createQueries(date, id), JsonObject.class, param);
daily.setPageActiveUsersDaily((Integer)(((JsonArray)allValues.opt("page_active_users_daily")).getJsonObject(0)).opt("value"));
...
This throws the following exception:
com.restfb.json.JsonException: JsonArray[0] not found.
at com.restfb.json.JsonArray.get(JsonArray.java:252)
at com.restfb.json.JsonArray.getJsonObject(JsonArray.java:341)
Again, this used to work fine but now throws this.
You need the manage_pages permission from the user to access their list of adminned pages - a year ago I'm not sure you did - check that you're obtaining that permission from your users
{edit}
Some of the insights metrics were also deprecated, the specific values you're checking may no longer exist - https://developers.facebook.com/docs/reference/fql/insights/ should have the details of what is available now
Try to check your queries manually in the Graph API Explorer to eliminate any issues in your code and hopefully get more detailed error messages that your SDK may be swallowing