Skip to content

Commit

Permalink
brought in replay script changes
Browse files Browse the repository at this point in the history
  • Loading branch information
afkbyte committed Jun 9, 2024
1 parent 11b2f7f commit 7c7dcf5
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions cmd/replay/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,16 +152,17 @@ func (r *BlobPreimageReader) Initialize(ctx context.Context) error {

// struct for recovering data from preimage, impl interface EigenDAReader

func (dasReader *PreimageEigenDAReader) QueryBlob(ctx context.Context, ref *eigenda.EigenDARef) ([]byte, error) {
dataPointer, err := ref.Serialize()
func (dasReader *PreimageEigenDAReader) QueryBlob(ctx context.Context, cert *eigenda.EigenDABlobInfo) ([]byte, error) {
dataPointer, err := cert.SerializeCommitment()

Check failure on line 156 in cmd/replay/main.go

View workflow job for this annotation

GitHub Actions / Go Tests (defaults)

cert.SerializeCommitment undefined (type *eigenda.EigenDABlobInfo has no field or method SerializeCommitment)

Check failure on line 156 in cmd/replay/main.go

View workflow job for this annotation

GitHub Actions / Go Tests (race)

cert.SerializeCommitment undefined (type *eigenda.EigenDABlobInfo has no field or method SerializeCommitment)

Check failure on line 156 in cmd/replay/main.go

View workflow job for this annotation

GitHub Actions / Go Tests (challenge)

cert.SerializeCommitment undefined (type *eigenda.EigenDABlobInfo has no field or method SerializeCommitment)
if err != nil {
return nil, err
}
shaDataHash := sha256.New()
shaDataHash.Write(dataPointer)
dataHash := shaDataHash.Sum([]byte{})
dataHash[0] = 1
// check function eigenda.RecoverPayloadFromEigenDABatch, the data population and data reading should be matched.
return wavmio.ResolveTypedPreimage(arbutil.Sha2_256PreimageType, common.BytesToHash(dataHash))
return wavmio.ResolveTypedPreimage(arbutil.EigenDaPreimageType, common.BytesToHash(dataHash))
}

// To generate:
Expand Down Expand Up @@ -213,29 +214,32 @@ func main() {
panic(fmt.Sprintf("Error opening state db: %v", err.Error()))
}

readMessage := func(dasEnabled bool) *arbostypes.MessageWithMetadata {
readMessage := func(dasEnabled bool, eigenDAEnabled bool) *arbostypes.MessageWithMetadata {
var delayedMessagesRead uint64
if lastBlockHeader != nil {
delayedMessagesRead = lastBlockHeader.Nonce.Uint64()
}
// due to the lack of abstraction, we have to define our own Reader here.
// once we have a way to unify the interface between DataAvailabilityReader and EigenDAReader, we should be able to retain the old struct.
// todo make it compatible with dasReader
// var dasReader arbstate.DataAvailabilityReader

var dasReader *PreimageDASReader
var eigenDAReader *PreimageEigenDAReader
if dasEnabled {
dasReader = &PreimageDASReader{}
} else if eigenDAEnabled {
eigenDAReader = &PreimageEigenDAReader{}
}
backend := WavmInbox{}
var keysetValidationMode = arbstate.KeysetPanicIfInvalid
if backend.GetPositionWithinMessage() > 0 {
keysetValidationMode = arbstate.KeysetDontValidate
}
var daProviders []arbstate.DataAvailabilityProvider
// TODO: add dasReader of type eigenda.EigenDAReader when it conforms to interface

if dasReader != nil {
daProviders = append(daProviders, arbstate.NewDAProviderDAS(dasReader))
}
if eigenDAReader != nil {
daProviders = append(daProviders, arbstate.NewDAProviderEigenDA(eigenDAReader))

Check failure on line 241 in cmd/replay/main.go

View workflow job for this annotation

GitHub Actions / Go Tests (defaults)

cannot use eigenDAReader (variable of type *PreimageEigenDAReader) as eigenda.EigenDAReader value in argument to arbstate.NewDAProviderEigenDA: *PreimageEigenDAReader does not implement eigenda.EigenDAReader (wrong type for method QueryBlob)

Check failure on line 241 in cmd/replay/main.go

View workflow job for this annotation

GitHub Actions / Go Tests (race)

cannot use eigenDAReader (variable of type *PreimageEigenDAReader) as eigenda.EigenDAReader value in argument to arbstate.NewDAProviderEigenDA: *PreimageEigenDAReader does not implement eigenda.EigenDAReader (wrong type for method QueryBlob)

Check failure on line 241 in cmd/replay/main.go

View workflow job for this annotation

GitHub Actions / Go Tests (challenge)

cannot use eigenDAReader (variable of type *PreimageEigenDAReader) as eigenda.EigenDAReader value in argument to arbstate.NewDAProviderEigenDA: *PreimageEigenDAReader does not implement eigenda.EigenDAReader (wrong type for method QueryBlob)
}
daProviders = append(daProviders, arbstate.NewDAProviderBlobReader(&BlobPreimageReader{}))
inboxMultiplexer := arbstate.NewInboxMultiplexer(backend, delayedMessagesRead, daProviders, nil, keysetValidationMode)

Check failure on line 244 in cmd/replay/main.go

View workflow job for this annotation

GitHub Actions / Go Tests (defaults)

too many arguments in call to arbstate.NewInboxMultiplexer

Check failure on line 244 in cmd/replay/main.go

View workflow job for this annotation

GitHub Actions / Go Tests (race)

too many arguments in call to arbstate.NewInboxMultiplexer

Check failure on line 244 in cmd/replay/main.go

View workflow job for this annotation

GitHub Actions / Go Tests (challenge)

too many arguments in call to arbstate.NewInboxMultiplexer
ctx := context.Background()
Expand Down Expand Up @@ -289,8 +293,7 @@ func main() {
}
}

// message := readMessage(chainConfig.ArbitrumChainParams.DataAvailabilityCommittee)
message := readMessage(true)
message := readMessage(chainConfig.ArbitrumChainParams.DataAvailabilityCommittee, false)

chainContext := WavmChainContext{}
batchFetcher := func(batchNum uint64) ([]byte, error) {
Expand All @@ -303,8 +306,7 @@ func main() {

} else {
// Initialize ArbOS with this init message and create the genesis block.

message := readMessage(false)
message := readMessage(false, false)

initMessage, err := message.Message.ParseInitMessage()
if err != nil {
Expand Down

0 comments on commit 7c7dcf5

Please sign in to comment.