[feature] Extending Ethereum-SONs to support ERC20 tokens #473

Open
opened 2022-11-07 05:29:03 +00:00 by bobinson · 26 comments
bobinson commented 2022-11-07 05:29:03 +00:00 (Migrated from gitlab.com)

Right now the Ethereum-SONs supports moving of ETH token across the blockchains. This functionality must be extended to support ERC20 tokens as well. While we need the ERC20 support for all tokens eventually, we need to start with a white listed and pre approved set of 3 tokens. If additional tokens are to be supported, the respective token owners must created a proposal to add support for the token. This verification mechanism is introduced to make sure that no spam/junk assets are included and there are no attacks against tokens thats moved from other Layer2 or Layer1 solutions in the future. Any end user can create a proposal to submit a token on a supported chain and the witnesses must then approve the proposal to include or ignore the token. [Can we have either manual method or a longer proposal approval/disapproval time to give time for witnesses to manually approve the requests ? Any other methods ? ] There must be a mechanism to list/unlist tokens as the network may need to ignore tokens from time to time.

Tokens from Layer2 Solutions (Hive-Engine, TribalDEX, SPK Honeycomb & others)

For the above mentioned tokens, we will have to consider the scenario of the token originally being available in the networks [both Peerplays & Ethereum] and ideally we must be supporting tokens which are already present in these supported chains. (additional discussion needed during design phase).

Right now the Ethereum-SONs supports moving of ETH token across the blockchains. This functionality must be extended to support ERC20 tokens as well. While we need the ERC20 support for all tokens eventually, we need to start with a white listed and pre approved set of 3 tokens. If additional tokens are to be supported, the respective token owners must created a proposal to add support for the token. This verification mechanism is introduced to make sure that no spam/junk assets are included and there are no attacks against tokens thats moved from other Layer2 or Layer1 solutions in the future. Any end user can create a proposal to submit a token on a supported chain and the witnesses must then approve the proposal to include or ignore the token. [Can we have either manual method or a longer proposal approval/disapproval time to give time for witnesses to manually approve the requests ? Any other methods ? ] There must be a mechanism to list/unlist tokens as the network may need to ignore tokens from time to time. **Tokens from Layer2 Solutions (Hive-Engine, TribalDEX, SPK Honeycomb & others)** For the above mentioned tokens, we will have to consider the scenario of the token originally being available in the networks [both Peerplays & Ethereum] and ideally we must be supporting tokens which are already present in these supported chains. (additional discussion needed during design phase).
vampik commented 2022-12-12 12:11:57 +00:00 (Migrated from gitlab.com)

assigned to @vampik

assigned to @vampik
vampik commented 2022-12-13 05:55:41 +00:00 (Migrated from gitlab.com)

mentioned in commit f8ea01802295cd6793ec79980bf416318d9032e4

mentioned in commit f8ea01802295cd6793ec79980bf416318d9032e4
vampik commented 2022-12-13 05:57:17 +00:00 (Migrated from gitlab.com)

mentioned in commit 1abe262799c622fd11c55a676ea601b63bffaedd

mentioned in commit 1abe262799c622fd11c55a676ea601b63bffaedd
vampik commented 2022-12-13 06:26:03 +00:00 (Migrated from gitlab.com)

mentioned in commit 8fa7533238d79ee757198c7b9e0a1ce9b4624052

mentioned in commit 8fa7533238d79ee757198c7b9e0a1ce9b4624052
vampik commented 2022-12-14 13:29:36 +00:00 (Migrated from gitlab.com)

mentioned in commit 46311906172faf87b2fe565fa6858b88dad3925f

mentioned in commit 46311906172faf87b2fe565fa6858b88dad3925f
vampik commented 2022-12-19 05:20:37 +00:00 (Migrated from gitlab.com)

mentioned in commit 8b5b05b345e083e2f2371d32e4ba1755447e2511

mentioned in commit 8b5b05b345e083e2f2371d32e4ba1755447e2511
vampik commented 2022-12-20 06:03:34 +00:00 (Migrated from gitlab.com)

mentioned in commit 8035e8846a8f5ec968f84b6b480ff4a47387c886

mentioned in commit 8035e8846a8f5ec968f84b6b480ff4a47387c886
vampik commented 2022-12-29 06:14:00 +00:00 (Migrated from gitlab.com)

mentioned in commit 8fb4c9e303a5c151d28b26c93557442866d16162

mentioned in commit 8fb4c9e303a5c151d28b26c93557442866d16162
vampik commented 2022-12-29 06:27:11 +00:00 (Migrated from gitlab.com)

mentioned in merge request !198

mentioned in merge request !198
vampik commented 2022-12-29 06:29:21 +00:00 (Migrated from gitlab.com)
Additionally, to merge request for `peerplays` repo: https://gitlab.com/PBSA/peerplays/-/merge_requests/198 We need to merge `peerplays-utils` and `peerplays-ethereum` repos: https://gitlab.com/PBSA/peerplays-ethereum/-/merge_requests/11 https://gitlab.com/PBSA/tools-libs/peerplays-utils/-/merge_requests/32
vampik commented 2022-12-29 06:29:58 +00:00 (Migrated from gitlab.com)

assigned to @serkixenos

assigned to @serkixenos
vampik commented 2023-01-31 10:48:46 +00:00 (Migrated from gitlab.com)

mentioned in commit 0b64f0cfcc

mentioned in commit 0b64f0cfccb6f606799c802e9283aeed2561a9c8
serkixenos commented 2023-01-31 10:48:46 +00:00 (Migrated from gitlab.com)

mentioned in commit 559769db2b

mentioned in commit 559769db2baee1d1b5ba67e7cca6156fb128b6b3
serkixenos commented 2023-01-31 10:49:02 +00:00 (Migrated from gitlab.com)

assigned to @prandnum and @wsalloum

assigned to @prandnum and @wsalloum
vampik commented 2023-02-01 06:22:14 +00:00 (Migrated from gitlab.com)

@prandnum @wsalloum

In Ethereum container in QA environment, test ERC-20 smart contract is already deployed.
And in init-network.sh for peerplays we also create asset for ERC20TEST.

The address of ERC20TEST is:

erc-20-address = ["ERC20TEST", "0xC11Ae091d112D6e2E7a45065E307B29e5DF74706"]

Note also that smart contract address for PrimaryWallet also changed to:

ethereum-wallet-contract-address = 0x572eA65762bFFf521C11Ce5334FfaaF4bDD4974e

In order to deposit ERC-20 token, you can execute an additional script I wrote. In Ethereum container, execute:

cd peerplays-ethereum
npx hardhat run scripts/deposit_simple_token.js --network localhost

Then check that ERC20TEST is deposited.

In order to withdraw just transfer ERC20TEST to son-account as usual.

@prandnum @wsalloum In Ethereum container in QA environment, test ERC-20 smart contract is already deployed. And in `init-network.sh` for peerplays we also create asset for `ERC20TEST`. The address of ERC20TEST is: ``` erc-20-address = ["ERC20TEST", "0xC11Ae091d112D6e2E7a45065E307B29e5DF74706"] ``` Note also that smart contract address for PrimaryWallet also changed to: ``` ethereum-wallet-contract-address = 0x572eA65762bFFf521C11Ce5334FfaaF4bDD4974e ``` In order to **deposit** ERC-20 token, you can execute an additional script I wrote. In Ethereum container, execute: ``` cd peerplays-ethereum npx hardhat run scripts/deposit_simple_token.js --network localhost ``` Then check that `ERC20TEST` is deposited. In order to **withdraw** just transfer `ERC20TEST` to `son-account` as usual.
bobinson commented 2023-02-01 12:49:29 +00:00 (Migrated from gitlab.com)

@vampik - how to verify "In Ethereum container in QA environment, test ERC-20 smart contract is already deployed." ? ie, what if someone puts a random address in ec-20-address which doesn't exist ? It will be great to test that scenario and also provide steps to verify how to make sure the contract is deployed / token is existing.

@vampik - how to verify "In Ethereum container in QA environment, test ERC-20 smart contract is already deployed." ? ie, what if someone puts a random address in `ec-20-address` which doesn't exist ? It will be great to test that scenario and also provide steps to verify how to make sure the contract is deployed / token is existing.
wsalloum commented 2023-02-02 12:09:01 +00:00 (Migrated from gitlab.com)

It looks ok

  • Deposit in ethereum :
oot@89b086275b17:~/ethereum-network/peerplays-ethereum# npx hardhat run scripts/deposit_simple_token.js --network localhost
Owner: 0x5C79A9F5767E3C1b926f963fA24E21D8a04289aE
Balance of owner:  BigNumber { value: "100" }
Balance before deposit:  BigNumber { value: "0" }
Balance after deposit:  BigNumber { value: "10" }
  • Withdraw from peerplays:
unlocked >>> list_account_balances account01
list_account_balances account01
49999950 TEST
1000000 PBTC
1000000 PEOS
1000000 PETH
10 ERC20TEST

unlocked >>> transfer account01 son-account 2 ERC20TEST true true
transfer account01 son-account 2 ERC20TEST true true
{
  "ref_block_num": 195,
  "ref_block_prefix": 2590316593,
  "expiration": "2023-02-02T12:06:21",
  "operations": [[
      0,{
        "fee": {
          "amount": 0,
          "asset_id": "1.3.0"
        },
        "from": "1.2.52",
        "to": "1.2.19",
        "amount": {
          "amount": 2,
          "asset_id": "1.3.8"
        },
        "memo": {
          "from": "TEST73rCkGNinnNSqJprEf6vXb6fiH9opF2DHVjbq2kutF8BH2n12a",
          "to": "TEST1111111111111111111111111111111114T1Anm",
          "nonce": 0,
          "message": "0000000074727565"
        },
        "extensions": []
      }
    ]
  ],
  "extensions": [],
  "signatures": [
    "204bc06da2fcd959a61bfe51844cf2851b688cd460befa4094947497fecde58281201b3c07d4f327968532baa49f2167d274a0c7da9a1d30b2a3ec7c0f520075c5"
  ]
}
unlocked >>> list_account_balances account01                      
list_account_balances account01
49999950 TEST
1000000 PBTC
1000000 PEOS
1000000 PETH
8 ERC20TEST

It looks ok - Deposit in ethereum : ``` oot@89b086275b17:~/ethereum-network/peerplays-ethereum# npx hardhat run scripts/deposit_simple_token.js --network localhost Owner: 0x5C79A9F5767E3C1b926f963fA24E21D8a04289aE Balance of owner: BigNumber { value: "100" } Balance before deposit: BigNumber { value: "0" } Balance after deposit: BigNumber { value: "10" } ``` - Withdraw from peerplays: ``` unlocked >>> list_account_balances account01 list_account_balances account01 49999950 TEST 1000000 PBTC 1000000 PEOS 1000000 PETH 10 ERC20TEST unlocked >>> transfer account01 son-account 2 ERC20TEST true true transfer account01 son-account 2 ERC20TEST true true { "ref_block_num": 195, "ref_block_prefix": 2590316593, "expiration": "2023-02-02T12:06:21", "operations": [[ 0,{ "fee": { "amount": 0, "asset_id": "1.3.0" }, "from": "1.2.52", "to": "1.2.19", "amount": { "amount": 2, "asset_id": "1.3.8" }, "memo": { "from": "TEST73rCkGNinnNSqJprEf6vXb6fiH9opF2DHVjbq2kutF8BH2n12a", "to": "TEST1111111111111111111111111111111114T1Anm", "nonce": 0, "message": "0000000074727565" }, "extensions": [] } ] ], "extensions": [], "signatures": [ "204bc06da2fcd959a61bfe51844cf2851b688cd460befa4094947497fecde58281201b3c07d4f327968532baa49f2167d274a0c7da9a1d30b2a3ec7c0f520075c5" ] } unlocked >>> list_account_balances account01 list_account_balances account01 49999950 TEST 1000000 PBTC 1000000 PEOS 1000000 PETH 8 ERC20TEST ```
bobinson commented 2023-02-02 13:44:52 +00:00 (Migrated from gitlab.com)

hi @wsalloum - can you also test with few rainy day scenarios and list the outcome ?

hi @wsalloum - can you also test with few rainy day scenarios and list the outcome ?
serkixenos commented 2023-02-10 14:53:37 +00:00 (Migrated from gitlab.com)

@prandnum @wsalloum Any updates on this?

@prandnum @wsalloum Any updates on this?
wsalloum commented 2023-02-16 09:27:08 +00:00 (Migrated from gitlab.com)

Using beatrice branch:

root@5bacea67f7dd:~/ethereum-network/peerplays-ethereum# npx hardhat run scripts/deposit_simple_token.js --network localhost
Owner: 0x5C79A9F5767E3C1b926f963fA24E21D8a04289aE
Balance of owner:  BigNumber { value: "100" }
Balance before deposit:  BigNumber { value: "0" }
Balance after deposit:  BigNumber { value: "10" }

from peerplease :

unlocked >>> list_assets 0 100
list_assets 0 100
[{
    "id": "1.3.1",
    "symbol": "BTC",
      ...
  },{
    "id": "1.3.8",
    "symbol": "ERC20TEST",
    "precision": 0,
    "issuer": "1.2.19",
    "options": {
      "max_supply": 10000000,
      "market_fee_percent": 0,
      "max_market_fee": 10000000,
      "issuer_permissions": 79,
      "flags": 5,
      "core_exchange_rate": {
        "base": {
          "amount": 100000,
          "asset_id": "1.3.0"
        },
        "quote": {
          "amount": 2500,
          "asset_id": "1.3.8"
        }
      },
      "whitelist_authorities": [],
      "blacklist_authorities": [],
      "whitelist_markets": [],
      "blacklist_markets": [],
      "description": "",
      "extensions": []
    },
    "dynamic_asset_data_id": "2.3.8"
  },{
    "id": "1.3.2",
    "symbol": "ETH",
     ....

Check the balance

unlocked >>> list_account_balances account01
list_account_balances account01
49999949 TEST
1000000 PBTC
1000000 PEOS
1000000 PETH

Using beatrice branch: ``` root@5bacea67f7dd:~/ethereum-network/peerplays-ethereum# npx hardhat run scripts/deposit_simple_token.js --network localhost Owner: 0x5C79A9F5767E3C1b926f963fA24E21D8a04289aE Balance of owner: BigNumber { value: "100" } Balance before deposit: BigNumber { value: "0" } Balance after deposit: BigNumber { value: "10" } ``` from peerplease : ``` unlocked >>> list_assets 0 100 list_assets 0 100 [{ "id": "1.3.1", "symbol": "BTC", ... },{ "id": "1.3.8", "symbol": "ERC20TEST", "precision": 0, "issuer": "1.2.19", "options": { "max_supply": 10000000, "market_fee_percent": 0, "max_market_fee": 10000000, "issuer_permissions": 79, "flags": 5, "core_exchange_rate": { "base": { "amount": 100000, "asset_id": "1.3.0" }, "quote": { "amount": 2500, "asset_id": "1.3.8" } }, "whitelist_authorities": [], "blacklist_authorities": [], "whitelist_markets": [], "blacklist_markets": [], "description": "", "extensions": [] }, "dynamic_asset_data_id": "2.3.8" },{ "id": "1.3.2", "symbol": "ETH", .... ``` Check the balance ``` unlocked >>> list_account_balances account01 list_account_balances account01 49999949 TEST 1000000 PBTC 1000000 PEOS 1000000 PETH ```
wsalloum commented 2023-02-28 11:44:10 +00:00 (Migrated from gitlab.com)

Checkout develop branch, rebuild docker images, and run QA env.

I notice ERC20TEST in peerplays initiation:

nlocked >>> create_asset son-account ERC20TEST 0 { "max_supply": "10000000", "market_fee_percent": 0, "max_market_fee": "10000000", "issuer_permissions": 79, "flags": 5, "core_exchange_rate": { "base": { "amount": 100000, "asset_id": "1.3.0" }, "quote": { "amount": 2500, "asset_id": "1.3.1" } }, "whitelist_authorities": [], "blacklist_authorities": [], "whitelist_markets": [], "blacklist_markets": [], "description": "", "extensions": [] } null true
create_asset son-account ERC20TEST 0 { "max_supply": "10000000", "market_fee_percent": 0, "max_market_fee": "10000000", "issuer_permissions": 79, "flags": 5, "core_exchange_rate": { "base": { "amount": 100000, "asset_id": "1.3.0" }, "quote": { "amount": 2500, "asset_id": "1.3.1" } }, "whitelist_authorities": [], "blacklist_authorities": [], "whitelist_markets": [], "blacklist_markets": [], "description": "", "extensions": [] } null true
{
  "ref_block_num": 11,
  "ref_block_prefix": 1837777538,
  "expiration": "2023-02-28T11:35:57",
  "operations": [[
      10,{
        "fee": {
          "amount": 500000000,
          "asset_id": "1.3.0"
        },
        "issuer": "1.2.19",
        "symbol": "ERC20TEST",
        "precision": 0,
        "common_options": {
          "max_supply": 10000000,
          "market_fee_percent": 0,
          "max_market_fee": 10000000,
          "issuer_permissions": 79,
          "flags": 5,
          "core_exchange_rate": {
            "base": {
              "amount": 100000,
              "asset_id": "1.3.0"
            },
            "quote": {
              "amount": 2500,
              "asset_id": "1.3.1"
            }
          },
          "whitelist_authorities": [],
          "blacklist_authorities": [],
          "whitelist_markets": [],
          "blacklist_markets": [],
          "description": "",
          "extensions": []
        },
        "is_prediction_market": false,
        "extensions": []
      }
    ]
  ],
  "extensions": [],
  "signatures": []
}

I get this exception on deposit :

root@52fad0b74347:~/ethereum-network/peerplays-ethereum# npx hardhat run scripts/deposit_simple_token.js --network localhost
Owner: 0x5C79A9F5767E3C1b926f963fA24E21D8a04289aE
Balance of owner:  BigNumber { value: "100" }
Balance before deposit:  BigNumber { value: "0" }
Error: insufficient funds for intrinsic transaction cost [ See: https://links.ethers.org/v5-errors-INSUFFICIENT_FUNDS ] (error={"name":"ProviderError","_stack":"ProviderError: HttpProviderError\n    at HttpProvider.request (/home/peerplays/ethereum-network/peerplays-ethereum/node_modules/hardhat/src/internal/core/providers/http.ts:78:19)\n    at LocalAccountsProvider.request (/home/peerplays/ethereum-network/peerplays-ethereum/node_modules/hardhat/src/internal/core/providers/accounts.ts:181:36)\n    at processTicksAndRejections (node:internal/process/task_queues:96:5)\n    at EthersProviderWrapper.send (/home/peerplays/ethereum-network/peerplays-ethereum/node_modules/@nomiclabs/hardhat-ethers/src/internal/ethers-provider-wrapper.ts:13:20)","code":-32000,"_isProviderError":true}, method="sendTransaction", transaction=undefined, code=INSUFFICIENT_FUNDS, version=providers/5.7.2)
    at Logger.makeError (/home/peerplays/ethereum-network/peerplays-ethereum/node_modules/@ethersproject/logger/src.ts/index.ts:269:28)
    at Logger.throwError (/home/peerplays/ethereum-network/peerplays-ethereum/node_modules/@ethersproject/logger/src.ts/index.ts:281:20)
    at checkError (/home/peerplays/ethereum-network/peerplays-ethereum/node_modules/@ethersproject/providers/src.ts/json-rpc-provider.ts:98:16)
    at /home/peerplays/ethereum-network/peerplays-ethereum/node_modules/@ethersproject/providers/src.ts/json-rpc-provider.ts:265:24
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  reason: 'insufficient funds for intrinsic transaction cost',
  code: 'INSUFFICIENT_FUNDS',
  error: ProviderError: HttpProviderError
      at HttpProvider.request (/home/peerplays/ethereum-network/peerplays-ethereum/node_modules/hardhat/src/internal/core/providers/http.ts:78:19)
      at LocalAccountsProvider.request (/home/peerplays/ethereum-network/peerplays-ethereum/node_modules/hardhat/src/internal/core/providers/accounts.ts:181:36)
      at processTicksAndRejections (node:internal/process/task_queues:96:5)
      at EthersProviderWrapper.send (/home/peerplays/ethereum-network/peerplays-ethereum/node_modules/@nomiclabs/hardhat-ethers/src/internal/ethers-provider-wrapper.ts:13:20),
  method: 'sendTransaction',
  transaction: undefined
}
...
Checkout develop branch, rebuild docker images, and run QA env. I notice ERC20TEST in peerplays initiation: ``` nlocked >>> create_asset son-account ERC20TEST 0 { "max_supply": "10000000", "market_fee_percent": 0, "max_market_fee": "10000000", "issuer_permissions": 79, "flags": 5, "core_exchange_rate": { "base": { "amount": 100000, "asset_id": "1.3.0" }, "quote": { "amount": 2500, "asset_id": "1.3.1" } }, "whitelist_authorities": [], "blacklist_authorities": [], "whitelist_markets": [], "blacklist_markets": [], "description": "", "extensions": [] } null true create_asset son-account ERC20TEST 0 { "max_supply": "10000000", "market_fee_percent": 0, "max_market_fee": "10000000", "issuer_permissions": 79, "flags": 5, "core_exchange_rate": { "base": { "amount": 100000, "asset_id": "1.3.0" }, "quote": { "amount": 2500, "asset_id": "1.3.1" } }, "whitelist_authorities": [], "blacklist_authorities": [], "whitelist_markets": [], "blacklist_markets": [], "description": "", "extensions": [] } null true { "ref_block_num": 11, "ref_block_prefix": 1837777538, "expiration": "2023-02-28T11:35:57", "operations": [[ 10,{ "fee": { "amount": 500000000, "asset_id": "1.3.0" }, "issuer": "1.2.19", "symbol": "ERC20TEST", "precision": 0, "common_options": { "max_supply": 10000000, "market_fee_percent": 0, "max_market_fee": 10000000, "issuer_permissions": 79, "flags": 5, "core_exchange_rate": { "base": { "amount": 100000, "asset_id": "1.3.0" }, "quote": { "amount": 2500, "asset_id": "1.3.1" } }, "whitelist_authorities": [], "blacklist_authorities": [], "whitelist_markets": [], "blacklist_markets": [], "description": "", "extensions": [] }, "is_prediction_market": false, "extensions": [] } ] ], "extensions": [], "signatures": [] } ``` I get this exception on deposit : ``` root@52fad0b74347:~/ethereum-network/peerplays-ethereum# npx hardhat run scripts/deposit_simple_token.js --network localhost Owner: 0x5C79A9F5767E3C1b926f963fA24E21D8a04289aE Balance of owner: BigNumber { value: "100" } Balance before deposit: BigNumber { value: "0" } Error: insufficient funds for intrinsic transaction cost [ See: https://links.ethers.org/v5-errors-INSUFFICIENT_FUNDS ] (error={"name":"ProviderError","_stack":"ProviderError: HttpProviderError\n at HttpProvider.request (/home/peerplays/ethereum-network/peerplays-ethereum/node_modules/hardhat/src/internal/core/providers/http.ts:78:19)\n at LocalAccountsProvider.request (/home/peerplays/ethereum-network/peerplays-ethereum/node_modules/hardhat/src/internal/core/providers/accounts.ts:181:36)\n at processTicksAndRejections (node:internal/process/task_queues:96:5)\n at EthersProviderWrapper.send (/home/peerplays/ethereum-network/peerplays-ethereum/node_modules/@nomiclabs/hardhat-ethers/src/internal/ethers-provider-wrapper.ts:13:20)","code":-32000,"_isProviderError":true}, method="sendTransaction", transaction=undefined, code=INSUFFICIENT_FUNDS, version=providers/5.7.2) at Logger.makeError (/home/peerplays/ethereum-network/peerplays-ethereum/node_modules/@ethersproject/logger/src.ts/index.ts:269:28) at Logger.throwError (/home/peerplays/ethereum-network/peerplays-ethereum/node_modules/@ethersproject/logger/src.ts/index.ts:281:20) at checkError (/home/peerplays/ethereum-network/peerplays-ethereum/node_modules/@ethersproject/providers/src.ts/json-rpc-provider.ts:98:16) at /home/peerplays/ethereum-network/peerplays-ethereum/node_modules/@ethersproject/providers/src.ts/json-rpc-provider.ts:265:24 at processTicksAndRejections (node:internal/process/task_queues:96:5) { reason: 'insufficient funds for intrinsic transaction cost', code: 'INSUFFICIENT_FUNDS', error: ProviderError: HttpProviderError at HttpProvider.request (/home/peerplays/ethereum-network/peerplays-ethereum/node_modules/hardhat/src/internal/core/providers/http.ts:78:19) at LocalAccountsProvider.request (/home/peerplays/ethereum-network/peerplays-ethereum/node_modules/hardhat/src/internal/core/providers/accounts.ts:181:36) at processTicksAndRejections (node:internal/process/task_queues:96:5) at EthersProviderWrapper.send (/home/peerplays/ethereum-network/peerplays-ethereum/node_modules/@nomiclabs/hardhat-ethers/src/internal/ethers-provider-wrapper.ts:13:20), method: 'sendTransaction', transaction: undefined } ...
vampik commented 2023-02-28 15:52:32 +00:00 (Migrated from gitlab.com)

Creating assets inside Peerplays blockchain and ETH ERC-20 token, these are two different things.
You have some misconfiguration in ETH container. Try to rebuild and reinit it from beginning.

Creating assets inside Peerplays blockchain and ETH ERC-20 token, these are two different things. You have some misconfiguration in ETH container. Try to rebuild and reinit it from beginning.
wsalloum commented 2023-03-02 10:56:30 +00:00 (Migrated from gitlab.com)

So now after rebuilding, if I run the deposit script before peerplays initiation, it runs without exception, but the can't see it in the account01 for peerplays

root@a540ab093dfa:~/ethereum-network/peerplays-ethereum# npx hardhat run scripts/deposit_simple_token.js --network localhost
Owner: 0x5C79A9F5767E3C1b926f963fA24E21D8a04289aE
Balance of owner:  BigNumber { value: "100" }
Balance before deposit:  BigNumber { value: "0" }
Balance after deposit:  BigNumber { value: "10" }
root@a540ab093dfa:~/ethereum-network/peerplays-ethereum#
unlocked >>> list_account_balances account01
list_account_balances account01
49999949 TEST
1000000 PBTC
1000000 PEOS
1000000 PETH

And if I run the script after peerplays initiation, I get this exception :


root@706b3f9f6d94:~/ethereum-network/peerplays-ethereum# npx hardhat run scripts/deposit_simple_token.js --network localhost
Owner: 0x5C79A9F5767E3C1b926f963fA24E21D8a04289aE
Balance of owner:  BigNumber { value: "100" }
Balance before deposit:  BigNumber { value: "0" }
Error: insufficient funds for intrinsic transaction cost [ See: https://links.ethers.org/v5-errors-INSUFFICIENT_FUNDS ] (error={"name":"ProviderError","_stack":"ProviderError: HttpProviderError\n    at HttpProvider.request (/home/peerplays/ethereum-network/peerplays-ethereum/node_modules/hardhat/src/internal/core/providers/http.ts:78:19)\n    at LocalAccountsProvider.request (/home/peerplays/ethereum-network/peerplays-ethereum/node_modules/hardhat/src/internal/core/providers/accounts.ts:181:36)\n    at processTicksAndRejections (node:internal/process/task_queues:96:5)\n    at EthersProviderWrapper.send (/home/peerplays/ethereum-network/peerplays-ethereum/node_modules/@nomiclabs/hardhat-ethers/src/internal/ethers-provider-wrapper.ts:13:20)","code":-32000,"_isProviderError":true}, method="sendTransaction", transaction=undefined, code=INSUFFICIENT_FUNDS, version=providers/5.7.2)
    at Logger.makeError (/home/peerplays/ethereum-network/peerplays-ethereum/node_modules/@ethersproject/logger/src.ts/index.ts:269:28)
    at Logger.throwError (/home/peerplays/ethereum-network/peerplays-ethereum/node_modules/@ethersproject/logger/src.ts/index.ts:281:20)
    at checkError (/home/peerplays/ethereum-network/peerplays-ethereum/node_modules/@ethersproject/providers/src.ts/json-rpc-provider.ts:98:16)
    at /home/peerplays/ethereum-network/peerplays-ethereum/node_modules/@ethersproject/providers/src.ts/json-rpc-provider.ts:265:24
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  reason: 'insufficient funds for intrinsic transaction cost',
  code: 'INSUFFICIENT_FUNDS',
  error: ProviderError: HttpProviderError
      at HttpProvider.request (/home/peerplays/ethereum-network/peerplays-ethereum/node_modules/hardhat/src/internal/core/providers/http.ts:78:19)
      at LocalAccountsProvider.request (/home/peerplays/ethereum-network/peerplays-ethereum/node_modules/hardhat/src/internal/core/providers/accounts.ts:181:36)
      at processTicksAndRejections (node:internal/process/task_queues:96:5)
      at EthersProviderWrapper.send (/home/peerplays/ethereum-network/peerplays-ethereum/node_modules/@nomiclabs/hardhat-ethers/src/internal/ethers-provider-wrapper.ts:13:20),
  method: 'sendTransaction',
  transaction: undefined
}
So now after rebuilding, if I run the deposit script before peerplays initiation, it runs without exception, but the can't see it in the account01 for peerplays ``` root@a540ab093dfa:~/ethereum-network/peerplays-ethereum# npx hardhat run scripts/deposit_simple_token.js --network localhost Owner: 0x5C79A9F5767E3C1b926f963fA24E21D8a04289aE Balance of owner: BigNumber { value: "100" } Balance before deposit: BigNumber { value: "0" } Balance after deposit: BigNumber { value: "10" } root@a540ab093dfa:~/ethereum-network/peerplays-ethereum# ``` ``` unlocked >>> list_account_balances account01 list_account_balances account01 49999949 TEST 1000000 PBTC 1000000 PEOS 1000000 PETH ``` And if I run the script after peerplays initiation, I get this exception : ``` root@706b3f9f6d94:~/ethereum-network/peerplays-ethereum# npx hardhat run scripts/deposit_simple_token.js --network localhost Owner: 0x5C79A9F5767E3C1b926f963fA24E21D8a04289aE Balance of owner: BigNumber { value: "100" } Balance before deposit: BigNumber { value: "0" } Error: insufficient funds for intrinsic transaction cost [ See: https://links.ethers.org/v5-errors-INSUFFICIENT_FUNDS ] (error={"name":"ProviderError","_stack":"ProviderError: HttpProviderError\n at HttpProvider.request (/home/peerplays/ethereum-network/peerplays-ethereum/node_modules/hardhat/src/internal/core/providers/http.ts:78:19)\n at LocalAccountsProvider.request (/home/peerplays/ethereum-network/peerplays-ethereum/node_modules/hardhat/src/internal/core/providers/accounts.ts:181:36)\n at processTicksAndRejections (node:internal/process/task_queues:96:5)\n at EthersProviderWrapper.send (/home/peerplays/ethereum-network/peerplays-ethereum/node_modules/@nomiclabs/hardhat-ethers/src/internal/ethers-provider-wrapper.ts:13:20)","code":-32000,"_isProviderError":true}, method="sendTransaction", transaction=undefined, code=INSUFFICIENT_FUNDS, version=providers/5.7.2) at Logger.makeError (/home/peerplays/ethereum-network/peerplays-ethereum/node_modules/@ethersproject/logger/src.ts/index.ts:269:28) at Logger.throwError (/home/peerplays/ethereum-network/peerplays-ethereum/node_modules/@ethersproject/logger/src.ts/index.ts:281:20) at checkError (/home/peerplays/ethereum-network/peerplays-ethereum/node_modules/@ethersproject/providers/src.ts/json-rpc-provider.ts:98:16) at /home/peerplays/ethereum-network/peerplays-ethereum/node_modules/@ethersproject/providers/src.ts/json-rpc-provider.ts:265:24 at processTicksAndRejections (node:internal/process/task_queues:96:5) { reason: 'insufficient funds for intrinsic transaction cost', code: 'INSUFFICIENT_FUNDS', error: ProviderError: HttpProviderError at HttpProvider.request (/home/peerplays/ethereum-network/peerplays-ethereum/node_modules/hardhat/src/internal/core/providers/http.ts:78:19) at LocalAccountsProvider.request (/home/peerplays/ethereum-network/peerplays-ethereum/node_modules/hardhat/src/internal/core/providers/accounts.ts:181:36) at processTicksAndRejections (node:internal/process/task_queues:96:5) at EthersProviderWrapper.send (/home/peerplays/ethereum-network/peerplays-ethereum/node_modules/@nomiclabs/hardhat-ethers/src/internal/ethers-provider-wrapper.ts:13:20), method: 'sendTransaction', transaction: undefined } ```
prandnum commented 2023-04-16 10:34:54 +00:00 (Migrated from gitlab.com)

@vampik After running "npx hardhat run scripts/deposit_simple_token.js --network localhost" i am unable to see the token in peerplays account. I can see that the the sidechain transaction is only detected in witness peerplays01. The deposit is also not processed because the number of approver threshold is not reached. Is there any configuration file which needs to be corrected?

docker logs here: 473.tar.gz

kiran@warpspeed:~/PBSA/472/peerplays-utils/peerplays-qa-environment$ docker exec -it peerplays-qa-environment_ethereum-for-peerplays_1 /bin/bash
root@4c176aa39762:~/ethereum-network# 
root@4c176aa39762:~/ethereum-network# 
root@4c176aa39762:~/ethereum-network# cd peerplays-ethereum
root@4c176aa39762:~/ethereum-network/peerplays-ethereum# npx hardhat run scripts/deposit_simple_token.js --network localhost
Owner: 0x5C79A9F5767E3C1b926f963fA24E21D8a04289aE
Balance of owner:  BigNumber { value: "100" }
Balance before deposit:  BigNumber { value: "0" }
Balance after deposit:  BigNumber { value: "10" }
root@4c176aa39762:~/ethereum-network/peerplays-ethereum# 
unlocked >>> get_object 1.36.0 
get_object 1.36.0
[{
    "id": "1.36.0",
    "timestamp": "2023-04-16T10:27:09",
    "block_num": 1005,
    "sidechain": "ethereum",
    "sidechain_uid": "ethereum-0xdf893e236d50bf5c36191863ac39e870bb4d80b0ac7af9f418be5ea308015dec-0",
    "sidechain_transaction_id": "0xdf893e236d50bf5c36191863ac39e870bb4d80b0ac7af9f418be5ea308015dec",
    "sidechain_from": "0x5c79a9f5767e3c1b926f963fa24e21d8a04289ae",
    "sidechain_to": "0x56316f7354845275f28478d53f8dd423e42cfce6",
    "sidechain_currency": "ERC20TEST",
    "sidechain_amount": 10,
    "peerplays_from": "1.2.52",
    "peerplays_to": "1.2.19",
    "peerplays_asset": {
      "amount": 400,
      "asset_id": "1.3.0"
    },
    "expected_reports": [[
        "1.33.0",
        1
      ],[
        "1.33.1",
        1
      ],[
        "1.33.2",
        1
      ],[
        "1.33.3",
        1
      ],[
        "1.33.4",
        1
      ]
    ],
    "received_reports": [
      "1.33.0"
    ],
    "confirmed": false,
    "processed": false
  }
]
unlocked >>> 
@vampik After running "`npx hardhat run scripts/deposit_simple_token.js --network localhost`" i am unable to see the token in peerplays account. I can see that the the sidechain transaction is only detected in witness peerplays01. The deposit is also not processed because the number of approver threshold is not reached. Is there any configuration file which needs to be corrected? docker logs here: [473.tar.gz](/uploads/42e480029ef710b402699e0d04ac626d/473.tar.gz) ``` kiran@warpspeed:~/PBSA/472/peerplays-utils/peerplays-qa-environment$ docker exec -it peerplays-qa-environment_ethereum-for-peerplays_1 /bin/bash root@4c176aa39762:~/ethereum-network# root@4c176aa39762:~/ethereum-network# root@4c176aa39762:~/ethereum-network# cd peerplays-ethereum root@4c176aa39762:~/ethereum-network/peerplays-ethereum# npx hardhat run scripts/deposit_simple_token.js --network localhost Owner: 0x5C79A9F5767E3C1b926f963fA24E21D8a04289aE Balance of owner: BigNumber { value: "100" } Balance before deposit: BigNumber { value: "0" } Balance after deposit: BigNumber { value: "10" } root@4c176aa39762:~/ethereum-network/peerplays-ethereum# ``` ``` unlocked >>> get_object 1.36.0 get_object 1.36.0 [{ "id": "1.36.0", "timestamp": "2023-04-16T10:27:09", "block_num": 1005, "sidechain": "ethereum", "sidechain_uid": "ethereum-0xdf893e236d50bf5c36191863ac39e870bb4d80b0ac7af9f418be5ea308015dec-0", "sidechain_transaction_id": "0xdf893e236d50bf5c36191863ac39e870bb4d80b0ac7af9f418be5ea308015dec", "sidechain_from": "0x5c79a9f5767e3c1b926f963fa24e21d8a04289ae", "sidechain_to": "0x56316f7354845275f28478d53f8dd423e42cfce6", "sidechain_currency": "ERC20TEST", "sidechain_amount": 10, "peerplays_from": "1.2.52", "peerplays_to": "1.2.19", "peerplays_asset": { "amount": 400, "asset_id": "1.3.0" }, "expected_reports": [[ "1.33.0", 1 ],[ "1.33.1", 1 ],[ "1.33.2", 1 ],[ "1.33.3", 1 ],[ "1.33.4", 1 ] ], "received_reports": [ "1.33.0" ], "confirmed": false, "processed": false } ] unlocked >>> ```
vampik commented 2023-04-17 10:51:34 +00:00 (Migrated from gitlab.com)

Are you building from beatrice branch?
Both for witness_node and QA env?

Are you building from `beatrice` branch? Both for `witness_node` and QA env?
prandnum commented 2023-04-17 12:22:41 +00:00 (Migrated from gitlab.com)

default QA environment so it should be develop branch.

default QA environment so it should be develop branch.
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Peerplays_Blockchain/peerplays_migrated#473
No description provided.