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

feat(proposer): introduce proposer transaction builder #612

Merged
merged 20 commits into from
Mar 9, 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
6 changes: 6 additions & 0 deletions cmd/flags/prover.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ var (
Usage: "Minimum accepted fee for generating a SGX proof",
Category: proverCategory,
}
MinSgxAndZkVMTierFee = &cli.Uint64Flag{
Name: "minTierFee.sgxAndZkvm",
Usage: "Minimum accepted fee for generating a SGX + zkVM proof",
Category: proverCategory,
}
// Guardian prover related.
GuardianProver = &cli.StringFlag{
Name: "guardianProver",
Expand Down Expand Up @@ -192,6 +197,7 @@ var ProverFlags = MergeFlags(CommonFlags, []cli.Flag{
L1ProverPrivKey,
MinOptimisticTierFee,
MinSgxTierFee,
MinSgxAndZkVMTierFee,
StartingBlockID,
Dummy,
GuardianProver,
Expand Down
16 changes: 8 additions & 8 deletions internal/sender/sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ func (s *Sender) SendRawTransaction(nonce uint64, target *common.Address, value

if err := s.send(txToConfirm, false); err != nil && !strings.Contains(err.Error(), "replacement transaction") {
log.Error("Failed to send transaction",
"tx_id", txID,
"txId", txID,
"nonce", txToConfirm.CurrentTx.Nonce(),
"err", err,
)
Expand Down Expand Up @@ -271,7 +271,7 @@ func (s *Sender) SendTransaction(tx *types.Transaction) (string, error) {
if err := s.send(txToConfirm, true); err != nil && !strings.Contains(err.Error(), "replacement transaction") {
log.Error(
"Failed to send transaction",
"tx_id", txID,
"txId", txID,
"nonce", txToConfirm.CurrentTx.Nonce(),
"hash", tx.Hash(),
"err", err,
Expand Down Expand Up @@ -315,15 +315,15 @@ func (s *Sender) send(tx *TxToConfirm, resetNonce bool) error {
if err := s.SetNonce(originalTx, true); err != nil {
log.Error(
"Failed to set nonce when appear nonce too low",
"tx_id", tx.ID,
"txId", tx.ID,
"nonce", tx.CurrentTx.Nonce(),
"hash", rawTx.Hash(),
"err", err,
)
} else {
log.Warn(
"Nonce is incorrect, retry sending the transaction with new nonce",
"tx_id", tx.ID,
"txId", tx.ID,
"nonce", tx.CurrentTx.Nonce(),
"hash", rawTx.Hash(),
"err", err,
Expand All @@ -335,7 +335,7 @@ func (s *Sender) send(tx *TxToConfirm, resetNonce bool) error {
s.adjustGas(originalTx)
log.Warn(
"Replacement transaction underpriced",
"tx_id", tx.ID,
"txId", tx.ID,
"nonce", tx.CurrentTx.Nonce(),
"hash", rawTx.Hash(),
"err", err,
Expand All @@ -344,7 +344,7 @@ func (s *Sender) send(tx *TxToConfirm, resetNonce bool) error {
}
log.Error(
"Failed to send transaction",
"tx_id", tx.ID,
"txId", tx.ID,
"nonce", tx.CurrentTx.Nonce(),
"hash", rawTx.Hash(),
"err", err,
Expand Down Expand Up @@ -409,7 +409,7 @@ func (s *Sender) resendUnconfirmedTxs() {
if err := s.send(unconfirmedTx, true); err != nil {
log.Warn(
"Failed to resend the transaction",
"tx_id", id,
"txId", id,
"nonce", unconfirmedTx.CurrentTx.Nonce(),
"hash", unconfirmedTx.CurrentTx.Hash(),
"retrys", unconfirmedTx.Retrys,
Expand All @@ -430,7 +430,7 @@ func (s *Sender) checkPendingTransactionsConfirmation() {
tx, isPending, err := s.client.TransactionByHash(s.ctx, pendingTx.CurrentTx.Hash())
if err != nil {
log.Warn("Failed to fetch transaction",
"tx_id", pendingTx.ID,
"txId", pendingTx.ID,
"nonce", pendingTx.CurrentTx.Nonce(),
"hash", pendingTx.CurrentTx.Hash(),
"err", err,
Expand Down
1 change: 1 addition & 0 deletions internal/testutils/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ func (s *ClientTestSuite) NewTestProverServer(
ProverPrivateKey: proverPrivKey,
MinOptimisticTierFee: common.Big1,
MinSgxTierFee: common.Big1,
MinSgxAndZkVMTierFee: common.Big1,
MaxExpiry: 24 * time.Hour,
TaikoL1Address: common.HexToAddress(os.Getenv("TAIKO_L1_ADDRESS")),
AssignmentHookAddress: common.HexToAddress(os.Getenv("ASSIGNMENT_HOOK_ADDRESS")),
Expand Down
10 changes: 4 additions & 6 deletions pkg/rpc/tx_blob.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var (
// TransactBlobTx creates, signs and then sends blob transactions.
func (c *EthClient) TransactBlobTx(
opts *bind.TransactOpts,
contract *common.Address,
contract common.Address,
input []byte,
sidecar *types.BlobTxSidecar,
) (*types.Transaction, error) {
Expand Down Expand Up @@ -47,7 +47,7 @@ func (c *EthClient) TransactBlobTx(
// createBlobTx creates a blob transaction by given parameters.
func (c *EthClient) createBlobTx(
opts *bind.TransactOpts,
contract *common.Address,
contract common.Address,
input []byte,
sidecar *types.BlobTxSidecar,
) (*types.Transaction, error) {
Expand All @@ -63,17 +63,15 @@ func (c *EthClient) createBlobTx(
if input == nil {
input = []byte{}
}
if contract == nil {
contract = &common.Address{}
}

if opts.GasLimit != 0 {
gasVal := hexutil.Uint64(opts.GasLimit)
gas = &gasVal
}

rawTx, err := c.FillTransaction(opts.Context, &TransactionArgs{
From: &opts.From,
To: contract,
To: &contract,
Gas: gas,
GasPrice: (*hexutil.Big)(opts.GasPrice),
MaxFeePerGas: (*hexutil.Big)(opts.GasFeeCap),
Expand Down
2 changes: 1 addition & 1 deletion pkg/rpc/tx_blob_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func TestSendingBlobTx(t *testing.T) {
sideCar, sErr := MakeSidecar(data)
assert.NoError(t, sErr)

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

receipt, err := bind.WaitMined(ctx, l1Client, tx)
Expand Down
Loading
Loading