Skip to content

Commit

Permalink
rename fields
Browse files Browse the repository at this point in the history
  • Loading branch information
temaniarpit27 committed Feb 5, 2025
1 parent ae1f6a1 commit 1f1c649
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 83 deletions.
24 changes: 12 additions & 12 deletions aggsender/grpc/aggchain_proof_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ type AggchainProofClientInterface interface {
GenerateAggchainProof(
startBlock uint64,
maxEndBlock uint64,
l1InfoTreeRoot common.Hash,
l1InfoTreeLeaf common.Hash,
l1InfoTreeProof treeTypes.Proof,
l1InfoTreeRootHash common.Hash,
l1InfoTreeLeafHash common.Hash,
l1InfoTreeMerkleProof treeTypes.Proof,
) (*types.AggchainProof, error)
}

Expand All @@ -41,24 +41,24 @@ func NewAggchainProofClient(serverAddr string) (*AggchainProofClient, error) {
func (c *AggchainProofClient) GenerateAggchainProof(
startBlock uint64,
maxEndBlock uint64,
l1InfoTreeRoot common.Hash,
l1InfoTreeLeaf common.Hash,
l1InfoTreeProof treeTypes.Proof,
l1InfoTreeRootHash common.Hash,
l1InfoTreeLeafHash common.Hash,
l1InfoTreeMerkleProof treeTypes.Proof,
) (*types.AggchainProof, error) {
ctx, cancel := context.WithTimeout(context.Background(), time.Minute*TIMEOUT)
defer cancel()

convertedProof := make([][]byte, treeTypes.DefaultHeight)
for i := 0; i < int(treeTypes.DefaultHeight); i++ {
convertedProof[i] = l1InfoTreeProof[i].Bytes()
convertedProof[i] = l1InfoTreeMerkleProof[i].Bytes()
}

resp, err := c.client.GenerateAggchainProof(ctx, &types.GenerateAggchainProofRequest{
StartBlock: startBlock,
MaxEndBlock: maxEndBlock,
L1InfoTreeRoot: l1InfoTreeRoot.Bytes(),
L1InfoTreeLeaf: l1InfoTreeLeaf.Bytes(),
L1InfoTreeProof: convertedProof,
StartBlock: startBlock,
MaxEndBlock: maxEndBlock,
L1InfoTreeRootHash: l1InfoTreeRootHash.Bytes(),
L1InfoTreeLeafHash: l1InfoTreeLeafHash.Bytes(),
L1InfoTreeMerkleProof: convertedProof,
})
if err != nil {
return nil, err
Expand Down
20 changes: 10 additions & 10 deletions aggsender/grpc/aggchain_proof_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ func TestGenerateAggchainProof_Success(t *testing.T) {
}

mockClient.On("GenerateAggchainProof", mock.Anything, &types.GenerateAggchainProofRequest{
StartBlock: 100,
MaxEndBlock: 200,
L1InfoTreeRoot: common.Hash{}.Bytes(),
L1InfoTreeLeaf: common.Hash{}.Bytes(),
L1InfoTreeProof: convertedProof,
StartBlock: 100,
MaxEndBlock: 200,
L1InfoTreeRootHash: common.Hash{}.Bytes(),
L1InfoTreeLeafHash: common.Hash{}.Bytes(),
L1InfoTreeMerkleProof: convertedProof,
}).Return(expectedResponse, nil)

result, err := client.GenerateAggchainProof(100, 200, common.Hash{}, common.Hash{}, [32]common.Hash{})
Expand All @@ -61,11 +61,11 @@ func TestGenerateAggchainProof_Error(t *testing.T) {
}

mockClient.On("GenerateAggchainProof", mock.Anything, &types.GenerateAggchainProofRequest{
StartBlock: 300,
MaxEndBlock: 400,
L1InfoTreeRoot: common.Hash{}.Bytes(),
L1InfoTreeLeaf: common.Hash{}.Bytes(),
L1InfoTreeProof: convertedProof,
StartBlock: 300,
MaxEndBlock: 400,
L1InfoTreeRootHash: common.Hash{}.Bytes(),
L1InfoTreeLeafHash: common.Hash{}.Bytes(),
L1InfoTreeMerkleProof: convertedProof,
}).Return((*types.GenerateAggchainProofResponse)(nil), expectedError)

result, err := client.GenerateAggchainProof(300, 400, common.Hash{}, common.Hash{}, [32]common.Hash{})
Expand Down
24 changes: 12 additions & 12 deletions aggsender/mocks/mock_aggchain_proof_client_interface.go

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

12 changes: 6 additions & 6 deletions aggsender/proto/aggchain_proof_generation.proto
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ message GenerateAggchainProofRequest {
uint64 start_block = 1;
// The max end block for which the aggchain proof is requested.
uint64 max_end_block = 2;
// L1 Info tree root.
bytes l1_info_tree_root = 3;
// L1 Info tree leaf.
bytes l1_info_tree_leaf = 4;
// L1 Info tree proof.
repeated bytes l1_info_tree_proof = 5;
// L1 Info tree root. (hash)
bytes l1_info_tree_root_hash = 3;
// L1 Info tree leaf. (hash)
bytes l1_info_tree_leaf_hash = 4;
// L1 Info tree proof. ([32]hash)
repeated bytes l1_info_tree_merkle_proof = 5;
}

// The aggchain proof response message.
Expand Down
88 changes: 45 additions & 43 deletions aggsender/types/aggchain_proof_generation.pb.go

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

0 comments on commit 1f1c649

Please sign in to comment.