Skip to content
This repository was archived by the owner on May 11, 2024. It is now read-only.

Commit 9bd2aea

Browse files
feat(proposer): introduce proposer transaction builder (#612)
1 parent e1f5393 commit 9bd2aea

File tree

16 files changed

+469
-231
lines changed

16 files changed

+469
-231
lines changed

cmd/flags/prover.go

+6
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ var (
6464
Usage: "Minimum accepted fee for generating a SGX proof",
6565
Category: proverCategory,
6666
}
67+
MinSgxAndZkVMTierFee = &cli.Uint64Flag{
68+
Name: "minTierFee.sgxAndZkvm",
69+
Usage: "Minimum accepted fee for generating a SGX + zkVM proof",
70+
Category: proverCategory,
71+
}
6772
// Guardian prover related.
6873
GuardianProver = &cli.StringFlag{
6974
Name: "guardianProver",
@@ -192,6 +197,7 @@ var ProverFlags = MergeFlags(CommonFlags, []cli.Flag{
192197
L1ProverPrivKey,
193198
MinOptimisticTierFee,
194199
MinSgxTierFee,
200+
MinSgxAndZkVMTierFee,
195201
StartingBlockID,
196202
Dummy,
197203
GuardianProver,

internal/sender/sender.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ func (s *Sender) SendRawTransaction(nonce uint64, target *common.Address, value
236236

237237
if err := s.send(txToConfirm, false); err != nil && !strings.Contains(err.Error(), "replacement transaction") {
238238
log.Error("Failed to send transaction",
239-
"tx_id", txID,
239+
"txId", txID,
240240
"nonce", txToConfirm.CurrentTx.Nonce(),
241241
"err", err,
242242
)
@@ -271,7 +271,7 @@ func (s *Sender) SendTransaction(tx *types.Transaction) (string, error) {
271271
if err := s.send(txToConfirm, true); err != nil && !strings.Contains(err.Error(), "replacement transaction") {
272272
log.Error(
273273
"Failed to send transaction",
274-
"tx_id", txID,
274+
"txId", txID,
275275
"nonce", txToConfirm.CurrentTx.Nonce(),
276276
"hash", tx.Hash(),
277277
"err", err,
@@ -315,15 +315,15 @@ func (s *Sender) send(tx *TxToConfirm, resetNonce bool) error {
315315
if err := s.SetNonce(originalTx, true); err != nil {
316316
log.Error(
317317
"Failed to set nonce when appear nonce too low",
318-
"tx_id", tx.ID,
318+
"txId", tx.ID,
319319
"nonce", tx.CurrentTx.Nonce(),
320320
"hash", rawTx.Hash(),
321321
"err", err,
322322
)
323323
} else {
324324
log.Warn(
325325
"Nonce is incorrect, retry sending the transaction with new nonce",
326-
"tx_id", tx.ID,
326+
"txId", tx.ID,
327327
"nonce", tx.CurrentTx.Nonce(),
328328
"hash", rawTx.Hash(),
329329
"err", err,
@@ -335,7 +335,7 @@ func (s *Sender) send(tx *TxToConfirm, resetNonce bool) error {
335335
s.adjustGas(originalTx)
336336
log.Warn(
337337
"Replacement transaction underpriced",
338-
"tx_id", tx.ID,
338+
"txId", tx.ID,
339339
"nonce", tx.CurrentTx.Nonce(),
340340
"hash", rawTx.Hash(),
341341
"err", err,
@@ -344,7 +344,7 @@ func (s *Sender) send(tx *TxToConfirm, resetNonce bool) error {
344344
}
345345
log.Error(
346346
"Failed to send transaction",
347-
"tx_id", tx.ID,
347+
"txId", tx.ID,
348348
"nonce", tx.CurrentTx.Nonce(),
349349
"hash", rawTx.Hash(),
350350
"err", err,
@@ -409,7 +409,7 @@ func (s *Sender) resendUnconfirmedTxs() {
409409
if err := s.send(unconfirmedTx, true); err != nil {
410410
log.Warn(
411411
"Failed to resend the transaction",
412-
"tx_id", id,
412+
"txId", id,
413413
"nonce", unconfirmedTx.CurrentTx.Nonce(),
414414
"hash", unconfirmedTx.CurrentTx.Hash(),
415415
"retrys", unconfirmedTx.Retrys,
@@ -430,7 +430,7 @@ func (s *Sender) checkPendingTransactionsConfirmation() {
430430
tx, isPending, err := s.client.TransactionByHash(s.ctx, pendingTx.CurrentTx.Hash())
431431
if err != nil {
432432
log.Warn("Failed to fetch transaction",
433-
"tx_id", pendingTx.ID,
433+
"txId", pendingTx.ID,
434434
"nonce", pendingTx.CurrentTx.Nonce(),
435435
"hash", pendingTx.CurrentTx.Hash(),
436436
"err", err,

internal/testutils/helper.go

+1
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ func (s *ClientTestSuite) NewTestProverServer(
174174
ProverPrivateKey: proverPrivKey,
175175
MinOptimisticTierFee: common.Big1,
176176
MinSgxTierFee: common.Big1,
177+
MinSgxAndZkVMTierFee: common.Big1,
177178
MaxExpiry: 24 * time.Hour,
178179
TaikoL1Address: common.HexToAddress(os.Getenv("TAIKO_L1_ADDRESS")),
179180
AssignmentHookAddress: common.HexToAddress(os.Getenv("ASSIGNMENT_HOOK_ADDRESS")),

pkg/rpc/tx_blob.go

+4-6
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ var (
1818
// TransactBlobTx creates, signs and then sends blob transactions.
1919
func (c *EthClient) TransactBlobTx(
2020
opts *bind.TransactOpts,
21-
contract *common.Address,
21+
contract common.Address,
2222
input []byte,
2323
sidecar *types.BlobTxSidecar,
2424
) (*types.Transaction, error) {
@@ -47,7 +47,7 @@ func (c *EthClient) TransactBlobTx(
4747
// createBlobTx creates a blob transaction by given parameters.
4848
func (c *EthClient) createBlobTx(
4949
opts *bind.TransactOpts,
50-
contract *common.Address,
50+
contract common.Address,
5151
input []byte,
5252
sidecar *types.BlobTxSidecar,
5353
) (*types.Transaction, error) {
@@ -63,17 +63,15 @@ func (c *EthClient) createBlobTx(
6363
if input == nil {
6464
input = []byte{}
6565
}
66-
if contract == nil {
67-
contract = &common.Address{}
68-
}
66+
6967
if opts.GasLimit != 0 {
7068
gasVal := hexutil.Uint64(opts.GasLimit)
7169
gas = &gasVal
7270
}
7371

7472
rawTx, err := c.FillTransaction(opts.Context, &TransactionArgs{
7573
From: &opts.From,
76-
To: contract,
74+
To: &contract,
7775
Gas: gas,
7876
GasPrice: (*hexutil.Big)(opts.GasPrice),
7977
MaxFeePerGas: (*hexutil.Big)(opts.GasFeeCap),

pkg/rpc/tx_blob_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func TestSendingBlobTx(t *testing.T) {
4646
sideCar, sErr := MakeSidecar(data)
4747
assert.NoError(t, sErr)
4848

49-
tx, err := l1Client.TransactBlobTx(opts, nil, nil, sideCar)
49+
tx, err := l1Client.TransactBlobTx(opts, common.Address{}, nil, sideCar)
5050
assert.NoError(t, err)
5151

5252
receipt, err := bind.WaitMined(ctx, l1Client, tx)

0 commit comments

Comments
 (0)