Skip to content

Commit

Permalink
feat: remove aggsender component (#252)
Browse files Browse the repository at this point in the history
* remove aggsender component

* fix: remove build-tools
  • Loading branch information
Stefan-Ethernal committed Jan 21, 2025
1 parent a45dbfc commit 04b8363
Show file tree
Hide file tree
Showing 67 changed files with 19 additions and 11,455 deletions.
75 changes: 0 additions & 75 deletions .github/workflows/test-e2e-multi_pp.yml

This file was deleted.

1 change: 0 additions & 1 deletion .github/workflows/test-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ jobs:
- "fork11-rollup"
- "fork12-validium"
- "fork12-rollup"
- "fork12-pessimistic"
steps:
- name: Checkout Code
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ RUN go mod download

# BUILD BINARY
COPY . .
RUN make build-go build-tools
RUN make build-go

# BUILD RUST BIN
FROM --platform=${BUILDPLATFORM} rust:slim-bookworm AS chef
Expand Down
6 changes: 1 addition & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ install-linter: check-go check-curl
generate-code-from-proto: check-protoc

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

.PHONY: build-rust
build-rust:
Expand All @@ -66,10 +66,6 @@ build-rust:
build-go:
$(GOENVVARS) go build -ldflags "all=$(LDFLAGS)" -o $(GOBIN)/$(GOBINARY) $(GOCMD)

.PHONY: build-tools
build-tools: ## Builds the tools
$(GOENVVARS) go build -o $(GOBIN)/aggsender_find_imported_bridge ./tools/aggsender_find_imported_bridge

.PHONY: build-docker
build-docker: ## Builds a docker image with the cdk binary
docker build -t cdk -f ./Dockerfile .
Expand Down
91 changes: 0 additions & 91 deletions agglayer/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,10 @@ var (
jSONRPCCall = rpc.JSONRPCCall
)

type AggLayerClientGetEpochConfiguration interface {
GetEpochConfiguration() (*ClockConfiguration, error)
}

// AgglayerClientInterface is the interface that defines the methods that the AggLayerClient will implement
type AgglayerClientInterface interface {
SendTx(signedTx SignedTx) (common.Hash, error)
WaitTxToBeMined(hash common.Hash, ctx context.Context) error
SendCertificate(certificate *SignedCertificate) (common.Hash, error)
GetCertificateHeader(certificateHash common.Hash) (*CertificateHeader, error)
GetLatestKnownCertificateHeader(networkID uint32) (*CertificateHeader, error)
AggLayerClientGetEpochConfiguration
}

// AggLayerClient is the client that will be used to interact with the AggLayer
Expand Down Expand Up @@ -97,86 +89,3 @@ func (c *AggLayerClient) WaitTxToBeMined(hash common.Hash, ctx context.Context)
}
}
}

// SendCertificate sends a certificate to the AggLayer
func (c *AggLayerClient) SendCertificate(certificate *SignedCertificate) (common.Hash, error) {
certificateToSend := certificate.CopyWithDefaulting()

response, err := rpc.JSONRPCCall(c.url, "interop_sendCertificate", certificateToSend)
if err != nil {
return common.Hash{}, err
}

if response.Error != nil {
return common.Hash{}, fmt.Errorf("%d %s", response.Error.Code, response.Error.Message)
}

var result types.ArgHash
err = json.Unmarshal(response.Result, &result)
if err != nil {
return common.Hash{}, err
}

return result.Hash(), nil
}

// GetCertificateHeader returns the certificate header associated to the hash
func (c *AggLayerClient) GetCertificateHeader(certificateHash common.Hash) (*CertificateHeader, error) {
response, err := rpc.JSONRPCCall(c.url, "interop_getCertificateHeader", certificateHash)
if err != nil {
return nil, err
}

if response.Error != nil {
return nil, fmt.Errorf("%d %s", response.Error.Code, response.Error.Message)
}

var result *CertificateHeader
err = json.Unmarshal(response.Result, &result)
if err != nil {
return nil, err
}

return result, nil
}

// GetEpochConfiguration returns the clock configuration of AggLayer
func (c *AggLayerClient) GetEpochConfiguration() (*ClockConfiguration, error) {
response, err := jSONRPCCall(c.url, "interop_getEpochConfiguration")
if err != nil {
return nil, err
}

if response.Error != nil {
return nil, fmt.Errorf("GetEpochConfiguration code=%d msg=%s", response.Error.Code, response.Error.Message)
}

var result *ClockConfiguration
err = json.Unmarshal(response.Result, &result)
if err != nil {
return nil, err
}

return result, nil
}

// GetLatestKnownCertificateHeader returns the last certificate header submitted by networkID
func (c *AggLayerClient) GetLatestKnownCertificateHeader(networkID uint32) (*CertificateHeader, error) {
response, err := jSONRPCCall(c.url, "interop_getLatestKnownCertificateHeader", networkID)
if err != nil {
return nil, fmt.Errorf("GetLatestKnownCertificateHeader error jSONRPCCall. Err: %w", err)
}

if response.Error != nil {
return nil, fmt.Errorf("GetLatestKnownCertificateHeader rpc returns an error: code=%d msg=%s",
response.Error.Code, response.Error.Message)
}

var result *CertificateHeader
err = json.Unmarshal(response.Result, &result)
if err != nil {
return nil, fmt.Errorf("GetLatestKnownCertificateHeader error Unmashal. Err: %w", err)
}

return result, nil
}
163 changes: 0 additions & 163 deletions agglayer/client_test.go

This file was deleted.

Loading

0 comments on commit 04b8363

Please sign in to comment.