Skip to content

Commit 9e856bf

Browse files
authored
Merge branch 'master' into raul/mel-replay-txs-walking
2 parents dd5f62d + 14aa343 commit 9e856bf

File tree

94 files changed

+405
-620
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+405
-620
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,13 +153,13 @@ jobs:
153153
if: matrix.test-mode == 'pathdb'
154154
run: |
155155
echo "Running tests with Path Scheme" >> full.log
156-
${{ github.workspace }}/.github/workflows/gotestsum.sh --tags cionly --timeout 20m --cover --test_state_scheme path
156+
${{ github.workspace }}/.github/workflows/gotestsum.sh --tags cionly --timeout 90m --cover --test_state_scheme path
157157
158158
- name: run tests without race detection and hash state scheme
159159
if: matrix.test-mode == 'defaults'
160160
run: |
161161
echo "Running tests with Hash Scheme" >> full.log
162-
${{ github.workspace }}/.github/workflows/gotestsum.sh --tags cionly --timeout 20m --test_state_scheme hash
162+
${{ github.workspace }}/.github/workflows/gotestsum.sh --tags cionly --timeout 60m --test_state_scheme hash
163163
164164
- name: run redis tests
165165
if: matrix.test-mode == 'defaults'

bold

execution/gethexec/executionengine.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ import (
3737
"github.com/ethereum/go-ethereum/core/types"
3838
"github.com/ethereum/go-ethereum/log"
3939
"github.com/ethereum/go-ethereum/metrics"
40+
"github.com/ethereum/go-ethereum/params"
4041

4142
"github.com/offchainlabs/nitro/arbos"
4243
"github.com/offchainlabs/nitro/arbos/arbosState"
4344
"github.com/offchainlabs/nitro/arbos/arbostypes"
4445
"github.com/offchainlabs/nitro/arbos/l1pricing"
4546
"github.com/offchainlabs/nitro/arbos/programs"
4647
"github.com/offchainlabs/nitro/arbutil"
47-
"github.com/offchainlabs/nitro/cmd/chaininfo"
4848
"github.com/offchainlabs/nitro/execution"
4949
"github.com/offchainlabs/nitro/util/arbmath"
5050
"github.com/offchainlabs/nitro/util/sharedmetrics"
@@ -1005,17 +1005,16 @@ func (s *ExecutionEngine) digestMessageWithBlockMutex(msgIdxToDigest arbutil.Mes
10051005
timestamp = time.Unix(int64(timestampInt), 0)
10061006
timeUntilUpgrade = time.Until(timestamp)
10071007
}
1008-
maxSupportedVersion := chaininfo.ArbitrumDevTestChainConfig().ArbitrumChainParams.InitialArbOSVersion
10091008
logLevel := log.Warn
10101009
if timeUntilUpgrade < time.Hour*24 {
10111010
logLevel = log.Error
10121011
}
1013-
if version > maxSupportedVersion {
1012+
if version > params.MaxArbosVersionSupported {
10141013
logLevel(
10151014
"you need to update your node to the latest version before this scheduled ArbOS upgrade",
10161015
"timeUntilUpgrade", timeUntilUpgrade,
10171016
"upgradeScheduledFor", timestamp,
1018-
"maxSupportedArbosVersion", maxSupportedVersion,
1017+
"maxSupportedArbosVersion", params.MaxArbosVersionSupported,
10191018
"pendingArbosUpgradeVersion", version,
10201019
)
10211020
}

staker/bold/bold_staker.go

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ import (
1616
"github.com/ethereum/go-ethereum/accounts/abi/bind"
1717
"github.com/ethereum/go-ethereum/common"
1818
"github.com/ethereum/go-ethereum/log"
19+
"github.com/ethereum/go-ethereum/metrics"
1920
"github.com/ethereum/go-ethereum/node"
21+
"github.com/ethereum/go-ethereum/params"
2022
"github.com/ethereum/go-ethereum/rpc"
2123

2224
protocol "github.com/offchainlabs/bold/chain-abstraction"
@@ -31,11 +33,17 @@ import (
3133
"github.com/offchainlabs/nitro/arbutil"
3234
"github.com/offchainlabs/nitro/staker"
3335
legacystaker "github.com/offchainlabs/nitro/staker/legacy"
36+
"github.com/offchainlabs/nitro/util/arbmath"
3437
"github.com/offchainlabs/nitro/util/headerreader"
3538
"github.com/offchainlabs/nitro/util/stopwaiter"
3639
"github.com/offchainlabs/nitro/validator"
3740
)
3841

42+
var (
43+
boldStakerBalanceGauge = metrics.NewRegisteredGaugeFloat64("arb/staker/balance", nil)
44+
boldStakerAmountStakedGauge = metrics.NewRegisteredGauge("arb/staker/amount_staked", nil)
45+
)
46+
3947
var assertionCreatedId common.Hash
4048

4149
func init() {
@@ -195,7 +203,7 @@ type BOLDStaker struct {
195203
blockValidator *staker.BlockValidator
196204
rollupAddress common.Address
197205
l1Reader *headerreader.HeaderReader
198-
client protocol.ChainBackend
206+
client *util.BackendWrapper
199207
callOpts bind.CallOpts
200208
wallet legacystaker.ValidatorWalletInterface
201209
stakedNotifiers []legacystaker.LatestStakedNotifier
@@ -327,10 +335,43 @@ func (b *BOLDStaker) Start(ctxIn context.Context) {
327335
notifier.UpdateLatestConfirmed(confirmedMsgCount, *confirmedGlobalState)
328336
}
329337
}
338+
err = b.updateStakerBalanceMetric(ctx)
339+
if err != nil {
340+
log.Warn("error updating staker balance metric", "err", err)
341+
}
330342
return b.config.AssertionPostingInterval
331343
})
332344
}
333345

346+
func (b *BOLDStaker) updateStakerBalanceMetric(ctx context.Context) error {
347+
walletAddressOrZero := b.wallet.AddressOrZero()
348+
if walletAddressOrZero != (common.Address{}) {
349+
rollupUserLogic, err := boldrollup.NewRollupUserLogic(b.rollupAddress, b.client)
350+
if err != nil {
351+
return fmt.Errorf("error creating rollup user logic: %w", err)
352+
}
353+
amountStaked, err := rollupUserLogic.AmountStaked(&bind.CallOpts{Context: ctx}, walletAddressOrZero)
354+
if err != nil {
355+
return fmt.Errorf("error getting amount staked: %w", err)
356+
}
357+
boldStakerAmountStakedGauge.Update(arbmath.BigDivByUint(amountStaked, params.Ether).Int64())
358+
} else {
359+
boldStakerAmountStakedGauge.Update(0)
360+
}
361+
362+
txSenderAddress := b.wallet.TxSenderAddress()
363+
if txSenderAddress != nil {
364+
balance, err := b.client.BalanceAt(ctx, *txSenderAddress, nil)
365+
if err != nil {
366+
return fmt.Errorf("error getting balance for %v: %w", txSenderAddress, err)
367+
}
368+
boldStakerBalanceGauge.Update(arbmath.BalancePerEther(balance))
369+
} else {
370+
boldStakerBalanceGauge.Update(0)
371+
}
372+
return nil
373+
}
374+
334375
func (b *BOLDStaker) getLatestState(ctx context.Context, confirmed bool) (arbutil.MessageIndex, *validator.GoGlobalState, error) {
335376
var globalState protocol.GoGlobalState
336377
var err error

staker/legacy/fast_confirm.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,6 @@ func (f *FastConfirmSafe) checkApprovedHashAndExecTransaction(ctx context.Contex
243243
}
244244
return true, nil
245245
}
246-
log.Info("Not enough Safe tx approvals yet to fast confirm", "safeHash", common.BytesToHash(safeTxHash[:]), "approved", approvedHashCount, "threshold", f.threshold, "self", f.wallet.Address())
246+
log.Info("Not enough Safe tx approvals yet to fast confirm", "safeHash", common.BytesToHash(safeTxHash[:]).Hex(), "approved", approvedHashCount, "threshold", f.threshold, "self", f.wallet.Address())
247247
return false, nil
248248
}

system_tests/aliasing_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import (
1919
)
2020

2121
func TestAliasing(t *testing.T) {
22-
t.Parallel()
2322
ctx, cancel := context.WithCancel(context.Background())
2423
defer cancel()
2524

system_tests/arbos_upgrade_test.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,6 @@ func checkArbOSVersion(t *testing.T, testClient *TestClient, expectedVersion uin
9595
}
9696

9797
func TestArbos11To32UpgradeWithMcopy(t *testing.T) {
98-
t.Parallel()
99-
10098
ctx, cancel := context.WithCancel(context.Background())
10199
defer cancel()
102100

@@ -199,8 +197,6 @@ func TestArbos11To32UpgradeWithMcopy(t *testing.T) {
199197
}
200198

201199
func TestArbos11To32UpgradeWithCalldata(t *testing.T) {
202-
t.Parallel()
203-
204200
ctx, cancel := context.WithCancel(context.Background())
205201
defer cancel()
206202

system_tests/batch_poster_test.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,6 @@ func testBatchPosterParallel(t *testing.T, useRedis bool) {
208208
}
209209

210210
func TestBatchPosterLargeTx(t *testing.T) {
211-
t.Parallel()
212211
ctx, cancel := context.WithCancel(context.Background())
213212
defer cancel()
214213

@@ -281,7 +280,6 @@ func TestBatchPosterKeepsUp(t *testing.T) {
281280
}
282281

283282
func testAllowPostingFirstBatchWhenSequencerMessageCountMismatch(t *testing.T, enabled bool) {
284-
t.Parallel()
285283
ctx, cancel := context.WithCancel(context.Background())
286284
defer cancel()
287285

@@ -486,8 +484,6 @@ func TestBatchPosterDelayBufferDontForceNonDelayedMessages(t *testing.T) {
486484
}
487485

488486
func TestParentChainNonEIP7623(t *testing.T) {
489-
t.Parallel()
490-
491487
ctx, cancel := context.WithCancel(context.Background())
492488
defer cancel()
493489

system_tests/block_validator_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ type Options struct {
5353
}
5454

5555
func testBlockValidatorSimple(t *testing.T, opts Options) {
56-
t.Parallel()
5756
ctx, cancel := context.WithCancel(context.Background())
5857
defer cancel()
5958

@@ -71,7 +70,8 @@ func testBlockValidatorSimple(t *testing.T, opts Options) {
7170
builder := NewNodeBuilder(ctx).DefaultConfig(t, true)
7271
builder = builder.WithWasmRootDir(opts.wasmRootDir)
7372
// For now PathDB is not supported when using block validation
74-
builder.execConfig.Caching.StateScheme = rawdb.HashScheme
73+
builder.RequireScheme(t, rawdb.HashScheme)
74+
7575
builder.nodeConfig = l1NodeConfigA
7676
builder.chainConfig = chainConfig
7777
builder.L2Info = nil

system_tests/blocks_reexecutor_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ func testBlocksReExecutorModes(t *testing.T, onMultipleRanges bool) {
2323
defer cancel()
2424

2525
builder := NewNodeBuilder(ctx).DefaultConfig(t, false)
26-
builder.execConfig.Caching.StateScheme = rawdb.HashScheme
26+
// For now PathDB is not supported
27+
builder.RequireScheme(t, rawdb.HashScheme)
28+
2729
// This allows us to see reexecution of multiple ranges
2830
if onMultipleRanges {
2931
builder.execConfig.Caching.Archive = true

0 commit comments

Comments
 (0)