Skip to content

Commit

Permalink
Basic support mumbai (#960)
Browse files Browse the repository at this point in the history
  • Loading branch information
aopoltorzhicky authored Mar 10, 2023
1 parent 90947a6 commit df8ee64
Show file tree
Hide file tree
Showing 11 changed files with 70 additions and 30 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/tests_master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,18 @@ on:
name: build
jobs:
golangci:
name: Linter
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v3
with:
go-version: '1.18'
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v2.3.0
uses: golangci/golangci-lint-action@v3
with:
version: v1.49.0
args: --timeout=2m --go=1.18
version: v1.51.2
args: --timeout=3m
test:
name: Tests
runs-on: ubuntu-latest
Expand Down
13 changes: 8 additions & 5 deletions .github/workflows/tests_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,18 @@ on:
name: Pull Request Tests
jobs:
golangci:
name: Linter
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v3
with:
go-version: '1.18'
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v2.3.0
uses: golangci/golangci-lint-action@v3
with:
version: v1.49.0
args: --timeout=2m --go=1.18
version: v1.51.2
args: --timeout=3m
test:
name: Tests
runs-on: ubuntu-latest
Expand Down
21 changes: 16 additions & 5 deletions configs/development.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ rpc:
uri: https://rpc.tzkt.io/limanet
timeout: 20
requests_per_second: 20
mumbainet:
uri: https://rpc.tzkt.io/mumbainet
timeout: 20
requests_per_second: 20

tzkt:
mainnet:
Expand All @@ -23,6 +27,8 @@ services:
mempool: https://mempool.test.dipdup.net/v1/graphql
limanet:
mempool: https://mempool.test.dipdup.net/v1/graphql
mumbainet:
mempool: https://mempool.test.dipdup.net/v1/graphql

storage:
pg:
Expand Down Expand Up @@ -60,10 +66,12 @@ api:
mainnet: https://rpc.tzkt.io/mainnet
ghostnet: https://rpc.tzkt.io/ghostnet
limanet: https://rpc.tzkt.io/limanet
mumbainet: https://rpc.tzkt.io/mumbainet
networks:
- mainnet
- ghostnet
- limanet
- mumbainet
connections:
max: 50
idle: 50
Expand All @@ -72,11 +80,13 @@ indexer:
project_name: indexer
sentry_enabled: false
networks:
mainnet:
receiver_threads: 5
ghostnet:
receiver_threads: 10
limanet:
# mainnet:
# receiver_threads: 5
# ghostnet:
# receiver_threads: 10
# limanet:
# receiver_threads: 10
mumbainet:
receiver_threads: 10
connections:
max: 5
Expand All @@ -92,6 +102,7 @@ scripts:
- mainnet
- ghostnet
- limanet
- mumbainet
connections:
max: 5
idle: 5
11 changes: 11 additions & 0 deletions configs/production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ rpc:
uri: https://rpc.tzkt.io/limanet
timeout: 20
requests_per_second: 20
mumbainet:
uri: https://rpc.tzkt.io/mumbainet
timeout: 20
requests_per_second: 20

tzkt:
mainnet:
Expand All @@ -24,6 +28,8 @@ services:
mempool: https://mempool.test.dipdup.net/v1/graphql
limanet:
mempool: https://mempool.test.dipdup.net/v1/graphql
mumbainet:
mempool: https://mempool.test.dipdup.net/v1/graphql

storage:
pg:
Expand Down Expand Up @@ -61,10 +67,12 @@ api:
mainnet: https://rpc.tzkt.io/mainnet
ghostnet: https://rpc.tzkt.io/ghostnet
limanet: https://rpc.tzkt.io/limanet
mumbainet: https://rpc.tzkt.io/mumbainet
networks:
- mainnet
- ghostnet
- limanet
- mumbainet
connections:
max: 50
idle: 10
Expand All @@ -79,6 +87,8 @@ indexer:
receiver_threads: ${TESTNET_THREADS:-1}
limanet:
receiver_threads: ${TESTNET_THREADS:-1}
mumbainet:
receiver_threads: ${TESTNET_THREADS:-1}
connections:
max: 5
idle: 5
Expand All @@ -93,6 +103,7 @@ scripts:
- mainnet
- ghostnet
- limanet
- mumbainet
connections:
max: 5
idle: 5
4 changes: 3 additions & 1 deletion internal/bcd/encoding/base58.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const (
PrefixPublicKeyTZ4 = "tz4"
PrefixPublicKeyKT1 = "KT1"
PrefixPublicKeyTxr1 = "txr1"
PrefixOriginatedSmartRollup = "sr1"
PrefixRollupInboxHash = "txi"
PrefixRollupMessageHash = "txm"
PrefixRollupCommitmentHash = "txc"
Expand Down Expand Up @@ -70,10 +71,11 @@ var base58Encodings = []base58Encoding{
{[]byte(PrefixPublicKeyTZ1), 36, []byte{6, 161, 159}, 20, "ed25519 public key hash"},
{[]byte(PrefixPublicKeyTZ2), 36, []byte{6, 161, 161}, 20, "secp256k1 public key hash"},
{[]byte(PrefixPublicKeyTZ3), 36, []byte{6, 161, 164}, 20, "p256 public key hash"},
{[]byte(PrefixPublicKeyTZ4), 36, []byte{6, 161, 166}, 20, "BLS-MinPk"},
{[]byte(PrefixPublicKeyKT1), 36, []byte{2, 90, 121}, 20, "Originated address"},

{[]byte(PrefixPublicKeyTxr1), 37, []byte{1, 128, 120, 31}, 20, "Rollup address"},
{[]byte(PrefixPublicKeyTZ4), 36, []byte{6, 161, 166}, 20, "L2 rollup address"},
{[]byte(PrefixOriginatedSmartRollup), 37, []byte{6, 124, 117}, 20, "Smart rollup"},
{[]byte(PrefixRollupInboxHash), 53, []byte{79, 148, 196}, 32, "Inbox hash"},
{[]byte(PrefixRollupMessageHash), 53, []byte{79, 149, 030}, 32, "Message hash"},
{[]byte(PrefixRollupCommitmentHash), 53, []byte{79, 148, 017}, 32, "Commitment hash"},
Expand Down
9 changes: 9 additions & 0 deletions internal/bcd/forge/domaintypes.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,17 @@ func Address(val string, tzOnly bool) ([]byte, error) {
address = append([]byte{0, 1}, address...)
case encoding.PrefixPublicKeyTZ3:
address = append([]byte{0, 2}, address...)
case encoding.PrefixPublicKeyTZ4:
address = append([]byte{0, 3}, address...)
case encoding.PrefixPublicKeyKT1:
address = append([]byte{1}, address...)
address = append(address, byte(0))
case encoding.PrefixPublicKeyTxr1:
address = append([]byte{2}, address...)
address = append(address, byte(0))
case encoding.PrefixOriginatedSmartRollup:
address = append([]byte{3}, address...)
address = append(address, byte(0))
default:
return nil, errors.Errorf("Invalid address prefix: %s", prefix)
}
Expand All @@ -53,10 +58,14 @@ func UnforgeAddress(str string) (string, error) {
return encoding.EncodeBase58String(str[4:], []byte(encoding.PrefixPublicKeyTZ2))
case strings.HasPrefix(str, "0002"):
return encoding.EncodeBase58String(str[4:], []byte(encoding.PrefixPublicKeyTZ3))
case strings.HasPrefix(str, "0003"):
return encoding.EncodeBase58String(str[4:], []byte(encoding.PrefixPublicKeyTZ3))
case strings.HasPrefix(str, "01") && strings.HasSuffix(str, "00"):
return encoding.EncodeBase58String(str[2:len(str)-2], []byte(encoding.PrefixPublicKeyKT1))
case strings.HasPrefix(str, "02") && strings.HasSuffix(str, "00"):
return encoding.EncodeBase58String(str[2:len(str)-2], []byte(encoding.PrefixPublicKeyTxr1))
case strings.HasPrefix(str, "03") && strings.HasSuffix(str, "00"):
return encoding.EncodeBase58String(str[2:len(str)-2], []byte(encoding.PrefixOriginatedSmartRollup))
default:
return str, errors.Wrapf(consts.ErrInvalidAddress, "UnforgeAddress: %s", str)
}
Expand Down
3 changes: 3 additions & 0 deletions internal/bcd/protocols.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ var symLinks = map[string]string{
"PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY": SymLinkJakarta, // Jakarta
"PtKathmankSpLLDALzWw7CGD2j2MtyveTwboEYokqUCP4a1LxMg": SymLinkJakarta, // Kathmandu
"PtLimaPtLMwfNinJi9rCfDPWea8dFgTZ1MeJ9f1m2SRic6ayiwW": SymLinkJakarta, // Lima
"PtMumbaiiFFEGbew1rRjzSPyzRbA51Tm3RVZL5suHPxSZYDhCEc": SymLinkJakarta, // Mumbai
"PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1": SymLinkJakarta, // Mumbai 2
}

// GetProtoSymLink -
Expand Down Expand Up @@ -66,4 +68,5 @@ var ChainID = map[string]string{
"NetXLH1uAxK7CCh": "jakarta",
"NetXi2ZagzEsXbZ": "kathmandunet",
"NetXizpkH94bocH": "limanet",
"NetXQw6nWSnrJ5t": "mumbainet",
}
3 changes: 3 additions & 0 deletions internal/models/types/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const (
Limanet
Mondaynet
Dailynet
Mumbainet
)

var networkNames = map[Network]string{
Expand All @@ -47,6 +48,7 @@ var networkNames = map[Network]string{
Limanet: "limanet",
Mondaynet: "mondaynet",
Dailynet: "dailynet",
Mumbainet: "mumbainet",
}

var namesToNetwork = map[string]Network{
Expand All @@ -66,6 +68,7 @@ var namesToNetwork = map[string]Network{
"limanet": Limanet,
"mondaynet": Mondaynet,
"dailynet": Dailynet,
"mumbainet": Mumbainet,
}

// String - convert enum to string for printing
Expand Down
4 changes: 3 additions & 1 deletion internal/parsers/operations/migration.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ func (m Migration) Parse(data noderpc.Operation, operation *operation.Operation,
"PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV",
"PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY",
"PtKathmankSpLLDALzWw7CGD2j2MtyveTwboEYokqUCP4a1LxMg",
"PtLimaPtLMwfNinJi9rCfDPWea8dFgTZ1MeJ9f1m2SRic6ayiwW":
"PtLimaPtLMwfNinJi9rCfDPWea8dFgTZ1MeJ9f1m2SRic6ayiwW",
"PtMumbaiiFFEGbew1rRjzSPyzRbA51Tm3RVZL5suHPxSZYDhCEc",
"PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1":

return m.fromLazyStorageDiff(data, operation, store)
default:
Expand Down
8 changes: 6 additions & 2 deletions internal/parsers/protocols/protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ func Get(ctx *config.Context, protocol string) (*Specific, error) {
case "PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY",
"PtKathmankSpLLDALzWw7CGD2j2MtyveTwboEYokqUCP4a1LxMg",
"ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK",
"PtLimaPtLMwfNinJi9rCfDPWea8dFgTZ1MeJ9f1m2SRic6ayiwW":
"PtLimaPtLMwfNinJi9rCfDPWea8dFgTZ1MeJ9f1m2SRic6ayiwW",
"PtMumbaiiFFEGbew1rRjzSPyzRbA51Tm3RVZL5suHPxSZYDhCEc",
"PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1":
return &Specific{
StorageParser: storage.NewLazyBabylon(ctx.BigMapDiffs, ctx.Operations, ctx.Accounts),
ContractParser: contract.NewJakarta(ctx),
Expand Down Expand Up @@ -123,7 +125,9 @@ func NeedImplicitParsing(protocol string) bool {
"PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY",
"PtKathmankSpLLDALzWw7CGD2j2MtyveTwboEYokqUCP4a1LxMg",
"ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK",
"PtLimaPtLMwfNinJi9rCfDPWea8dFgTZ1MeJ9f1m2SRic6ayiwW":
"PtLimaPtLMwfNinJi9rCfDPWea8dFgTZ1MeJ9f1m2SRic6ayiwW",
"PtMumbaiiFFEGbew1rRjzSPyzRbA51Tm3RVZL5suHPxSZYDhCEc",
"PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1":
return true
}
return false
Expand Down
11 changes: 0 additions & 11 deletions scripts/bcdctl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@ import (
)

var ctxs config.Contexts
var creds awsData

type awsData struct {
BucketName string
Region string
}

func main() {
cfg, err := config.LoadDefaultConfig()
Expand All @@ -25,11 +19,6 @@ func main() {
return
}

creds = awsData{
BucketName: cfg.Scripts.AWS.BucketName,
Region: cfg.Scripts.AWS.Region,
}

ctxs = config.NewContexts(cfg, cfg.Scripts.Networks,
config.WithStorage(cfg.Storage, "bcdctl", 0, cfg.Scripts.Connections.Open, cfg.Scripts.Connections.Idle, false),
config.WithConfigCopy(cfg),
Expand Down

0 comments on commit df8ee64

Please sign in to comment.