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 22, 2024
1 parent 479e6bd commit 468d9cd
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 150 deletions.
2 changes: 1 addition & 1 deletion build/compose-devnet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ services:
CARTESI_BLOCKCHAIN_WS_ENDPOINT: "ws://devnet:8545"
CARTESI_LEGACY_BLOCKCHAIN_ENABLED: "false"
CARTESI_BLOCKCHAIN_FINALITY_OFFSET: "1"
CARTESI_CONTRACTS_APPLICATION_ADDRESS: "0x00D13Ee2EB6D14eD8A2CA9DAD09D3345F95bE731"
CARTESI_CONTRACTS_APPLICATION_ADDRESS: "0x1b0FAD42f016a9EBa358c7491A67fa1fAE82912A"
CARTESI_CONTRACTS_ICONSENSUS_ADDRESS: "0x3fd5dc9dCf5Df3c7002C0628Eb9AD3bb5e2ce257"
CARTESI_CONTRACTS_INPUT_BOX_ADDRESS: "0x593E5BCf894D6829Dd26D0810DA7F064406aebB6"
CARTESI_CONTRACTS_INPUT_BOX_DEPLOYMENT_BLOCK_NUMBER: "10"
Expand Down
10 changes: 5 additions & 5 deletions build/docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ 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_IMAGE_KERNEL_VERSION = "0.20.0"
MACHINE_KERNEL_VERSION = "6.5.13"
MACHINE_XGENEXT2FS_VERSION = "1.5.6"
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/addresses/addresses.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type Book struct {
func GetTestBook() *Book {
return &Book{
Application: common.HexToAddress(
"0x00D13Ee2EB6D14eD8A2CA9DAD09D3345F95bE731"),
"0x1b0FAD42f016a9EBa358c7491A67fa1fAE82912A"),
ApplicationFactory: common.HexToAddress(
"0xA1DA32BF664109D62208a1cb0d69aACc6a484873"),
Authority: common.HexToAddress(
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.

2 changes: 1 addition & 1 deletion setup_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export CARTESI_BLOCKCHAIN_HTTP_ENDPOINT="http://localhost:8545"
export CARTESI_BLOCKCHAIN_WS_ENDPOINT="ws://localhost:8545"
export CARTESI_BLOCKCHAIN_FINALITY_OFFSET="1"
export CARTESI_BLOCKCHAIN_BLOCK_TIMEOUT="60"
export CARTESI_CONTRACTS_APPLICATION_ADDRESS="0x00D13Ee2EB6D14eD8A2CA9DAD09D3345F95bE731"
export CARTESI_CONTRACTS_APPLICATION_ADDRESS="0x1b0FAD42f016a9EBa358c7491A67fa1fAE82912A"
export CARTESI_CONTRACTS_ICONSENSUS_ADDRESS="0x3fd5dc9dCf5Df3c7002C0628Eb9AD3bb5e2ce257"
export CARTESI_CONTRACTS_INPUT_BOX_ADDRESS="0x593E5BCf894D6829Dd26D0810DA7F064406aebB6"
export CARTESI_CONTRACTS_INPUT_BOX_DEPLOYMENT_BLOCK_NUMBER="10"
Expand Down

0 comments on commit 468d9cd

Please sign in to comment.