concrete-eth / concrete-geth

Concrete is a framework for building application-specific rollups on the OP Stack
GNU Lesser General Public License v3.0
47 stars 19 forks source link

[ODHack 5.0] Test state methods in Concrete environment #34

Open therealbytes opened 1 month ago

therealbytes commented 1 month ago

[ODHack 5.0] Contributors: Note that we highly recommend that you comment on the issue by introducing yourself and how you plan on tackling the issue! Just saying you want an issue is not helpful. This will help with assigning tasks, especially if many comment.

Rationale

Currently, the Concrete environment is poorly tested.

Implementation

This depends on #33 being implemented. Once that is done, the mock statedb in concrete/mock can be moved to/reimplemented within concrete/api to have an in-memory statedb for testing. Both execution and gas usage should be tested.

At the moment, the state methods are:

type Environment interface {
    // ...

    StorageLoad(key common.Hash) common.Hash
    StorageStore(key common.Hash, value common.Hash)
    Log(topics []common.Hash, data []byte)

    GetBalance(address common.Address) *uint256.Int
    GetCode(address common.Address) []byte
    GetCodeSize() int
    GetExternalBalance(address common.Address) *uint256.Int
    GetExternalCode(address common.Address) []byte
    GetExternalCodeSize(address common.Address) int
    GetExternalCodeHash(address common.Address) common.Hash
}

Note two more methods will be added by #31 .

Gift-Naomi commented 1 month ago

@therealbytes Can i work on this?

Adecom16 commented 1 month ago

I am Adeoluwa, A smart contract developer @therealbytes assign this to me

therealbytes commented 1 month ago

@Adecom16 Any updates?

therealbytes commented 1 month ago

Assigned to @Gift-Naomi since @Adecom16 has not provided any updates in almost a week.

Shoetan commented 1 week ago

@therealbytes I would love to get on with this by creating all necessary test files ending with _test.go

Import go built in testing module

Write test functions taking pointer to the testing package (t *testing. T)

therealbytes commented 3 days ago

@Shoetan Any progress here?

Shoetan commented 3 days ago

@therealbytes I saw from the comments that this depends on issue 33 and the last time I checked it issue 33 is not closed yet.

therealbytes commented 3 days ago

@Shoetan Would you like to work on 33 instead?

Shoetan commented 3 days ago

@therealbytes ok I can try.

Iwueseiter commented 3 days ago

@therealbytes can I work on this issue if @Shoetan is taking #33?