Invalid proposal key [Error Code: 1006] on 0.3.0-alpha.14
adbario opened this issue · 2 comments
adbario commented
Problem
As 0.3.0-alpha.15
has issues with getAccountAddress and apparently with @onflow/flow-cadut
as well, we had to downgrade to 0.3.0-alpha.14
to get the getAccountAddress
working.
Sadly this leads to another error though:
execution error code 1006: [Error Code: 1006] invalid proposal key: public key 0 on account
f8d6e0586b0a20c7 does not have a valid signature: [Error Code: 1009] invalid envelope key:
public key 0 on account f8d6e0586b0a20c7 does not have a valid signature: signature is not valid
Next, we downgraded it to 0.3.0-alpha.13
, and finally, all our tests passed.
Have recreated flow.json
with flow init
:
{
"networks": {
"emulator": "127.0.0.1:3569",
"mainnet": "access.mainnet.nodes.onflow.org:9000",
"testnet": "access.devnet.nodes.onflow.org:9000"
},
"accounts": {
"emulator-account": {
"address": "f8d6e0586b0a20c7",
"key": "acd1bdd97463e4ef135c06e2f3552a4bdd9111efa481abc4cece4d5286b91e8a"
}
}
}
Steps to Reproduce
Config for failing 0.3.0-alpha.14
test
Flow version: v0.39.3
package.json
{
"name": "test",
"version": "1.0.0",
"main": "index.js",
"author": "",
"license": "ISC",
"dependencies": {
"@babel/core": "^7.19.1",
"@babel/preset-env": "^7.19.1",
"@onflow/flow-js-testing": "0.3.0-alpha.14",
"babel-jest": "^29.0.3",
"jest": "^29.0.3"
}
}
babel.config.json
{
"presets": [
[
"@babel/preset-env",
{
"targets": {
"node": "current"
}
}
]
]
}
jest.config.json
{
"testEnvironment": "node",
"verbose": true,
"coveragePathIgnorePatterns": ["/node_modules/"],
"testTimeout": 50000
}
deploy-contract.test.js
import path from "path"
import {
init,
emulator,
getAccountAddress,
deployContract,
executeScript,
shallResolve,
shallPass,
} from "@onflow/flow-js-testing"
beforeEach(async () => {
const basePath = path.resolve(__dirname, "../cadence")
await init(basePath)
await emulator.start()
})
test("deploy contract", async () => {
const to = await getAccountAddress("Alice")
const name = "Wallet"
const code = `
pub contract Wallet{
pub let balance: UInt
init(balance: UInt){
self.balance = balance
}
}
`
const args = [1337]
await shallPass(deployContract({to, name, code, args}))
const [balance] = await shallResolve(
executeScript({
code: `
import Wallet from 0x01
pub fun main(): UInt{
return Wallet.balance
}
`,
})
)
expect(balance).toBe("1337")
})
afterEach(async () => {
await emulator.stop()
})
Acceptance Criteria
Tests run without errors.
Context
Upgrading to the latest testing library is currently blocked.
justinbarry commented
@adbario Does this issue still exist with alpha 16?
adbario commented
@adbario Does this issue still exist with alpha 16?
@justinbarry This seems to be solved now as well, thanks!