Skip to content

Commit

Permalink
feat: change emulator version
Browse files Browse the repository at this point in the history
  • Loading branch information
renan061 committed Aug 14, 2024
1 parent 2f88645 commit 50fadc2
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 144 deletions.
4 changes: 2 additions & 2 deletions build/docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ target "common" {
RUST_VERSION = "1.78.0"
GO_VERSION = "1.22.1"
FOUNDRY_NIGHTLY_VERSION = "293fad73670b7b59ca901c7f2105bf7a29165a90"
MACHINE_EMULATOR_VERSION = "0.17.0"
MACHINE_TOOLS_VERSION = "0.15.0"
MACHINE_EMULATOR_VERSION = "0.18.1"
MACHINE_TOOLS_VERSION = "0.16.1"
MACHINE_IMAGE_KERNEL_VERSION = "0.20.0"
MACHINE_KERNEL_VERSION = "6.5.13"
MACHINE_XGENEXT2FS_VERSION = "1.5.6"
Expand Down
2 changes: 1 addition & 1 deletion pkg/emulator/emulator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (

var (
imagesPath = "/usr/share/cartesi-machine/images/"
address = "localhost:8081"
address = "127.0.0.1:8081"
)

func init() {
Expand Down
6 changes: 3 additions & 3 deletions pkg/emulator/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

// A connection to the remote jsonrpc machine manager.
type RemoteMachineManager struct {
c *C.cm_jsonrpc_mg_mgr
c *C.cm_jsonrpc_mgr

Address string
}
Expand All @@ -22,13 +22,13 @@ func NewRemoteMachineManager(address string) (*RemoteMachineManager, error) {
cRemoteAddress := C.CString(address)
defer C.free(unsafe.Pointer(cRemoteAddress))
var msg *C.char
code := C.cm_create_jsonrpc_mg_mgr(cRemoteAddress, &manager.c, &msg)
code := C.cm_create_jsonrpc_mgr(cRemoteAddress, &manager.c, &msg)
return manager, newError(code, msg)
}

func (remote *RemoteMachineManager) Delete() {
if remote.c != nil {
C.cm_delete_jsonrpc_mg_mgr(remote.c)
C.cm_delete_jsonrpc_mgr(remote.c)
remote.c = nil
}
}
Expand Down
1 change: 1 addition & 0 deletions pkg/rollupsmachine/abi.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
{ "type" : "uint256" },
{ "type" : "uint256" },
{ "type" : "uint256" },
{ "type" : "uint256" },
{ "type" : "bytes" }
]
}, {
Expand Down
10 changes: 5 additions & 5 deletions pkg/rollupsmachine/io.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ type Input struct {
Sender Address
BlockNumber uint64
BlockTimestamp uint64
// PrevRandao uint64
Index uint64
Data []byte
PrevRandao uint64
Index uint64
Data []byte
}

// A Query is sent by a inspect-state request.
Expand All @@ -64,10 +64,10 @@ func (input Input) Encode() ([]byte, error) {
sender := common.BytesToAddress(input.Sender[:])
blockNumber := new(big.Int).SetUint64(input.BlockNumber)
blockTimestamp := new(big.Int).SetUint64(input.BlockTimestamp)
// prevRandao := new(big.Int).SetUint64(input.PrevRandao)
prevRandao := new(big.Int).SetUint64(input.PrevRandao)
index := new(big.Int).SetUint64(input.Index)
return ioABI.Pack("EvmAdvance", chainId, appContract, sender, blockNumber, blockTimestamp,
index, input.Data)
prevRandao, index, input.Data)
}

// DecodeOutput decodes an output into either a voucher or a notice.
Expand Down
15 changes: 8 additions & 7 deletions pkg/rollupsmachine/machine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ func (s *RollupsMachineSuite) TestNew() { suite.Run(s.T(), new(NewSuite)) }
func (s *RollupsMachineSuite) TestFork() { suite.Run(s.T(), new(ForkSuite)) }
func (s *RollupsMachineSuite) TestAdvance() { suite.Run(s.T(), new(AdvanceSuite)) }
func (s *RollupsMachineSuite) TestInspect() { suite.Run(s.T(), new(InspectSuite)) }
func (s *RollupsMachineSuite) TestUnit() { suite.Run(s.T(), new(UnitSuite)) }

// ------------------------------------------------------------------------------------------------

Expand Down Expand Up @@ -97,7 +98,7 @@ func (s *NewSuite) TestOkAccept() {
config := &emulator.MachineRuntimeConfig{}
cartesiMachine, err := cartesimachine.Load(s.acceptSnapshot.Path(), s.address, config)
require.NotNil(cartesiMachine)
require.Nil(err)
require.Nil(err, "%v", err)

rollupsMachine, err := New(cartesiMachine, defaultInc, defaultMax)
require.NotNil(rollupsMachine)
Expand Down Expand Up @@ -421,10 +422,6 @@ func expectNotice(t *testing.T, output Output) *Notice {
// Unit tests
// ------------------------------------------------------------------------------------------------

func TestRollupsMachineUnit(t *testing.T) {
suite.Run(t, new(UnitSuite))
}

type UnitSuite struct{ suite.Suite }

func (_ *UnitSuite) newMachines() (*CartesiMachineMock, *RollupsMachine) {
Expand Down Expand Up @@ -631,9 +628,13 @@ func (s *UnitSuite) TestClose() {
})
}

func (s *UnitSuite) TestLastRequestWasAccepted() {}
func (s *UnitSuite) TestLastRequestWasAccepted() {
s.T().Skip("TODO")
}

func (s *UnitSuite) TestProcess() {}
func (s *UnitSuite) TestProcess() {
s.T().Skip("TODO")
}

func (s *UnitSuite) TestRun() {
newMachines := func() (*CartesiMachineMock, *RollupsMachine) {
Expand Down
126 changes: 0 additions & 126 deletions pkg/rollupsmachine/server.go

This file was deleted.

0 comments on commit 50fadc2

Please sign in to comment.