pendulum-chain / wasm-deploy

A tool to deploy an ensemble of wasm smart contracts to Pendulum
GNU General Public License v3.0
2 stars 1 forks source link

Bug: BackstopPool does not emit InsuranceFeeSet #46

Closed TorstenStueber closed 6 months ago

TorstenStueber commented 6 months ago

The current Nabla deployment on Foucoco has the backstop pool at this address: 6hZJZnisXo5LeFwV3aE4piaJCCPeRTTf9iiASNFTwYc1jVDP.

This deployment uses this version of the backstop pool.

It is obvious that the method setInsuranceFee should emit the InsuranceFeeSet event whenever it runs successfully.

However, this is not the case. When, e.g., calling setInsuranceFee as follows:

TorstenStueber commented 6 months ago

This problem could be due to a compilation problem with Solang (?)

It's effect is that the indexer cannot correctly track the insurance fee of a swap pool.

ebma commented 6 months ago

I don't think I'm able to reproduce this issue. I deployed the contracts on Foucoco using the same deployment account as you did. As you can see in the following logs, the InsuranceFeeSet event is emitted when using an insuranceFeeBps of 0. I did not change this parameter in the default configuration.

I'm using the contracts from the pendulum-launch branch and deploying from 39-implement-tests-for-nabla-indexer. I compiled solang v0.3.3 from source.

 🧰 backstop.addSwapPool [ fee: 0.001 AMPE ] success
    🎉 Event backstop.InsuranceFeeSet
      - sender: "6iFKMtX29zYoHRgDkPTXKuRsHRbJ3Gnaxyc4dRrZTANHvZi3"
      - swapPool: "6kgKPJbCQKyDVmyFMMkESkT2JkYfaXFqfr4CqxBL9Wz7idjD"
      - insuranceFeeBps: "0"
    🎉 Event backstop.SwapPoolAdded
      - sender: "6iFKMtX29zYoHRgDkPTXKuRsHRbJ3Gnaxyc4dRrZTANHvZi3"
      - swapPool: "6kgKPJbCQKyDVmyFMMkESkT2JkYfaXFqfr4CqxBL9Wz7idjD"
  🧰 router.registerPool [ fee: 0.0017 AMPE ] success
    🎉 Event xcm0Erc20Wrapper.Approval
      - owner: "6mwyRVmxj3SDoinATY36L7rfnKNaqkJboSMUkEXoa3hb5e2Q"
      - spender: "6jWmBYexLnjiqjtMLT3diRmbGRRd1KjA5uTw8MResQe2fB5w"
      - value: "115,792,089,237,316,195,423,570,985,008,687,907,853,269,984,665,640,564,039,457,584,007,913,129,639,935"
    🎉 Event router.SwapPoolRegistered
      - sender: "6iFKMtX29zYoHRgDkPTXKuRsHRbJ3Gnaxyc4dRrZTANHvZi3"
      - pool: "6jWmBYexLnjiqjtMLT3diRmbGRRd1KjA5uTw8MResQe2fB5w"
      - asset: "6iD9m1iDPTqEeesBuWckVfS3EWhKkGGSLnKSzLwF1bjeCVYW"
  🧰 backstop.addSwapPool [ fee: 0.001 AMPE ] success
    🎉 Event backstop.InsuranceFeeSet
      - sender: "6iFKMtX29zYoHRgDkPTXKuRsHRbJ3Gnaxyc4dRrZTANHvZi3"
      - swapPool: "6jWmBYexLnjiqjtMLT3diRmbGRRd1KjA5uTw8MResQe2fB5w"
  🧰 router.registerPool [ fee: 0.0017 AMPE ] success
    🎉 Event nativeErc20Wrapper.Approval
      - owner: "6mwyRVmxj3SDoinATY36L7rfnKNaqkJboSMUkEXoa3hb5e2Q"
      - spender: "6kgKPJbCQKyDVmyFMMkESkT2JkYfaXFqfr4CqxBL9Wz7idjD"
      - value: "115,792,089,237,316,195,423,570,985,008,687,907,853,269,984,665,640,564,039,457,584,007,913,129,639,935"
    🎉 Event router.SwapPoolRegistered
      - sender: "6iFKMtX29zYoHRgDkPTXKuRsHRbJ3Gnaxyc4dRrZTANHvZi3"
      - pool: "6kgKPJbCQKyDVmyFMMkESkT2JkYfaXFqfr4CqxBL9Wz7idjD"
      - asset: "6juXMwQSBybzNAz1i9kvWHnfkvPh5fKi6F11EjbkMXuojaJ8"
  🧰 backstop.addSwapPool [ fee: 0.001 AMPE ] success
    🎉 Event backstop.InsuranceFeeSet
      - sender: "6iFKMtX29zYoHRgDkPTXKuRsHRbJ3Gnaxyc4dRrZTANHvZi3"
      - swapPool: "6kgKPJbCQKyDVmyFMMkESkT2JkYfaXFqfr4CqxBL9Wz7idjD"
      - insuranceFeeBps: "0"
    🎉 Event backstop.SwapPoolAdded
      - sender: "6iFKMtX29zYoHRgDkPTXKuRsHRbJ3Gnaxyc4dRrZTANHvZi3"
      - swapPool: "6kgKPJbCQKyDVmyFMMkESkT2JkYfaXFqfr4CqxBL9Wz7idjD"
  🧰 router.registerPool [ fee: 0.0017 AMPE ] success
    🎉 Event xcm0Erc20Wrapper.Approval
      - owner: "6mwyRVmxj3SDoinATY36L7rfnKNaqkJboSMUkEXoa3hb5e2Q"
      - spender: "6jWmBYexLnjiqjtMLT3diRmbGRRd1KjA5uTw8MResQe2fB5w"
  🧰 backstop.addSwapPool [ fee: 0.001 AMPE ] success
    🎉 Event backstop.InsuranceFeeSet
      - sender: "6iFKMtX29zYoHRgDkPTXKuRsHRbJ3Gnaxyc4dRrZTANHvZi3"
      - swapPool: "6kgKPJbCQKyDVmyFMMkESkT2JkYfaXFqfr4CqxBL9Wz7idjD"
      - insuranceFeeBps: "0"
    🎉 Event backstop.SwapPoolAdded
      - sender: "6iFKMtX29zYoHRgDkPTXKuRsHRbJ3Gnaxyc4dRrZTANHvZi3"
      - swapPool: "6kgKPJbCQKyDVmyFMMkESkT2JkYfaXFqfr4CqxBL9Wz7idjD"
  🧰 router.registerPool [ fee: 0.0017 AMPE ] success
    🎉 Event xcm0Erc20Wrapper.Approval
      - owner: "6mwyRVmxj3SDoinATY36L7rfnKNaqkJboSMUkEXoa3hb5e2Q"
      - spender: "6jWmBYexLnjiqjtMLT3diRmbGRRd1KjA5uTw8MResQe2fB5w"
      - value: "115,792,089,237,316,195,423,570,985,008,687,907,853,269,984,665,640,564,039,457,584,007,913,129,639,935"
    🎉 Event router.SwapPoolRegistered
      - sender: "6iFKMtX29zYoHRgDkPTXKuRsHRbJ3Gnaxyc4dRrZTANHvZi3"
      - pool: "6jWmBYexLnjiqjtMLT3diRmbGRRd1KjA5uTw8MResQe2fB5w"
      - asset: "6iD9m1iDPTqEeesBuWckVfS3EWhKkGGSLnKSzLwF1bjeCVYW"
  🧰 backstop.addSwapPool [ fee: 0.001 AMPE ] success
    🎉 Event backstop.InsuranceFeeSet
      - sender: "6iFKMtX29zYoHRgDkPTXKuRsHRbJ3Gnaxyc4dRrZTANHvZi3"
      - swapPool: "6kgKPJbCQKyDVmyFMMkESkT2JkYfaXFqfr4CqxBL9Wz7idjD"
      - insuranceFeeBps: "0"
    🎉 Event backstop.SwapPoolAdded
      - sender: "6iFKMtX29zYoHRgDkPTXKuRsHRbJ3Gnaxyc4dRrZTANHvZi3"
      - swapPool: "6kgKPJbCQKyDVmyFMMkESkT2JkYfaXFqfr4CqxBL9Wz7idjD"
  🧰 router.registerPool [ fee: 0.0017 AMPE ] success
    🎉 Event xcm0Erc20Wrapper.Approval
      - owner: "6mwyRVmxj3SDoinATY36L7rfnKNaqkJboSMUkEXoa3hb5e2Q"
      - spender: "6jWmBYexLnjiqjtMLT3diRmbGRRd1KjA5uTw8MResQe2fB5w"
      - value: "115,792,089,237,316,195,423,570,985,008,687,907,853,269,984,665,640,564,039,457,584,007,913,129,639,935"
    🎉 Event router.SwapPoolRegistered
      - sender: "6iFKMtX29zYoHRgDkPTXKuRsHRbJ3Gnaxyc4dRrZTANHvZi3"
      - pool: "6jWmBYexLnjiqjtMLT3diRmbGRRd1KjA5uTw8MResQe2fB5w"
      - asset: "6iD9m1iDPTqEeesBuWckVfS3EWhKkGGSLnKSzLwF1bjeCVYW"
  🧰 backstop.addSwapPool [ fee: 0.001 AMPE ] success
    🎉 Event backstop.InsuranceFeeSet
      - sender: "6iFKMtX29zYoHRgDkPTXKuRsHRbJ3Gnaxyc4dRrZTANHvZi3"
      - swapPool: "6jWmBYexLnjiqjtMLT3diRmbGRRd1KjA5uTw8MResQe2fB5w"
      - insuranceFeeBps: "0"
    🎉 Event backstop.SwapPoolAdded
      - sender: "6iFKMtX29zYoHRgDkPTXKuRsHRbJ3Gnaxyc4dRrZTANHvZi3"
      - swapPool: "6jWmBYexLnjiqjtMLT3diRmbGRRd1KjA5uTw8MResQe2fB5w"
  🧰 router.registerPool [ fee: 0.0017 AMPE ] success
    🎉 Event xcm1Erc20Wrapper.Approval
      - owner: "6mwyRVmxj3SDoinATY36L7rfnKNaqkJboSMUkEXoa3hb5e2Q"
      - spender: "6nPPULtZ73qYz8se3nvYSvLHmfadLffFKAawooYqbryUH4Uz"
      - value: "115,792,089,237,316,195,423,570,985,008,687,907,853,269,984,665,640,564,039,457,584,007,913,129,639,935"
    🎉 Event router.SwapPoolRegistered
      - sender: "6iFKMtX29zYoHRgDkPTXKuRsHRbJ3Gnaxyc4dRrZTANHvZi3"
      - pool: "6nPPULtZ73qYz8se3nvYSvLHmfadLffFKAawooYqbryUH4Uz"
      - asset: "6mQekcLz1xEDW2YTcMQWPoPryhEi3ZxANXokfsz1JzXei7aR"
  🧰 backstop.addSwapPool [ fee: 0.001 AMPE ] success
    🎉 Event backstop.InsuranceFeeSet
      - sender: "6iFKMtX29zYoHRgDkPTXKuRsHRbJ3Gnaxyc4dRrZTANHvZi3"
      - swapPool: "6nPPULtZ73qYz8se3nvYSvLHmfadLffFKAawooYqbryUH4Uz"
      - insuranceFeeBps: "0"
    🎉 Event backstop.SwapPoolAdded
      - sender: "6iFKMtX29zYoHRgDkPTXKuRsHRbJ3Gnaxyc4dRrZTANHvZi3"
      - swapPool: "6nPPULtZ73qYz8se3nvYSvLHmfadLffFKAawooYqbryUH4Uz"
TorstenStueber commented 6 months ago

I left a bunch of messages here but I deleted them again. After doing more tests I finally realized that I just used linked to an old version of the backstop pool when adding the backstop pool to polkadot.js. I linked to the backstop pool at address 6h4rVhtWSJcZdxKspLnM7LpjgGdmTUTPSnLqpoYia2aR6vqc instead of 6hZJZnisXo5LeFwV3aE4piaJCCPeRTTf9iiASNFTwYc1jVDP. The backstop pool at the former address uses this version of the code where setInsuranceFee does not emit an event.

I now tested with the backstop pool at the correct address and it works as expected and the indexer picks up the change as expected.

I will close this issue now.