Skip to content

Commit

Permalink
Persistent storage for sovereign builder (#180)
Browse files Browse the repository at this point in the history
* Persistence storage for sovereign builder

* add unit test

* add unit test to ci and add mutex

* Optional header in jst

* initialize pending transactions if not present

* remove unwanted test

* resolve bugs

* remove nil pointer panic

* cleanup

* revert to strings.contains

* fix isErrNotFound

---------

Co-authored-by: ImJeremyHe <[email protected]>
  • Loading branch information
Sneh1999 and ImJeremyHe authored Aug 7, 2024
1 parent c2a4f6b commit 7d73c05
Show file tree
Hide file tree
Showing 11 changed files with 246 additions and 63 deletions.
1 change: 1 addition & 0 deletions .github/workflows/espresso-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ jobs:
if: steps.cache-cbrotli.outputs.cache-hit != 'true'
run: ./scripts/build-brotli.sh -w -d


- name: Build
run: make build build-replay-env -j

Expand Down
5 changes: 2 additions & 3 deletions arbnode/batch_poster.go
Original file line number Diff line number Diff line change
Expand Up @@ -502,9 +502,8 @@ func (b *BatchPoster) addEspressoBlockMerkleProof(
return err
}

if jst.Header.Height == 0 {
// This means the header in the jst is still the dummy header.
return fmt.Errorf("this msg has not been included in hotshot %v", jst.Header.Height)
if jst.Header == nil {
return fmt.Errorf("this msg has not been included in hotshot")
}

snapshot, err := b.lightClientReader.FetchMerkleRoot(jst.Header.Height, nil)
Expand Down
11 changes: 7 additions & 4 deletions arbnode/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@ var (
sequencerBatchMetaPrefix []byte = []byte("s") // maps a batch sequence number to BatchMetadata
delayedSequencedPrefix []byte = []byte("a") // maps a delayed message count to the first sequencer batch sequence number with this delayed count

messageCountKey []byte = []byte("_messageCount") // contains the current message count
delayedMessageCountKey []byte = []byte("_delayedMessageCount") // contains the current delayed message count
sequencerBatchCountKey []byte = []byte("_sequencerBatchCount") // contains the current sequencer message count
dbSchemaVersion []byte = []byte("_schemaVersion") // contains a uint64 representing the database schema version
messageCountKey []byte = []byte("_messageCount") // contains the current message count
delayedMessageCountKey []byte = []byte("_delayedMessageCount") // contains the current delayed message count
sequencerBatchCountKey []byte = []byte("_sequencerBatchCount") // contains the current sequencer message count
dbSchemaVersion []byte = []byte("_schemaVersion") // contains a uint64 representing the database schema version
espressoSubmittedPos []byte = []byte("_espressoSubmittedPos") // contains the current message index of the last submitted txn
espressoSubmittedHash []byte = []byte("_espressoSubmittedHash") // contains the hash of the last submitted txn
espressoPendingTxnsPositions []byte = []byte("_espressoPendingTxnsPositions") // contains the index of the pending txns that need to be submitted to espresso
)

const currentDbSchemaVersion uint64 = 1
Loading

0 comments on commit 7d73c05

Please sign in to comment.