core, eth, internal, les: RPC methods and fields for EIP 1559 (#22964)
* internal/ethapi: add baseFee to RPCMarshalHeader * internal/ethapi: add FeeCap, Tip and correct GasPrice to EIP-1559 RPCTransaction results * core,eth,les,internal: add support for tip estimation in gas price oracle * internal/ethapi,eth/gasprice: don't suggest tip larger than fee cap * core/types,internal: use correct eip1559 terminology for json marshalling * eth, internal/ethapi: fix rebase problems * internal/ethapi: fix rpc name of basefee * internal/ethapi: address review concerns * core, eth, internal, les: simplify gasprice oracle (#25) * core, eth, internal, les: simplify gasprice oracle * eth/gasprice: fix typo * internal/ethapi: minor tweak in tx args * internal/ethapi: calculate basefee for pending block * internal/ethapi: fix panic * internal/ethapi, eth/tracers: simplify txargs ToMessage * internal/ethapi: remove unused param * core, eth, internal: fix regressions wrt effective gas price in the evm * eth/gasprice: drop weird debug println * internal/jsre/deps: hack in 1559 gas conversions into embedded web3 * internal/jsre/deps: hack basFee to decimal conversion * internal/ethapi: init feecap and tipcap for legacy txs too * eth, graphql, internal, les: fix gas price suggestion on all combos * internal/jsre/deps: handle decimal tipcap and feecap * eth, internal: minor review fixes * graphql, internal: export max fee cap RPC endpoint * internal/ethapi: fix crash in transaction_args * internal/ethapi: minor refactor to make the code safer Co-authored-by: Ryan Schneider <ryanleeschneider@gmail.com> Co-authored-by: lightclient@protonmail.com <lightclient@protonmail.com> Co-authored-by: gary rong <garyrong0905@gmail.com> Co-authored-by: Péter Szilágyi <peterke@gmail.com>
This commit is contained in:
19 files changed
+410
-159
No files matched your search
@@ -252,7 +252,6 @@ func makeHeader(chain consensus.ChainReader, parent *types.Block, state *state.S
|
||||
} else {
|
||||
time = parent.Time() + 10 // block time is fixed at 10 seconds
|
||||
}
|
||||
|
||||
header := &types.Header{
|
||||
Root: state.IntermediateRoot(chain.Config().IsEIP158(parent.Number())),
|
||||
ParentHash: parent.Hash(),
|
||||
@@ -267,11 +266,14 @@ func makeHeader(chain consensus.ChainReader, parent *types.Block, state *state.S
|
||||
Number: new(big.Int).Add(parent.Number(), common.Big1),
|
||||
Time: time,
|
||||
}
|
||||
|
||||
if chain.Config().IsLondon(parent.Number()) {
|
||||
if chain.Config().IsLondon(header.Number) {
|
||||
header.BaseFee = misc.CalcBaseFee(chain.Config(), parent.Header())
|
||||
parentGasLimit := parent.GasLimit()
|
||||
if !chain.Config().IsLondon(parent.Number()) {
|
||||
parentGasLimit = parent.GasLimit() * params.ElasticityMultiplier
|
||||
}
|
||||
header.GasLimit = CalcGasLimit1559(parentGasLimit, parentGasLimit)
|
||||
}
|
||||
|
||||
return header
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -84,7 +84,7 @@ type Header struct {
|
||||
Nonce BlockNonce `json:"nonce"`
|
||||
|
||||
// BaseFee was added by EIP-1559 and is ignored in legacy headers.
|
||||
BaseFee *big.Int `json:"baseFee" rlp:"optional"`
|
||||
BaseFee *big.Int `json:"baseFeePerGas" rlp:"optional"`
|
||||
}
|
||||
|
||||
// field type overrides for gencodec
|
||||
|
||||
@@ -31,6 +31,7 @@ func (h Header) MarshalJSON() ([]byte, error) {
|
||||
Extra hexutil.Bytes `json:"extraData" gencodec:"required"`
|
||||
MixDigest common.Hash `json:"mixHash"`
|
||||
Nonce BlockNonce `json:"nonce"`
|
||||
BaseFee *hexutil.Big `json:"baseFeePerGas" rlp:"optional"`
|
||||
Hash common.Hash `json:"hash"`
|
||||
}
|
||||
var enc Header
|
||||
@@ -49,6 +50,7 @@ func (h Header) MarshalJSON() ([]byte, error) {
|
||||
enc.Extra = h.Extra
|
||||
enc.MixDigest = h.MixDigest
|
||||
enc.Nonce = h.Nonce
|
||||
enc.BaseFee = (*hexutil.Big)(h.BaseFee)
|
||||
enc.Hash = h.Hash()
|
||||
return json.Marshal(&enc)
|
||||
}
|
||||
@@ -71,6 +73,7 @@ func (h *Header) UnmarshalJSON(input []byte) error {
|
||||
Extra *hexutil.Bytes `json:"extraData" gencodec:"required"`
|
||||
MixDigest *common.Hash `json:"mixHash"`
|
||||
Nonce *BlockNonce `json:"nonce"`
|
||||
BaseFee *hexutil.Big `json:"baseFeePerGas" rlp:"optional"`
|
||||
}
|
||||
var dec Header
|
||||
if err := json.Unmarshal(input, &dec); err != nil {
|
||||
@@ -134,5 +137,8 @@ func (h *Header) UnmarshalJSON(input []byte) error {
|
||||
if dec.Nonce != nil {
|
||||
h.Nonce = *dec.Nonce
|
||||
}
|
||||
if dec.BaseFee != nil {
|
||||
h.BaseFee = (*big.Int)(dec.BaseFee)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -604,12 +604,10 @@ func (tx *Transaction) AsMessage(s Signer, baseFee *big.Int) (Message, error) {
|
||||
accessList: tx.AccessList(),
|
||||
checkNonce: true,
|
||||
}
|
||||
|
||||
// If baseFee provided, set gasPrice to effectiveGasPrice.
|
||||
if baseFee != nil {
|
||||
msg.gasPrice = math.BigMin(msg.gasPrice.Add(msg.tip, baseFee), msg.feeCap)
|
||||
}
|
||||
|
||||
var err error
|
||||
msg.from, err = Sender(s, tx)
|
||||
return msg, err
|
||||
|
||||
@@ -32,8 +32,6 @@ type txJSON struct {
|
||||
// Common transaction fields:
|
||||
Nonce *hexutil.Uint64 `json:"nonce"`
|
||||
GasPrice *hexutil.Big `json:"gasPrice"`
|
||||
FeeCap *hexutil.Big `json:"feeCap"`
|
||||
Tip *hexutil.Big `json:"tip"`
|
||||
MaxPriorityFeePerGas *hexutil.Big `json:"maxPriorityFeePerGas"`
|
||||
MaxFeePerGas *hexutil.Big `json:"maxFeePerGas"`
|
||||
Gas *hexutil.Uint64 `json:"gas"`
|
||||
@@ -88,8 +86,8 @@ func (t *Transaction) MarshalJSON() ([]byte, error) {
|
||||
enc.AccessList = &tx.AccessList
|
||||
enc.Nonce = (*hexutil.Uint64)(&tx.Nonce)
|
||||
enc.Gas = (*hexutil.Uint64)(&tx.Gas)
|
||||
enc.FeeCap = (*hexutil.Big)(tx.FeeCap)
|
||||
enc.Tip = (*hexutil.Big)(tx.Tip)
|
||||
enc.MaxFeePerGas = (*hexutil.Big)(tx.FeeCap)
|
||||
enc.MaxPriorityFeePerGas = (*hexutil.Big)(tx.Tip)
|
||||
enc.Value = (*hexutil.Big)(tx.Value)
|
||||
enc.Data = (*hexutil.Bytes)(&tx.Data)
|
||||
enc.To = t.To()
|
||||
@@ -226,26 +224,14 @@ func (t *Transaction) UnmarshalJSON(input []byte) error {
|
||||
return errors.New("missing required field 'nonce' in transaction")
|
||||
}
|
||||
itx.Nonce = uint64(*dec.Nonce)
|
||||
switch {
|
||||
case dec.Tip == nil && dec.MaxPriorityFeePerGas == nil:
|
||||
return errors.New("at least one of 'tip' or 'maxPriorityFeePerGas' must be defined")
|
||||
case dec.Tip != nil && dec.MaxPriorityFeePerGas != nil:
|
||||
return errors.New("only one of 'tip' or 'maxPriorityFeePerGas' may be defined")
|
||||
case dec.Tip != nil && dec.MaxPriorityFeePerGas == nil:
|
||||
itx.Tip = (*big.Int)(dec.Tip)
|
||||
case dec.Tip == nil && dec.MaxPriorityFeePerGas != nil:
|
||||
itx.Tip = (*big.Int)(dec.MaxPriorityFeePerGas)
|
||||
if dec.MaxPriorityFeePerGas == nil {
|
||||
return errors.New("missing required field 'maxPriorityFeePerGas' for txdata")
|
||||
}
|
||||
switch {
|
||||
case dec.FeeCap == nil && dec.MaxFeePerGas == nil:
|
||||
return errors.New("at least one of 'feeCap' or 'maxFeePerGas' must be defined")
|
||||
case dec.FeeCap != nil && dec.MaxFeePerGas != nil:
|
||||
return errors.New("only one of 'feeCap' or 'maxFeePerGas' may be defined")
|
||||
case dec.FeeCap != nil && dec.MaxFeePerGas == nil:
|
||||
itx.FeeCap = (*big.Int)(dec.FeeCap)
|
||||
case dec.FeeCap == nil && dec.MaxFeePerGas != nil:
|
||||
itx.FeeCap = (*big.Int)(dec.MaxFeePerGas)
|
||||
itx.Tip = (*big.Int)(dec.MaxPriorityFeePerGas)
|
||||
if dec.MaxFeePerGas == nil {
|
||||
return errors.New("missing required field 'maxFeePerGas' for txdata")
|
||||
}
|
||||
itx.FeeCap = (*big.Int)(dec.MaxFeePerGas)
|
||||
if dec.Gas == nil {
|
||||
return errors.New("missing required field 'gas' for txdata")
|
||||
}
|
||||
|
||||
+2
-2
@@ -275,8 +275,8 @@ func (b *EthAPIBackend) Downloader() *downloader.Downloader {
|
||||
return b.eth.Downloader()
|
||||
}
|
||||
|
||||
func (b *EthAPIBackend) SuggestPrice(ctx context.Context) (*big.Int, error) {
|
||||
return b.gpo.SuggestPrice(ctx)
|
||||
func (b *EthAPIBackend) SuggestGasTipCap(ctx context.Context) (*big.Int, error) {
|
||||
return b.gpo.SuggestTipCap(ctx)
|
||||
}
|
||||
|
||||
func (b *EthAPIBackend) ChainDb() ethdb.Database {
|
||||
|
||||
+63
-36
@@ -31,8 +31,10 @@ import (
|
||||
|
||||
const sampleNumber = 3 // Number of transactions sampled in a block
|
||||
|
||||
var DefaultMaxPrice = big.NewInt(500 * params.GWei)
|
||||
var DefaultIgnorePrice = big.NewInt(2 * params.Wei)
|
||||
var (
|
||||
DefaultMaxPrice = big.NewInt(500 * params.GWei)
|
||||
DefaultIgnorePrice = big.NewInt(2 * params.Wei)
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
Blocks int
|
||||
@@ -103,9 +105,13 @@ func NewOracle(backend OracleBackend, params Config) *Oracle {
|
||||
}
|
||||
}
|
||||
|
||||
// SuggestPrice returns a gasprice so that newly created transaction can
|
||||
// have a very high chance to be included in the following blocks.
|
||||
func (gpo *Oracle) SuggestPrice(ctx context.Context) (*big.Int, error) {
|
||||
// SuggestTipCap returns a tip cap so that newly created transaction can have a
|
||||
// very high chance to be included in the following blocks.
|
||||
//
|
||||
// Note, for legacy transactions and the legacy eth_gasPrice RPC call, it will be
|
||||
// necessary to add the basefee to the returned number to fall back to the legacy
|
||||
// behavior.
|
||||
func (gpo *Oracle) SuggestTipCap(ctx context.Context) (*big.Int, error) {
|
||||
head, _ := gpo.backend.HeaderByNumber(ctx, rpc.LatestBlockNumber)
|
||||
headHash := head.Hash()
|
||||
|
||||
@@ -114,7 +120,7 @@ func (gpo *Oracle) SuggestPrice(ctx context.Context) (*big.Int, error) {
|
||||
lastHead, lastPrice := gpo.lastHead, gpo.lastPrice
|
||||
gpo.cacheLock.RUnlock()
|
||||
if headHash == lastHead {
|
||||
return lastPrice, nil
|
||||
return new(big.Int).Set(lastPrice), nil
|
||||
}
|
||||
gpo.fetchLock.Lock()
|
||||
defer gpo.fetchLock.Unlock()
|
||||
@@ -124,17 +130,17 @@ func (gpo *Oracle) SuggestPrice(ctx context.Context) (*big.Int, error) {
|
||||
lastHead, lastPrice = gpo.lastHead, gpo.lastPrice
|
||||
gpo.cacheLock.RUnlock()
|
||||
if headHash == lastHead {
|
||||
return lastPrice, nil
|
||||
return new(big.Int).Set(lastPrice), nil
|
||||
}
|
||||
var (
|
||||
sent, exp int
|
||||
number = head.Number.Uint64()
|
||||
result = make(chan getBlockPricesResult, gpo.checkBlocks)
|
||||
result = make(chan results, gpo.checkBlocks)
|
||||
quit = make(chan struct{})
|
||||
txPrices []*big.Int
|
||||
results []*big.Int
|
||||
)
|
||||
for sent < gpo.checkBlocks && number > 0 {
|
||||
go gpo.getBlockPrices(ctx, types.MakeSigner(gpo.backend.ChainConfig(), big.NewInt(int64(number))), number, sampleNumber, gpo.ignorePrice, result, quit)
|
||||
go gpo.getBlockValues(ctx, types.MakeSigner(gpo.backend.ChainConfig(), big.NewInt(int64(number))), number, sampleNumber, gpo.ignorePrice, result, quit)
|
||||
sent++
|
||||
exp++
|
||||
number--
|
||||
@@ -143,31 +149,31 @@ func (gpo *Oracle) SuggestPrice(ctx context.Context) (*big.Int, error) {
|
||||
res := <-result
|
||||
if res.err != nil {
|
||||
close(quit)
|
||||
return lastPrice, res.err
|
||||
return new(big.Int).Set(lastPrice), res.err
|
||||
}
|
||||
exp--
|
||||
// Nothing returned. There are two special cases here:
|
||||
// - The block is empty
|
||||
// - All the transactions included are sent by the miner itself.
|
||||
// In these cases, use the latest calculated price for samping.
|
||||
if len(res.prices) == 0 {
|
||||
res.prices = []*big.Int{lastPrice}
|
||||
if len(res.values) == 0 {
|
||||
res.values = []*big.Int{lastPrice}
|
||||
}
|
||||
// Besides, in order to collect enough data for sampling, if nothing
|
||||
// meaningful returned, try to query more blocks. But the maximum
|
||||
// is 2*checkBlocks.
|
||||
if len(res.prices) == 1 && len(txPrices)+1+exp < gpo.checkBlocks*2 && number > 0 {
|
||||
go gpo.getBlockPrices(ctx, types.MakeSigner(gpo.backend.ChainConfig(), big.NewInt(int64(number))), number, sampleNumber, gpo.ignorePrice, result, quit)
|
||||
if len(res.values) == 1 && len(results)+1+exp < gpo.checkBlocks*2 && number > 0 {
|
||||
go gpo.getBlockValues(ctx, types.MakeSigner(gpo.backend.ChainConfig(), big.NewInt(int64(number))), number, sampleNumber, gpo.ignorePrice, result, quit)
|
||||
sent++
|
||||
exp++
|
||||
number--
|
||||
}
|
||||
txPrices = append(txPrices, res.prices...)
|
||||
results = append(results, res.values...)
|
||||
}
|
||||
price := lastPrice
|
||||
if len(txPrices) > 0 {
|
||||
sort.Sort(bigIntArray(txPrices))
|
||||
price = txPrices[(len(txPrices)-1)*gpo.percentile/100]
|
||||
if len(results) > 0 {
|
||||
sort.Sort(bigIntArray(results))
|
||||
price = results[(len(results)-1)*gpo.percentile/100]
|
||||
}
|
||||
if price.Cmp(gpo.maxPrice) > 0 {
|
||||
price = new(big.Int).Set(gpo.maxPrice)
|
||||
@@ -176,53 +182,74 @@ func (gpo *Oracle) SuggestPrice(ctx context.Context) (*big.Int, error) {
|
||||
gpo.lastHead = headHash
|
||||
gpo.lastPrice = price
|
||||
gpo.cacheLock.Unlock()
|
||||
return price, nil
|
||||
|
||||
return new(big.Int).Set(price), nil
|
||||
}
|
||||
|
||||
type getBlockPricesResult struct {
|
||||
prices []*big.Int
|
||||
type results struct {
|
||||
values []*big.Int
|
||||
err error
|
||||
}
|
||||
|
||||
type transactionsByGasPrice []*types.Transaction
|
||||
type txSorter struct {
|
||||
txs []*types.Transaction
|
||||
baseFee *big.Int
|
||||
}
|
||||
|
||||
func (t transactionsByGasPrice) Len() int { return len(t) }
|
||||
func (t transactionsByGasPrice) Swap(i, j int) { t[i], t[j] = t[j], t[i] }
|
||||
func (t transactionsByGasPrice) Less(i, j int) bool { return t[i].FeeCapCmp(t[j]) < 0 }
|
||||
func newSorter(txs []*types.Transaction, baseFee *big.Int) *txSorter {
|
||||
return &txSorter{
|
||||
txs: txs,
|
||||
baseFee: baseFee,
|
||||
}
|
||||
}
|
||||
|
||||
func (s *txSorter) Len() int { return len(s.txs) }
|
||||
func (s *txSorter) Swap(i, j int) {
|
||||
s.txs[i], s.txs[j] = s.txs[j], s.txs[i]
|
||||
}
|
||||
func (s *txSorter) Less(i, j int) bool {
|
||||
// It's okay to discard the error because a tx would never be
|
||||
// accepted into a block with an invalid effective tip.
|
||||
tip1, _ := s.txs[i].EffectiveTip(s.baseFee)
|
||||
tip2, _ := s.txs[j].EffectiveTip(s.baseFee)
|
||||
return tip1.Cmp(tip2) < 0
|
||||
}
|
||||
|
||||
// getBlockPrices calculates the lowest transaction gas price in a given block
|
||||
// and sends it to the result channel. If the block is empty or all transactions
|
||||
// are sent by the miner itself(it doesn't make any sense to include this kind of
|
||||
// transaction prices for sampling), nil gasprice is returned.
|
||||
func (gpo *Oracle) getBlockPrices(ctx context.Context, signer types.Signer, blockNum uint64, limit int, ignoreUnder *big.Int, result chan getBlockPricesResult, quit chan struct{}) {
|
||||
func (gpo *Oracle) getBlockValues(ctx context.Context, signer types.Signer, blockNum uint64, limit int, ignoreUnder *big.Int, result chan results, quit chan struct{}) {
|
||||
block, err := gpo.backend.BlockByNumber(ctx, rpc.BlockNumber(blockNum))
|
||||
if block == nil {
|
||||
select {
|
||||
case result <- getBlockPricesResult{nil, err}:
|
||||
case result <- results{nil, err}:
|
||||
case <-quit:
|
||||
}
|
||||
return
|
||||
}
|
||||
blockTxs := block.Transactions()
|
||||
txs := make([]*types.Transaction, len(blockTxs))
|
||||
copy(txs, blockTxs)
|
||||
sort.Sort(transactionsByGasPrice(txs))
|
||||
// Sort the transaction by effective tip in ascending sort.
|
||||
txs := make([]*types.Transaction, len(block.Transactions()))
|
||||
copy(txs, block.Transactions())
|
||||
sorter := newSorter(txs, block.BaseFee())
|
||||
sort.Sort(sorter)
|
||||
|
||||
var prices []*big.Int
|
||||
for _, tx := range txs {
|
||||
if ignoreUnder != nil && tx.GasPrice().Cmp(ignoreUnder) == -1 {
|
||||
for _, tx := range sorter.txs {
|
||||
tip, _ := tx.EffectiveTip(block.BaseFee())
|
||||
if ignoreUnder != nil && tip.Cmp(ignoreUnder) == -1 {
|
||||
continue
|
||||
}
|
||||
sender, err := types.Sender(signer, tx)
|
||||
if err == nil && sender != block.Coinbase() {
|
||||
prices = append(prices, tx.GasPrice())
|
||||
prices = append(prices, tip)
|
||||
if len(prices) >= limit {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
select {
|
||||
case result <- getBlockPricesResult{prices, nil}:
|
||||
case result <- results{prices, nil}:
|
||||
case <-quit:
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ func (b *testBackend) ChainConfig() *params.ChainConfig {
|
||||
return b.chain.Config()
|
||||
}
|
||||
|
||||
func newTestBackend(t *testing.T) *testBackend {
|
||||
func newTestBackend(t *testing.T, londonBlock *big.Int) *testBackend {
|
||||
var (
|
||||
key, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
|
||||
addr = crypto.PubkeyToAddress(key.PublicKey)
|
||||
@@ -65,14 +65,42 @@ func newTestBackend(t *testing.T) *testBackend {
|
||||
}
|
||||
signer = types.LatestSigner(gspec.Config)
|
||||
)
|
||||
if londonBlock != nil {
|
||||
gspec.Config.LondonBlock = londonBlock
|
||||
signer = types.LatestSigner(gspec.Config)
|
||||
}
|
||||
engine := ethash.NewFaker()
|
||||
db := rawdb.NewMemoryDatabase()
|
||||
genesis, _ := gspec.Commit(db)
|
||||
|
||||
// Generate testing blocks
|
||||
blocks, _ := core.GenerateChain(params.TestChainConfig, genesis, engine, db, 32, func(i int, b *core.BlockGen) {
|
||||
blocks, _ := core.GenerateChain(gspec.Config, genesis, engine, db, 32, func(i int, b *core.BlockGen) {
|
||||
b.SetCoinbase(common.Address{1})
|
||||
tx, err := types.SignTx(types.NewTransaction(b.TxNonce(addr), common.HexToAddress("deadbeef"), big.NewInt(100), 21000, big.NewInt(int64(i+1)*params.GWei), nil), signer, key)
|
||||
|
||||
var tx *types.Transaction
|
||||
if londonBlock != nil && b.Number().Cmp(londonBlock) >= 0 {
|
||||
txdata := &types.DynamicFeeTx{
|
||||
ChainID: gspec.Config.ChainID,
|
||||
Nonce: b.TxNonce(addr),
|
||||
To: &common.Address{},
|
||||
Gas: 30000,
|
||||
FeeCap: big.NewInt(100 * params.GWei),
|
||||
Tip: big.NewInt(int64(i+1) * params.GWei),
|
||||
Data: []byte{},
|
||||
}
|
||||
tx = types.NewTx(txdata)
|
||||
} else {
|
||||
txdata := &types.LegacyTx{
|
||||
Nonce: b.TxNonce(addr),
|
||||
To: &common.Address{},
|
||||
Gas: 21000,
|
||||
GasPrice: big.NewInt(int64(i+1) * params.GWei),
|
||||
Value: big.NewInt(100),
|
||||
Data: []byte{},
|
||||
}
|
||||
tx = types.NewTx(txdata)
|
||||
}
|
||||
tx, err := types.SignTx(tx, signer, key)
|
||||
if err != nil {
|
||||
t.Fatalf("failed to create tx: %v", err)
|
||||
}
|
||||
@@ -81,7 +109,7 @@ func newTestBackend(t *testing.T) *testBackend {
|
||||
// Construct testing chain
|
||||
diskdb := rawdb.NewMemoryDatabase()
|
||||
gspec.Commit(diskdb)
|
||||
chain, err := core.NewBlockChain(diskdb, nil, params.TestChainConfig, engine, vm.Config{}, nil, nil)
|
||||
chain, err := core.NewBlockChain(diskdb, nil, gspec.Config, engine, vm.Config{}, nil, nil)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to create local chain, %v", err)
|
||||
}
|
||||
@@ -97,22 +125,33 @@ func (b *testBackend) GetBlockByNumber(number uint64) *types.Block {
|
||||
return b.chain.GetBlockByNumber(number)
|
||||
}
|
||||
|
||||
func TestSuggestPrice(t *testing.T) {
|
||||
func TestSuggestTipCap(t *testing.T) {
|
||||
config := Config{
|
||||
Blocks: 3,
|
||||
Percentile: 60,
|
||||
Default: big.NewInt(params.GWei),
|
||||
}
|
||||
backend := newTestBackend(t)
|
||||
oracle := NewOracle(backend, config)
|
||||
|
||||
// The gas price sampled is: 32G, 31G, 30G, 29G, 28G, 27G
|
||||
got, err := oracle.SuggestPrice(context.Background())
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to retrieve recommended gas price: %v", err)
|
||||
var cases = []struct {
|
||||
fork *big.Int // London fork number
|
||||
expect *big.Int // Expected gasprice suggestion
|
||||
}{
|
||||
{nil, big.NewInt(params.GWei * int64(30))},
|
||||
{big.NewInt(0), big.NewInt(params.GWei * int64(30))}, // Fork point in genesis
|
||||
{big.NewInt(1), big.NewInt(params.GWei * int64(30))}, // Fork point in first block
|
||||
{big.NewInt(32), big.NewInt(params.GWei * int64(30))}, // Fork point in last block
|
||||
{big.NewInt(33), big.NewInt(params.GWei * int64(30))}, // Fork point in the future
|
||||
}
|
||||
expect := big.NewInt(params.GWei * int64(30))
|
||||
if got.Cmp(expect) != 0 {
|
||||
t.Fatalf("Gas price mismatch, want %d, got %d", expect, got)
|
||||
for _, c := range cases {
|
||||
backend := newTestBackend(t, c.fork)
|
||||
oracle := NewOracle(backend, config)
|
||||
|
||||
// The gas price sampled is: 32G, 31G, 30G, 29G, 28G, 27G
|
||||
got, err := oracle.SuggestTipCap(context.Background())
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to retrieve recommended gas price: %v", err)
|
||||
}
|
||||
if got.Cmp(c.expect) != 0 {
|
||||
t.Fatalf("Gas price mismatch, want %d, got %d", c.expect, got)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -53,7 +53,7 @@ func TestHashRanges(t *testing.T) {
|
||||
head: common.HexToHash("0x2000000000000000000000000000000000000000000000000000000000000000"),
|
||||
chunks: 2,
|
||||
starts: []common.Hash{
|
||||
common.Hash{},
|
||||
{},
|
||||
common.HexToHash("0x9000000000000000000000000000000000000000000000000000000000000000"),
|
||||
},
|
||||
ends: []common.Hash{
|
||||
|
||||
+4
-1
@@ -762,7 +762,10 @@ func (api *API) TraceCall(ctx context.Context, args ethapi.TransactionArgs, bloc
|
||||
}
|
||||
}
|
||||
// Execute the trace
|
||||
msg := args.ToMessage(api.backend.RPCGasCap())
|
||||
msg, err := args.ToMessage(api.backend.RPCGasCap(), block.BaseFee())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
vmctx := core.NewEVMBlockContext(block.Header(), api.chainContext(ctx), nil)
|
||||
|
||||
var traceConfig *TraceConfig
|
||||
|
||||
+16
-2
@@ -1106,8 +1106,22 @@ func (r *Resolver) Logs(ctx context.Context, args struct{ Filter FilterCriteria
|
||||
}
|
||||
|
||||
func (r *Resolver) GasPrice(ctx context.Context) (hexutil.Big, error) {
|
||||
price, err := r.backend.SuggestPrice(ctx)
|
||||
return hexutil.Big(*price), err
|
||||
tipcap, err := r.backend.SuggestGasTipCap(ctx)
|
||||
if err != nil {
|
||||
return hexutil.Big{}, err
|
||||
}
|
||||
if head := r.backend.CurrentHeader(); head.BaseFee != nil {
|
||||
tipcap.Add(tipcap, head.BaseFee)
|
||||
}
|
||||
return (hexutil.Big)(*tipcap), nil
|
||||
}
|
||||
|
||||
func (r *Resolver) MaxPriorityFeePerGas(ctx context.Context) (hexutil.Big, error) {
|
||||
tipcap, err := r.backend.SuggestGasTipCap(ctx)
|
||||
if err != nil {
|
||||
return hexutil.Big{}, err
|
||||
}
|
||||
return (hexutil.Big)(*tipcap), nil
|
||||
}
|
||||
|
||||
func (r *Resolver) ChainID(ctx context.Context) (hexutil.Big, error) {
|
||||
|
||||
@@ -319,6 +319,9 @@ const schema string = `
|
||||
# GasPrice returns the node's estimate of a gas price sufficient to
|
||||
# ensure a transaction is mined in a timely fashion.
|
||||
gasPrice: BigInt!
|
||||
# MaxPriorityFeePerGas returns the node's estimate of a gas tip sufficient
|
||||
# to ensure a transaction is mined in a timely fashion.
|
||||
maxPriorityFeePerGas: BigInt!
|
||||
# Syncing returns information on the current synchronisation state.
|
||||
syncing: SyncState
|
||||
# ChainID returns the current chain ID for transaction replay protection.
|
||||
|
||||
+67
-17
@@ -34,6 +34,7 @@ import (
|
||||
"github.com/ethereum/go-ethereum/common/math"
|
||||
"github.com/ethereum/go-ethereum/consensus/clique"
|
||||
"github.com/ethereum/go-ethereum/consensus/ethash"
|
||||
"github.com/ethereum/go-ethereum/consensus/misc"
|
||||
"github.com/ethereum/go-ethereum/core"
|
||||
"github.com/ethereum/go-ethereum/core/state"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
@@ -58,10 +59,25 @@ func NewPublicEthereumAPI(b Backend) *PublicEthereumAPI {
|
||||
return &PublicEthereumAPI{b}
|
||||
}
|
||||
|
||||
// GasPrice returns a suggestion for a gas price.
|
||||
// GasPrice returns a suggestion for a gas price for legacy transactions.
|
||||
func (s *PublicEthereumAPI) GasPrice(ctx context.Context) (*hexutil.Big, error) {
|
||||
price, err := s.b.SuggestPrice(ctx)
|
||||
return (*hexutil.Big)(price), err
|
||||
tipcap, err := s.b.SuggestGasTipCap(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if head := s.b.CurrentHeader(); head.BaseFee != nil {
|
||||
tipcap.Add(tipcap, head.BaseFee)
|
||||
}
|
||||
return (*hexutil.Big)(tipcap), err
|
||||
}
|
||||
|
||||
// MaxPriorityFeePerGas returns a suggestion for a gas tip cap for dynamic transactions.
|
||||
func (s *PublicEthereumAPI) MaxPriorityFeePerGas(ctx context.Context) (*hexutil.Big, error) {
|
||||
tipcap, err := s.b.SuggestGasTipCap(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return (*hexutil.Big)(tipcap), err
|
||||
}
|
||||
|
||||
// Syncing returns false in case the node is currently not syncing with the network. It can be up to date or has not
|
||||
@@ -105,12 +121,12 @@ func (s *PublicTxPoolAPI) Content() map[string]map[string]map[string]*RPCTransac
|
||||
"queued": make(map[string]map[string]*RPCTransaction),
|
||||
}
|
||||
pending, queue := s.b.TxPoolContent()
|
||||
|
||||
curHeader := s.b.CurrentHeader()
|
||||
// Flatten the pending transactions
|
||||
for account, txs := range pending {
|
||||
dump := make(map[string]*RPCTransaction)
|
||||
for _, tx := range txs {
|
||||
dump[fmt.Sprintf("%d", tx.Nonce())] = newRPCPendingTransaction(tx)
|
||||
dump[fmt.Sprintf("%d", tx.Nonce())] = newRPCPendingTransaction(tx, curHeader, s.b.ChainConfig())
|
||||
}
|
||||
content["pending"][account.Hex()] = dump
|
||||
}
|
||||
@@ -118,7 +134,7 @@ func (s *PublicTxPoolAPI) Content() map[string]map[string]map[string]*RPCTransac
|
||||
for account, txs := range queue {
|
||||
dump := make(map[string]*RPCTransaction)
|
||||
for _, tx := range txs {
|
||||
dump[fmt.Sprintf("%d", tx.Nonce())] = newRPCPendingTransaction(tx)
|
||||
dump[fmt.Sprintf("%d", tx.Nonce())] = newRPCPendingTransaction(tx, curHeader, s.b.ChainConfig())
|
||||
}
|
||||
content["queued"][account.Hex()] = dump
|
||||
}
|
||||
@@ -829,7 +845,10 @@ func DoCall(ctx context.Context, b Backend, args TransactionArgs, blockNrOrHash
|
||||
defer cancel()
|
||||
|
||||
// Get a new instance of the EVM.
|
||||
msg := args.ToMessage(globalGasCap)
|
||||
msg, err := args.ToMessage(globalGasCap, header.BaseFee)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
evm, vmError, err := b.GetEVM(ctx, msg, state, header, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -1088,7 +1107,7 @@ func FormatLogs(logs []vm.StructLog) []StructLogRes {
|
||||
|
||||
// RPCMarshalHeader converts the given header to the RPC output .
|
||||
func RPCMarshalHeader(head *types.Header) map[string]interface{} {
|
||||
return map[string]interface{}{
|
||||
result := map[string]interface{}{
|
||||
"number": (*hexutil.Big)(head.Number),
|
||||
"hash": head.Hash(),
|
||||
"parentHash": head.ParentHash,
|
||||
@@ -1107,6 +1126,12 @@ func RPCMarshalHeader(head *types.Header) map[string]interface{} {
|
||||
"transactionsRoot": head.TxHash,
|
||||
"receiptsRoot": head.ReceiptHash,
|
||||
}
|
||||
|
||||
if head.BaseFee != nil {
|
||||
result["baseFeePerGas"] = (*hexutil.Big)(head.BaseFee)
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
// RPCMarshalBlock converts the given block to the RPC output which depends on fullTx. If inclTx is true transactions are
|
||||
@@ -1173,6 +1198,8 @@ type RPCTransaction struct {
|
||||
From common.Address `json:"from"`
|
||||
Gas hexutil.Uint64 `json:"gas"`
|
||||
GasPrice *hexutil.Big `json:"gasPrice"`
|
||||
FeeCap *hexutil.Big `json:"maxFeePerGas,omitempty"`
|
||||
Tip *hexutil.Big `json:"maxPriorityFeePerGas,omitempty"`
|
||||
Hash common.Hash `json:"hash"`
|
||||
Input hexutil.Bytes `json:"input"`
|
||||
Nonce hexutil.Uint64 `json:"nonce"`
|
||||
@@ -1189,7 +1216,7 @@ type RPCTransaction struct {
|
||||
|
||||
// newRPCTransaction returns a transaction that will serialize to the RPC
|
||||
// representation, with the given location metadata set (if available).
|
||||
func newRPCTransaction(tx *types.Transaction, blockHash common.Hash, blockNumber uint64, index uint64) *RPCTransaction {
|
||||
func newRPCTransaction(tx *types.Transaction, blockHash common.Hash, blockNumber uint64, index uint64, baseFee *big.Int) *RPCTransaction {
|
||||
// Determine the signer. For replay-protected transactions, use the most permissive
|
||||
// signer, because we assume that signers are backwards-compatible with old
|
||||
// transactions. For non-protected transactions, the homestead signer signer is used
|
||||
@@ -1200,7 +1227,6 @@ func newRPCTransaction(tx *types.Transaction, blockHash common.Hash, blockNumber
|
||||
} else {
|
||||
signer = types.HomesteadSigner{}
|
||||
}
|
||||
|
||||
from, _ := types.Sender(signer, tx)
|
||||
v, r, s := tx.RawSignatureValues()
|
||||
result := &RPCTransaction{
|
||||
@@ -1222,17 +1248,36 @@ func newRPCTransaction(tx *types.Transaction, blockHash common.Hash, blockNumber
|
||||
result.BlockNumber = (*hexutil.Big)(new(big.Int).SetUint64(blockNumber))
|
||||
result.TransactionIndex = (*hexutil.Uint64)(&index)
|
||||
}
|
||||
if tx.Type() != types.LegacyTxType {
|
||||
switch tx.Type() {
|
||||
case types.AccessListTxType:
|
||||
al := tx.AccessList()
|
||||
result.Accesses = &al
|
||||
result.ChainID = (*hexutil.Big)(tx.ChainId())
|
||||
case types.DynamicFeeTxType:
|
||||
al := tx.AccessList()
|
||||
result.Accesses = &al
|
||||
result.ChainID = (*hexutil.Big)(tx.ChainId())
|
||||
result.FeeCap = (*hexutil.Big)(tx.FeeCap())
|
||||
result.Tip = (*hexutil.Big)(tx.Tip())
|
||||
// if the transaction has been mined, compute the effective gas price
|
||||
if baseFee != nil && blockHash != (common.Hash{}) {
|
||||
// price = min(tip, feeCap - baseFee) + baseFee
|
||||
price := math.BigMin(new(big.Int).Add(tx.Tip(), baseFee), tx.FeeCap())
|
||||
result.GasPrice = (*hexutil.Big)(price)
|
||||
} else {
|
||||
result.GasPrice = nil
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
// newRPCPendingTransaction returns a pending transaction that will serialize to the RPC representation
|
||||
func newRPCPendingTransaction(tx *types.Transaction) *RPCTransaction {
|
||||
return newRPCTransaction(tx, common.Hash{}, 0, 0)
|
||||
func newRPCPendingTransaction(tx *types.Transaction, current *types.Header, config *params.ChainConfig) *RPCTransaction {
|
||||
var baseFee *big.Int
|
||||
if current != nil {
|
||||
baseFee = misc.CalcBaseFee(config, current)
|
||||
}
|
||||
return newRPCTransaction(tx, common.Hash{}, 0, 0, baseFee)
|
||||
}
|
||||
|
||||
// newRPCTransactionFromBlockIndex returns a transaction that will serialize to the RPC representation.
|
||||
@@ -1241,7 +1286,7 @@ func newRPCTransactionFromBlockIndex(b *types.Block, index uint64) *RPCTransacti
|
||||
if index >= uint64(len(txs)) {
|
||||
return nil
|
||||
}
|
||||
return newRPCTransaction(txs[index], b.Hash(), b.NumberU64(), index)
|
||||
return newRPCTransaction(txs[index], b.Hash(), b.NumberU64(), index, b.BaseFee())
|
||||
}
|
||||
|
||||
// newRPCRawTransactionFromBlockIndex returns the bytes of a transaction given a block and a transaction index.
|
||||
@@ -1450,11 +1495,15 @@ func (s *PublicTransactionPoolAPI) GetTransactionByHash(ctx context.Context, has
|
||||
return nil, err
|
||||
}
|
||||
if tx != nil {
|
||||
return newRPCTransaction(tx, blockHash, blockNumber, index), nil
|
||||
header, err := s.b.HeaderByHash(ctx, blockHash)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return newRPCTransaction(tx, blockHash, blockNumber, index, header.BaseFee), nil
|
||||
}
|
||||
// No finalized transaction, try to retrieve it from the pool
|
||||
if tx := s.b.GetPoolTransaction(hash); tx != nil {
|
||||
return newRPCPendingTransaction(tx), nil
|
||||
return newRPCPendingTransaction(tx, s.b.CurrentHeader(), s.b.ChainConfig()), nil
|
||||
}
|
||||
|
||||
// Transaction unknown, return as such
|
||||
@@ -1705,11 +1754,12 @@ func (s *PublicTransactionPoolAPI) PendingTransactions() ([]*RPCTransaction, err
|
||||
accounts[account.Address] = struct{}{}
|
||||
}
|
||||
}
|
||||
curHeader := s.b.CurrentHeader()
|
||||
transactions := make([]*RPCTransaction, 0, len(pending))
|
||||
for _, tx := range pending {
|
||||
from, _ := types.Sender(s.signer, tx)
|
||||
if _, exists := accounts[from]; exists {
|
||||
transactions = append(transactions, newRPCPendingTransaction(tx))
|
||||
transactions = append(transactions, newRPCPendingTransaction(tx, curHeader, s.b.ChainConfig()))
|
||||
}
|
||||
}
|
||||
return transactions, nil
|
||||
|
||||
@@ -41,7 +41,7 @@ import (
|
||||
type Backend interface {
|
||||
// General Ethereum API
|
||||
Downloader() *downloader.Downloader
|
||||
SuggestPrice(ctx context.Context) (*big.Int, error)
|
||||
SuggestGasTipCap(ctx context.Context) (*big.Int, error)
|
||||
ChainDb() ethdb.Database
|
||||
AccountManager() *accounts.Manager
|
||||
ExtRPCEnabled() bool
|
||||
|
||||
@@ -20,6 +20,7 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"math/big"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
@@ -37,6 +38,8 @@ type TransactionArgs struct {
|
||||
To *common.Address `json:"to"`
|
||||
Gas *hexutil.Uint64 `json:"gas"`
|
||||
GasPrice *hexutil.Big `json:"gasPrice"`
|
||||
FeeCap *hexutil.Big `json:"maxFeePerGas"`
|
||||
Tip *hexutil.Big `json:"maxPriorityFeePerGas"`
|
||||
Value *hexutil.Big `json:"value"`
|
||||
Nonce *hexutil.Uint64 `json:"nonce"`
|
||||
|
||||
@@ -72,12 +75,43 @@ func (arg *TransactionArgs) data() []byte {
|
||||
|
||||
// setDefaults fills in default values for unspecified tx fields.
|
||||
func (args *TransactionArgs) setDefaults(ctx context.Context, b Backend) error {
|
||||
if args.GasPrice == nil {
|
||||
price, err := b.SuggestPrice(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
if args.GasPrice != nil && (args.FeeCap != nil || args.Tip != nil) {
|
||||
return errors.New("both gasPrice and (maxFeePerGas or maxPriorityFeePerGas) specified")
|
||||
}
|
||||
// After london, default to 1559 unless gasPrice is set
|
||||
head := b.CurrentHeader()
|
||||
if b.ChainConfig().IsLondon(head.Number) && args.GasPrice == nil {
|
||||
if args.Tip == nil {
|
||||
tip, err := b.SuggestGasTipCap(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
args.Tip = (*hexutil.Big)(tip)
|
||||
}
|
||||
if args.FeeCap == nil {
|
||||
feeCap := new(big.Int).Add(
|
||||
(*big.Int)(args.Tip),
|
||||
new(big.Int).Mul(head.BaseFee, big.NewInt(2)),
|
||||
)
|
||||
args.FeeCap = (*hexutil.Big)(feeCap)
|
||||
}
|
||||
if args.FeeCap.ToInt().Cmp(args.Tip.ToInt()) < 0 {
|
||||
return fmt.Errorf("maxFeePerGas (%v) < maxPriorityFeePerGas (%v)", args.FeeCap, args.Tip)
|
||||
}
|
||||
} else {
|
||||
if args.FeeCap != nil || args.Tip != nil {
|
||||
return errors.New("maxFeePerGas or maxPriorityFeePerGas specified but london is not active yet")
|
||||
}
|
||||
if args.GasPrice == nil {
|
||||
price, err := b.SuggestGasTipCap(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if b.ChainConfig().IsLondon(head.Number) {
|
||||
price.Add(price, head.BaseFee)
|
||||
}
|
||||
args.GasPrice = (*hexutil.Big)(price)
|
||||
}
|
||||
args.GasPrice = (*hexutil.Big)(price)
|
||||
}
|
||||
if args.Value == nil {
|
||||
args.Value = new(hexutil.Big)
|
||||
@@ -103,6 +137,8 @@ func (args *TransactionArgs) setDefaults(ctx context.Context, b Backend) error {
|
||||
From: args.From,
|
||||
To: args.To,
|
||||
GasPrice: args.GasPrice,
|
||||
FeeCap: args.FeeCap,
|
||||
Tip: args.Tip,
|
||||
Value: args.Value,
|
||||
Data: args.Data,
|
||||
AccessList: args.AccessList,
|
||||
@@ -123,7 +159,11 @@ func (args *TransactionArgs) setDefaults(ctx context.Context, b Backend) error {
|
||||
}
|
||||
|
||||
// ToMessage converts TransactionArgs to the Message type used by the core evm
|
||||
func (args *TransactionArgs) ToMessage(globalGasCap uint64) types.Message {
|
||||
func (args *TransactionArgs) ToMessage(globalGasCap uint64, baseFee *big.Int) (types.Message, error) {
|
||||
// Reject invalid combinations of pre- and post-1559 fee styles
|
||||
if args.GasPrice != nil && (args.FeeCap != nil || args.Tip != nil) {
|
||||
return types.Message{}, errors.New("both gasPrice and (maxFeePerGas or maxPriorityFeePerGas) specified")
|
||||
}
|
||||
// Set sender address or use zero address if none specified.
|
||||
addr := args.from()
|
||||
|
||||
@@ -139,9 +179,34 @@ func (args *TransactionArgs) ToMessage(globalGasCap uint64) types.Message {
|
||||
log.Warn("Caller gas above allowance, capping", "requested", gas, "cap", globalGasCap)
|
||||
gas = globalGasCap
|
||||
}
|
||||
gasPrice := new(big.Int)
|
||||
if args.GasPrice != nil {
|
||||
gasPrice = args.GasPrice.ToInt()
|
||||
var (
|
||||
gasPrice *big.Int
|
||||
feeCap *big.Int
|
||||
tip *big.Int
|
||||
)
|
||||
if baseFee == nil {
|
||||
// If there's no basefee, then it must be a non-1559 execution
|
||||
gasPrice = new(big.Int)
|
||||
if args.GasPrice != nil {
|
||||
gasPrice = args.GasPrice.ToInt()
|
||||
}
|
||||
feeCap, tip = gasPrice, gasPrice
|
||||
} else {
|
||||
// A basefee is provided, necessitating 1559-type execution
|
||||
if args.GasPrice != nil {
|
||||
gasPrice = args.GasPrice.ToInt()
|
||||
feeCap, tip = gasPrice, gasPrice
|
||||
} else {
|
||||
feeCap = new(big.Int)
|
||||
if args.FeeCap != nil {
|
||||
feeCap = args.FeeCap.ToInt()
|
||||
}
|
||||
tip = new(big.Int)
|
||||
if args.Tip != nil {
|
||||
tip = args.Tip.ToInt()
|
||||
}
|
||||
gasPrice = math.BigMin(new(big.Int).Add(tip, baseFee), feeCap)
|
||||
}
|
||||
}
|
||||
value := new(big.Int)
|
||||
if args.Value != nil {
|
||||
@@ -152,24 +217,32 @@ func (args *TransactionArgs) ToMessage(globalGasCap uint64) types.Message {
|
||||
if args.AccessList != nil {
|
||||
accessList = *args.AccessList
|
||||
}
|
||||
msg := types.NewMessage(addr, args.To, 0, value, gas, gasPrice, nil, nil, data, accessList, false)
|
||||
return msg
|
||||
msg := types.NewMessage(addr, args.To, 0, value, gas, gasPrice, feeCap, tip, data, accessList, false)
|
||||
return msg, nil
|
||||
}
|
||||
|
||||
// toTransaction converts the arguments to a transaction.
|
||||
// This assumes that setDefaults has been called.
|
||||
func (args *TransactionArgs) toTransaction() *types.Transaction {
|
||||
var data types.TxData
|
||||
if args.AccessList == nil {
|
||||
data = &types.LegacyTx{
|
||||
To: args.To,
|
||||
Nonce: uint64(*args.Nonce),
|
||||
Gas: uint64(*args.Gas),
|
||||
GasPrice: (*big.Int)(args.GasPrice),
|
||||
Value: (*big.Int)(args.Value),
|
||||
Data: args.data(),
|
||||
switch {
|
||||
case args.FeeCap != nil:
|
||||
al := types.AccessList{}
|
||||
if args.AccessList != nil {
|
||||
al = *args.AccessList
|
||||
}
|
||||
} else {
|
||||
data = &types.DynamicFeeTx{
|
||||
To: args.To,
|
||||
ChainID: (*big.Int)(args.ChainID),
|
||||
Nonce: uint64(*args.Nonce),
|
||||
Gas: uint64(*args.Gas),
|
||||
FeeCap: (*big.Int)(args.FeeCap),
|
||||
Tip: (*big.Int)(args.Tip),
|
||||
Value: (*big.Int)(args.Value),
|
||||
Data: args.data(),
|
||||
AccessList: al,
|
||||
}
|
||||
case args.AccessList != nil:
|
||||
data = &types.AccessListTx{
|
||||
To: args.To,
|
||||
ChainID: (*big.Int)(args.ChainID),
|
||||
@@ -180,6 +253,15 @@ func (args *TransactionArgs) toTransaction() *types.Transaction {
|
||||
Data: args.data(),
|
||||
AccessList: *args.AccessList,
|
||||
}
|
||||
default:
|
||||
data = &types.LegacyTx{
|
||||
To: args.To,
|
||||
Nonce: uint64(*args.Nonce),
|
||||
Gas: uint64(*args.Gas),
|
||||
GasPrice: (*big.Int)(args.GasPrice),
|
||||
Value: (*big.Int)(args.Value),
|
||||
Data: args.data(),
|
||||
}
|
||||
}
|
||||
return types.NewTx(data)
|
||||
}
|
||||
@@ -1,12 +1,14 @@
|
||||
// Package deps Code generated by go-bindata. (@generated) DO NOT EDIT.
|
||||
// Code generated by go-bindata. DO NOT EDIT.
|
||||
// sources:
|
||||
// bignumber.js
|
||||
// web3.js
|
||||
// bignumber.js (17.314kB)
|
||||
// web3.js (401.627kB)
|
||||
|
||||
package deps
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"compress/gzip"
|
||||
"crypto/sha256"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
@@ -37,8 +39,9 @@ func bindataRead(data []byte, name string) ([]byte, error) {
|
||||
}
|
||||
|
||||
type asset struct {
|
||||
bytes []byte
|
||||
info os.FileInfo
|
||||
bytes []byte
|
||||
info os.FileInfo
|
||||
digest [sha256.Size]byte
|
||||
}
|
||||
|
||||
type bindataFileInfo struct {
|
||||
@@ -48,32 +51,21 @@ type bindataFileInfo struct {
|
||||
modTime time.Time
|
||||
}
|
||||
|
||||
// Name return file name
|
||||
func (fi bindataFileInfo) Name() string {
|
||||
return fi.name
|
||||
}
|
||||
|
||||
// Size return file size
|
||||
func (fi bindataFileInfo) Size() int64 {
|
||||
return fi.size
|
||||
}
|
||||
|
||||
// Mode return file mode
|
||||
func (fi bindataFileInfo) Mode() os.FileMode {
|
||||
return fi.mode
|
||||
}
|
||||
|
||||
// ModTime return file modify time
|
||||
func (fi bindataFileInfo) ModTime() time.Time {
|
||||
return fi.modTime
|
||||
}
|
||||
|
||||
// IsDir return file whether a directory
|
||||
func (fi bindataFileInfo) IsDir() bool {
|
||||
return fi.mode&os.ModeDir != 0
|
||||
return false
|
||||
}
|
||||
|
||||
// Sys return file is sys mode
|
||||
func (fi bindataFileInfo) Sys() interface{} {
|
||||
return nil
|
||||
}
|
||||
@@ -94,11 +86,11 @@ func bignumberJs() (*asset, error) {
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "bignumber.js", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x5b, 0x75, 0xfc, 0x15, 0x5e, 0x7d, 0x27, 0x1a, 0x9a, 0xb5, 0xfb, 0x16, 0x90, 0xf4, 0x93, 0xac, 0xcb, 0x6c, 0x9c, 0xcd, 0x68, 0xe6, 0xd0, 0x3a, 0xcf, 0xa3, 0x83, 0x5c, 0x20, 0x34, 0x66, 0x45}}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
var _web3Js = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\xfd\x6b\x7b\x13\x39\xd2\x38\x0e\xbf\xcf\xa7\x50\xfc\xdc\x0f\xb6\x49\x63\xe7\x34\x0c\xd3\x99\x0c\x1b\x02\x33\x64\x6f\x20\x5c\x40\x76\x76\xef\x6c\x96\xab\xed\x96\x6d\x0d\xed\x6e\xff\xba\xdb\x09\x19\x92\xef\xfe\xbf\x54\x3a\x1f\xfa\xe0\x24\xcc\x69\x93\x17\xe0\x96\x4a\xa7\x52\xa9\x54\x2a\x95\xaa\x72\xfc\xff\x96\x24\xc7\xfb\xbd\xc9\x32\x1d\x97\x24\x4b\x11\xee\x95\x41\x1a\xe4\xfd\x2f\x32\xa5\xe8\x65\xc1\xb2\xff\x85\x4c\x7a\xeb\xe9\x69\x76\xc6\x7e\x95\xf0\xeb\x3c\xca\x51\xb4\x5f\x5e\x2e\x70\x36\x41\xa2\xae\xfd\x8e\x28\xda\x79\xf0\x80\x27\xee\xd1\x32\xcb\x07\x0f\xa2\x7e\x8e\xcb\x65\x9e\xa2\xa8\x97\x05\xeb\x9b\x7d\x9a\x4e\x44\x1a\xe1\x69\xb4\xd6\xc9\x7e\x8a\x2f\xd0\x8b\x3c\xcf\xf2\x5e\xe7\x30\x4a\xd3\xac\x44\x13\x92\xc6\x68\x9e\xc5\xcb\x04\xa3\x6e\x67\x23\xdb\xe8\x74\x3b\xfd\xbd\x72\x96\x67\x17\x68\x32\x18\x67\x31\xde\xef\xbc\x3e\x7e\x7e\xf2\xea\xc5\xc7\x37\xc7\x1f\x3e\xfe\x78\x7c\xf2\xe6\x79\x27\x98\x5c\xd3\xfa\x92\x7d\xda\xf7\xfd\x2f\xf8\xf3\x22\xcb\xcb\x22\xfc\x72\x7d\xbd\x47\xc7\x70\xba\x79\x36\x18\x47\x49\xd2\x4b\x06\x3c\x2b\x10\xbd\xef\x61\x36\xc0\x74\x1f\x00\xb7\xce\x4e\xf1\xd9\x1e\xef\x6a\xd1\x4b\x9f\xa6\x21\xee\x5f\x07\x49\xa0\x4a\xe2\x80\xe1\xee\x9a\x43\xd1\x26\x45\x26\xf4\x82\xb4\xc2\xd5\x24\xcb\x7b\x14\x3a\xdb\xdf\xdc\xcb\xbe\xcf\x07\x09\x4e\xa7\xe5\x6c\x2f\xdb\xd8\xe8\x17\xbd\x9c\x22\x5e\x76\xe3\xba\xdf\xfb\xb2\x15\x9e\xca\x2e\xf3\x2a\x02\x86\xa5\x80\xb7\xdd\xff\xb2\xc6\x12\x44\x67\xf6\x4f\xd7\x10\xfa\xb2\x86\x10\x42\x9d\x71\x96\x16\x65\x94\x96\x9d\x10\x95\xf9\x12\x07\x2c\x95\xa4\x8b\x65\x59\x74\x42\x74\x0a\xdf\x02\x1a\xf2\xd2\x68\x8e\x3b\x21\xea\x7c\xcc\x2e\x52\x9c\x77\x02\x95\x43\x47\x47\x73\xa2\x38\xce\x71\x51\x74\x78\xce\x35\xfc\x7f\xc6\xab\x16\xc5\xe1\x7f\x9e\x96\x2d\xcb\xe6\xf6\xb2\x8f\x5a\x11\xa3\xbd\xd1\x65\x89\x8b\x9d\x6d\x7f\x7b\x02\x48\x62\x7a\x0d\xa1\xeb\xe0\x4e\x10\x70\xa3\xfe\xc8\xe1\x68\xd8\x6b\x87\x80\x95\x51\xfd\x47\x1d\xfa\x38\x4b\x4b\x9c\x96\xb7\x1e\xfc\x9f\x72\xde\xe9\x8c\xfd\x61\xa6\x7d\x12\x25\xc5\x6f\x37\xf4\x1c\x17\x38\x3f\xf7\xad\xfa\x3f\xfa\xa4\x15\xcb\xd1\x3b\x3c\x25\x45\x99\x47\xff\x05\x93\x17\xd4\xd5\x81\x2f\x8e\x6f\xc5\xf7\xcb\x3c\x4a\x8b\x89\x97\xf5\xfd\x59\x70\x90\x5b\xa4\xb0\x3a\x12\x0a\x5c\xbe\xaf\x27\xa9\x3b\xc3\x85\xdd\xf4\x6f\xd2\xe8\x57\x9e\x80\xa8\x0d\xe2\xeb\x2a\x58\xe4\x64\x1e\xe5\x97\xde\x7e\x64\x59\xd2\x38\x79\x07\xbc\xad\x3f\x2f\x0a\xcd\x3d\xb8\xb6\x9a\x2a\x24\x1c\x56\x6e\xe3\x7f\x24\x24\x78\x7b\x1f\x93\x22\xbb\x48\x6f\xd1\xf3\x28\xcd\xd2\xcb\x79\xb6\x2c\x56\xe8\x3a\x49\x63\xfc\x19\xc7\xc6\xde\x75\x67\x13\xab\x2a\xd7\xba\x63\xd6\x7e\x41\xd2\xdb\x30\xee\x83\x25\x60\xe2\x45\x1a\xe3\xb8\x63\xa1\x09\x9f\x53\x42\xf8\x0b\xe0\x68\x44\xe2\xb8\x1d\x8e\x6e\x56\xff\x79\x94\x2c\xbd\xdd\x5f\x92\xb4\xdc\xfe\xe6\x71\xfd\x14\xbc\xc1\x17\xcf\xc8\xef\x88\xfc\x5b\xad\xb9\xc3\x59\x94\x4e\x7f\x4f\xd2\xb9\x13\xca\xa9\xa8\x5b\x93\xea\x6b\xa9\xc6\x8b\x99\xb7\x6c\x37\x6a\x44\xd0\xda\xd9\xda\xda\x75\xf0\xe5\xfa\x2c\xd8\xfe\xdd\x0e\xfd\x7f\xa1\x33\xef\xef\x24\x3b\x4e\x96\x69\x7c\x63\x52\xb9\xf5\xc6\x75\x7f\xec\xfd\x73\x1f\x7b\xef\x0f\x7d\x7f\xe4\x33\x87\x77\xf0\xfc\xbc\xf0\x47\x93\x36\xbf\xee\x66\xae\xf6\xaa\x9d\x3b\xdb\xab\x56\x9d\xf7\x49\x9e\xcd\x6f\x39\xed\x65\x76\xcb\xa3\xe6\xed\x04\xbe\xdf\x77\xdd\xfc\x11\xf0\x47\xd2\x98\xe4\x78\x5c\x1e\x79\xf7\xcc\x15\x7a\x72\xbb\x89\x20\xe3\x68\xf1\xe1\x77\x9d\x0c\x3f\x26\xdb\x9d\x76\xf1\x22\x2b\x48\xdd\x41\x7d\x11\x5d\x46\xa3\x04\x9b\x42\xc1\xef\xc2\x95\xaa\x68\xee\x4e\x8e\x5f\xb7\xa3\x81\x03\x31\xde\xe7\x26\x3e\x7f\xfb\x93\xcc\x9d\x20\xa9\xa2\xee\x76\x74\xf6\x3b\xa0\xff\x0f\x8b\xf5\xbb\x38\x3f\xde\x98\x4f\x7e\x6d\xac\xdb\x4c\xef\x1e\xed\x2d\xd1\x7e\xeb\x8d\xeb\x6b\xcf\xec\x91\x67\x4b\xab\x93\xe3\x76\xdb\xc8\x71\x60\xbc\x81\xf6\x85\x85\x43\xaf\x3b\x18\x4e\xb2\x7c\x1e\x95\x25\xce\x8b\x6e\x7f\x0f\x00\xde\x67\x09\x89\x49\x79\xf9\xe1\x72\x81\x4d\x58\xda\x3e\x85\x5a\x1b\x3e\x7c\xb8\x86\x1e\x1a\x90\x5c\xe7\x8e\x48\x81\x22\xb4\xc8\xb3\x8c\x02\xa3\x72\x16\x95\x28\xc7\x0b\x7a\xc8\x4a\xcb\x02\xf1\xb9\x43\x34\x93\xd6\x70\x54\xa2\x79\x54\x8e\x67\xb8\x08\xe9\x27\xcf\xd6\x7e\x9e\x9e\xe9\x1f\xbb\xc6\xd7\x99\x99\xb9\x63\x7d\x9f\x9d\x3e\x3e\x3b\x3d\x0b\xd0\x60\x30\x58\x43\x0f\x87\xce\xd8\x44\x8f\xf7\x91\xb4\xa6\xe9\xf5\xf9\x14\x97\x33\x52\x0c\x3e\xc2\xc2\xf8\x51\x20\x88\x02\x0e\x18\xba\x8e\x68\xc6\x51\x5a\xee\x69\xc0\x6c\xdf\xf6\x41\x1f\x43\x0e\x6f\x6e\x6f\xed\x7a\x6f\x6d\xcd\xd3\x8f\xc1\x22\xcf\x4a\x86\xb5\x7d\x94\xe2\x0b\xa3\xaf\xbd\x2f\xd7\xfd\xbd\xfa\x52\x03\x90\x5e\xf2\xe5\xb8\xcc\x68\xe3\x1e\xd8\xa6\x76\x07\xa4\xe0\x73\xae\x10\x42\xc9\x51\x20\x85\xdb\xb5\xac\xaf\xd3\xc4\x01\xcc\x5b\x6f\xc8\xb1\xdd\xfb\xf7\x69\xef\x74\xf3\xd1\x77\x67\x0f\xfb\xff\x3e\xeb\x3f\x1d\xf6\xd9\x38\xcd\x83\x43\x65\xb7\xae\x83\x2f\x1d\x9d\x14\x3b\xe1\x77\x41\x87\xd1\x5b\x27\xdc\xda\xbd\x3e\x0b\xbe\xf9\x9d\xc9\xfb\x59\x96\x25\x0d\xb4\x3d\xa2\x20\x15\x84\x4d\xf3\xc4\xff\x8c\x4a\xe1\xd7\xae\xfa\x79\xa6\x25\xef\xe8\x1f\x4d\x64\x0c\x3d\xbb\x29\x0d\xd3\xc2\xab\x10\x31\x83\xb7\x29\x98\xa6\xae\x48\xbe\x66\x91\x1a\xda\x65\x2d\Line truncated
|
||||
var _web3Js = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\xfd\x6b\x7b\x13\x39\xd2\x38\x0e\xbf\xcf\xa7\x10\x7e\xee\x07\xdb\xc4\xd8\x39\x0d\xc3\x38\x93\x61\x43\x60\x86\xec\x0d\x84\x0b\xc8\xce\xee\x9d\xcd\x72\xb5\xdd\xb2\xdd\x43\xbb\xdb\xbf\xee\x76\x0e\x43\xf2\xdd\xff\x97\x4a\xa7\xd2\xa1\x0f\x4e\xc2\x9c\x36\x79\x01\x6e\xa9\x74\x2a\x95\x4a\xa5\x52\xa9\x2a\xa3\xff\x6f\x19\x65\x74\xaf\x33\x59\x26\xe3\x22\x4a\x13\x42\x3b\x45\x2f\xe9\x65\xdd\x2f\x2a\x25\xef\xa4\xbd\x65\xf7\x4b\x34\xe9\x3c\x48\x4e\xd2\x53\xfe\xab\x80\x5f\x67\x41\x46\x82\xbd\xe2\x72\x41\xd3\x09\x91\x75\xed\xb5\x64\xd1\xd6\xc3\x87\x22\x71\x97\x95\x59\x3e\x7c\x18\x74\x33\x5a\x2c\xb3\x84\x04\x9d\xb4\xf7\x60\xa3\xcb\xd2\x23\x99\x16\x89\x34\x56\xeb\x64\x2f\xa1\xe7\xe4\x65\x96\xa5\x59\xa7\x75\x10\x24\x49\x5a\x90\x49\x94\x84\x64\x9e\x86\xcb\x98\x92\x76\x6b\x3d\x5d\x6f\xb5\x5b\xdd\xdd\x62\x96\xa5\xe7\x64\xd2\x1f\xa7\x21\xdd\x6b\xbd\x39\x7a\x71\xfc\xfa\xe5\xa7\xb7\x47\x1f\x3f\xfd\x78\x74\xfc\xf6\x45\xab\x37\xb9\x66\xf5\xc5\x7b\xac\xef\x7b\x5f\xe8\xc5\x22\xcd\x8a\x7c\xf8\xe5\xfa\x7a\x97\x8d\xe1\x64\xe3\xb4\x3f\x0e\xe2\xb8\x13\xf7\x45\x56\x4f\xf6\xbe\x43\xf9\x00\x93\x3d\x00\xdc\x3c\x3d\xa1\xa7\xbb\xa2\xab\x79\x27\x79\x96\x0c\x69\xf7\xba\x17\xf7\x74\x49\xda\xe3\xb8\xbb\x16\x50\xac\x49\x99\x09\xbd\x88\x1a\xe1\x6a\x92\x66\x1d\x06\x9d\xee\x6d\xec\xa6\xdf\x67\xfd\x98\x26\xd3\x62\xb6\x9b\xae\xaf\x77\xf3\x4e\xc6\x10\xaf\xba\x71\xdd\xed\x7c\xd9\x1c\x9e\xa8\x2e\x8b\x2a\x7a\x1c\x4b\x3d\xd1\x76\xf7\xcb\x1a\x4f\x90\x9d\xd9\x3b\x59\x23\xe4\xcb\x1a\x21\x84\xb4\xc6\x69\x92\x17\x41\x52\xb4\x86\xa4\xc8\x96\xb4\xc7\x53\xa3\x64\xb1\x2c\xf2\xd6\x90\x9c\xc0\xb7\x84\x86\xbc\x24\x98\xd3\xd6\x90\xb4\x3e\xa5\xe7\x09\xcd\x5a\x3d\x9d\xc3\x46\xc7\x72\x82\x30\xcc\x68\x9e\xb7\x44\xce\x35\xfc\x7f\x2a\xaa\x96\xc5\xe1\x7f\x91\x96\x2e\x8b\xfa\xf6\xd2\x4f\xa8\x88\xd1\xde\xe8\xb2\xa0\xf9\xf6\x96\xbf\x3d\x09\xa4\x30\xbd\x46\xc8\x75\xef\x4e\x10\x70\xa3\xfe\xa8\xe1\x20\xec\x35\x43\xc0\xca\xa8\xfe\xa3\x0e\x7d\x9c\x26\x05\x4d\x8a\x5b\x0f\xfe\x4f\x39\xef\x6c\xc6\xfe\x30\xd3\x3e\x09\xe2\xfc\xb7\x1b\x7a\x46\x73\x9a\x9d\xf9\x56\xfd\x1f\x7d\xd2\xf2\xe5\xe8\x3d\x9d\x46\x79\x91\x05\xff\x05\x93\xd7\xab\xaa\x83\x9e\x1f\xdd\x8a\xef\x17\x59\x90\xe4\x13\x2f\xeb\xfb\xb3\xe0\x20\xb3\x48\x61\x75\x24\xe4\xb4\xf8\x50\x4d\x52\x77\x86\x0b\xbb\xe9\xdf\xa4\xd1\xaf\x3c\x01\x41\x13\xc4\x57\x55\xb0\xc8\xa2\x79\x90\x5d\x7a\xfb\x91\xa6\x71\xed\xe4\xed\x8b\xb6\xfe\xbc\x28\x34\xf7\xe0\xca\x6a\xca\x90\x70\x50\xba\x8d\xff\x91\x90\xe0\xed\x7d\x18\xe5\xe9\x79\x72\x8b\x9e\x07\x49\x9a\x5c\xce\xd3\x65\xbe\x42\xd7\xa3\x24\xa4\x17\x34\x34\xf6\xae\x3b\x9b\x58\x5d\x39\xea\x8e\x59\xfb\x79\x94\xdc\x86\x71\xef\x2f\x01\x13\x2f\x93\x90\x86\x2d\x0b\x4d\xf4\x8c\x11\xc2\x5f\x00\x47\xa3\x28\x0c\x9b\xe1\xe8\x66\xf5\x9f\x05\xf1\xd2\xdb\xfd\x65\x94\x14\x5b\xdf\x3c\xa9\x9e\x82\xb7\xf4\xfc\x79\xf4\x3b\x22\xff\x56\x6b\xee\x60\x16\x24\xd3\xdf\x93\x74\xee\x84\x72\x4a\xea\x46\x52\x7d\x25\xd5\x78\x31\xf3\x8e\xef\x46\xb5\x08\x5a\x3b\x5d\x5b\xbb\xee\x7d\xb9\x3e\xed\x6d\xfd\x6e\x87\xfe\xbf\xd0\x99\xf7\x77\x92\x1d\x27\xcb\x24\xbc\x31\xa9\xdc\x7a\xe3\xba\x3f\xf6\xfe\xb9\x8f\xbd\xf7\x87\xbe\x3f\xf2\x99\xc3\x3b\x78\x71\x5e\xf8\xa3\x49\x9b\x5f\x77\x33\xd7\x7b\xd5\xf6\x9d\xed\x55\xab\xce\xfb\x24\x4b\xe7\xb7\x9c\xf6\x22\xbd\xe5\x51\xf3\x76\x02\xdf\xef\xbb\x6e\xfe\x08\xf8\x8b\x92\x30\xca\xe8\xb8\x38\xf4\xee\x99\x2b\xf4\xe4\x76\x13\x11\x8d\x83\xc5\xc7\xdf\x75\x32\xfc\x98\x6c\x76\xda\xa5\x8b\x34\x8f\xaa\x0e\xea\x8b\xe0\x32\x18\xc5\xd4\x14\x0a\x7e\x17\xae\x54\x46\x73\x77\x72\xfc\xba\x1d\x0d\xec\xcb\xf1\xbe\x30\xf1\xf9\xdb\x9f\x64\xee\x04\x49\x25\x75\x37\xa3\xb3\xdf\x01\xfd\x7f\x58\xac\xdf\xc5\xf9\xf1\xc6\x7c\xf2\x6b\x63\xdd\x66\x7a\xf7\x68\x6f\x88\xf6\x5b\x6f\x5c\x5f\x7b\x66\x0f\x3d\x5b\x5a\x95\x1c\xb7\xd3\x44\x8e\x03\xe3\x0d\xb2\x27\x2d\x1c\x3a\xed\xfe\x60\x92\x66\xf3\xa0\x28\x68\x96\xb7\xbb\xbb\x00\xf0\x21\x8d\xa3\x30\x2a\x2e\x3f\x5e\x2e\xa8\x09\xcb\xda\x67\x50\x6b\x83\x47\x8f\xd6\xc8\x23\x03\x52\xe8\xdc\x49\x94\x93\x80\x2c\xb2\x34\x65\xc0\xa4\x98\x05\x05\xc9\xe8\x82\x1d\xb2\x92\x22\x27\x62\xee\x08\xcb\x64\x35\x1c\x16\x64\x1e\x14\xe3\x19\xcd\x87\xec\x53\x64\xa3\x9f\x27\xa7\xf8\x63\xc7\xf8\x3a\x35\x33\xb7\xad\xef\xd3\x93\x27\xa7\x27\xa7\x3d\xd2\xef\xf7\xd7\xc8\xa3\x81\x33\x36\xd9\xe3\x3d\xa2\xac\x69\x3a\x5d\x31\xc5\xc5\x2c\xca\xfb\x9f\x60\x61\xfc\x28\x11\xc4\x00\xfb\x1c\x5d\x87\x2c\xe3\x30\x29\x76\x11\x30\xdf\xb7\x7d\xd0\x47\x90\x23\x9a\xdb\x5d\xbb\xde\x5d\x5b\xf3\xf4\xa3\xbf\xc8\xd2\x82\x63\x6d\x8f\x24\xf4\xdc\xe8\x6b\xe7\xcb\x75\x77\xb7\xba\x54\x1f\xa4\x97\x6c\x39\x2e\x52\xd6\xb8\x07\xb6\xae\xdd\x7e\x94\x8b\x39\xd7\x08\x61\xe4\x28\x91\x22\xec\x5a\x1e\x3c\x60\x89\x7d\x98\xb7\xce\x40\x60\xbb\xf3\xef\x93\xce\xc9\xc6\xe3\xef\x4e\x1f\x75\xff\x7d\xda\x7d\x36\xe8\xf2\x71\x9a\x07\x87\xd2\x6e\x5d\xf7\xbe\xb4\x30\x29\xb6\x86\xdf\xf5\x5a\x9c\xde\x5a\xc3\xcd\x9d\xeb\xd3\xde\x37\xbf\x33\x79\x3f\x4f\xd3\xb8\x86\xb6\x47\x0c\xa4\x84\xb0\x59\x9e\xfc\x9f\x53\x29\xfc\xda\xd1\x3f\x4f\x51\xf2\x36\xfe\xa8\x23\x63\xe8\xd9\x4d\x69\x98\x15\x5e\x85\x88\x39\xbc\x4d\xc1\x2c\x75\x45\xf2\Line truncated
|
||||
|
||||
func web3JsBytes() ([]byte, error) {
|
||||
return bindataRead(
|
||||
@@ -114,7 +106,7 @@ func web3Js() (*asset, error) {
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "web3.js", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xf4, 0xe8, 0x7a, 0x64, 0xe9, 0xba, 0x34, 0x54, 0x9a, 0x11, 0x5d, 0x39, 0xcb, 0x63, 0x13, 0x52, 0x4e, 0x9d, 0xfa, 0xae, 0xfd, 0xc0, 0x43, 0x92, 0x91, 0xdb, 0x4e, 0xd6, 0xd9, 0x3, 0x45, 0xb8}}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
@@ -133,6 +125,12 @@ func Asset(name string) ([]byte, error) {
|
||||
return nil, fmt.Errorf("Asset %s not found", name)
|
||||
}
|
||||
|
||||
// AssetString returns the asset contents as a string (instead of a []byte).
|
||||
func AssetString(name string) (string, error) {
|
||||
data, err := Asset(name)
|
||||
return string(data), err
|
||||
}
|
||||
|
||||
// MustAsset is like Asset but panics when Asset would return an error.
|
||||
// It simplifies safe initialization of global variables.
|
||||
func MustAsset(name string) []byte {
|
||||
@@ -144,6 +142,12 @@ func MustAsset(name string) []byte {
|
||||
return a
|
||||
}
|
||||
|
||||
// MustAssetString is like AssetString but panics when Asset would return an
|
||||
// error. It simplifies safe initialization of global variables.
|
||||
func MustAssetString(name string) string {
|
||||
return string(MustAsset(name))
|
||||
}
|
||||
|
||||
// AssetInfo loads and returns the asset info for the given name.
|
||||
// It returns an error if the asset could not be found or
|
||||
// could not be loaded.
|
||||
@@ -159,6 +163,33 @@ func AssetInfo(name string) (os.FileInfo, error) {
|
||||
return nil, fmt.Errorf("AssetInfo %s not found", name)
|
||||
}
|
||||
|
||||
// AssetDigest returns the digest of the file with the given name. It returns an
|
||||
// error if the asset could not be found or the digest could not be loaded.
|
||||
func AssetDigest(name string) ([sha256.Size]byte, error) {
|
||||
canonicalName := strings.Replace(name, "\\", "/", -1)
|
||||
if f, ok := _bindata[canonicalName]; ok {
|
||||
a, err := f()
|
||||
if err != nil {
|
||||
return [sha256.Size]byte{}, fmt.Errorf("AssetDigest %s can't read by error: %v", name, err)
|
||||
}
|
||||
return a.digest, nil
|
||||
}
|
||||
return [sha256.Size]byte{}, fmt.Errorf("AssetDigest %s not found", name)
|
||||
}
|
||||
|
||||
// Digests returns a map of all known files and their checksums.
|
||||
func Digests() (map[string][sha256.Size]byte, error) {
|
||||
mp := make(map[string][sha256.Size]byte, len(_bindata))
|
||||
for name := range _bindata {
|
||||
a, err := _bindata[name]()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
mp[name] = a.digest
|
||||
}
|
||||
return mp, nil
|
||||
}
|
||||
|
||||
// AssetNames returns the names of the assets.
|
||||
func AssetNames() []string {
|
||||
names := make([]string, 0, len(_bindata))
|
||||
@@ -171,7 +202,8 @@ func AssetNames() []string {
|
||||
// _bindata is a table, holding each asset generator, mapped to its name.
|
||||
var _bindata = map[string]func() (*asset, error){
|
||||
"bignumber.js": bignumberJs,
|
||||
"web3.js": web3Js,
|
||||
|
||||
"web3.js": web3Js,
|
||||
}
|
||||
|
||||
// AssetDir returns the file names below a certain
|
||||
@@ -183,9 +215,9 @@ var _bindata = map[string]func() (*asset, error){
|
||||
// img/
|
||||
// a.png
|
||||
// b.png
|
||||
// then AssetDir("data") would return []string{"foo.txt", "img"}
|
||||
// AssetDir("data/img") would return []string{"a.png", "b.png"}
|
||||
// AssetDir("foo.txt") and AssetDir("notexist") would return an error
|
||||
// then AssetDir("data") would return []string{"foo.txt", "img"},
|
||||
// AssetDir("data/img") would return []string{"a.png", "b.png"},
|
||||
// AssetDir("foo.txt") and AssetDir("notexist") would return an error, and
|
||||
// AssetDir("") will return []string{"data"}.
|
||||
func AssetDir(name string) ([]string, error) {
|
||||
node := _bintree
|
||||
@@ -219,7 +251,7 @@ var _bintree = &bintree{nil, map[string]*bintree{
|
||||
"web3.js": {web3Js, map[string]*bintree{}},
|
||||
}}
|
||||
|
||||
// RestoreAsset restores an asset under the given directory
|
||||
// RestoreAsset restores an asset under the given directory.
|
||||
func RestoreAsset(dir, name string) error {
|
||||
data, err := Asset(name)
|
||||
if err != nil {
|
||||
@@ -237,14 +269,10 @@ func RestoreAsset(dir, name string) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
return os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime())
|
||||
}
|
||||
|
||||
// RestoreAssets restores an asset under the given directory recursively
|
||||
// RestoreAssets restores an asset under the given directory recursively.
|
||||
func RestoreAssets(dir, name string) error {
|
||||
children, err := AssetDir(name)
|
||||
// File
|
||||
|
||||
@@ -3759,7 +3759,7 @@ var inputTransactionFormatter = function (options){
|
||||
options.to = inputAddressFormatter(options.to);
|
||||
}
|
||||
|
||||
['gasPrice', 'gas', 'value', 'nonce'].filter(function (key) {
|
||||
['maxFeePerGas', 'maxPriorityFeePerGas', 'gasPrice', 'gas', 'value', 'nonce'].filter(function (key) {
|
||||
return options[key] !== undefined;
|
||||
}).forEach(function(key){
|
||||
options[key] = utils.fromDecimal(options[key]);
|
||||
@@ -3783,6 +3783,12 @@ var outputTransactionFormatter = function (tx){
|
||||
tx.nonce = utils.toDecimal(tx.nonce);
|
||||
tx.gas = utils.toDecimal(tx.gas);
|
||||
tx.gasPrice = utils.toBigNumber(tx.gasPrice);
|
||||
if(tx.maxFeePerGas !== undefined) {
|
||||
tx.maxFeePerGas = utils.toBigNumber(tx.maxFeePerGas);
|
||||
}
|
||||
if(tx.maxPriorityFeePerGas !== undefined) {
|
||||
tx.maxPriorityFeePerGas = utils.toBigNumber(tx.maxPriorityFeePerGas);
|
||||
}
|
||||
tx.value = utils.toBigNumber(tx.value);
|
||||
return tx;
|
||||
};
|
||||
@@ -3819,8 +3825,10 @@ var outputTransactionReceiptFormatter = function (receipt){
|
||||
* @returns {Object}
|
||||
*/
|
||||
var outputBlockFormatter = function(block) {
|
||||
|
||||
// transform to number
|
||||
if (block.baseFeePerGas !== undefined) {
|
||||
block.baseFeePerGas = utils.toBigNumber(block.baseFeePerGas);
|
||||
}
|
||||
block.gasLimit = utils.toDecimal(block.gasLimit);
|
||||
block.gasUsed = utils.toDecimal(block.gasUsed);
|
||||
block.size = utils.toDecimal(block.size);
|
||||
|
||||
@@ -595,6 +595,11 @@ web3._extend({
|
||||
return formatted;
|
||||
}
|
||||
}),
|
||||
new web3._extend.Property({
|
||||
name: 'maxPriorityFeePerGas',
|
||||
getter: 'eth_maxPriorityFeePerGas',
|
||||
outputFormatter: web3._extend.utils.toBigNumber
|
||||
}),
|
||||
]
|
||||
});
|
||||
`
|
||||
|
||||
+2
-2
@@ -251,8 +251,8 @@ func (b *LesApiBackend) ProtocolVersion() int {
|
||||
return b.eth.LesVersion() + 10000
|
||||
}
|
||||
|
||||
func (b *LesApiBackend) SuggestPrice(ctx context.Context) (*big.Int, error) {
|
||||
return b.gpo.SuggestPrice(ctx)
|
||||
func (b *LesApiBackend) SuggestGasTipCap(ctx context.Context) (*big.Int, error) {
|
||||
return b.gpo.SuggestTipCap(ctx)
|
||||
}
|
||||
|
||||
func (b *LesApiBackend) ChainDb() ethdb.Database {
|
||||
|
||||
Reference in new issue
Block a user