I’m trying to deploy simple flipper contract example on local stack.
Based on this doc I have compiled and started node, pruntime and pherry (master branch of phala-blockchain).
[1]. However I notices issues in pherry - every processed block I get logs (pherry):
[2022-09-16T15:59:30.043698Z INFO pherry] try to sync blocks. next required: (body=501, header=501), finalized tip: 320, buffered: 0
[2022-09-16T15:59:30.063247Z INFO phactory_api::pruntime_client] Response: 404 Not Found
[2022-09-16T15:59:30.063269Z ERROR pherry] FailedToCallBindWorkerEndpoint: Method Not Found
[2022-09-16T15:59:30.078479Z INFO phactory_api::pruntime_client] Response: 200 OK
and in pruntime:
[INFO phactory::prpc_service] Dispatching request: PhactoryAPI.GetEndpointInfo
[ERROR phactory::prpc_service] Rpc error: NotFound
It didn’t crashed so I assume it is not big deal.
Dev node is not prepared for contracts deployment so I’m configuring it in those steps:
- get worker public key from
http://localhost:8000/get_info
- sudo
phalaFatContracts.addCluster(alice.address, 'Public', [ workerPublicKey ])
as Alice
Now based on this doc I’m deploying contract in few steps:
- build with
cargo +nightly contract build
- get JSON contract info from
./target/ink/flipper.contract
- execute
phalaFatContracts.clusterUploadResource(
0,
'InkCode',
contract.source.wasm
)
- execute
phalaFatContracts.instantiateContract(
{ WasmCode: contract.source.hash },
'0xed4b9d1b',
randomHex,
0
)
[2] BTW how to instantiate contract with contructor which request some args? I suppose it is required to somehow encode args with contructor signature.
[3] However I only get one event - phalaFatContracts.Instantiating
. It is never finalized.
I’ve noticed there is no entires when queried with phalaFatContracts.clusterContracts(0)
and phalaFatContracts.clusterWorkers(0)
But phalaFatContracts.clusters(0)
gives nice result
{
owner: 45R2pfjQUW2s9PQRHU48HQKLKHVMaDja7N3wpBtmF28UYDs2
permission: Public
workers: [
0x3a3d45dc55b57bf542f4c6ff41af080ec675317f4ed50ae1d2713bf9f892692d
]
}
and phalaFatContracts.contracts(contractHash)
gives
{
deployer: 45R2pfjQUW2s9PQRHU48HQKLKHVMaDja7N3wpBtmF28UYDs2
codeIndex: {
WasmCode: 0xfc7dc6a1272105e32e748310dcee0485cfe6a5219b7cdf2687d734703cfba0cf
}
salt: 1b74c95d6
clusterId: 0x0000000000000000000000000000000000000000000000000000000000000000
instantiateData: 0xed4b9d1b
}
Here I have pushed my sandbox repo.
Steps to reproduce (with running local stack on default ports)
cargo +nightly contract build
yarn install
yarn deploy
UPDATE1:
e2e tests seems nice source of knowledge :) I will return with update.
UPDATE2:
[4] Sadly both in repo docs and e2e tests seems outdated (on master branch)