-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Labels
area/coreCore SDK integrationCore SDK integrationenhancementNew feature or requestNew feature or requestpriority/p2Medium priorityMedium priority
Description
Overview
Implement gas estimation, EIP-1559 pricing, and retry logic with gas bumping.
Implementation Details
Files:
internal/gas/estimator.go- Gas estimationinternal/gas/eip1559.go- EIP-1559 gas pricinginternal/gas/retry.go- Retry with gas bumping
Gas Estimator
type EstimatorConfig struct {
GasLimitMultiplier float64 // Default: 1.2 (20% buffer)
MaxGasLimit uint64 // Default: 3,000,000
MinGasLimit uint64 // Default: 21,000
}
func (e *Estimator) Estimate(ctx, msg ethereum.CallMsg) (uint64, error)EIP-1559 Gas Price Oracle
type GasPrice struct {
MaxFeePerGas *big.Int
MaxPriorityFeePerGas *big.Int
BaseFee *big.Int
}
func (o *PriceOracle) GetGasPrice(ctx) (*GasPrice, error)- Get base fee from latest block
- Get priority fee from
eth_maxPriorityFeePerGas - Calculate:
MaxFee = 2 * BaseFee + PriorityFee - Apply configurable max limits
Retry Logic
type RetryConfig struct {
MaxRetries int // Default: 3
InitialDelay time.Duration // Default: 5s
MaxDelay time.Duration // Default: 30s
GasBumpPercent int64 // Default: 10 (10%)
MaxGasBumpFactor int64 // Default: 3 (3x original)
}Retryable Errors:
- "replacement transaction underpriced"
- "nonce too low"
- "transaction underpriced"
- "intrinsic gas too low"
Gas Bumping: Increase gas price by GasBumpPercent per retry attempt.
Integration
func (s *EVMSigner) SendTransactionWithRetry(
ctx context.Context,
to string,
data []byte,
gasEstimator *gas.Estimator,
gasOracle *gas.PriceOracle,
retrier *gas.Retrier,
) (string, error)Acceptance Criteria
- Gas estimator with buffer
- EIP-1559 gas price oracle
- Retry logic with exponential backoff
- Gas price bumping on retry
- Max limits enforcement
- Retryable error detection
- Unit tests
- Integration tests with testnet
Dependencies
- [Feature 02] EVM Signer Implementation #21 EVM Signer Implementation
Branch
feature/gas-optimization
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area/coreCore SDK integrationCore SDK integrationenhancementNew feature or requestNew feature or requestpriority/p2Medium priorityMedium priority