Skip to content

Commit

Permalink
fix: various build fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
atanmarko committed Sep 7, 2023
1 parent e32f415 commit b9902b7
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 21 deletions.
4 changes: 2 additions & 2 deletions consensus/ibft/signer/helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -184,7 +184,7 @@ func Test_getOrCreateECDSAKey(t *testing.T) {
}
}

//nolint
// nolint
func Test_getOrCreateBLSKey(t *testing.T) {
t.Parallel()

Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
16 changes: 8 additions & 8 deletions jsonrpc/eth_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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),
}
}

Expand Down Expand Up @@ -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{
Expand All @@ -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
Expand All @@ -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"
Expand All @@ -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{
Expand All @@ -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{
Expand Down
22 changes: 11 additions & 11 deletions state/runtime/tracer/structtracer/tracer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"`
}
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b9902b7

Please sign in to comment.