Skip to content
This repository was archived by the owner on Jul 31, 2025. It is now read-only.

Commit 39444a1

Browse files
authored
Revert "Nitro Integration Misc Details" (#402)
1 parent 82620f0 commit 39444a1

File tree

8 files changed

+13
-57
lines changed

8 files changed

+13
-57
lines changed

assertions/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ go_library(
1212
"//chain-abstraction:protocol",
1313
"//chain-abstraction/sol-implementation",
1414
"//challenge-manager/types",
15-
"//containers",
1615
"//layer2-state-provider",
1716
"//runtime",
1817
"//solgen/go/rollupgen",

assertions/scanner.go

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import (
1515

1616
protocol "github.com/OffchainLabs/bold/chain-abstraction"
1717
"github.com/OffchainLabs/bold/challenge-manager/types"
18-
"github.com/OffchainLabs/bold/containers"
1918
l2stateprovider "github.com/OffchainLabs/bold/layer2-state-provider"
2019
retry "github.com/OffchainLabs/bold/runtime"
2120
"github.com/OffchainLabs/bold/solgen/go/rollupgen"
@@ -170,57 +169,37 @@ func (s *Scanner) ProcessAssertionCreation(
170169
ctx context.Context,
171170
assertionHash protocol.AssertionHash,
172171
) error {
172+
srvlog.Info("Processed assertion creation event", log.Ctx{"validatorName": s.validatorName})
173+
s.assertionsProcessedCount++
173174
creationInfo, err := s.chain.ReadAssertionCreationInfo(ctx, assertionHash)
174175
if err != nil {
175-
srvlog.Error("Could not read creation", log.Ctx{"err": err})
176176
return err
177177
}
178-
prevAssertionHash := creationInfo.ParentAssertionHash
179-
// If the assertion is the genesis assertion, we ignore it.
180-
if (prevAssertionHash == common.Hash{}) {
181-
return nil
182-
}
183-
srvlog.Info("Processing assertion creation event", log.Ctx{"validatorName": s.validatorName, "hash": containers.Trunc(assertionHash.Hash[:])})
184-
s.assertionsProcessedCount++
185-
186-
prevAssertion, err := s.chain.GetAssertion(ctx, protocol.AssertionHash{Hash: prevAssertionHash})
178+
prevAssertion, err := s.chain.GetAssertion(ctx, protocol.AssertionHash{Hash: creationInfo.ParentAssertionHash})
187179
if err != nil {
188-
srvlog.Error("Could not get prev assertion", log.Ctx{"err": err})
189180
return err
190181
}
191182
hasSecondChild, err := prevAssertion.HasSecondChild()
192183
if err != nil {
193-
srvlog.Error("Could not check if has second child", log.Ctx{"err": err})
194184
return err
195185
}
196186
if !hasSecondChild {
197187
srvlog.Info("No fork detected in assertion chain", log.Ctx{"validatorName": s.validatorName})
198188
return nil
199189
}
200-
srvlog.Info("Assertion has second child", log.Ctx{"hash": containers.Trunc(prevAssertionHash[:])})
201190
s.forksDetectedCount++
202-
203191
execState := protocol.GoExecutionStateFromSolidity(creationInfo.AfterState)
204192
msgCount, err := s.stateProvider.ExecutionStateMsgCount(ctx, execState)
205193
switch {
206194
case errors.Is(err, l2stateprovider.ErrNoExecutionState):
207-
srvlog.Warn("Disagreed with execution state of posted assertion", log.Ctx{
208-
"parentAssertionHash": containers.Trunc(creationInfo.ParentAssertionHash[:]),
209-
"detectedAssertionHash": containers.Trunc(assertionHash.Hash[:]),
210-
"msgCount": msgCount,
211-
})
212195
return nil
213196
case err != nil:
214-
srvlog.Error("Could not check execution state msg count for seen assertion", log.Ctx{"err": err})
215197
return err
216198
default:
217199
}
218-
srvlog.Info("Agreed with execution state of posted assertion", log.Ctx{
219-
"parentAssertionHash": containers.Trunc(creationInfo.ParentAssertionHash[:]),
220-
"detectedAssertionHash": containers.Trunc(assertionHash.Hash[:]),
221-
"msgCount": msgCount,
222-
})
200+
223201
if s.challengeReader.Mode() == types.DefensiveMode || s.challengeReader.Mode() == types.MakeMode {
202+
224203
// Generating a random integer between 0 and max delay second to wait before challenging.
225204
// This is to avoid all validators challenging at the same time.
226205
mds := 1 // default max delay seconds to 1 to avoid panic
@@ -231,7 +210,6 @@ func (s *Scanner) ProcessAssertionCreation(
231210
if err != nil {
232211
return err
233212
}
234-
srvlog.Info("Submitting a challenge to assertion with two children", log.Ctx{"assertionHash": containers.Trunc(prevAssertionHash[:])})
235213
srvlog.Info("Waiting before challenging", log.Ctx{"delay": randSecs})
236214
time.Sleep(time.Duration(randSecs) * time.Second)
237215

@@ -241,6 +219,12 @@ func (s *Scanner) ProcessAssertionCreation(
241219
s.challengesSubmittedCount++
242220
return nil
243221
}
222+
223+
srvlog.Error("Detected invalid assertion, but not configured to challenge", log.Ctx{
224+
"parentAssertionHash": creationInfo.ParentAssertionHash,
225+
"detectedAssertionHash": assertionHash,
226+
"msgCount": msgCount,
227+
})
244228
return nil
245229
}
246230

assertions/scanner_test.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,6 @@ import (
2222

2323
func TestScanner_ProcessAssertionCreation(t *testing.T) {
2424
ctx := context.Background()
25-
t.Run("ignores genesis", func(t *testing.T) {
26-
p := &mocks.MockProtocol{}
27-
assertionHash := mockId(1)
28-
p.On("ReadAssertionCreationInfo", ctx, assertionHash).Return(&protocol.AssertionCreatedInfo{
29-
ParentAssertionHash: common.Hash{},
30-
}, nil)
31-
scanner := assertions.NewScanner(p, nil, nil, nil, common.Address{}, "", time.Second)
32-
err := scanner.ProcessAssertionCreation(ctx, assertionHash)
33-
require.NoError(t, err)
34-
})
3525
t.Run("no fork detected", func(t *testing.T) {
3626
manager, _, mockStateProvider, cfg := setupChallengeManager(t)
3727

chain-abstraction/interfaces.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,7 @@ func (i AssertionCreatedInfo) ExecutionHash() common.Hash {
6969
type AssertionChain interface {
7070
// Read-only methods.
7171
GetAssertion(ctx context.Context, id AssertionHash) (Assertion, error)
72-
GenesisAssertionHash(ctx context.Context) (common.Hash, error)
7372
LatestConfirmed(ctx context.Context) (Assertion, error)
74-
RollupAddress() common.Address
7573
LatestCreatedAssertion(ctx context.Context) (Assertion, error)
7674
ReadAssertionCreationInfo(
7775
ctx context.Context, id AssertionHash,

chain-abstraction/sol-implementation/assertion_chain.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,6 @@ func NewAssertionChain(
101101
return chain, nil
102102
}
103103

104-
func (a *AssertionChain) RollupAddress() common.Address {
105-
return a.rollupAddr
106-
}
107-
108104
func (a *AssertionChain) GetAssertion(ctx context.Context, assertionHash protocol.AssertionHash) (protocol.Assertion, error) {
109105
var b [32]byte
110106
copy(b[:], assertionHash.Bytes())

challenge-manager/edge-tracker/tracker.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,7 @@ func (et *Tracker) Act(ctx context.Context) error {
258258
// Edge tracker should add a subchallenge level zero leaf.
259259
case edgeAddingSubchallengeLeaf:
260260
if err := et.openSubchallengeLeaf(ctx); err != nil {
261-
fields["err"] = err
262-
srvlog.Error("Could not open subchallenge leaf", fields)
261+
srvlog.Error("Could not open subchallenge leaf", err, fields)
263262
return et.fsm.Do(edgeBackToStart{})
264263
}
265264
layerZeroLeafCounter.Inc(1)

contracts/src/mocks/SimpleOneStepProofEntry.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,6 @@ contract SimpleOneStepProofEntry is IOneStepProofEntry {
4646

4747
function getMachineHash(ExecutionState calldata execState) external pure override returns (bytes32) {
4848
require(execState.machineStatus == MachineStatus.FINISHED, "BAD_MACHINE_STATUS");
49-
return keccak256(abi.encodePacked("Machine finished:", execState.globalState.hash()));
49+
return execState.globalState.hash();
5050
}
5151
}

testing/mocks/mocks.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -404,11 +404,6 @@ func (m *MockProtocol) NumAssertions(ctx context.Context) (uint64, error) {
404404
return args.Get(0).(uint64), args.Error(1)
405405
}
406406

407-
func (m *MockProtocol) RollupAddress() common.Address {
408-
args := m.Called()
409-
return args.Get(0).(common.Address)
410-
}
411-
412407
func (m *MockProtocol) GetAssertion(ctx context.Context, id protocol.AssertionHash) (protocol.Assertion, error) {
413408
args := m.Called(ctx, id)
414409
return args.Get(0).(protocol.Assertion), args.Error(1)
@@ -424,11 +419,6 @@ func (m *MockProtocol) TopLevelAssertion(ctx context.Context, edgeId protocol.Ed
424419
return args.Get(0).(protocol.AssertionHash), args.Error(1)
425420
}
426421

427-
func (m *MockProtocol) GenesisAssertionHash(ctx context.Context) (common.Hash, error) {
428-
args := m.Called(ctx)
429-
return args.Get(0).(common.Hash), args.Error(1)
430-
}
431-
432422
func (m *MockProtocol) TopLevelClaimHeights(ctx context.Context, edgeId protocol.EdgeId) (protocol.OriginHeights, error) {
433423
args := m.Called(ctx, edgeId)
434424
return args.Get(0).(protocol.OriginHeights), args.Error(1)

0 commit comments

Comments
 (0)