Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Dennis Gearon
    @kwince
    Thx Alex @hedgar2017
    hanakomodo
    @hanakomodo
    turing complete zinc and testnet are both targeting may right? excited to try developing for zksync but seems like the correct thing to do is wait for that?
    Alex Z
    @hedgar2017
    @hanakomodo yeah, exactly :)
    85
    @eightyfive
    👋 there. How much cheaper is running some SC on zkSync L2? Is there some
    *docs someone could point to?
    Alex Z
    @hedgar2017
    @eightyfive hi!
    There were some talks about orders of magnitude, but there zkSync guys should give more precise info :)
    https://gitter.im/matter-labs/zksync
    85
    @eightyfive
    🙏
    Is there some public vyper-to-zinc transpiler ? I guess the team did not translate all the Curve vyper contracts by hand, or did you?
    Alex Z
    @hedgar2017
    @eightyfive nope, just rewrote this part by hand.
    https://github.com/matter-labs/curve-zinc
    85
    @eightyfive
    Ok. Why not 🙂
    JamesRay
    @james-ray
    I am trying to use CLion to debug the server and the prover, however the sever started and soon panicked:
    thread 'main' panicked at 'Cannot drop a runtime in a context where blocking is not allowed. This happens when a runtime is dropped from within an asynchronous context.'
    24: 0x562d3a2c60ba - zksync_api::fee_ticker::ticker_api::coingecko::CoinGeckoAPI::new::hb7540c35664399f4
    at /home/james/workspace/zksync/core/bin/zksync_api/src/fee_ticker/ticker_api/coingecko.rs:27:26
    25: 0x562d3a3c1127 - zksync_api::fee_ticker::run_ticker_task::h47c3c743da9dc809
    at /home/james/workspace/zksync/core/bin/zksync_api/src/fee_ticker/mod.rs:282:17
    26: 0x562d3a6efd54 - zksync_api::run_api::h550531807cbf1995
    at /home/james/workspace/zksync/core/bin/zksync_api/src/lib.rs:25:23
    I found it tries to connect http://127.0.0.1:9876/api/v3/coins/list, I open the url in internet explorer, the url is fine.
    Alex Z
    @hedgar2017
    @james-ray please, address zkSync issues to the zkSync chat :)
    Dennis Gearon
    @kwince
    @hedgar2017 Do you know how to get the private_key needed for transactions? Is it a ZKSYNC private key derived from an Ethereum wallet private key, or is it just he Ethereum private key. I am doing the 'minimal example' here. https://zinc.zksync.io/07-smart-contracts/02-minimal-example.html
    Madis Nõmme
    @madis

    Hello. First of all, amazing technology. I'm happy to be a pioneer and bringing it to the masses. Sorry for my n00b questions in case this is something obvious to the more knowledgeable people here.

    1. When deploying a contract written in Zinc using zargo to rinkeby, do the rinkeby EVM nodes execute it? Or where and how does the L2 come into play (e.g. when and where is the actual zkSync storage kept)?

    2. To call the Zinc contract methods, should I use the same web3 workflow (e.g. new web3.eth.Contract(...) etc.)? Or something else is needed? (the tutorial on Contract Workflow suggests zargo call ...). If it's the latter, what options there are (e.g. to do it using JavaScript)?

    Madis Nõmme
    @madis

    Another question. I followed the minimal-example to the dot (https://zinc.zksync.io/07-smart-contracts/02-minimal-example.html), added private_key but during deployment I get the following error.

    ❯ zargo publish --network rinkeby --instance default
       Compiling vorsti_hind v0.1.0
        Finished release [optimized] target
      Setting up key pair `./data/proving_key` and `./data/verifying_key`
       Uploading the instance `default` of `vorsti_hind v0.1.0` to network `rinkeby`
         Address 0xa87b7674c7e7f1e46e880542b15d4c6857893bfc
    [ERROR zargo] Invalid character 'x' at position 1

    Any hints what could be causing the [ERROR zargo] Invalid character 'x' at position 1?

    Alex Z
    @hedgar2017
    @kwince L1 and L2 share the private key, so I think it is both :)
    Alex Z
    @hedgar2017
    @madis hi! Thank you, welcome here :)
    1. The current version of Zinc and Zargo interact with the Zandbox server, which resides on rinkeby and interacts with its zkSync node (sends transactions and executing contract methods). The release you are using now (0.2.3) is half a year old demo, so the contract storage (except balances) is kept in PostgreSQL, but the balances are stored in zkSync.
    2. There is no JS client for Zandbox, but I wrote the endpoint specification a while ago, so you are free to use it: https://www.notion.so/matterlabs/Endpoint-documentation-f9841e45616f4c0d85275cd72812b540.
      However, there is an upcoming Turing-complete release soon, and all the functionality I'm talking about is already deprecated and removed. So it is worth to wait for this release :)
    3. Ah, just remove the 0x prefix from the private key.
    Madis Nõmme
    @madis

    Thanks for the help! Can't wait for the next release. The private key change worked. I was also able to deploy & call my contract on rinkeby using zargo.

    Tried the API endpoints but so far to no avail (gives 404). Is the root url I got from https://github.com/matter-labs/zinc/blob/main/zargo/src/network.rs#L23 correct (https://rinkeby3-zandbox.zksync.dev)?

    I tried with

    curl -v -X PUT "https://rinkeby3-zandbox.zksync.dev/api/v1/query?address=0x6f5c9eaa40f5ca1b5fb0913d59a85beb4aa721d9&method=get_fee"
    Alex Z
    @hedgar2017
    @madis sorry, the document got a little outdated :) https://github.com/matter-labs/zinc/blob/main/zinc-const/src/zandbox.rs
    Updated!
    Dennis Gearon
    @kwince
    Thx Alex very much
    Holy cow! If there's no network connection, my android gitter does not terminate the msg and buffer it for sending. It just accepts the CR/EOL! That, and my android gitter keeps crashing, and there's no decent search on mobile. Hmmm, gitter underwhelms.
    Dennis Gearon
    @kwince
    @madis I should be getting close to doing that myself soon. Congratulations! I'm looking forward to the getting this test version done before zinc comes out with its latest version
    Husen Wang
    @wanghs09
    @hedgar2017 Is it possible to start a localhost network to deploy Zinc contract? rinkeby is not stable enough
    Madis Nõmme
    @madis

    Good morning. What's the preferred approach to testing contract methods of Zinc code? The examples I've found so far all call individual methods (outside a contract) e.g. https://github.com/matter-labs/curve-zinc/blob/main/src/exchange.zn#L74-L83

    Is that the only way? I.e. extract and delegate from contract to pure methods outside the contract and test these? Or is there a way to instantiate the contract object itself (with some state) and call its methods (via zargo test for example)?

    4 replies
    Husen Wang
    @wanghs09
    @hedgar2017 is there any bytecode size limit? the compiled main.znb is 105k and reported error when zargo publish [ERROR zargo] contract uploading request: HTTP error (422 Unprocessable Entity) Runtime: MalformedBytecode(StackUnderflow)
    Alex Z
    @hedgar2017
    @kwince thanks!
    Alex Z
    @hedgar2017

    @madis it is possible by running zvm manually using zargo run.
    @wanghs09 that might indicate a bug in the old VM.

    Sorry, we do not support that version anymore, as we are extremely focused on the upcoming Turing-complete contracts release.
    Please, look forward to the testnet release in May :)

    Husen Wang
    @wanghs09

    @wanghs09 that might indicate a bug in the old VM.

    Sorry, we do not support that version anymore, as we are extremely focused on the upcoming Turing-complete contracts release.
    Please, look forward to the testnet release in May :)

    would that be a new language? is it compatible with the zinc contract?
    Alex Z
    @hedgar2017
    @wanghs09 all the same, but Turing-complete (like Solidity).
    Husen Wang
    @wanghs09
    Thanks! that would be great!:D
    Kristof Gazso
    @kristofgazso
    Hey! I was wondering what is the best way of getting a user on a website to sign a mutable zinc transaction without installing zargo themselves and without copy-pasting their private key into the website.
    Kristof Gazso
    @kristofgazso
    1. There is no JS client for Zandbox, but I wrote the endpoint specification a while ago, so you are free to use it: https://www.notion.so/matterlabs/Endpoint-documentation-f9841e45616f4c0d85275cd72812b540.
    How would you create valid signatures for the call transaction in the required format using web3.js?
    Madis Nõmme
    @madis
    :point_up: I'd be interested in it too. The urls posted in https://github.com/matter-labs/zinc/blob/main/zinc-const/src/zandbox.rs are missing the root url also. The closest I got was with the following, which gave me 400 error (from CloudFlare) instead of 404
    curl -v -X PUT "https://rinkeby3-zandbox.zksync.dev/api/v1/contract/query?address=0x6f5c9eaa40f5ca1b5fb0913d59a85beb4aa721d9&method=get_fee"

    Post to the same url gives 405, so something is happening.

    Grepped the zargo binary and got the following urls

    https://rinkeby3-zandbox.zksync.dev
    https://ropsten-api.zksync.io/jsrpc
    https://rinkeby-api.zksync.io/jsrpc
    https://api.zksync.io/jsrpc
    Kristof Gazso
    @kristofgazso
    1. There is no JS client for Zandbox, but I wrote the endpoint specification a while ago, so you are free to use it: https://www.notion.so/matterlabs/Endpoint-documentation-f9841e45616f4c0d85275cd72812b540.

    How would you create valid signatures for the call transaction in the required format using web3.js?

    As an example, what would be the best way of generating this following JSON code?

    {
      "arguments": {
        "value": "42"
      },
      "transaction": {
        "tx": {
          "type": "Transfer",
          "accountId": 1,
          "from": "0x36615cf349d7f6344891b1e7ca7c72883f5dc049",
          "to": "0x1234567812345678123456781234567812345678",
          "token": 0,
          "amount": "0",
          "fee": "37500000000000",
          "nonce": 2,
          "signature": {
            "pubKey": "07f86efb9bf58d5ebf23042406cb43e9363879ff79223be05b7feac1dbc58c86",
            "signature": "042c7356c3970c5ab620e1eaf0a9e39563edc9383072ac33a29398f11678b2a3acdc40ff05acd225b6a71962cfabfa6012fae8492106987bcd48135fefa09c02"
          }
        },
        "ethereumSignature": {
          "type": "EthereumSignature",
          "signature": "0xbe7a011c0b03a2ab8eceb3f51ec3055e5998b025e3e41a320f6b00532a4c49604608fe7b9c36d837c36817bbaf5570197484281dd45d83f2d9ef867b7454b91e1b"
        }
      }
    }
    Madis Nõmme
    @madis
    Could someone help me understand how to return value from MTreeMap from a contract method? I have the below minimal-example
    contract ThingContract {
        things: std::collections::MTreeMap<u32, Thing>;
        pub fn new(owner: u160) -> Self {
            Self {
                things: std::collections::MTreeMap
            }
        }
    
        pub fn addThing(mut self, id: u32, weight: u32) {
            self.things.insert(id, Thing {weight: weight});
        }
        pub fn getThing(mut self, id: u32) -> Thing {
            self.things.get(id); // With only this line, fails with: function `getThing` must return a value of type `structure Thing`, found `()`
    
            let (val, exists) = self.things.get(id); // Fails: function `getThing` must return a value of type `structure Thing`, found `()`
            val; // error[0048]: function `getThing` must return a value of type `structure Thing`, found `()`
        }
    }
    Or if it's not possible to return composed type (e.g. struct), I had the same error with returning simple value (after changing method return type)
    Forgot to include Thing definition earlier
    struct Thing {
        weight: u32
    }
    Madis Nõmme
    @madis

    I narrowed the error down more. :confused:

    contract Simpler {
        pub fn getNumber(mut self, value: u8) -> u16 {
            value * 42;
        }
    }

    Fails with

    ❯ zargo test --manifest-path=invoices/Zargo.toml
       Compiling invoices v0.1.0
    [ERROR   znc] 
    error[0048]: function `getNumber` must return a value of type `u16`, found `()`
       |
    37 |     pub fn getNumber(mut self, value: u8) -> u16 {
       | _____________________________________________^
     --> invoices/src/main.zn:38:15
       |
    38 |         value * 42;
       | ______________^
    
    [ERROR zargo] the subprocess failed with status exit code: 1
    How to correctly return result of this multiplication (or value from an earlier MTreeMap)?
    Madis Nõmme
    @madis
    Ok got it :sweat: Had to remove the semicolon. Why such confusing syntax? Seems much clearer to me to just return the value of the last expression.
    contract Simpler {
        pub fn getNumber(mut self, value: u8) -> u16 {
            (value * 42) as u16
        }
    }
    From the docs: The only way to return a value is to specify it as the last unterminated statement of the function block.
    First time I hear about unterminated statement I hope it doesn't make it to the final version
    Alex Z
    @hedgar2017
    @kristofgazso you should use the zkSync JS SDK for that.
    @madis this syntax is borrowed from Rust, just like the other 99% of Zinc :)
    I agree, it's a bit unusual for people from Solidity and JS ecosystems.
    Ofc, we'll be improving the errors and hints as people get stuck with such issues.
    Kristof Gazso
    @kristofgazso

    @kristofgazso you should use the zkSync JS SDK for that.

    Thanks for your response, I've looked through the entire documentation, but I can't seem to find a transaction signer that allows signing of zksync smart contract calls with arguments (I only found ones that sign simple EOA transactions). Apologies for the inconvenience, but could you point me to which function would be appropriate?