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

handle zkevm_estimateCounters better #960

Merged
merged 1 commit into from
Aug 14, 2024
Merged
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
14 changes: 14 additions & 0 deletions cmd/rpcdaemon/commands/zkevm_counters.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ type zkevmRPCTransaction struct {
Input hexutility.Bytes `json:"input"`
Nonce hexutil.Uint64 `json:"nonce"`
To *common.Address `json:"to"`
From *common.Address `json:"from"`
Value *hexutil.Big `json:"value"`
V *hexutil.Big `json:"v"`
R *hexutil.Big `json:"r"`
Expand Down Expand Up @@ -70,6 +71,10 @@ func (tx *zkevmRPCTransaction) Tx() types.Transaction {
)
}

if tx.From != nil {
legacy.SetSender(*tx.From)
}

if tx.V != nil && tx.R != nil && tx.S != nil {
// parse signature raw values V, R, S from local hex strings
legacy.V = *uint256.MustFromBig(tx.V.ToInt())
Expand All @@ -90,6 +95,11 @@ func (zkapi *ZkEvmAPIImpl) EstimateCounters(ctx context.Context, rpcTx *zkevmRPC
}
defer dbtx.Rollback()

if rpcTx.Value == nil {
// set this to something non nil
rpcTx.Value = &hexutil.Big{}
}

tx := rpcTx.Tx()

chainConfig, err := api.chainConfig(dbtx)
Expand Down Expand Up @@ -133,6 +143,10 @@ func (zkapi *ZkEvmAPIImpl) EstimateCounters(ctx context.Context, rpcTx *zkevmRPC
if err != nil {
return nil, err
}

// we don't care about the nonce value for this check on counters
msg.SetCheckNonce(false)

txCtx := core.NewEVMTxContext(msg)

eriDb := db2.NewRoEriDb(dbtx)
Expand Down
Loading