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 caller methods in Concrete environment #38

Closed therealbytes closed 6 days 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 #37 being implemented. Once that is done, the new mock caller can be used for testing. Both execution and gas usage should be tested.

At the moment, the caller methods are:

type Environment interface {
    // ...

    CallStatic(address common.Address, data []byte, gas uint64) ([]byte, error)
    Call(address common.Address, data []byte, gas uint64, value *uint256.Int) ([]byte, error)
    CallDelegate(address common.Address, data []byte, gas uint64) ([]byte, error)

    Create(data []byte, value *uint256.Int) (common.Address, error)
    Create2(data []byte, endowment *uint256.Int, salt *uint256.Int) (common.Address, error)
}

Note that the two create methods will be modified by #32 .

kateberryd commented 1 month ago

@therealbytes I would love to work on this

This is how I intend to tackle this issue

I would use the new mock caller, create unit tests for each method, utilizing the generated mocks to simulate different scenarios. Define expected inputs and outputs, configuring the mocks to return these outputs for the specified inputs. Call the methods on the mock implementations and use assertions to verify that actual outputs match expected outputs. Finally, execute the tests using the Go test tool to ensure all methods function as expected.

Looking forward to working on this. Thank you

therealbytes commented 1 month ago

Any progress with this? @kateberryd

kateberryd commented 1 month ago

@therealbytes I'm waiting on #37 to kickstart

kateberryd commented 4 weeks ago

Hi @therealbytes #37 is completed and I've commenced work, will open a PR soon

fabrobles92 commented 1 week ago

Hello @therealbytes, fab here, in the last ODHack I contributed to this great project creating some unit tests, thus, I have context to work on this issue, I would love to keep contributing to it, so if this issue is available I would like to take it. :)