zkBob / libzkbob-rs

Apache License 2.0
1 stars 3 forks source link

Multipool addresses support #61

Closed EvgenKor closed 1 year ago

EvgenKor commented 1 year ago

The new addresses format description is here: https://www.notion.so/blockscout/Shielded-addresses-in-multipool-environment-a4f34585570240258575bb6ef59ee92a

Added routines to generate and parse universal addresses and checking address format. New functions are covered by unit-tests

Added pool catalog (pools.rs file). To support new pool it should be updated (currently supported: BOB on Polygon, BOB on Optimism, ETH on Optimism (not deployed yet), BOB on Sepolia, BOB on Goerli, BOB on Goerli-Optimism).

The old address format is supported on the BOB Polygon pool only

PRs chain:

AllFi commented 1 year ago

I'm not sure about hardcoding pools in the library. As for me, it looks more like a configuration that should be passed from the zkbob-client-js. We can initialize the UserAccount with a PoolConfig object that contains the poolId, poolPrefix, poolName, and other relevant information.

EvgenKor commented 1 year ago

I'm not sure about hardcoding pools in the library. As for me, it looks more like a configuration that should be passed from the zkbob-client-js. We can initialize the UserAccount with a PoolConfig object that contains the poolId, poolPrefix, poolName, and other relevant information.

Yes, I thought about that. The main disadvantage of such approach is unable to check shielded address for another pool and say in UI something like 'The address belongs to Optimism pool, please request another one for Polygon' until we have multipool configuration for all available pools. For example, zk-addresses for Sepolia will parsed with invalid checksum error on the mainnet UI

AllFi commented 1 year ago

Yes, I thought about that. The main disadvantage of such approach is unable to check shielded address for another pool and say in UI something like 'The address belongs to Optimism pool, please request another one for Polygon' until we have multipool configuration for all available pools. For example, zk-addresses for Sepolia will parsed with invalid checksum error on the mainnet UI

Maybe it's enough to say something like 'The address belongs to another pool, please request one for Polygon'?

EvgenKor commented 1 year ago

Maybe it's enough to say something like 'The address belongs to another pool, please request one for Polygon'?

We can't guess that address belongs to another pool without pool_id knowing