Commit 93f7f2b1 authored by mergify[bot]'s avatar mergify[bot] Committed by GitHub

Merge branch 'develop' into dependabot/npm_and_yarn/web3-eth-4.1.0

parents 31c3382b 26634b22
---
'@eth-optimism/web3.js-plugin': patch
---
Update code exmaples in README
......@@ -321,11 +321,3 @@ pull_request_rules:
label:
add:
- M-ci
- name: Add M-bot label for bots
conditions:
- 'author=(github-actions|dependabot|)'
- '#label<5'
actions:
label:
add:
- M-bot
......@@ -88,6 +88,7 @@ type MetricsConfig struct {
// LoadConfig loads the `indexer.toml` config file from a given path
func LoadConfig(logger geth_log.Logger, path string) (Config, error) {
logger.Info("Loading config file", "path", path)
var conf Config
data, err := os.ReadFile(path)
......@@ -97,6 +98,8 @@ func LoadConfig(logger geth_log.Logger, path string) (Config, error) {
data = []byte(os.ExpandEnv(string(data)))
logger.Debug("Decoding config file", "data", string(data))
if _, err := toml.Decode(string(data), &conf); err != nil {
logger.Info("Failed to decode config file", "message", err)
return conf, err
......
......@@ -131,9 +131,9 @@ func (s *SyncClient) eventLoop() {
s.log.Info("Starting sync client event loop")
backoffStrategy := &backoff.ExponentialStrategy{
Min: 1000,
Max: 20_000,
MaxJitter: 250,
Min: 1000 * time.Millisecond,
Max: 20_000 * time.Millisecond,
MaxJitter: 250 * time.Millisecond,
}
for {
......
......@@ -16,35 +16,34 @@ type Strategy interface {
// ExponentialStrategy performs exponential backoff. The exponential backoff
// function is min(e.Min + (2^attempt * 1000) + randBetween(0, e.MaxJitter), e.Max)
type ExponentialStrategy struct {
// Min is the minimum amount of time to wait between attempts in ms.
Min float64
// Min is the minimum amount of time to wait between attempts.
Min time.Duration
// Max is the maximum amount of time to wait between attempts in ms.
Max float64
// Max is the maximum amount of time to wait between attempts.
Max time.Duration
// MaxJitter is the maximum amount of random jitter to insert between
// attempts in ms.
MaxJitter int
// MaxJitter is the maximum amount of random jitter to insert between attempts.
MaxJitter time.Duration
}
func (e *ExponentialStrategy) Duration(attempt int) time.Duration {
var jitter int
var jitter time.Duration
if e.MaxJitter > 0 {
jitter = rand.Intn(e.MaxJitter)
jitter = time.Duration(rand.Int63n(e.MaxJitter.Nanoseconds()))
}
dur := e.Min + (math.Pow(2, float64(attempt)) * 1000)
dur += float64(jitter)
dur := e.Min + time.Duration(int(math.Pow(2, float64(attempt))*1000))*time.Millisecond
dur += jitter
if dur > e.Max {
return time.Millisecond * time.Duration(e.Max)
return e.Max
}
return time.Millisecond * time.Duration(dur)
return dur
}
func Exponential() Strategy {
return &ExponentialStrategy{
Max: 10000,
MaxJitter: 250,
Max: time.Duration(10000 * time.Millisecond),
MaxJitter: time.Duration(250 * time.Millisecond),
}
}
......
......@@ -9,13 +9,13 @@ import (
func TestExponential(t *testing.T) {
strategy := &ExponentialStrategy{
Min: 3000,
Max: 10000,
Min: 3000 * time.Millisecond,
Max: 10000 * time.Millisecond,
MaxJitter: 0,
}
durations := []int{4, 5, 7, 10, 10}
durations := []time.Duration{4, 5, 7, 10, 10}
for i, dur := range durations {
require.Equal(t, time.Millisecond*time.Duration(dur*1000), strategy.Duration(i))
require.Equal(t, dur*time.Second, strategy.Duration(i))
}
}
......@@ -46,7 +46,7 @@
"express-prom-bundle": "^6.4.1",
"lodash": "^4.17.21",
"morgan": "^1.10.0",
"pino": "^6.11.3",
"pino": "^8.15.0",
"pino-multi-stream": "^5.3.0",
"pino-sentry": "^0.14.0",
"prom-client": "^13.1.0"
......
......@@ -11,7 +11,7 @@ export const logLevels = [
'error',
'fatal',
] as const
export type LogLevel = typeof logLevels[number]
export type LogLevel = (typeof logLevels)[number]
export interface LoggerOptions {
name: string
......
# @eth-optimism/web3.js-plugin
## 0.1.2
### Patch Changes
- [#6873](https://github.com/ethereum-optimism/optimism/pull/6873) [`fdab6caa7`](https://github.com/ethereum-optimism/optimism/commit/fdab6caa7e6684b08882d2a766ccd727068c2b2f) Thanks [@spacesailor24](https://github.com/spacesailor24)! - Update code exmaples in README
## 0.1.1
### Patch Changes
......
{
"name": "@eth-optimism/web3.js-plugin",
"version": "0.1.1",
"version": "0.1.2",
"description": "A Web3.js plugin for doing OP-Chain gas estimation",
"license": "MIT",
"repository": {
......
......@@ -77,7 +77,7 @@ importers:
version: 1.2.3(eslint@8.47.0)
eslint-plugin-prettier:
specifier: ^4.0.0
version: 4.0.0(eslint-config-prettier@8.3.0)(eslint@8.47.0)(prettier@2.8.1)
version: 4.0.0(eslint-config-prettier@8.3.0)(eslint@8.47.0)(prettier@2.8.8)
eslint-plugin-promise:
specifier: ^5.1.0
version: 5.2.0(eslint@8.47.0)
......@@ -119,10 +119,10 @@ importers:
version: 6.4.7
prettier:
specifier: ^2.8.0
version: 2.8.1
version: 2.8.8
prettier-plugin-solidity:
specifier: ^1.0.0-beta.13
version: 1.0.0-beta.18(prettier@2.8.1)
version: 1.0.0-beta.18(prettier@2.8.8)
rimraf:
specifier: ^5.0.1
version: 5.0.1
......@@ -228,8 +228,8 @@ importers:
specifier: ^1.10.0
version: 1.10.0
pino:
specifier: ^6.11.3
version: 6.13.1
specifier: ^8.15.0
version: 8.15.0
pino-multi-stream:
specifier: ^5.3.0
version: 5.3.0
......@@ -1012,7 +1012,7 @@ packages:
fs-extra: 7.0.1
lodash.startcase: 4.4.0
outdent: 0.5.0
prettier: 2.8.1
prettier: 2.8.8
resolve-from: 5.0.0
semver: 5.7.2
dev: false
......@@ -1198,7 +1198,7 @@ packages:
'@changesets/types': 5.2.1
fs-extra: 7.0.1
human-id: 1.0.2
prettier: 2.8.1
prettier: 2.8.8
dev: false
/@codechecks/client@0.1.11(typescript@5.1.6):
......@@ -2705,7 +2705,7 @@ packages:
/@manypkg/find-root@1.1.0:
resolution: {integrity: sha512-mki5uBvhHzO8kYYix/WRy2WX8S3B5wdVSc9D6KcU5lQNglP2yt58/VfLuAK49glRXChosY8ap2oJ1qgma3GUVA==}
dependencies:
'@babel/runtime': 7.20.7
'@babel/runtime': 7.22.6
'@types/node': 12.20.55
find-up: 4.1.0
fs-extra: 8.1.0
......@@ -5666,7 +5666,6 @@ packages:
engines: {node: '>=6.5'}
dependencies:
event-target-shim: 5.0.1
dev: true
/abstract-leveldown@6.2.3:
resolution: {integrity: sha512-BsLm5vFMRUrrLeCcRc+G0t2qOaTzpoJQLOubq2XM72eNpjF5UdU5o/5NvlNhx95XHcAvcl8OMXr4mlg/fRgUXQ==}
......@@ -8366,7 +8365,7 @@ packages:
eslint: 8.47.0
dev: true
/eslint-plugin-prettier@4.0.0(eslint-config-prettier@8.3.0)(eslint@8.47.0)(prettier@2.8.1):
/eslint-plugin-prettier@4.0.0(eslint-config-prettier@8.3.0)(eslint@8.47.0)(prettier@2.8.8):
resolution: {integrity: sha512-98MqmCJ7vJodoQK359bqQWaxOE0CS8paAz/GgjaZLyex4TTk3g9HugoO89EqWCrFiOqn9EVvcoo7gZzONCWVwQ==}
engines: {node: '>=6.0.0'}
peerDependencies:
......@@ -8379,7 +8378,7 @@ packages:
dependencies:
eslint: 8.47.0
eslint-config-prettier: 8.3.0(eslint@8.47.0)
prettier: 2.8.1
prettier: 2.8.8
prettier-linter-helpers: 1.0.0
dev: true
......@@ -8852,7 +8851,6 @@ packages:
/event-target-shim@5.0.1:
resolution: {integrity: sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==}
engines: {node: '>=6'}
dev: true
/eventemitter3@4.0.7:
resolution: {integrity: sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==}
......@@ -9053,11 +9051,6 @@ packages:
resolution: {integrity: sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==}
dev: true
/fast-redact@3.0.1:
resolution: {integrity: sha512-kYpn4Y/valC9MdrISg47tZOpYBNoTXKgT9GYXFpHN/jYFs+lFkPoisY+LcBODdKVMY96ATzvzsWv+ES/4Kmufw==}
engines: {node: '>=6'}
dev: false
/fast-redact@3.2.0:
resolution: {integrity: sha512-zaTadChr+NekyzallAMXATXLOR8MNx3zqpZ0MUF2aGf4EathnG0f32VLODNlY8IuGY3HoRO2L6/6fSzNsLaHIw==}
engines: {node: '>=6'}
......@@ -13097,6 +13090,10 @@ packages:
/on-exit-leak-free@0.2.0:
resolution: {integrity: sha512-dqaz3u44QbRXQooZLTUKU41ZrzYrcvLISVgbrzbyCMxpmSLJvZ3ZamIJIZ29P6OhZIkNIQKosdeM6t1LYbA9hg==}
/on-exit-leak-free@2.1.0:
resolution: {integrity: sha512-VuCaZZAjReZ3vUwgOB8LxAosIurDiAW0s13rI1YwmaP++jvcxP77AWoQvenZebpCA2m8WC1/EosPYPMjnRAp/w==}
dev: false
/on-finished@2.3.0:
resolution: {integrity: sha512-ikqdkGAAyf/X/gPhXGvfgAytDZtDbr+bkNUJ0N9h5MI/dmdgCs3l6hoHrcUv41sRKew3jIwrp4qQDXiK99Utww==}
engines: {node: '>= 0.8'}
......@@ -13627,6 +13624,13 @@ packages:
duplexify: 4.1.2
split2: 4.2.0
/pino-abstract-transport@1.0.0:
resolution: {integrity: sha512-c7vo5OpW4wIS42hUVcT5REsL8ZljsUfBjqV/e2sFxmFEFZiq1XLUp5EYLtuDH6PEHq9W1egWqRbnLUP5FuZmOA==}
dependencies:
readable-stream: 4.4.2
split2: 4.2.0
dev: false
/pino-multi-stream@5.3.0:
resolution: {integrity: sha512-4fAGCRll18I+JmoAbxDvU9zc5sera/3c+VgTtUdoNMOZ/VSHB+HMAYtixKpeRmZTDHDDdE2rtwjVkuwWB8mYQA==}
deprecated: No longer supported. Use the multi-stream support in the latest core Pino
......@@ -13655,16 +13659,20 @@ packages:
/pino-std-serializers@4.0.0:
resolution: {integrity: sha512-cK0pekc1Kjy5w9V2/n+8MkZwusa6EyyxfeQCB799CQRhRt/CqYKiWs5adeu8Shve2ZNffvfC/7J64A2PJo1W/Q==}
/pino-std-serializers@6.2.2:
resolution: {integrity: sha512-cHjPPsE+vhj/tnhCy/wiMh3M3z3h/j15zHQX+S9GkTBgqJuTuJzYJ4gUyACLhDaJ7kk9ba9iRDmbH2tJU03OiA==}
dev: false
/pino@6.13.1:
resolution: {integrity: sha512-QQf67BU+cANnc/2U+wzUV20UjO5oBryWpnNyKshdLfT9BdeiXlh9wxLGmOjAuBWMYITdMs+BtJSQQNlGRNbWpA==}
hasBin: true
dependencies:
fast-redact: 3.0.1
fast-redact: 3.2.0
fast-safe-stringify: 2.0.8
fastify-warning: 0.2.0
flatstr: 1.0.12
pino-std-serializers: 3.2.0
quick-format-unescaped: 4.0.3
quick-format-unescaped: 4.0.4
sonic-boom: 1.4.1
dev: false
......@@ -13684,6 +13692,23 @@ packages:
sonic-boom: 2.8.0
thread-stream: 0.15.2
/pino@8.15.0:
resolution: {integrity: sha512-olUADJByk4twxccmAxb1RiGKOSvddHugCV3wkqjyv+3Sooa2KLrmXrKEWOKi0XPCLasRR5jBXxioE1jxUa4KzQ==}
hasBin: true
dependencies:
atomic-sleep: 1.0.0
fast-redact: 3.2.0
on-exit-leak-free: 2.1.0
pino-abstract-transport: 1.0.0
pino-std-serializers: 6.2.2
process-warning: 2.2.0
quick-format-unescaped: 4.0.4
real-require: 0.2.0
safe-stable-stringify: 2.4.3
sonic-boom: 3.3.0
thread-stream: 2.4.0
dev: false
/pirates@4.0.6:
resolution: {integrity: sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg==}
engines: {node: '>= 6'}
......@@ -13768,7 +13793,7 @@ packages:
fast-diff: 1.2.0
dev: true
/prettier-plugin-solidity@1.0.0-beta.18(prettier@2.8.1):
/prettier-plugin-solidity@1.0.0-beta.18(prettier@2.8.8):
resolution: {integrity: sha512-ezWdsG/jIeClmYBzg8V9Voy8jujt+VxWF8OS3Vld+C3c+3cPVib8D9l8ahTod7O5Df1anK9zo+WiiS5wb1mLmg==}
engines: {node: '>=12'}
peerDependencies:
......@@ -13777,22 +13802,16 @@ packages:
'@solidity-parser/parser': 0.13.2
emoji-regex: 9.2.2
escape-string-regexp: 4.0.0
prettier: 2.8.1
prettier: 2.8.8
semver: 7.5.3
solidity-comments-extractor: 0.0.7
string-width: 4.2.3
dev: true
/prettier@2.8.1:
resolution: {integrity: sha512-lqGoSJBQNJidqCHE80vqZJHWHRFoNYsSpP9AjFhlhi9ODCJA541svILes/+/1GM3VaL/abZi7cpFzOpdR9UPKg==}
engines: {node: '>=10.13.0'}
hasBin: true
/prettier@2.8.8:
resolution: {integrity: sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==}
engines: {node: '>=10.13.0'}
hasBin: true
dev: true
/pretty-format@27.5.1:
resolution: {integrity: sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==}
......@@ -13830,6 +13849,10 @@ packages:
/process-warning@1.0.0:
resolution: {integrity: sha512-du4wfLyj4yCZq1VupnVSZmRsPJsNuxoDQFdCFHLaYiEbFBD7QE0a+I4D7hOxrVnh78QE/YipFAj9lXHiXocV+Q==}
/process-warning@2.2.0:
resolution: {integrity: sha512-/1WZ8+VQjR6avWOgHeEPd7SDQmFQ1B5mC1eRXsCm5TarlNmx/wCsa5GEaxGm05BORRtyG/Ex/3xq3TuRvq57qg==}
dev: false
/process@0.11.10:
resolution: {integrity: sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==}
engines: {node: '>= 0.6.0'}
......@@ -14018,10 +14041,6 @@ packages:
/queue-microtask@1.2.3:
resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==}
/quick-format-unescaped@4.0.3:
resolution: {integrity: sha512-MaL/oqh02mhEo5m5J2rwsVL23Iw2PEaGVHgT2vFt8AAsr0lfvQA5dpXo9TPu0rz7tSBdUPgkbam0j/fj5ZM8yg==}
dev: false
/quick-format-unescaped@4.0.4:
resolution: {integrity: sha512-tYC1Q1hgyRuHgloV/YXs2w15unPVh8qfu/qCTfhTYamaw7fyhumKa2yGpdSo87vY32rIclj+4fWYQXUMs9EHvg==}
......@@ -14243,6 +14262,17 @@ packages:
string_decoder: 1.3.0
util-deprecate: 1.0.2
/readable-stream@4.4.2:
resolution: {integrity: sha512-Lk/fICSyIhodxy1IDK2HazkeGjSmezAWX2egdtJnYhtzKEsBPJowlI6F6LPb5tqIQILrMbx22S5o3GuJavPusA==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
dependencies:
abort-controller: 3.0.0
buffer: 6.0.3
events: 3.3.0
process: 0.11.10
string_decoder: 1.3.0
dev: false
/readdirp@3.6.0:
resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==}
engines: {node: '>=8.10.0'}
......@@ -14254,6 +14284,11 @@ packages:
resolution: {integrity: sha512-r/H9MzAWtrv8aSVjPCMFpDMl5q66GqtmmRkRjpHTsp4zBAa+snZyiQNlMONiUmEJcsnaw0wCauJ2GWODr/aFkg==}
engines: {node: '>= 12.13.0'}
/real-require@0.2.0:
resolution: {integrity: sha512-57frrGM/OCTLqLOAh0mhVA9VBMHd+9U7Zb2THMGdBUoZVOtGbJzjxsYGDJ3A9AYYCP4hn6y1TVbaOfzWtm5GFg==}
engines: {node: '>= 12.13.0'}
dev: false
/redent@3.0.0:
resolution: {integrity: sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg==}
engines: {node: '>=8'}
......@@ -15021,6 +15056,12 @@ packages:
dependencies:
atomic-sleep: 1.0.0
/sonic-boom@3.3.0:
resolution: {integrity: sha512-LYxp34KlZ1a2Jb8ZQgFCK3niIHzibdwtwNUWKg0qQRzsDoJ3Gfgkf8KdBTFU3SkejDEIlWwnSnpVdOZIhFMl/g==}
dependencies:
atomic-sleep: 1.0.0
dev: false
/sort-keys@2.0.0:
resolution: {integrity: sha512-/dPCrG1s3ePpWm6yBbxZq5Be1dXGLyLn9Z791chDC3NFrpkVbWGzkBwPN1knaciexFXgRJ7hzdnwZ4stHSDmjg==}
engines: {node: '>=4'}
......@@ -15578,6 +15619,12 @@ packages:
dependencies:
real-require: 0.1.0
/thread-stream@2.4.0:
resolution: {integrity: sha512-xZYtOtmnA63zj04Q+F9bdEay5r47bvpo1CaNqsKi7TpoJHcotUez8Fkfo2RJWpW91lnnaApdpRbVwCWsy+ifcw==}
dependencies:
real-require: 0.2.0
dev: false
/through2@2.0.5:
resolution: {integrity: sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==}
dependencies:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment