Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move zkEVM in DID from blockchain level to network level. Add Linea #464

Merged
merged 4 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 30 additions & 11 deletions did.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ const (
// Polygon is polygon blockchain network
Polygon Blockchain = "polygon"
// ZkEVM is zkEVM blockchain network
// Note: deprecated in favor of a zkEVM network of Polygon, will be removed in the future
ZkEVM Blockchain = "zkevm"
// Privado is Privado blockchain network
Privado Blockchain = "privado"
Expand Down Expand Up @@ -102,17 +103,10 @@ func RegisterBlockchain(b Blockchain) error {
// NetworkID is method specific network identifier
type NetworkID string

// Generic NetworkIDs
const (
// Main is main network
Main NetworkID = "main"
// Mumbai is polygon mumbai test network
Mumbai NetworkID = "mumbai"
// Amoy is polygon amoy test network
Amoy NetworkID = "amoy"
// Goerli is ethereum goerli test network
Goerli NetworkID = "goerli" // goerli
// Sepolia is ethereum Sepolia test network
Sepolia NetworkID = "sepolia"
// Test is test network
Test NetworkID = "test"
// UnknownNetwork is used when it's not possible to retrieve network from identifier
Expand All @@ -121,10 +115,32 @@ const (
NoNetwork NetworkID = ""
)

// Ethereum-specific NetworkIDs
const (
// Goerli is Ethereum goerli test network
Goerli NetworkID = "goerli"
// Sepolia is Ethereum Sepolia test network
Sepolia NetworkID = "sepolia"
)

// Polygon-specific NetworkIDs
const (
// Mumbai is Polygon mumbai test network
Mumbai NetworkID = "mumbai"
// Amoy is Polygon amoy test network
Amoy NetworkID = "amoy"
// Zkevm is zkEVM network in Polygon and potentially other blockchains
Zkevm NetworkID = "zkevm"
// Cardona is Polygon zkEVM Cardona test network
Cardona NetworkID = "cardona"
)

var networks = map[NetworkID]NetworkID{
Main: Main,
Mumbai: Mumbai,
Amoy: Amoy,
Zkevm: Zkevm,
Cardona: Cardona,
Goerli: Goerli,
Sepolia: Sepolia,
Test: Test,
Expand Down Expand Up @@ -188,14 +204,17 @@ type DIDNetworkFlag struct {
var blockchainNetworkMap = map[DIDNetworkFlag]byte{
{Blockchain: ReadOnly, NetworkID: NoNetwork}: 0b0000_0000,

{Blockchain: Polygon, NetworkID: Main}: 0b0001_0000 | 0b0000_0001,
{Blockchain: Polygon, NetworkID: Mumbai}: 0b0001_0000 | 0b0000_0010,
{Blockchain: Polygon, NetworkID: Amoy}: 0b0001_0000 | 0b0000_0011,
{Blockchain: Polygon, NetworkID: Main}: 0b0001_0000 | 0b0000_0001,
{Blockchain: Polygon, NetworkID: Mumbai}: 0b0001_0000 | 0b0000_0010,
{Blockchain: Polygon, NetworkID: Amoy}: 0b0001_0000 | 0b0000_0011,
{Blockchain: Polygon, NetworkID: Zkevm}: 0b0001_0000 | 0b0000_0100,
{Blockchain: Polygon, NetworkID: Cardona}: 0b0001_0000 | 0b0000_0101,

{Blockchain: Ethereum, NetworkID: Main}: 0b0010_0000 | 0b0000_0001,
{Blockchain: Ethereum, NetworkID: Goerli}: 0b0010_0000 | 0b0000_0010,
{Blockchain: Ethereum, NetworkID: Sepolia}: 0b0010_0000 | 0b0000_0011,

// deprecated in favor of a zkEVM network of Polygon, will be removed in the future
{Blockchain: ZkEVM, NetworkID: Main}: 0b0011_0000 | 0b0000_0001,
{Blockchain: ZkEVM, NetworkID: Test}: 0b0011_0000 | 0b0000_0010,

Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ module github.com/iden3/go-iden3-core/v2
go 1.18

require (
github.com/iden3/go-iden3-crypto v0.0.15
github.com/iden3/go-iden3-crypto v0.0.17
github.com/mr-tron/base58 v1.2.0
github.com/stretchr/testify v1.8.2
github.com/stretchr/testify v1.9.0
)

require (
Expand Down
15 changes: 4 additions & 11 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,24 +1,17 @@
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/iden3/go-iden3-crypto v0.0.15 h1:4MJYlrot1l31Fzlo2sF56u7EVFeHHJkxGXXZCtESgK4=
github.com/iden3/go-iden3-crypto v0.0.15/go.mod h1:dLpM4vEPJ3nDHzhWFXDjzkn1qHoBeOT/3UEhXsEsP3E=
github.com/iden3/go-iden3-crypto v0.0.17 h1:NdkceRLJo/pI4UpcjVah4lN/a3yzxRUGXqxbWcYh9mY=
github.com/iden3/go-iden3-crypto v0.0.17/go.mod h1:dLpM4vEPJ3nDHzhWFXDjzkn1qHoBeOT/3UEhXsEsP3E=
github.com/leanovate/gopter v0.2.9 h1:fQjYxZaynp97ozCzfOyOuAGOU4aU/z37zf/tOujFk7c=
github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o=
github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8=
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
Loading