-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EigenDA Proxy + Historical Nitro Changes #11
Closed
Closed
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
2c0d205
start fresh
afkbyte 670432b
try to parse with abi
afkbyte cd78e91
parsing correctly with the abi decoder now! Bringing other changes ba…
afkbyte 3671179
remove commented out code
afkbyte ddb75c4
update typo in hash
afkbyte 11b2f7f
brought in historical changes
afkbyte 7c7dcf5
brought in replay script changes
afkbyte 0b37bb8
bring in eigenDA ref to the replay script
afkbyte 48faf73
added all changes
afkbyte f2a8af7
update inbox multiplexer
afkbyte 6e8489a
modify eigenda file path
afkbyte fc12d81
add more informative logs
afkbyte c1f70c2
change no EigenDA configured to a log level error, follow same patter…
afkbyte 616d94a
change to string
afkbyte 77922bf
differentiate between derivation pipeline and fraud proof preimages
afkbyte acbfdec
bump nitro testnode commit
afkbyte 98231af
modified put and get to be synchronus and blocking
afkbyte c5d1db9
Fix some failing lint errors
teddyknox File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ import ( | |
"github.com/offchainlabs/nitro/arbos/l1pricing" | ||
"github.com/offchainlabs/nitro/arbutil" | ||
"github.com/offchainlabs/nitro/das/dastree" | ||
"github.com/offchainlabs/nitro/das/eigenda" | ||
"github.com/offchainlabs/nitro/eigenda" | ||
"github.com/offchainlabs/nitro/util/blobs" | ||
"github.com/offchainlabs/nitro/zeroheavy" | ||
) | ||
|
@@ -70,7 +70,7 @@ var ( | |
ErrInvalidBlobDataFormat = errors.New("blob batch data is not a list of hashes as expected") | ||
) | ||
|
||
func parseSequencerMessage(ctx context.Context, batchNum uint64, batchBlockHash common.Hash, data []byte, daProviders []DataAvailabilityProvider, eigenDAReader eigenda.EigenDAReader, keysetValidationMode KeysetValidationMode) (*sequencerMessage, error) { | ||
func parseSequencerMessage(ctx context.Context, batchNum uint64, batchBlockHash common.Hash, data []byte, daProviders []DataAvailabilityProvider, keysetValidationMode KeysetValidationMode) (*sequencerMessage, error) { | ||
if len(data) < 40 { | ||
return nil, errors.New("sequencer message missing L1 header") | ||
} | ||
|
@@ -84,6 +84,7 @@ func parseSequencerMessage(ctx context.Context, batchNum uint64, batchBlockHash | |
} | ||
payload := data[40:] | ||
log.Info("Inbox parse sequencer message: ", "payload", hex.EncodeToString(payload)) | ||
log.Info("Inbox parse header message: ", "header", hex.EncodeToString(data[:40])) | ||
|
||
// Stage 0: Check if our node is out of date and we don't understand this batch type | ||
// If the parent chain sequencer inbox smart contract authenticated this batch, | ||
|
@@ -101,23 +102,6 @@ func parseSequencerMessage(ctx context.Context, batchNum uint64, batchBlockHash | |
foundDA := false | ||
var err error | ||
|
||
// detect eigenda message from byte | ||
if eigenda.IsEigenDAMessageHeaderByte(payload[0]) { | ||
if eigenDAReader == nil { | ||
log.Error("No EigenDA Reader configured, but sequencer message found with EigenDA header") | ||
} else { | ||
var err error | ||
payload, err = eigenda.RecoverPayloadFromEigenDABatch(ctx, payload[1:], eigenDAReader, nil) | ||
if err != nil { | ||
return nil, err | ||
} | ||
if payload == nil { | ||
return parsedMsg, nil | ||
} | ||
foundDA = true | ||
} | ||
} | ||
|
||
for _, provider := range daProviders { | ||
if provider != nil && provider.IsValidHeaderByte(payload[0]) { | ||
payload, err = provider.RecoverPayloadFromBatch(ctx, batchNum, batchBlockHash, data, nil, keysetValidationMode) | ||
|
@@ -137,6 +121,8 @@ func parseSequencerMessage(ctx context.Context, batchNum uint64, batchBlockHash | |
log.Error("No DAS Reader configured, but sequencer message found with DAS header") | ||
} else if IsBlobHashesHeaderByte(payload[0]) { | ||
return nil, ErrNoBlobReader | ||
} else if eigenda.IsEigenDAMessageHeaderByte(payload[0]) { | ||
log.Error("eigenDA versioned batch payload was encountered but no instance of EigenDA was configured") | ||
} | ||
} | ||
} | ||
|
@@ -385,6 +371,35 @@ func (b *dAProviderForBlobReader) RecoverPayloadFromBatch( | |
return payload, nil | ||
} | ||
|
||
// NewDAProviderEigenDA is generally meant to be only used by nitro. | ||
// DA Providers should implement methods in the DataAvailabilityProvider interface independently | ||
func NewDAProviderEigenDA(eigenDAReader eigenda.EigenDAReader) *daProviderForEigenDA { | ||
return &daProviderForEigenDA{ | ||
eigenDAReader: eigenDAReader, | ||
} | ||
} | ||
|
||
type daProviderForEigenDA struct { | ||
eigenDAReader eigenda.EigenDAReader | ||
} | ||
|
||
func (e *daProviderForEigenDA) IsValidHeaderByte(headerByte byte) bool { | ||
return eigenda.IsEigenDAMessageHeaderByte(headerByte) | ||
} | ||
|
||
func (e *daProviderForEigenDA) RecoverPayloadFromBatch( | ||
ctx context.Context, | ||
batchNum uint64, | ||
batchBlockHash common.Hash, | ||
sequencerMsg []byte, | ||
preimages map[arbutil.PreimageType]map[common.Hash][]byte, | ||
keysetValidationMode KeysetValidationMode, | ||
) ([]byte, error) { | ||
// we start from the 41st byte of sequencerMsg because bytes 0 - 40 are the header, and 40 - 41 is the eigenDA header flag | ||
// we use the binary domain here because this is what we use in the derivation pipeline | ||
return eigenda.RecoverPayloadFromEigenDABatch(ctx, sequencerMsg[41:], e.eigenDAReader, preimages, "binary") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Knit - domain could be enum |
||
} | ||
|
||
type KeysetValidationMode uint8 | ||
|
||
const KeysetValidate KeysetValidationMode = 0 | ||
|
@@ -395,7 +410,6 @@ type inboxMultiplexer struct { | |
backend InboxBackend | ||
delayedMessagesRead uint64 | ||
daProviders []DataAvailabilityProvider | ||
eigenDAReader eigenda.EigenDAReader | ||
cachedSequencerMessage *sequencerMessage | ||
cachedSequencerMessageNum uint64 | ||
cachedSegmentNum uint64 | ||
|
@@ -405,12 +419,11 @@ type inboxMultiplexer struct { | |
keysetValidationMode KeysetValidationMode | ||
} | ||
|
||
func NewInboxMultiplexer(backend InboxBackend, delayedMessagesRead uint64, daProviders []DataAvailabilityProvider, eigenDAReader eigenda.EigenDAReader, keysetValidationMode KeysetValidationMode) arbostypes.InboxMultiplexer { | ||
func NewInboxMultiplexer(backend InboxBackend, delayedMessagesRead uint64, daProviders []DataAvailabilityProvider, keysetValidationMode KeysetValidationMode) arbostypes.InboxMultiplexer { | ||
return &inboxMultiplexer{ | ||
backend: backend, | ||
delayedMessagesRead: delayedMessagesRead, | ||
daProviders: daProviders, | ||
eigenDAReader: eigenDAReader, | ||
keysetValidationMode: keysetValidationMode, | ||
} | ||
} | ||
|
@@ -432,7 +445,7 @@ func (r *inboxMultiplexer) Pop(ctx context.Context) (*arbostypes.MessageWithMeta | |
} | ||
r.cachedSequencerMessageNum = r.backend.GetSequencerInboxPosition() | ||
var err error | ||
r.cachedSequencerMessage, err = parseSequencerMessage(ctx, r.cachedSequencerMessageNum, batchBlockHash, bytes, r.daProviders, r.eigenDAReader, r.keysetValidationMode) | ||
r.cachedSequencerMessage, err = parseSequencerMessage(ctx, r.cachedSequencerMessageNum, batchBlockHash, bytes, r.daProviders, r.keysetValidationMode) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
knit - could be useful enforce that
use488
anduseEigenDA
are never both trueThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there are cases where we would want both flags to be true to be able to specify between using 4844 as fallback or calldata imo