Closed gautamprikshit1 closed 1 year ago
@frol please help me with migrating cross contract calls.
@gautamprikshit1 Can you be more specific? What exactly do you need help with?
Here are some good starting points with cross-contract calls implementation:
This line generates an error post upgrade, cannot find function in ext_scoial_db
@ailisp Can you take a look and maybe check it locally? (it is getting late here)
This line generates an error post upgrade, cannot find function in
ext_scoial_db
this because it tries cross contract call social.near on mainnet. If you're testing on sandbox or testnet it's not exist. You can test by either deploy to mainnet, or deploy a socialdb contract to sandbox/testnet.
@gautamprikshit1 Here is the guide on how to set things up on testnet:
Compile the contract to Wasm:
$ sh build.sh
Create testnet account if you don't have one yet: https://wallet.testnet.near.org/
Log into the account from the terminal (install near.cli.rs):
$ near account import-account using-web-wallet network-config testnet
Deploy the res/devgovgigs.wasm
file to your account:
$ near contract deploy use-file 'res/devgovgigs.wasm' with-init-call new json-args '{}' prepaid-gas '100.000 TeraGas' attached-deposit '0 NEAR' network-config testnet
Deploy devhub-widgets following this guide.
Go to https://test.near.social/ and sign in there, and open the Feed page of DevHub components deployed on the previous step to your account, and check that it works as expected try creating a new post, comment on it, etc, and report back.
Everthing works fine except that one rendering error
@gautamprikshit1 I had to revert this PR (https://github.com/near/neardevhub-contract/commit/8fc1fdd54237c646d16b25cbf5bbd7d84a7a4a49) as it caused "panicked at 'Cannot deserialize the contract state.: Custom { kind: InvalidData, error: ParseAccountIdError }" on any call to the contract.
Please, test the migration path with the following:
main
branch)near contract call-function as-read-only devgovgigs.near 'get_children_ids' json-args '{}' network-config 'mainnet' now
(change the account id and network connection name [testnet])It would be great to have tests suite using workspaces-rs
to catch such migration issues.
@frol so I have to deploy the old contract and upgrade it to the newer one
@gautamprikshit1 Yes, this is the way to reproduce the issue, and then we will need to solve it. I believe it will require writing a migration: https://github.com/near/neardevhub-contract/blob/main/src/migrations.rs
Given that the error message mentions a ParseAccountIdError, my wild guess is that it is SponsorshipToken
that is at blame as previously USD was not parsed and was just passed as address account and AccountId
type was not a strictly-validated type, but just a String alias, so it accepted "usd" as address
just fine, but now it tries to read it as a valid account id and fails. Thus the migration should go through all the SponsortShip posts and update the SponsorshipToken to either ::USD
or proper address in ::NEP141
(FYI, NEP is an abbreviatiation that denotes standards in NEAR ecosystem)
Updated near-sdk to v4.1.1. Fixes #23