Skip to content

Commit

Permalink
fix applying storage root hash (#67)
Browse files Browse the repository at this point in the history
* fix applying storage root hash

* test fix
  • Loading branch information
sh-cha authored Jan 24, 2025
1 parent c33ae5f commit 9059409
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions challenger/child/withdraw.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ func (ch *Child) handleTree(ctx types.Context, blockHeight int64, blockHeader cm
return nil, errors.Wrap(err, "failed to finalize working tree")
}

storageRoot = treeRootHash
if finalizedTree != nil {
err = merkle.SaveFinalizedTree(ch.stage, *finalizedTree)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions challenger/child/withdraw_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ func TestHandleTree(t *testing.T) {
finalizingBlockHeight: 5,

expected: func() (storageRoot []byte, lastOutputTime time.Time, nextOutputTime time.Time, finalizingBlockHeight int64) {
return nil, time.Unix(0, 10100).UTC(), time.Unix(0, 10300).UTC(), 0
return []byte{0x50, 0x26, 0x55, 0x2e, 0x7b, 0x21, 0xca, 0xb5, 0x27, 0xe4, 0x16, 0x9e, 0x66, 0x46, 0x02, 0xb8, 0x5d, 0x03, 0x67, 0x0b, 0xb5, 0x57, 0xe3, 0x29, 0x18, 0xd9, 0x33, 0xe3, 0xd5, 0x92, 0x5c, 0x7e}, time.Unix(0, 10100).UTC(), time.Unix(0, 10300).UTC(), 0
},
expectedStage: []types.KV{
{
Expand Down Expand Up @@ -566,7 +566,7 @@ func TestHandleTree(t *testing.T) {
finalizingBlockHeight: 5,

expected: func() (storageRoot []byte, lastOutputTime time.Time, nextOutputTime time.Time, finalizingBlockHeight int64) {
return nil, time.Unix(0, 10100).UTC(), time.Unix(0, 10300).UTC(), 0
return []byte{0xff, 0xd4, 0x7a, 0x71, 0xf6, 0x3a, 0x8a, 0x50, 0x09, 0x56, 0xef, 0x34, 0xb1, 0xfa, 0xbb, 0xd4, 0x2f, 0x07, 0xc8, 0x5e, 0x77, 0xf7, 0xad, 0x21, 0x27, 0x01, 0xe0, 0x64, 0xda, 0xbd, 0xf6, 0xa3}, time.Unix(0, 10100).UTC(), time.Unix(0, 10300).UTC(), 0
},
expectedStage: []types.KV{
{
Expand Down

0 comments on commit 9059409

Please sign in to comment.