icon-project / icon-bridge

The centralized bridge of ICON
Apache License 2.0
21 stars 15 forks source link

fix(deploy): Snow deployment can't addLink #827

Open andrii-kl opened 1 year ago

andrii-kl commented 1 year ago

Overview

Deployment process can't pass.

Steps to Reproduce

Steps to reproduce the behavior:

  1. Run deploysc.sh
  2. See error

config.txt

Error

BSC_RPC_URI: https://arctic-rpc.icenetwork.io:9933 Using network 'bsc'.

Add link btp://0x2.icon/cx3a5bcb33421e2c09215091471bc9635f736997fd ProviderError: exceeds block gas limit at module.exports (/icon-bridge/devnet/docker/icon-bsc/scripts/bmc.js:16:34) at processTicksAndRejections (node:internal/process/task_queues:95:5) { code: -32603, hijackedStack: 'ProviderError: exceeds block gas limit\n' +

bbist commented 1 year ago

@andrii-kl, can you check if the txn gas limit being assigned is below the block gas limit? If you're using default settings, please enforce a manual gas limit below block gas limit of SNOW chain.

manishbista28 commented 1 year ago

@sdpisreddevil -- is it possible for you to check why addLink() is not working ?

andrii-kl commented 1 year ago

@bbist @manishbista28 @sdpisreddevil The issue is not trivial. So to isolate the problem I called the function through the Remix app and I got the same error. It means that icon-bridge is not the reason of this issue. Also I try with different gas limits (in remix), the results were same.

Screen Shot 2022-12-03 at 1.28.36 PM.png

The interesting point that I found that the function addService is working properly, you can add any new services.

My ideas: After the update of the Arctic testnet, Arctic has new substrate and Frontier (EVM), some functionality that we use in the addLink are not working.

I tried to find the problem with Remix debugger, but app breaks each time when I try to debug addLink transaction.

sdpisreddevil commented 1 year ago

Going through the code, and seems like the new Arctic testnet is having problem on the encoding RLP codes. Will look through it deeply today.

manishbista28 commented 1 year ago

specifying "gas" manually on truffle config seems to get the method addLink() working. I used the following on bmc truffle config

        bsc: {
            ...
            gas: 9000000,
            gasPrice: 20000000000
        }

Can you guys confirm ?

Currently, truffle itself estimates gas necessary for a transaction and sets the gas limit accordingly on a transaction request Specifying the method manually can help but it has its own downsides too.

  1. If a large value is to be selected, one will have to ensure that the deployer account has at least (specified gas limit times gas price) amount of native token even if the transaction itself may consume a small fraction of the specified gas limit

2.there are constraints such as gas_limit X gas price should be less than 1 ETH on bsc chain. It may or may not be applicable on other chains. This constrains how large a gas limit can be placed for the specified gas price.

  1. Whether the specified gas limit is sufficient for all types of transactions (including truffle migrate or upgrade ones)
manishbista28 commented 1 year ago

could complete ICON-BSC-SNOW testnet deployment afterwards.

sdpisreddevil commented 1 year ago

By specifying "gas" manually on metamask transaction builder fixed the working of addLink().

On Arctic as the transaction fee is increased by 2000x we've to check every other user triggered method if the GAS will be enough to implement the method.

We can proceed ahead to complete ICON-BSC-ARCTIC deployment and testings.

manishbista28 commented 1 year ago

@sdpisreddevil if the solution involves using a fixed "gas" parameter, will this change to bmc's truffle config be committed through this ticket ? Will a static value of "gas" be suitable for all known transaction types (e.g. deployment, upgrade and configuration txns) ?