Skip to content

Commit

Permalink
Merge branch 'develop' into feat/update-l1info-v2
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaubennassar authored Oct 31, 2024
2 parents 55da82b + 8481a35 commit 0cb33c7
Show file tree
Hide file tree
Showing 78 changed files with 7,794 additions and 1,772 deletions.
9 changes: 0 additions & 9 deletions .github/workflows/lint-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,3 @@ jobs:
with:
ignoreLabels: |
release
commits:
name: Validate PR commits
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: wagoid/commitlint-github-action@v6
42 changes: 42 additions & 0 deletions aggregator/agglayer/agglayer_client.go → agglayer/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ var ErrAgglayerRateLimitExceeded = fmt.Errorf("agglayer rate limit exceeded")
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)
}

// AggLayerClient is the client that will be used to interact with the AggLayer
Expand Down Expand Up @@ -86,3 +88,43 @@ 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) {
response, err := rpc.JSONRPCCall(c.url, "interop_sendCertificate", certificate)
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
}
138 changes: 138 additions & 0 deletions agglayer/mock_agglayer_client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
Loading

0 comments on commit 0cb33c7

Please sign in to comment.