Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(taiko-client): call CreateAccessList #17691

Merged
merged 5 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,6 @@ require (

replace github.com/ethereum/go-ethereum v1.13.15 => github.com/taikoxyz/taiko-geth v0.0.0-20240504072040-7e1b8b65a3f8

replace github.com/ethereum-optimism/optimism v1.7.4 => github.com/taikoxyz/optimism v0.0.0-20240624055706-43346f17fbdb
replace github.com/ethereum-optimism/optimism v1.7.4 => github.com/taikoxyz/optimism v0.0.0-20240627061604-7871b0ec8bbb

replace github.com/uber/jaeger-client-go => github.com/uber/jaeger-client-go v2.25.0+incompatible
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1167,6 +1167,8 @@ github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d h1:vfofYNRScrDd
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d/go.mod h1:RRCYJbIwD5jmqPI9XoAFR0OcDxqUctll6zUj/+B4S48=
github.com/taikoxyz/optimism v0.0.0-20240624055706-43346f17fbdb h1:t4JcXSwxpUIYq5HrIYCkIfRBc/cytoC6X4YjeJF+qck=
github.com/taikoxyz/optimism v0.0.0-20240624055706-43346f17fbdb/go.mod h1:jKn73pLX8eDIG0Y3XeuUSetepecM8OvRflyPHbi05B4=
github.com/taikoxyz/optimism v0.0.0-20240627061604-7871b0ec8bbb h1:qlJDLlAgHbUrgyYK3OZ3CtS8zP71AIDjjn22KWCPA+w=
github.com/taikoxyz/optimism v0.0.0-20240627061604-7871b0ec8bbb/go.mod h1:jKn73pLX8eDIG0Y3XeuUSetepecM8OvRflyPHbi05B4=
github.com/taikoxyz/taiko-geth v0.0.0-20240504072040-7e1b8b65a3f8 h1:z4juQ4Nyp2T836JTCNC8t3vrbr0K9v2pPUV/ir2dy9s=
github.com/taikoxyz/taiko-geth v0.0.0-20240504072040-7e1b8b65a3f8/go.mod h1:nqByouVW0a0qx5KKgvYgoXba+pYEHznAAQp6LhZilgM=
github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA=
Expand Down
12 changes: 12 additions & 0 deletions packages/taiko-client/pkg/rpc/ethclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,18 @@ func (c *EthClient) SendTransaction(ctx context.Context, tx *types.Transaction)
return c.ethClient.SendTransaction(ctxWithTimeout, tx)
}

// CreateAccessList tries to create an access list for a specific transaction based on the
// current pending state of the blockchain.
func (c *EthClient) CreateAccessList(
ctx context.Context,
msg ethereum.CallMsg,
) (*types.AccessList, uint64, string, error) {
ctxWithTimeout, cancel := ctxWithTimeoutOrDefault(ctx, c.timeout)
defer cancel()

return c.gethClient.CreateAccessList(ctxWithTimeout, msg)
}

// TransactionArgs represents the arguments to construct a new transaction
// or a message call.
type TransactionArgs struct {
Expand Down
1 change: 0 additions & 1 deletion packages/taiko-client/proposer/proposer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ func (s *ProposerTestSuite) SetupTest() {
MaxTierFeePriceBumps: 3,
ExtraData: "test",
L1BlockBuilderTip: common.Big0,
BlobAllowed: true,
ProposeBlockTxGasLimit: 10_000_000,
TxmgrConfigs: &txmgr.CLIConfig{
L1RPCURL: os.Getenv("L1_NODE_WS_ENDPOINT"),
Expand Down
16 changes: 0 additions & 16 deletions packages/taiko-client/proposer/transaction_builder/blob.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"github.com/ethereum-optimism/optimism/op-service/eth"
"github.com/ethereum-optimism/optimism/op-service/txmgr"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/crypto/kzg4844"

Expand Down Expand Up @@ -128,27 +127,12 @@ func (b *BlobTransactionBuilder) Build(
return nil, err
}
}
// Calculate TaikoData.State slot hash (includes slot 0-6 currently)
var slotHashes []common.Hash
for i := 0; i < 7; i++ {
packedData := append(
common.LeftPadBytes(b.taikoL1Address.Bytes(), 32),
common.LeftPadBytes(big.NewInt(int64(i)).Bytes(), 32)...,
)
slotHashes = append(slotHashes, crypto.Keccak256Hash(packedData))
}

return &txmgr.TxCandidate{
TxData: data,
Blobs: []*eth.Blob{blob},
To: to,
GasLimit: b.gasLimit,
Value: maxFee,
AccessList: types.AccessList{
{
Address: b.taikoL1Address,
StorageKeys: slotHashes,
},
},
}, nil
}
17 changes: 0 additions & 17 deletions packages/taiko-client/proposer/transaction_builder/calldata.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (

"github.com/ethereum-optimism/optimism/op-service/txmgr"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"

"github.com/taikoxyz/taiko-mono/packages/taiko-client/bindings/encoding"
Expand Down Expand Up @@ -115,27 +114,11 @@ func (b *CalldataTransactionBuilder) Build(
}
}

// Calculate TaikoData.State slot hash (includes slot 0-6 currently)
var slotHashes []common.Hash
for i := 0; i < 7; i++ {
packedData := append(
common.LeftPadBytes(b.taikoL1Address.Bytes(), 32),
common.LeftPadBytes(big.NewInt(int64(i)).Bytes(), 32)...,
)
slotHashes = append(slotHashes, crypto.Keccak256Hash(packedData))
}

return &txmgr.TxCandidate{
TxData: data,
Blobs: nil,
To: to,
GasLimit: b.gasLimit,
Value: maxFee,
AccessList: types.AccessList{
{
Address: b.taikoL1Address,
StorageKeys: slotHashes,
},
},
}, nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@ import (
"fmt"
"math/big"

"github.com/ethereum/go-ethereum/crypto"

"github.com/ethereum-optimism/optimism/op-service/txmgr"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/log"

"github.com/taikoxyz/taiko-mono/packages/taiko-client/bindings"
Expand Down Expand Up @@ -105,28 +102,12 @@ func (a *ProveBlockTxBuilder) Build(
}
}

// Calculate TaikoData.State slot hash (includes slot 0-6 currently)
var slotHashes []common.Hash
for i := 0; i < 7; i++ {
packedData := append(
common.LeftPadBytes(a.taikoL1Address.Bytes(), 32),
common.LeftPadBytes(big.NewInt(int64(i)).Bytes(), 32)...,
)
slotHashes = append(slotHashes, crypto.Keccak256Hash(packedData))
}

return &txmgr.TxCandidate{
TxData: data,
To: &to,
Blobs: nil,
GasLimit: txOpts.GasLimit,
Value: txOpts.Value,
AccessList: types.AccessList{
{
Address: a.taikoL1Address,
StorageKeys: slotHashes,
},
},
}, nil
}
}
Loading