Skip to content

Commit 15f95ce

Browse files
Stefan-Ethernaltemaniarpit27rachit77ToniRamirezM
authored
feat: aggkit repo migration (#253)
* feat: remove `aggoracle` component (#251) * remove aggoracle component * improve Rust build perf and cleanup * handle error when unmarashaling versions.json * feat: remove `aggsender` component (#252) * remove aggsender component * fix: remove build-tools * fix: improve JSON parsing by cleaning up version strings * feat: mockery generate (#255) * mockery generate * Update .mockery.yaml Co-authored-by: Stefan Negovanović <93934272+Stefan-Ethernal@users.noreply.github.com> * review comments * review comment --------- Co-authored-by: Stefan Negovanović <93934272+Stefan-Ethernal@users.noreply.github.com> * rebase fix * feat: remove syncers and import the aggkit (#256) * feat: remove `aggoracle` component (#251) * remove aggoracle component * improve Rust build perf and cleanup * handle error when unmarashaling versions.json * feat: remove `aggsender` component (#252) * remove aggsender component * fix: remove build-tools * feat: mockery generate (#255) * mockery generate * Update .mockery.yaml Co-authored-by: Stefan Negovanović <93934272+Stefan-Ethernal@users.noreply.github.com> * review comments * review comment --------- Co-authored-by: Stefan Negovanović <93934272+Stefan-Ethernal@users.noreply.github.com> * wip * feat: fix BuildVersions during cargo build (#258) * fix DAC imports * remove unused code * chore: remove empty docker-compose.yml * fix build.rs * remove hex package * remove log package * remove db package * go mod tidy and fix in the proof * chore: remove redundant file * feat: remove bridge service (feat. claim sponsor, bridgesync, reorg detector l2 and corresponding config params) * chore: format and fix docs * chore: move bats e2e tests from fep folder * fix: path for batch_verification_monitor script --------- Co-authored-by: Stefan Negovanović <93934272+Stefan-Ethernal@users.noreply.github.com> Co-authored-by: Arpit Temani <temaniarpit27@gmail.com> Co-authored-by: Toni Ramírez <58293609+ToniRamirezM@users.noreply.github.com> Co-authored-by: Stefan Negovanović <stefan@ethernal.tech> --------- Co-authored-by: Arpit Temani <temaniarpit27@gmail.com> Co-authored-by: Rachit Sonthalia <54906134+rachit77@users.noreply.github.com> Co-authored-by: Toni Ramírez <58293609+ToniRamirezM@users.noreply.github.com>
1 parent 8a0eac0 commit 15f95ce

File tree

280 files changed

+1350
-35138
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

280 files changed

+1350
-35138
lines changed

.github/workflows/test-e2e-multi_pp.yml

Lines changed: 0 additions & 75 deletions
This file was deleted.

.github/workflows/test-e2e.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ jobs:
4242
- "fork11-rollup"
4343
- "fork12-validium"
4444
- "fork12-rollup"
45-
- "fork12-pessimistic"
4645
steps:
4746
- name: Checkout Code
4847
uses: actions/checkout@v4

.mockery.yaml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
with-expecter: true
2+
issue-845-fix: true
3+
resolve-type-alias: false
4+
dir: "{{ .InterfaceDir }}/../mocks"
5+
outpkg: "mocks"
6+
filename: "mock_{{ .InterfaceName | snakecase | lower }}.go"
7+
mockname: "{{ .InterfaceName }}"
8+
packages:
9+
github.com/0xPolygon/cdk/agglayer:
10+
config:
11+
inpackage: true
12+
dir: "{{ .InterfaceDir }}"
13+
outpkg: "{{ .PackageName }}"
14+
interfaces:
15+
AgglayerClientInterface:
16+
config:
17+
mockname: AgglayerClientMock
18+
github.com/0xPolygonHermez/zkevm-synchronizer-l1/synchronizer:
19+
config:
20+
interfaces:
21+
Synchronizer:
22+
config:
23+
dir: "./aggregator/mocks"
24+
mockname: "{{ .InterfaceName }}InterfaceMock"
25+
github.com/0xPolygon/cdk/aggregator:
26+
config:
27+
dir: "{{ .InterfaceDir }}/mocks"
28+
mockname: "{{ .InterfaceName }}Mock"
29+
interfaces:
30+
ProverInterface:
31+
Etherman:
32+
StorageInterface:
33+
EthTxManagerClient:
34+
RPCInterface:
35+
github.com/0xPolygon/cdk/aggregator/prover:
36+
config:
37+
dir: "{{ .InterfaceDir }}/mocks"
38+
interfaces:
39+
AggregatorService_ChannelServer:
40+
config:
41+
mockname: ChannelMock
42+
github.com/0xPolygon/cdk/dataavailability:
43+
config:
44+
dir: "{{ .InterfaceDir }}/mocks_da"
45+
all: true
46+
outpkg: "mocks_da"
47+
github.com/0xPolygon/cdk/sequencesender:
48+
config:
49+
dir: "{{ .InterfaceDir }}/mocks"
50+
outpkg: "mocks"
51+
mockname: "{{ .InterfaceName }}Mock"
52+
interfaces:
53+
EthTxManager:
54+
configs:
55+
- mockname: EthTxManagerMock
56+
- mockname: EthTxManagerMock
57+
dir: "{{ .InterfaceDir }}/../test/helpers"
58+
outpkg: "helpers"
59+
Etherman:
60+
RPCInterface:
61+
github.com/0xPolygon/cdk/sequencesender/txbuilder:
62+
config:
63+
dir: "{{ .InterfaceDir }}/mocks_txbuilder"
64+
all: true
65+
outpkg: "mocks_txbuilder"
66+
mockname: "{{ .InterfaceName | camelcase | firstUpper }}"
67+
interfaces:
68+
TxBuilder:
69+
configs:
70+
- dir: "{{ .InterfaceDir }}/../mocks"
71+
outpkg: "mocks"
72+
mockname: "{{ .InterfaceName | camelcase | firstUpper }}Mock"
73+
- dir: "{{ .InterfaceDir }}/mocks_txbuilder"
74+
outpkg: "mocks_txbuilder"
75+
mockname: "{{ .InterfaceName | camelcase | firstUpper }}"

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ RUN go mod download
99

1010
# BUILD BINARY
1111
COPY . .
12-
RUN make build-go build-tools
12+
RUN make build-go
1313

1414
# BUILD RUST BIN
1515
FROM --platform=${BUILDPLATFORM} rust:slim-bookworm AS chef

Makefile

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ check-docker:
3636
check-docker-compose:
3737
@which docker-compose > /dev/null || (echo "Error: docker-compose is not installed" && exit 1)
3838

39-
# Check for Protoc
39+
# Check for protoc
4040
.PHONY: check-protoc
4141
check-protoc:
42-
@which protoc > /dev/null || (echo "Error: Protoc is not installed" && exit 1)
42+
@which protoc > /dev/null || (echo "Error: protoc is not installed" && exit 1)
4343

44-
# Check for Curl
44+
# Check for curl
4545
.PHONY: check-curl
4646
check-curl:
4747
@which curl > /dev/null || (echo "Error: curl is not installed" && exit 1)
@@ -56,20 +56,16 @@ install-linter: check-go check-curl
5656
generate-code-from-proto: check-protoc
5757

5858
.PHONY: build
59-
build: build-rust build-go build-tools## Builds the binaries locally into ./target
59+
build: build-rust build-go ## Builds the binaries locally into ./target
6060

6161
.PHONY: build-rust
6262
build-rust:
63-
export BUILD_SCRIPT_DISABLED=1 && cargo build --release
63+
BUILD_SCRIPT_DISABLED=1 cargo build --release --jobs=$(shell nproc)
6464

6565
.PHONY: build-go
6666
build-go:
6767
$(GOENVVARS) go build -ldflags "all=$(LDFLAGS)" -o $(GOBIN)/$(GOBINARY) $(GOCMD)
6868

69-
.PHONY: build-tools
70-
build-tools: ## Builds the tools
71-
$(GOENVVARS) go build -o $(GOBIN)/aggsender_find_imported_bridge ./tools/aggsender_find_imported_bridge
72-
7369
.PHONY: build-docker
7470
build-docker: ## Builds a docker image with the cdk binary
7571
docker build -t cdk -f ./Dockerfile .

agglayer/client.go

Lines changed: 0 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,10 @@ var (
2020
jSONRPCCall = rpc.JSONRPCCall
2121
)
2222

23-
type AggLayerClientGetEpochConfiguration interface {
24-
GetEpochConfiguration() (*ClockConfiguration, error)
25-
}
26-
2723
// AgglayerClientInterface is the interface that defines the methods that the AggLayerClient will implement
2824
type AgglayerClientInterface interface {
2925
SendTx(signedTx SignedTx) (common.Hash, error)
3026
WaitTxToBeMined(hash common.Hash, ctx context.Context) error
31-
SendCertificate(certificate *SignedCertificate) (common.Hash, error)
32-
GetCertificateHeader(certificateHash common.Hash) (*CertificateHeader, error)
33-
GetLatestKnownCertificateHeader(networkID uint32) (*CertificateHeader, error)
34-
AggLayerClientGetEpochConfiguration
3527
}
3628

3729
// AggLayerClient is the client that will be used to interact with the AggLayer
@@ -97,86 +89,3 @@ func (c *AggLayerClient) WaitTxToBeMined(hash common.Hash, ctx context.Context)
9789
}
9890
}
9991
}
100-
101-
// SendCertificate sends a certificate to the AggLayer
102-
func (c *AggLayerClient) SendCertificate(certificate *SignedCertificate) (common.Hash, error) {
103-
certificateToSend := certificate.CopyWithDefaulting()
104-
105-
response, err := rpc.JSONRPCCall(c.url, "interop_sendCertificate", certificateToSend)
106-
if err != nil {
107-
return common.Hash{}, err
108-
}
109-
110-
if response.Error != nil {
111-
return common.Hash{}, fmt.Errorf("%d %s", response.Error.Code, response.Error.Message)
112-
}
113-
114-
var result types.ArgHash
115-
err = json.Unmarshal(response.Result, &result)
116-
if err != nil {
117-
return common.Hash{}, err
118-
}
119-
120-
return result.Hash(), nil
121-
}
122-
123-
// GetCertificateHeader returns the certificate header associated to the hash
124-
func (c *AggLayerClient) GetCertificateHeader(certificateHash common.Hash) (*CertificateHeader, error) {
125-
response, err := rpc.JSONRPCCall(c.url, "interop_getCertificateHeader", certificateHash)
126-
if err != nil {
127-
return nil, err
128-
}
129-
130-
if response.Error != nil {
131-
return nil, fmt.Errorf("%d %s", response.Error.Code, response.Error.Message)
132-
}
133-
134-
var result *CertificateHeader
135-
err = json.Unmarshal(response.Result, &result)
136-
if err != nil {
137-
return nil, err
138-
}
139-
140-
return result, nil
141-
}
142-
143-
// GetEpochConfiguration returns the clock configuration of AggLayer
144-
func (c *AggLayerClient) GetEpochConfiguration() (*ClockConfiguration, error) {
145-
response, err := jSONRPCCall(c.url, "interop_getEpochConfiguration")
146-
if err != nil {
147-
return nil, err
148-
}
149-
150-
if response.Error != nil {
151-
return nil, fmt.Errorf("GetEpochConfiguration code=%d msg=%s", response.Error.Code, response.Error.Message)
152-
}
153-
154-
var result *ClockConfiguration
155-
err = json.Unmarshal(response.Result, &result)
156-
if err != nil {
157-
return nil, err
158-
}
159-
160-
return result, nil
161-
}
162-
163-
// GetLatestKnownCertificateHeader returns the last certificate header submitted by networkID
164-
func (c *AggLayerClient) GetLatestKnownCertificateHeader(networkID uint32) (*CertificateHeader, error) {
165-
response, err := jSONRPCCall(c.url, "interop_getLatestKnownCertificateHeader", networkID)
166-
if err != nil {
167-
return nil, fmt.Errorf("GetLatestKnownCertificateHeader error jSONRPCCall. Err: %w", err)
168-
}
169-
170-
if response.Error != nil {
171-
return nil, fmt.Errorf("GetLatestKnownCertificateHeader rpc returns an error: code=%d msg=%s",
172-
response.Error.Code, response.Error.Message)
173-
}
174-
175-
var result *CertificateHeader
176-
err = json.Unmarshal(response.Result, &result)
177-
if err != nil {
178-
return nil, fmt.Errorf("GetLatestKnownCertificateHeader error Unmashal. Err: %w", err)
179-
}
180-
181-
return result, nil
182-
}

0 commit comments

Comments
 (0)