diff --git a/consensus/ibft/signer/helper_test.go b/consensus/ibft/signer/helper_test.go index 4386f63ee7..c5a24331b4 100644 --- a/consensus/ibft/signer/helper_test.go +++ b/consensus/ibft/signer/helper_test.go @@ -73,7 +73,7 @@ func Test_wrapCommitHash(t *testing.T) { assert.Equal(t, expectedOutput, output) } -//nolint +// nolint func Test_getOrCreateECDSAKey(t *testing.T) { t.Parallel() @@ -184,7 +184,7 @@ func Test_getOrCreateECDSAKey(t *testing.T) { } } -//nolint +// nolint func Test_getOrCreateBLSKey(t *testing.T) { t.Parallel() diff --git a/go.mod b/go.mod index 99986c14bd..92e7c931bc 100644 --- a/go.mod +++ b/go.mod @@ -97,6 +97,7 @@ require ( github.com/richardartoul/molecule v1.0.1-0.20221107223329-32cfee06a052 // indirect github.com/rogpeppe/go-internal v1.10.0 // indirect github.com/secure-systems-lab/go-securesystemslib v0.6.0 // indirect + github.com/topos-protocol/go-topos-sequencer-client v0.0.0-20230719150134-37636f549da4 // indirect go.uber.org/dig v1.16.1 // indirect go.uber.org/fx v1.19.2 // indirect golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df // indirect diff --git a/go.sum b/go.sum index 4a4835d4f7..1aa4d28de3 100644 --- a/go.sum +++ b/go.sum @@ -688,6 +688,8 @@ github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45 github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA= github.com/tinylib/msgp v1.1.6 h1:i+SbKraHhnrf9M5MYmvQhFnbLhAXSDWF8WWsuyRdocw= github.com/tinylib/msgp v1.1.6/go.mod h1:75BAfg2hauQhs3qedfdDZmWAPcFMAvJE5b9rGOMufyw= +github.com/topos-protocol/go-topos-sequencer-client v0.0.0-20230719150134-37636f549da4 h1:Nj+BFLcjdabxDNG94kRdDes97TVZ3NnmSoxBTY2eN3w= +github.com/topos-protocol/go-topos-sequencer-client v0.0.0-20230719150134-37636f549da4/go.mod h1:Dt4YfK6HlJg3sdqRpvzk/zab7V+CDS/cQaZLYjmkcfE= github.com/trailofbits/go-fuzz-utils v0.0.0-20210901195358-9657fcfd256c h1:4WU+p200eLYtBsx3M5CKXvkjVdf5SC3W9nMg37y0TFI= github.com/trailofbits/go-fuzz-utils v0.0.0-20210901195358-9657fcfd256c/go.mod h1:f3jBhpWvuZmue0HZK52GzRHJOYHYSILs/c8+K2S/J+o= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= diff --git a/jsonrpc/eth_endpoint.go b/jsonrpc/eth_endpoint.go index e2907f9993..f231951991 100644 --- a/jsonrpc/eth_endpoint.go +++ b/jsonrpc/eth_endpoint.go @@ -10,8 +10,8 @@ import ( "github.com/0xPolygon/polygon-edge/chain" "github.com/0xPolygon/polygon-edge/crypto" + "github.com/0xPolygon/polygon-edge/gasprice" "github.com/0xPolygon/polygon-edge/helper/common" - "github.com/0xPolygon/polygon-edge/helper/hex" "github.com/0xPolygon/polygon-edge/helper/progress" "github.com/0xPolygon/polygon-edge/prover" "github.com/0xPolygon/polygon-edge/state" @@ -109,7 +109,7 @@ var ( //Empty code hash is 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 EmptyCodeHashBytes = []byte{197, 210, 70, 1, 134, 247, 35, 60, 146, 126, 125, 178, 220, 199, 3, 192, 229, 0, 182, 83, 202, 130, 39, 59, 123, 250, 216, 4, 93, 133, 164, 112} - EmptyCodeHash = hex.EncodeToHex(EmptyCodeHashBytes) + EmptyCodeHash = "0x" + hex.EncodeToString(EmptyCodeHashBytes) ) // ChainId returns the chain id of the client @@ -932,7 +932,7 @@ func (e *Eth) GetProverData(block BlockNumberOrHash) (interface{}, error) { Nonce: acc.Nonce, Balance: acc.Balance, Root: acc.Root.String(), - CodeHash: hex.EncodeToHex(acc.CodeHash), + CodeHash: "0x" + hex.EncodeToString(acc.CodeHash), } } @@ -960,7 +960,7 @@ func (e *Eth) GetProverData(block BlockNumberOrHash) (interface{}, error) { ss := make([]string, len(storageMerkleProof)) for i, s := range storageMerkleProof { - ss[i] = hex.EncodeToHex(s) + ss[i] = "0x" + hex.EncodeToString(s) } storageAccesses = append(storageAccesses, prover.StorageAccess{ @@ -981,7 +981,7 @@ func (e *Eth) GetProverData(block BlockNumberOrHash) (interface{}, error) { transactions := make([]string, 0) for _, transaction := range fullBlock.Transactions { - transactions = append(transactions, hex.EncodeToHex(transaction.MarshalRLP())) + transactions = append(transactions, "0x"+hex.EncodeToString(transaction.MarshalRLP())) } // Receipts from this block @@ -1001,7 +1001,7 @@ func (e *Eth) GetProverData(block BlockNumberOrHash) (interface{}, error) { } codeHash := crypto.Keccak256(contractCode) - contractCodes[hex.EncodeToHex(codeHash)] = hex.EncodeToHex(contractCode) + contractCodes["0x"+hex.EncodeToString(codeHash)] = "0x" + hex.EncodeToString(contractCode) } else { // Add empty code hash contractCodes[EmptyCodeHash] = "0x" @@ -1019,7 +1019,7 @@ func (e *Eth) GetProverData(block BlockNumberOrHash) (interface{}, error) { aa := make([]string, 0) for _, proof := range accountProof { - aa = append(aa, hex.EncodeToHex(proof)) + aa = append(aa, "0x"+hex.EncodeToString(proof)) } state = append(state, prover.ProverAccountProof{ @@ -1038,7 +1038,7 @@ func (e *Eth) GetProverData(block BlockNumberOrHash) (interface{}, error) { zeroAccountProofArray := make([]string, 0) for _, proof := range zeroAccountProof { - zeroAccountProofArray = append(zeroAccountProofArray, hex.EncodeToHex(proof)) + zeroAccountProofArray = append(zeroAccountProofArray, "0x"+hex.EncodeToString(proof)) } state = append(state, prover.ProverAccountProof{ diff --git a/state/runtime/tracer/structtracer/tracer.go b/state/runtime/tracer/structtracer/tracer.go index 7222d8aa89..990ce41711 100644 --- a/state/runtime/tracer/structtracer/tracer.go +++ b/state/runtime/tracer/structtracer/tracer.go @@ -60,9 +60,9 @@ type StructTracer struct { output []byte err error - storage []map[types.Address]map[types.Hash]types.Hash - currentMemory []([]byte) - currentStack []([]*big.Int) + storage []map[types.Address]map[types.Hash]types.Hash + currentMemory []([]byte) + currentStack []([]*big.Int) contractAddress types.Address storageAccess []map[StorageAccess]bool accountStorageUpdates map[types.Address]map[StorageAccess]bool @@ -364,10 +364,10 @@ func (t *StructTracer) ExecuteState( } type StructTraceResult struct { - Failed bool `json:"failed"` - Gas uint64 `json:"gas"` - ReturnValue string `json:"returnValue"` - StructLogs []StructLogRes `json:"structLogs"` + Failed bool `json:"failed"` + Gas uint64 `json:"gas"` + ReturnValue string `json:"returnValue"` + StructLogs []StructLogRes `json:"structLogs"` Account string `json:"account"` StorageUpdates map[types.Address]map[StorageAccess]bool `json:"storageUpdates"` } @@ -402,10 +402,10 @@ func (t *StructTracer) GetResult() (interface{}, error) { storageUpdates := t.accountStorageUpdates return &StructTraceResult{ - Failed: t.err != nil, - Gas: t.consumedGas, - ReturnValue: returnValue, - StructLogs: formatStructLogs(t.logs), + Failed: t.err != nil, + Gas: t.consumedGas, + ReturnValue: returnValue, + StructLogs: formatStructLogs(t.logs), Account: t.contractAddress.String(), StorageUpdates: storageUpdates, }, nil