From a1043a85631892e0b03e0f9f4bb850d4e9a70967 Mon Sep 17 00:00:00 2001 From: David Date: Thu, 8 Aug 2024 13:57:02 +0800 Subject: [PATCH] feat(taiko-client): update `BlockParamsV2` struct (#17893) --- packages/taiko-client/bindings/encoding/custom_error.go | 6 ++++++ packages/taiko-client/bindings/encoding/input.go | 4 ---- packages/taiko-client/bindings/encoding/struct.go | 1 - packages/taiko-client/proposer/transaction_builder/blob.go | 1 - .../taiko-client/proposer/transaction_builder/calldata.go | 1 - 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/packages/taiko-client/bindings/encoding/custom_error.go b/packages/taiko-client/bindings/encoding/custom_error.go index 0c78ab8b8da..f453500c4e7 100644 --- a/packages/taiko-client/bindings/encoding/custom_error.go +++ b/packages/taiko-client/bindings/encoding/custom_error.go @@ -89,6 +89,12 @@ func getErrorData(err error) string { return errData } } + + // Anvil node custom errors with reasons, example: + // execution reverted: custom error 1a83d90e:, reason: 0x1a83d90e" + if strings.Contains(err.Error(), "custom error") && strings.Contains(err.Error(), "reason") { + return "0x" + err.Error()[len(err.Error())-8:len(err.Error())] + } // Anvil node custom errors, example: // "execution reverted: custom error 712eb087:" if strings.Contains(err.Error(), "custom error") { diff --git a/packages/taiko-client/bindings/encoding/input.go b/packages/taiko-client/bindings/encoding/input.go index c3091186047..faa904d5c87 100644 --- a/packages/taiko-client/bindings/encoding/input.go +++ b/packages/taiko-client/bindings/encoding/input.go @@ -226,10 +226,6 @@ var ( Name: "coinbase", Type: "address", }, - { - Name: "extraData", - Type: "bytes32", - }, { Name: "parentMetaHash", Type: "bytes32", diff --git a/packages/taiko-client/bindings/encoding/struct.go b/packages/taiko-client/bindings/encoding/struct.go index db7de5d30bf..7e9dc1fed16 100644 --- a/packages/taiko-client/bindings/encoding/struct.go +++ b/packages/taiko-client/bindings/encoding/struct.go @@ -46,7 +46,6 @@ type BlockParams struct { // BlockParamsV2 should be same with TaikoData.BlockParamsV2. type BlockParamsV2 struct { Coinbase common.Address - ExtraData [32]byte ParentMetaHash [32]byte AnchorBlockId uint64 Timestamp uint64 diff --git a/packages/taiko-client/proposer/transaction_builder/blob.go b/packages/taiko-client/proposer/transaction_builder/blob.go index 2b37c758ffc..24a716cdcee 100644 --- a/packages/taiko-client/proposer/transaction_builder/blob.go +++ b/packages/taiko-client/proposer/transaction_builder/blob.go @@ -129,7 +129,6 @@ func (b *BlobTransactionBuilder) Build( if encodedParams, err = encoding.EncodeBlockParamsOntake(&encoding.BlockParamsV2{ Coinbase: b.l2SuggestedFeeRecipient, - ExtraData: rpc.StringToBytes32(b.extraData), ParentMetaHash: parentMetaHash, AnchorBlockId: 0, Timestamp: 0, diff --git a/packages/taiko-client/proposer/transaction_builder/calldata.go b/packages/taiko-client/proposer/transaction_builder/calldata.go index e8fc2fd513b..552db2da252 100644 --- a/packages/taiko-client/proposer/transaction_builder/calldata.go +++ b/packages/taiko-client/proposer/transaction_builder/calldata.go @@ -113,7 +113,6 @@ func (b *CalldataTransactionBuilder) Build( if encodedParams, err = encoding.EncodeBlockParamsOntake(&encoding.BlockParamsV2{ Coinbase: b.l2SuggestedFeeRecipient, - ExtraData: rpc.StringToBytes32(b.extraData), ParentMetaHash: parentMetaHash, AnchorBlockId: 0, Timestamp: 0,