forgAE: problem after migration from 1.4 to 2.0

Hello,

I had to struggle a bit with migrating from 1.4 to 2.0 but almost figured out all the problems. The last problem I faced was that I encountered an issue within forgAE when trying to call a contract-function that doesn’t return any value.

The line in my test looks like this:

await deployedContractNonRecipient.payAndSplit({value: aettos});

The function in the contract is defined as follows:

public stateful function payAndSplit() =
      require(Contract.balance > 0, "contract didn't receive any payment")
      let recipientConditions: list((address, int)) = Map.to_list(state.recipientConditions)
      split(recipientConditions, Contract.balance)
      Chain.event(PaymentReceivedAndSplitted(Call.caller, Call.value, Contract.balance))

And the error I get looks like this:

TypeError: returnType.trim is not a function
      at functions.(anonymous function) (node_modules\forgae-lib\forgae-deployer.js:260:76)
      at process._tickCallback (internal/process/next_tick.js:68:7)

@martingrigorov.chain can you help me out here?

I have another issue that is more related to the aepp-sdk-js in combination with the standalone-compiler as far as I can judge this.

I am trying to pass in a Map as parameter for the following contract-function:

public stateful function updateRecipientConditions(recipients': map(address, int)) =
      onlyOwner()
      Chain.event(UpdatingAllRecipients)
      require(sumWeights(recipients') == 100, "sum of weights needs to be 100")
      put(state{recipientConditions = recipients'})
      fireRecipientAddedEvents(Map.to_list(state.recipientConditions))

The code in the test looks like this:

let recipientConditions = new Map();
recipientConditions.set(recipientOneKeyPair.publicKey, 15); recipientConditions.set(recipientTwoKeyPair.publicKey, 15);
recipientConditions.set(recipientThreeKeyPair.publicKey, 20);
recipientConditions.set(recipientFourKeyPair.publicKey, 20);
recipientConditions.set(recipientFiveKeyPair.publicKey, 25);
recipientConditions.set(recipientSixKeyPair.publicKey, 5);
await deployedContractOwner.updateRecipientConditions(recipientConditions);

The error I get is this:

Error: Http request for http://localhost:3080/encode-calldata failed with status code 403. Status: Forbidden. 
Error data: {"reason":"Type errors\nCannot unify map(address, int)\n         and string\nwhen checking the application at line 109, column 24 of\n  updateRecipientConditions : (map(address, int)) =>
()\nto arguments\n  \"[object Map]\" : string\n"}

here is the respective branch in our repository if somebody of the team wants to investigate:

Hey @marco.chain,

Monday we will release new version of forgae which will probably resolve these issues at least from first glance. I will dig more about your issue and I will comeback to you.

Best,
Martin

1 Like

thanks! looking forward to test the new forgAE version. hopefully the issues will all be solved then :slight_smile:

hey @marco.chain,

We have found and fixed the first issue and currently investigating and working on the second one. We will provide new version of forgae with the fixes as soon as possible. I will keep you posted.
Sorry for the inconvenience.

Best,
Martin

1 Like

you’re welcome to provide a pull-request to my migration-branch with the fixes :wink:

but if you can’t find time to do so I will do it by myself as soon as the issues are fixed.

thanks!

Hey @marco.chain we are still working on a fix , because it came bigger than we thought. We are trying to fix and release as fast as possible. If you need a workaround, please ping me and I will help.

Best,
Martin

1 Like

thanks for letting me know. I will wait for the fix being released. it isn’t critical and I am not a big fan of workarounds :smiley:

1 Like

@martingrigorov.chain any updates on that front? :slight_smile:

@marco.chain currently no, we have some progress here but nothing to release yet. I will keep you posted

Best,
Martin

1 Like

Hey, @marco.chain

We have fixed all of the issues and will be available on PR today. We will work on asap release for next week. I will ping you when the official release is made.

Thanks,
Martin

2 Likes

When can we expect the release? Next week?

@marco.chain yes, the release will be available next week.

1 Like

@marco.chain the new release is available!

1 Like

will adapt all the necessary changes as soon as possible. thanks! :slight_smile:

Nice, sorry for the delay but you will see that there are a lot of changes. If you need some support please open a post and we will try to help ASAP.

Best,
Martin

I finished the migration but it seems like the transfer of the aettos within a function-call doesn’t work anymore.

It is called like this:

await deployedContractNonRecipient.payAndSplit({value: aettos});

was there any change? because within the test I receive the error contract didn't receive any payment which my contract throws when there is no amount included in the function-call.

you can find the current state here:

didn’t try it, but remebert that it should be {amount: aettos}

will test this. but in 1.4 it definitely used to be „value“ instead of „amount“. at least this was working in the past.

just wondering :sweat_smile:

1 Like