Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
YoGhurt111 committed Sep 29, 2024
1 parent 023ff02 commit 9e82059
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
16 changes: 16 additions & 0 deletions packages/taiko-client/bindings/encoding/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,9 @@ var (
{Name: "TaikoData.BlockMetadata", Type: blockMetadataV2ComponentsType},
{Name: "TaikoData.Transition", Type: transitionComponentsType},
}
proveBlocksBatchProofArgs = abi.Arguments{
{Name: "TaikoData.TierProof", Type: tierProofComponentsType},
}
)

// Contract ABIs.
Expand Down Expand Up @@ -455,6 +458,19 @@ func EncodeProveBlocksInput(
return b, nil
}

// EncodeProveBlocksBatchProof performs the solidity `abi.encode` for the given TaikoL1.proveBlocks batchProof.
func EncodeProveBlocksBatchProof(
tierProof *bindings.TaikoDataTierProof,
) ([]byte, error) {
input, err := proveBlocksBatchProofArgs.Pack(
tierProof,
)
if err != nil {
return nil, fmt.Errorf("failed to abi.encode TaikoL1.proveBlocks input item after ontake fork, %w", err)
}
return input, nil
}

// UnpackTxListBytes unpacks the input data of a TaikoL1.proposeBlock transaction, and returns the txList bytes.
func UnpackTxListBytes(txData []byte) ([]byte, error) {
method, err := TaikoL1ABI.MethodById(txData)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,20 @@ func (a *ProveBlockTxBuilder) BuildProveBlocks(
if err != nil {
return nil, err
}
tierProof, err := encoding.EncodeProveBlocksBatchProof(&bindings.TaikoDataTierProof{
Tier: batchProof.Tier,
Data: batchProof.BatchProof,
})
if err != nil {
return nil, err
}

if a.proverSetAddress != ZeroAddress {
if data, err = encoding.ProverSetABI.Pack(
"proveBlocks",
blockIDs,
input,
batchProof.BatchProof,
tierProof,
); err != nil {
return nil, err
}
Expand All @@ -203,7 +210,7 @@ func (a *ProveBlockTxBuilder) BuildProveBlocks(
"proveBlocks",
blockIDs,
input,
batchProof.BatchProof,
tierProof,
); err != nil {
return nil, err
}
Expand Down

0 comments on commit 9e82059

Please sign in to comment.