# Calamari Vesting Issue
## Backend Part
### What went wrong?
I was working on a pallet named `calamari-vesting`, which is for vesting `KMA` tokens for crowdloan contributors. Basiscly, this pallet is functional.
We have so many contributors, up to `16005`, so we cannot send their rewards one by one. But `pallet-utility` that can help us to send batch transactions, just one batch can contains even 500 transactions. But unfortunately, I just forgot to allow `pallet-utility` in `BaseFilter`, we could not send batch transactions.
So what is `BaseFilter`?
Because our calamari network started from shell chain, we cannot open all extrinsics to users at the beginning. We have to set a filter to decide when and how to open a specific extrinsic or pallet to users.
> Tips: Only `Root` can call all extrinsics even it's filtered.
In the release [`v3.1.0`](https://github.com/Manta-Network/Manta/blob/v3.1.0/runtime/calamari/src/lib.rs#L184), you will see the `pallet-utility` is filtered.
So Shumo had to publish another emergency release to fix it.
Take a look at [`v3.1.0-1`](https://github.com/Manta-Network/Manta/blob/v3.1.0-1/runtime/calamari/src/lib.rs#L225), Shumo allowed `pallet-utility` to be dispatched.
## Tool Part
### What went wrong?
The tool(`KMA Distribution Tool`) is for sending batch transactions, these transactions contain crowdloan rewards for contributors.
I made a another mistake that I I forgot to check float number.
For example, some of rewards like this:
```json=
{
"address": "DgFydYwcE2tneQ9U8gabTb1f2Hp4zvtAtFskssM2ZuzDJ8K",
"base_reward": "10000",
"early_reward": "1000",
"referral_reward": "305",
"total_reward": "11305"
}
```
`total_reward` is integer number.
But this reward is float numer:
```json=
{
"address": "DfrM7A2WWtXjWpcUfcofxqPZCA3nZ7LMcTx3DfSC88tH4ex",
"base_reward": "170000",
"early_reward": "17000",
"referral_reward": "57652.0790325",
"total_reward": "244652.0790325"
}
```
Originally, this was how I handle `total_reward`.
```javascript=
const to_issue = parseFloat(reward['total_reward']);
const decimal = api.registry.chainDecimals;
const factor = new BN(10).pow(new BN(decimal));
const amount = new BN(to_issue).mul(factor);
```
> BN is from `polkadot-js`, for handling big numebr.
But in this way, the float part will lose. Shumo found this bug while reviewing my code.
Finaly, we changed that part of code to this, dividing `total_reward` into integer part and float part.
```javascript=
const to_issue = parseFloat(reward['total_reward']);
const int_part = Math.floor(to_issue);
const float_part = to_issue - int_part;
const decimal = api.registry.chainDecimals;
const factor = new BN(10).pow(decimal);
const r = new BN(factor.toNumber() * float_part);
const s = factor.mul(new BN(int_part));
const amount = r.add(s);
```
## Where we should do better?
1. We cannot publish a release in rush, we must give more time for testing. I just submited a [pr](https://github.com/Manta-Network/Manta/pull/288) to improve the workflow.
2. I think we should write test cases for calamari/manta runtime. We're missing this part of testing. Every new addition code to runtime should be tested. I'm going to look into it.