Skip to content

Commit

Permalink
Integration (#78)
Browse files Browse the repository at this point in the history
* change state fields of BlockDescriptor to be byte array

* feat(rollapp): rollapp state finalization (#74)

* ignite scaffold map block_height_to_finalization_queue finalization_queue:StateInfoIndex --index finalization_height:uint --no-message --module rollapp

* fix ignite command

* update finalizationQueue on UpdateState

* finalize states on EndBlocker

* add tests

* fix lint

* fix lint 2

* feat: simulation tests (#76)

* simulate create rollapp

* add simulation flag in app & keeper - used in sequencer simulation

* add simulation for update state

* change state fields of BlockDescriptor to be byte array

* fix gas consumption in simulation
  • Loading branch information
liorzilp authored Sep 6, 2022
1 parent 3fc38ce commit 9cfb350
Show file tree
Hide file tree
Showing 10 changed files with 309 additions and 87 deletions.
123 changes: 93 additions & 30 deletions docs/static/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20997,15 +20997,19 @@ paths:
title: height is the height of the block
stateRoot:
type: string
title: stateRoot is the state root of the block
format: byte
title: >-
stateRoot is a 32 byte array of the hash of
the block (state root of the block)
intermediateStatesRoot:
type: string
format: byte
title: >-
intermediateStatesRoot is is the root of a
Merkle tree built
intermediateStatesRoot is a 32 byte array
representing

from the ISRs of the block (Intermediate State
Roots)
the root of a Merkle tree built from the ISRs
of the block (Intermediate State Roots)
description: >-
BlockDescriptor defines a single rollapp chain
block description.
Expand Down Expand Up @@ -21208,15 +21212,19 @@ paths:
title: height is the height of the block
stateRoot:
type: string
title: stateRoot is the state root of the block
format: byte
title: >-
stateRoot is a 32 byte array of the hash of the
block (state root of the block)
intermediateStatesRoot:
type: string
format: byte
title: >-
intermediateStatesRoot is is the root of a
Merkle tree built
intermediateStatesRoot is a 32 byte array
representing

from the ISRs of the block (Intermediate State
Roots)
the root of a Merkle tree built from the ISRs of
the block (Intermediate State Roots)
description: >-
BlockDescriptor defines a single rollapp chain block
description.
Expand Down Expand Up @@ -21749,6 +21757,16 @@ paths:
in: query
required: false
type: boolean
- name: pagination.reverse
description: >-
reverse is set to true if results are to be returned in the
descending order.


Since: cosmos-sdk 0.43
in: query
required: false
type: boolean
tags:
- Query
'/dymensionxyz/dymension/sequencer/scheduler/{sequencerAddress}':
Expand Down Expand Up @@ -22473,6 +22491,16 @@ paths:
in: query
required: false
type: boolean
- name: pagination.reverse
description: >-
reverse is set to true if results are to be returned in the
descending order.


Since: cosmos-sdk 0.43
in: query
required: false
type: boolean
tags:
- Query
'/dymensionxyz/dymension/sequencer/sequencer/{sequencerAddress}':
Expand Down Expand Up @@ -23196,6 +23224,16 @@ paths:
in: query
required: false
type: boolean
- name: pagination.reverse
description: >-
reverse is set to true if results are to be returned in the
descending order.


Since: cosmos-sdk 0.43
in: query
required: false
type: boolean
tags:
- Query
'/dymensionxyz/dymension/sequencer/sequencers_by_rollapp/{rollappId}':
Expand Down Expand Up @@ -50453,12 +50491,18 @@ definitions:
title: height is the height of the block
stateRoot:
type: string
title: stateRoot is the state root of the block
format: byte
title: >-
stateRoot is a 32 byte array of the hash of the block (state root of
the block)
intermediateStatesRoot:
type: string
title: |-
intermediateStatesRoot is is the root of a Merkle tree built
from the ISRs of the block (Intermediate State Roots)
format: byte
title: >-
intermediateStatesRoot is a 32 byte array representing

the root of a Merkle tree built from the ISRs of the block
(Intermediate State Roots)
description: BlockDescriptor defines a single rollapp chain block description.
dymensionxyz.dymension.rollapp.BlockDescriptors:
type: object
Expand All @@ -50474,12 +50518,18 @@ definitions:
title: height is the height of the block
stateRoot:
type: string
title: stateRoot is the state root of the block
format: byte
title: >-
stateRoot is a 32 byte array of the hash of the block (state
root of the block)
intermediateStatesRoot:
type: string
title: |-
intermediateStatesRoot is is the root of a Merkle tree built
from the ISRs of the block (Intermediate State Roots)
format: byte
title: >-
intermediateStatesRoot is a 32 byte array representing

the root of a Merkle tree built from the ISRs of the block
(Intermediate State Roots)
description: BlockDescriptor defines a single rollapp chain block description.
description: BlockDescriptors defines list of BlockDescriptor.
dymensionxyz.dymension.rollapp.BlockHeightToFinalizationQueue:
Expand Down Expand Up @@ -50858,14 +50908,19 @@ definitions:
title: height is the height of the block
stateRoot:
type: string
title: stateRoot is the state root of the block
format: byte
title: >-
stateRoot is a 32 byte array of the hash of the block
(state root of the block)
intermediateStatesRoot:
type: string
format: byte
title: >-
intermediateStatesRoot is is the root of a Merkle tree
built
intermediateStatesRoot is a 32 byte array
representing

from the ISRs of the block (Intermediate State Roots)
the root of a Merkle tree built from the ISRs of the
block (Intermediate State Roots)
description: >-
BlockDescriptor defines a single rollapp chain block
description.
Expand Down Expand Up @@ -51127,14 +51182,18 @@ definitions:
title: height is the height of the block
stateRoot:
type: string
title: stateRoot is the state root of the block
format: byte
title: >-
stateRoot is a 32 byte array of the hash of the block
(state root of the block)
intermediateStatesRoot:
type: string
format: byte
title: >-
intermediateStatesRoot is is the root of a Merkle tree
built
intermediateStatesRoot is a 32 byte array representing

from the ISRs of the block (Intermediate State Roots)
the root of a Merkle tree built from the ISRs of the
block (Intermediate State Roots)
description: >-
BlockDescriptor defines a single rollapp chain block
description.
Expand Down Expand Up @@ -51293,14 +51352,18 @@ definitions:
title: height is the height of the block
stateRoot:
type: string
title: stateRoot is the state root of the block
format: byte
title: >-
stateRoot is a 32 byte array of the hash of the block (state
root of the block)
intermediateStatesRoot:
type: string
format: byte
title: >-
intermediateStatesRoot is is the root of a Merkle tree
built
intermediateStatesRoot is a 32 byte array representing

from the ISRs of the block (Intermediate State Roots)
the root of a Merkle tree built from the ISRs of the block
(Intermediate State Roots)
description: >-
BlockDescriptor defines a single rollapp chain block
description.
Expand Down
10 changes: 5 additions & 5 deletions proto/rollapp/block_descriptor.proto
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import "gogoproto/gogo.proto";
message BlockDescriptor {
// height is the height of the block
uint64 height = 1;
// stateRoot is the state root of the block
string stateRoot = 2;
// intermediateStatesRoot is is the root of a Merkle tree built
// from the ISRs of the block (Intermediate State Roots)
string intermediateStatesRoot = 3;
// stateRoot is a 32 byte array of the hash of the block (state root of the block)
bytes stateRoot = 2;
// intermediateStatesRoot is a 32 byte array representing
// the root of a Merkle tree built from the ISRs of the block (Intermediate State Roots)
bytes intermediateStatesRoot = 3;
}

// BlockDescriptors defines list of BlockDescriptor.
Expand Down
4 changes: 2 additions & 2 deletions x/rollapp/simulation/update_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ func SimulateMsgUpdateState(
for i := uint64(0); i < numBlocks; i++ {
bds.BD = append(bds.BD, types.BlockDescriptor{
Height: startHeight + i,
StateRoot: "",
IntermediateStatesRoot: "",
StateRoot: make([]byte, 32),
IntermediateStatesRoot: make([]byte, 32),
})
}

Expand Down
50 changes: 27 additions & 23 deletions x/rollapp/types/block_descriptor.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions x/rollapp/types/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
// x/rollapp module sentinel errors
var (
ErrRollappExists = sdkerrors.Register(ModuleName, 1000, "rollapp already exist for this rollapp-id; must use new rollapp-id")
ErrInvalidwMaxSequencers = sdkerrors.Register(ModuleName, 1001, "invalid max sequencers")
ErrInvalidwMaxWithholding = sdkerrors.Register(ModuleName, 1002, "invalid max withholding")
ErrInvalidMaxSequencers = sdkerrors.Register(ModuleName, 1001, "invalid max sequencers")
ErrInvalidMaxWithholding = sdkerrors.Register(ModuleName, 1002, "invalid max withholding")
ErrInvalidPermissionedAddress = sdkerrors.Register(ModuleName, 1003, "invalid permissioned address")
ErrPermissionedAddressesDuplicate = sdkerrors.Register(ModuleName, 1004, "permissioned-address has duplicates")
ErrInvalidNumBlocks = sdkerrors.Register(ModuleName, 1005, "invalid number of blocks")
Expand All @@ -19,4 +19,6 @@ var (
ErrVersionMismatch = sdkerrors.Register(ModuleName, 1008, "rollapp version mismatch")
ErrWrongBlockHeight = sdkerrors.Register(ModuleName, 1009, "start-height does not match rollapps state")
ErrMultiUpdateStateInBlock = sdkerrors.Register(ModuleName, 1010, "only one state update can take place per block")
ErrInvalidStateRoot = sdkerrors.Register(ModuleName, 1011, "invalid blocks state root")
ErrInvalidIntermediateStatesRoot = sdkerrors.Register(ModuleName, 1012, "invalid blocks intermediate states root")
)
Loading

0 comments on commit 9cfb350

Please sign in to comment.